edit.html 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476
  1. <!DOCTYPE HTML>
  2. <html xmlns:th="http://www.thymeleaf.org"
  3. xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
  4. layout:decorate="~{admin/common/common}">
  5. <head>
  6. <title>添加</title>
  7. <style>
  8. multiple:hover .dropdown-clear-all, .dropdown-single:hover .dropdown-clear-all {
  9. display: none;
  10. }
  11. .line {
  12. display: block;
  13. text-align: left;
  14. background-color: #fff;
  15. color: #333;
  16. border-bottom: 1px solid #0a6999;
  17. border-color: #fff;
  18. border-bottom: 1px solid #0a6999;
  19. margin-top: 10px;
  20. vertical-align: middle;
  21. padding: 4px 12px;
  22. height: 31px;
  23. line-height: 31px;
  24. font-size: 14px;
  25. font-weight: bold;
  26. }
  27. </style>
  28. </head>
  29. <body layout:fragment="content">
  30. <article class="page-container">
  31. <form class="form form-horizontal" id="form-add">
  32. <div class="line">基本信息 <span style="float:right">来源:[[${data?.recource}]]</span></div>
  33. <div class="row cl">
  34. <input id="id" name="id" type="hidden" th:value="${data.id}"/>
  35. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>项目标题:</label>
  36. <div class="formControls col-xs-8 col-sm-9">
  37. <input type="text" class="input-text" placeholder="请输入项目标题" id="title" name="title"
  38. th:value="${data.title}"/>
  39. </div>
  40. </div>
  41. <div class="row cl">
  42. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>项目用地:</label>
  43. <div class="formControls col-xs-8 col-sm-9">
  44. <input type="text" class="input-text" placeholder="请输入项目用地" id="location" name="location"
  45. th:value="${data.location}"/>
  46. </div>
  47. </div>
  48. <div class="row cl">
  49. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>项目介绍:</label>
  50. <div class="formControls col-xs-8 col-sm-9">
  51. <textarea id="content" name="content" required>[[${data.content}]]</textarea>
  52. </div>
  53. </div>
  54. <div class="row cl">
  55. <label class="form-label col-xs-4 col-sm-2"><span>上传附件:</span></label>
  56. <div class="formControls col-xs-8 col-sm-9">
  57. <div class="uploader-thum-container">
  58. <div id="fileListPre" class="uploader-list">
  59. <th:block th:unless="${data.fileDown==null || data.fileDown.file_url== null}">
  60. <a th:href=" ${fileUrl} + ${data.fileDown.file_url}" target="_blank">[[${data.fileDown.file_name}]]</a>
  61. </th:block>
  62. </div>
  63. <div id="filePicker">上传</div>
  64. <th:block th:switch = "${data.fileDown==null || data.fileDown.file_url== null}" >
  65.  <input th:case="true" type="hidden" name="fileDown.file_id" id="files">
  66. <input th:case="false" type="hidden" name="fileDown.file_id" id="files" th:value="${data.fileDown.file_id}">
  67. </th:block>
  68. </div>
  69. </div>
  70. </div>
  71. <div th:if="*{canAsk}" th:each="item,itemStat: ${consulDepartmentList}">
  72. <div class="line">[[${item.name}]]</div>
  73. <div class="row cl" th:id=" 'department'+${item.id}">
  74. <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
  75. <div><i class="Hui-iconfont" style="cursor: pointer;"
  76. th:onclick="'javascript:addFileLine(\''+'department'+${item.id}+'\')'">&#xe600; 添加</i></div>
  77. <table class="table table-border table-bordered table-bg table-hover ">
  78. <thead>
  79. <tr class="text-c">
  80. <th>咨询问题</th>
  81. <th>操作</th>
  82. </tr>
  83. </thead>
  84. <tbody class="add_file_line" th:id="'tbody_department'+${item.id}">
  85. <tr class="text-c"
  86. th:each="landSupplyCons,landSupplyConsStat: ${industrialLandSupplyConsultationList}"
  87. th:if="*{item.id+''==landSupplyCons.department_id}">
  88. <td class="td_material">
  89. <input type="text" class="input-text consultation" placeholder="请输入咨询的问题"
  90. th:name="'consultationList[1'+${landSupplyConsStat.index}+${itemStat.index}+'].consultation'"
  91. th:value="${landSupplyCons.consultation}"/>
  92. <input class="department_id" type="hidden"
  93. th:name="'consultationList[1'+${landSupplyConsStat.index}+${itemStat.index}+'].department_id'"
  94. th:value="${item.id}"/>
  95. </td>
  96. <td class="icon_font"><i class='Hui-iconfont' onclick='removeLine(this)'>&#xe6a1; 删除</i>
  97. </td>
  98. </tr>
  99. </tbody>
  100. </table>
  101. </div>
  102. </div>
  103. </div>
  104. </form>
  105. <form class="form form-horizontal" id="form-approve">
  106. <input id="status" type="hidden" name="status"/>
  107. <input id="apply_id" type="hidden" name="apply_id" th:value="${data.id}"/>
  108. <div th:if="*{data.approve_status=='2'}" class="line">流程信息</div>
  109. <div th:if="*{data.approve_status=='2'}" class="row cl">
  110. <div class="col-xs-8 col-sm-9 col-xs-offset-2 col-sm-offset-1">
  111. <table class="table table-border table-bordered table-bg table-hover processTb">
  112. <thead>
  113. <tr class="text-c">
  114. <th>时间</th>
  115. <!-- <th>审核状态</th> -->
  116. <th>单位</th>
  117. <th>操作人</th>
  118. <th>操作</th>
  119. <th>审核意见</th>
  120. </tr>
  121. </thead>
  122. <tbody>
  123. <tr class="text-c" th:each="model,iterStat:${approvalList}" th:object="${model}">
  124. <td th:text="*{create_time}"></td>
  125. <!-- <td th:text="*{before_approvalstatus_str}"></td> -->
  126. <td th:text="*{department}"></td>
  127. <td th:text="*{create_name}"></td>
  128. <td th:text="*{oper_type}"></td>
  129. <td class="viewComment" th:data="*{approval_comment}" th:text="*{approval_comment}"></td>
  130. </tr>
  131. </tbody>
  132. </table>
  133. </div>
  134. </div>
  135. <div th:if="*{data.approve_status=='2'}" class="line">审核意见</div>
  136. <div th:if="*{data.approve_status=='2'}" class="row cl">
  137. <div class="col-xs-8 col-sm-9 col-xs-offset-2 col-sm-offset-1">
  138. <textarea class="textarea" id="approval_comment" th:name="approval_comment"
  139. placeholder="请输入审核意见"></textarea>
  140. </div>
  141. </div>
  142. </form>
  143. <div class="row cl text-c" style="margin-top: 15px;background-color: white">
  144. <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
  145. <a onclick="save()" class="btn btn-secondary radius"
  146. th:if="*{data.approve_status=='1' || data.approve_status=='5'}">
  147. <i class="Hui-iconfont">&#xe632;</i>保存草稿</a>
  148. <a onclick="release()" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe632;</i>提交 </a>
  149. <a onclick="audit(1)" class="btn btn-default radius"
  150. th:if="*{data.approve_status=='2'}">退回 </a>
  151. <a onClick="removeIframe();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</a>
  152. </div>
  153. </div>
  154. </article>
  155. <script type="text/javascript" th:src="@{/h-ui/lib/webuploader/0.1.5/webuploader.min.js}"></script>
  156. <script th:inline="javascript">
  157. //富文本kindeditor初始化
  158. var editor;
  159. KindEditor.ready(function (K) {
  160. editor = K.create('#content', {
  161. uploadJson: pagePath + '/upload/kindEditorUpload',
  162. cssData: 'body {font-family: "微软雅黑"; font-size: 14px}',
  163. allowFileManager: false,
  164. allowUpload: true,
  165. width: "100%",
  166. height: "350px",
  167. items: array,
  168. syncType: "auto",
  169. filterMode: false,
  170. afterBlur: function () {
  171. this.sync();
  172. }
  173. });
  174. });
  175. $(function () {
  176. // 初始化上传
  177. var options = {
  178. uploadBtnId: '#filePicker',
  179. picturePreId: 'fileListPre',
  180. hiddenPictureUrl: 'img',
  181. hiddenPictureName: 'imgName',
  182. width: 81,
  183. height: 81,
  184. fileSizeLimit: 100 * 1024 * 1024,
  185. fileSingleSizeLimit: 100 * 1024 * 1024
  186. };
  187. var webUploadDoc = new $WebUploadDoc(options);
  188. webUploadDoc.init();
  189. // var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
  190. // var isOpera = userAgent.indexOf("Opera") > -1;
  191. // //判断是否IE浏览器
  192. // if (userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera) {
  193. // $("#apply_startdate").remove();
  194. // $("#apply_enddate").remove();
  195. // } else {
  196. // $("#apply_startdateIE").remove();
  197. // $("#apply_enddateIE").remove();
  198. // var startDate = laydate.render({
  199. // elem: '#apply_startdate',
  200. // type: 'datetime',
  201. // done: function (value, date) {
  202. // setTimeout(function () {
  203. // $("#form-add").validate().element($("#apply_startdate"));
  204. // }, 100)
  205. // if (value !== '') {
  206. // endDate.config.min.year = date.year;
  207. // endDate.config.min.month = date.month - 1;
  208. // endDate.config.min.date = date.date;
  209. // endDate.config.min.hours = date.hours;
  210. // endDate.config.min.minutes = date.minutes;
  211. // endDate.config.min.seconds = date.seconds;
  212. // } else {
  213. // endDate.config.min.year = '1900';
  214. // endDate.config.min.month = '0';
  215. // endDate.config.min.date = '1';
  216. // endDate.config.min.hours = '0';
  217. // endDate.config.min.minutes = '0';
  218. // endDate.config.min.seconds = '0';
  219. // }
  220. // }
  221. // });
  222. //
  223. // var endDate = laydate.render({
  224. // elem: '#apply_enddate',
  225. // type: 'datetime',
  226. // done: function (value, date) {
  227. // setTimeout(function () {
  228. // $("#form-add").validate().element($("#apply_enddate"));
  229. // }, 100)
  230. // if (value !== '') {
  231. // startDate.config.max.year = date.year;
  232. // startDate.config.max.month = date.month - 1;
  233. // startDate.config.max.date = date.date;
  234. // startDate.config.max.hours = date.hours;
  235. // startDate.config.max.minutes = date.minutes;
  236. // startDate.config.max.seconds = date.seconds;
  237. // } else {
  238. // startDate.config.max.year = '2100';
  239. // startDate.config.max.month = '0';
  240. // startDate.config.max.date = '1';
  241. // startDate.config.max.hours = '0';
  242. // startDate.config.max.minutes = '0';
  243. // startDate.config.max.seconds = '0';
  244. // }
  245. // }
  246. // });
  247. // }
  248. });
  249. //取消
  250. function removeIframe() {
  251. var index = parent.layer.getFrameIndex(window.name);
  252. parent.layer.close(index);
  253. }
  254. //默认状态为草稿
  255. var state = '0';
  256. $("#form-add").validate({
  257. rules: {
  258. title: {
  259. required: true,
  260. },
  261. location: {
  262. required: true,
  263. },
  264. content: {
  265. required: true,
  266. }
  267. },
  268. onkeyup: false,
  269. focusCleanup: true,
  270. focusInvalid: false,
  271. success: "valid",
  272. submitHandler: function (form) {
  273. if (editor.isEmpty()) {
  274. errorMessage('请输入项目介绍');
  275. return false;
  276. } else if (editor.text().length > 2000) {
  277. //errorMessage('项目内容最多2000字');
  278. //return false;
  279. }
  280. $(form).ajaxSubmit({
  281. type: 'post',
  282. url: pagePath + "/land_supply/update",
  283. dataType: "json",
  284. data: {
  285. state: state
  286. },
  287. success: function (result) {
  288. if (result.success) {
  289. succeedMessage(result.message);
  290. setTimeClose();
  291. } else {
  292. // $(form).find(":submit").attr("disabled", false);
  293. errorMessage(result.message);
  294. }
  295. },
  296. error: function () {
  297. errorMessage('系统错误!');
  298. }
  299. });
  300. return false; // 非常重要,如果是false,则表明是不跳转,在本页上处理,也就是ajax,如果是非false,则传统的form跳转。
  301. }
  302. });
  303. //发布
  304. function release() {
  305. state = "1";
  306. $("#form-add").submit();
  307. }
  308. //保存草稿
  309. function save() {
  310. state = "0";
  311. $("#form-add").ajaxSubmit({
  312. type: 'post',
  313. url: pagePath + "/land_supply/update",
  314. dataType: "json",
  315. data: {
  316. state: state
  317. },
  318. success: function (data) {
  319. if (data.success) {
  320. succeedMessage(data.message);
  321. setTimeClose();
  322. } else {
  323. // $(form).find(":submit").attr("disabled", false);
  324. errorMessage(data.message);
  325. }
  326. },
  327. error: function () {
  328. errorMessage('系统错误!');
  329. }
  330. });
  331. }
  332. //status 1退回,2通过,3不通过
  333. function audit(status) {
  334. $("#status").val(status);
  335. if ($("#approval_comment").val() && $("#approval_comment").val().length > 5000) {
  336. errorMessage('审核意见最多支持5000个字符!');
  337. return false;
  338. }
  339. if (status == 1 || status == 3) {
  340. //退回、不通过审核意见必填
  341. if ($.trim($("#approval_comment").val()) == "") {
  342. errorMessage('请填写审核意见!');
  343. return false;
  344. }
  345. var str = "确定操作吗?"
  346. if (status == 1) {
  347. str = "确定退回吗?"
  348. } else if (status == 3) {
  349. str = "确定不通过吗?"
  350. }
  351. layer.confirm(str, function (index) {
  352. $("#form-approve").submit();
  353. layer.close(index);
  354. });
  355. } else if (status == 2) {
  356. $("#form-approve").submit();
  357. }
  358. }
  359. $(function () {
  360. $("#form-approve").validate({
  361. rules: {},
  362. messages: {},
  363. onkeyup: false,
  364. focusCleanup: true,
  365. success: "valid",
  366. submitHandler: function (form) {
  367. $(form).ajaxSubmit({
  368. type: 'post',
  369. url: pagePath + "/land_supply/approve",
  370. dataType: "json",
  371. success: function (data) {
  372. if (data.success) {
  373. succeedMessage(data.message);
  374. setTimeClose();
  375. } else {
  376. errorMessage(data.message);
  377. }
  378. },
  379. error: function () {
  380. errorMessage('系统错误!');
  381. }
  382. });
  383. return false; // 非常重要,如果是false,则表明是不跳转,在本页上处理,也就是ajax,如果是非false,则传统的form跳转。
  384. }
  385. });
  386. //查看完整意见
  387. $(".viewComment").on("click", function () {
  388. layer.alert(
  389. $(this).attr('data'),
  390. {area: ['800px', '500px']}
  391. )
  392. });
  393. });
  394. var departmentList = [[${consulDepartmentList}]];
  395. var index = departmentList.length;
  396. function addFileLine(divId) {
  397. var length = index;
  398. if ($("#" + divId).find('.add_file_line>tr').length > 0) {
  399. var html = "<i class='Hui-iconfont' onclick='removeLine(this)'>&#xe6a1; 删除</i>";
  400. $("#" + divId).find(".add_file_line tr:eq(0)").clone().insertAfter($("#" + divId).find('.add_file_line>tr').eq(-1))
  401. .find(".consultation").removeAttr("name").attr("name", "consultationList[" + length + "].consultation").val("").end()
  402. .find(".department_id").removeAttr("name").attr("name", "consultationList[" + length + "].department_id").end()
  403. .find(".icon_font").html(html).end();
  404. } else {
  405. var str = "";
  406. str += "<tr class='text-c'>"
  407. str += "<td class='td_material'>"
  408. str += "<input type='text' class='input-text consultation' placeholder='请输入咨询的问题' name='consultationList[" + length + "].consultation'/>"
  409. str += "<input class='department_id' type='hidden' value='" + divId.split("department")[1] + "' name='consultationList[" + length + "].department_id' />"
  410. str += "</td>"
  411. str += "<td class='icon_font'><i class='Hui-iconfont' onclick='removeLine(this)'>&#xe6a1; 删除</i>"
  412. str += "</td>"
  413. str += "</tr>"
  414. $("#tbody_" + divId).html(str);
  415. }
  416. $('#layui-layer2').height(48);
  417. index++;
  418. }
  419. // function addFileLine(divId) {
  420. // // var length = $("#" + divId).find(".add_file_line tr").length;
  421. // var length = index;
  422. // var html = "<i class='Hui-iconfont' onclick='removeLine(this)'>&#xe6a1;</i>";
  423. // $("#" + divId).find(".add_file_line tr:eq(0)").clone().insertAfter($("#" + divId).find('.add_file_line>tr').eq(-1))
  424. // .find(".consultation").removeAttr("name").attr("name", "consultationList[" + length + "].consultation").val("").end()
  425. // .find(".department_id").removeAttr("name").attr("name", "consultationList[" + length + "].department_id").end()
  426. // .find(".icon_font").html(html).end();
  427. // $('#layui-layer2').height(48);
  428. // index++;
  429. // }
  430. // function addFileLine(divId) {
  431. // var length = $("#" + divId).find(".add_file_line tr").length;
  432. // var html = "<i class='Hui-iconfont' onclick='removeLine(this)'>&#xe6a1;</i>";
  433. // $("#" + divId).find(".add_file_line tr:eq(0)").clone().insertAfter($("#" + divId).find('.add_file_line>tr').eq(-1))
  434. // .find(".consultation").removeAttr("name").attr("name", divId + "[" + length + "].consultation").val("").end()
  435. // .find(".department_id").removeAttr("name").attr("name", divId + "[" + length + "].department_id").end()
  436. // .find(".icon_font").html(html).end();
  437. // $('#layui-layer2').height(48);
  438. // }
  439. function removeLine(obj) {
  440. $(obj).parent().parent().remove();
  441. }
  442. </script>
  443. </body>
  444. </html>