edit.html 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  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?.resource}]]</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" th:id="upload_file">
  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"-->
  67. <!-- th:value="${data.fileDown.file_id}">-->
  68. <!-- </th:block>-->
  69. <!-- </div>-->
  70. <div><i class="Hui-iconfont" style="cursor: pointer;"
  71. th:onclick="'javascript:addFileLine(\'upload_file\')'">&#xe600; 添加</i></div>
  72. <table class="table table-border table-bordered table-bg table-hover ">
  73. <thead>
  74. <tr class="text-c">
  75. <th>文件</th>
  76. <th>操作</th>
  77. </tr>
  78. </thead>
  79. <tbody class="add_file_line" th:id="'tbody_upload_file'">
  80. <th:block th:unless="${data.fileList==null}"
  81. th:each="item,itemStat: ${data.fileList}">
  82. <tr class="text-c">
  83. <td class="td_material">
  84. <div>
  85. <input class="uploadFileName btn btn-upload radius" name="uploadFileName"
  86. readonly="readonly"
  87. type="text" th:value="${item.file_name}"
  88. th:onclick="'javascript:addFileByName(\'/land_supply/addApplyFile\',this);'"/>
  89. <input class="uploadFileId" type="hidden" th:value="${item.file_id}"
  90. th:name="'fileList['+${itemStat.index}+'].file_id'"/>
  91. </div>
  92. </td>
  93. <td class="icon_font"><i class='Hui-iconfont' onclick='removeLine(this)'>&#xe6a1; 删除</i>
  94. </td>
  95. </tr>
  96. </th:block>
  97. </tbody>
  98. </table>
  99. </div>
  100. </div>
  101. <div th:if="*{canAsk}" th:each="item,itemStat: ${consulDepartmentList}">
  102. <div class="line">[[${item.name}]]</div>
  103. <div class="row cl" th:id=" 'department'+${item.id}">
  104. <label class="form-label col-xs-4 col-sm-2"></label>
  105. <div class="formControls col-xs-8 col-sm-9">
  106. <div><i class="Hui-iconfont" style="cursor: pointer;"
  107. th:onclick="'javascript:addQuestionLine(\''+'department'+${item.id}+'\')'">&#xe600; 添加</i>
  108. </div>
  109. <table class="table table-border table-bordered table-bg table-hover ">
  110. <thead>
  111. <tr class="text-c">
  112. <th>咨询问题</th>
  113. <th>操作</th>
  114. </tr>
  115. </thead>
  116. <tbody class="add_file_line" th:id="'tbody_department'+${item.id}">
  117. <tr class="text-c"
  118. th:each="landSupplyCons,landSupplyConsStat: ${industrialLandSupplyConsultationList}"
  119. th:if="*{item.id+''==landSupplyCons.department_id}">
  120. <td class="td_material">
  121. <input type="text" class="input-text consultation" placeholder="请输入咨询的问题"
  122. th:name="'consultationList[1'+${landSupplyConsStat.index}+${itemStat.index}+'].consultation'"
  123. th:value="${landSupplyCons.consultation}"/>
  124. <input class="department_id" type="hidden"
  125. th:name="'consultationList[1'+${landSupplyConsStat.index}+${itemStat.index}+'].department_id'"
  126. th:value="${item.id}"/>
  127. <input type="hidden"
  128. th:name="'consultationList[1'+${landSupplyConsStat.index}+${itemStat.index}+'].id'"
  129. th:value="${landSupplyCons.id}"/>
  130. </td>
  131. <td class="icon_font"><i class='Hui-iconfont' onclick='removeLine(this)'>&#xe6a1; 删除</i>
  132. </td>
  133. </tr>
  134. </tbody>
  135. </table>
  136. </div>
  137. </div>
  138. </div>
  139. </form>
  140. <form class="form form-horizontal" id="form-approve">
  141. <input id="status" type="hidden" name="status"/>
  142. <input id="apply_id" type="hidden" name="apply_id" th:value="${data.id}"/>
  143. <div th:if="*{data.approve_status=='2' || data.approve_status=='4' || data.approve_status=='12'}" class="line">流程信息</div>
  144. <div th:if="*{data.approve_status=='2' || data.approve_status=='4' || data.approve_status=='12'}" class="row cl">
  145. <label class="form-label col-xs-4 col-sm-2"></label>
  146. <div class="formControls col-xs-8 col-sm-9">
  147. <table class="table table-border table-bordered table-bg table-hover processTb">
  148. <thead>
  149. <tr class="text-c">
  150. <th>时间</th>
  151. <!-- <th>审核状态</th> -->
  152. <th>单位</th>
  153. <th>操作人</th>
  154. <th>操作</th>
  155. <th>审核意见</th>
  156. </tr>
  157. </thead>
  158. <tbody>
  159. <tr class="text-c" th:each="model,iterStat:${approvalList}" th:object="${model}">
  160. <td th:text="*{create_time}"></td>
  161. <!-- <td th:text="*{before_approvalstatus_str}"></td> -->
  162. <td th:text="*{department}"></td>
  163. <td th:text="*{create_name}"></td>
  164. <td th:text="*{oper_type}"></td>
  165. <td class="viewComment" th:data="*{approval_comment}" th:text="*{approval_comment}"></td>
  166. </tr>
  167. </tbody>
  168. </table>
  169. </div>
  170. </div>
  171. <div th:if="*{data.approve_status=='2'}" class="line">审核意见</div>
  172. <div th:if="*{data.approve_status=='2'}" class="row cl">
  173. <label class="form-label col-xs-4 col-sm-2">审核意见:</label>
  174. <div class="formControls col-xs-8 col-sm-9">
  175. <textarea class="textarea" id="approval_comment" th:name="approval_comment"
  176. placeholder="请输入审核意见"></textarea>
  177. </div>
  178. </div>
  179. </form>
  180. <div class="row cl text-c" style="margin-top: 15px;background-color: white">
  181. <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
  182. <a onclick="save()" class="btn btn-secondary radius"
  183. th:if="*{data.approve_status=='1' || data.approve_status=='5'}">
  184. <i class="Hui-iconfont">&#xe632;</i>保存草稿</a>
  185. <a onclick="release()" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe632;</i>提交 </a>
  186. <a onclick="audit(1)" class="btn btn-default radius"
  187. th:if="*{data.approve_status=='2'}">退回 </a>
  188. <a onClick="removeIframe();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</a>
  189. </div>
  190. </div>
  191. </article>
  192. <script type="text/javascript" th:src="@{/h-ui/lib/webuploader/0.1.5/webuploader.min.js}"></script>
  193. <script th:inline="javascript">
  194. //富文本kindeditor初始化
  195. var editor;
  196. KindEditor.ready(function (K) {
  197. editor = K.create('#content', {
  198. uploadJson: pagePath + '/upload/kindEditorUpload',
  199. cssData: 'body {font-family: "微软雅黑"; font-size: 14px}',
  200. allowFileManager: false,
  201. allowUpload: true,
  202. width: "100%",
  203. height: "350px",
  204. items: array,
  205. syncType: "auto",
  206. filterMode: false,
  207. afterBlur: function () {
  208. this.sync();
  209. }
  210. });
  211. });
  212. $(function () {
  213. // 初始化上传
  214. var options = {
  215. uploadBtnId: '#filePicker',
  216. picturePreId: 'fileListPre',
  217. hiddenPictureUrl: 'img',
  218. hiddenPictureName: 'imgName',
  219. width: 81,
  220. height: 81,
  221. fileSizeLimit: 100 * 1024 * 1024,
  222. fileSingleSizeLimit: 100 * 1024 * 1024
  223. };
  224. var webUploadDoc = new $WebUploadDoc(options);
  225. webUploadDoc.init();
  226. // var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
  227. // var isOpera = userAgent.indexOf("Opera") > -1;
  228. // //判断是否IE浏览器
  229. // if (userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera) {
  230. // $("#apply_startdate").remove();
  231. // $("#apply_enddate").remove();
  232. // } else {
  233. // $("#apply_startdateIE").remove();
  234. // $("#apply_enddateIE").remove();
  235. // var startDate = laydate.render({
  236. // elem: '#apply_startdate',
  237. // type: 'datetime',
  238. // done: function (value, date) {
  239. // setTimeout(function () {
  240. // $("#form-add").validate().element($("#apply_startdate"));
  241. // }, 100)
  242. // if (value !== '') {
  243. // endDate.config.min.year = date.year;
  244. // endDate.config.min.month = date.month - 1;
  245. // endDate.config.min.date = date.date;
  246. // endDate.config.min.hours = date.hours;
  247. // endDate.config.min.minutes = date.minutes;
  248. // endDate.config.min.seconds = date.seconds;
  249. // } else {
  250. // endDate.config.min.year = '1900';
  251. // endDate.config.min.month = '0';
  252. // endDate.config.min.date = '1';
  253. // endDate.config.min.hours = '0';
  254. // endDate.config.min.minutes = '0';
  255. // endDate.config.min.seconds = '0';
  256. // }
  257. // }
  258. // });
  259. //
  260. // var endDate = laydate.render({
  261. // elem: '#apply_enddate',
  262. // type: 'datetime',
  263. // done: function (value, date) {
  264. // setTimeout(function () {
  265. // $("#form-add").validate().element($("#apply_enddate"));
  266. // }, 100)
  267. // if (value !== '') {
  268. // startDate.config.max.year = date.year;
  269. // startDate.config.max.month = date.month - 1;
  270. // startDate.config.max.date = date.date;
  271. // startDate.config.max.hours = date.hours;
  272. // startDate.config.max.minutes = date.minutes;
  273. // startDate.config.max.seconds = date.seconds;
  274. // } else {
  275. // startDate.config.max.year = '2100';
  276. // startDate.config.max.month = '0';
  277. // startDate.config.max.date = '1';
  278. // startDate.config.max.hours = '0';
  279. // startDate.config.max.minutes = '0';
  280. // startDate.config.max.seconds = '0';
  281. // }
  282. // }
  283. // });
  284. // }
  285. });
  286. //取消
  287. function removeIframe() {
  288. var index = parent.layer.getFrameIndex(window.name);
  289. parent.layer.close(index);
  290. }
  291. //默认状态为草稿
  292. var state = '0';
  293. $("#form-add").validate({
  294. rules: {
  295. title: {
  296. required: true,
  297. },
  298. location: {
  299. required: true,
  300. },
  301. content: {
  302. required: true,
  303. }
  304. },
  305. onkeyup: false,
  306. focusCleanup: true,
  307. focusInvalid: false,
  308. success: "valid",
  309. submitHandler: function (form) {
  310. if (editor.isEmpty()) {
  311. errorMessage('请输入项目介绍');
  312. return false;
  313. } else if (editor.text().length > 2000) {
  314. //errorMessage('项目内容最多2000字');
  315. //return false;
  316. }
  317. $(form).ajaxSubmit({
  318. type: 'post',
  319. url: pagePath + "/land_supply/update",
  320. dataType: "json",
  321. data: {
  322. state: state,
  323. content_text: editor.text()
  324. },
  325. success: function (result) {
  326. if (result.success) {
  327. succeedMessage(result.message);
  328. setTimeClose();
  329. } else {
  330. // $(form).find(":submit").attr("disabled", false);
  331. errorMessage(result.message);
  332. }
  333. },
  334. error: function () {
  335. errorMessage('系统错误!');
  336. }
  337. });
  338. return false; // 非常重要,如果是false,则表明是不跳转,在本页上处理,也就是ajax,如果是非false,则传统的form跳转。
  339. }
  340. });
  341. //发布
  342. function release() {
  343. state = "1";
  344. $("#form-add").submit();
  345. }
  346. //保存草稿
  347. function save() {
  348. state = "0";
  349. $("#form-add").ajaxSubmit({
  350. type: 'post',
  351. url: pagePath + "/land_supply/update",
  352. dataType: "json",
  353. data: {
  354. state: state,
  355. content_text: editor.text()
  356. },
  357. success: function (data) {
  358. if (data.success) {
  359. succeedMessage(data.message);
  360. setTimeClose();
  361. } else {
  362. // $(form).find(":submit").attr("disabled", false);
  363. errorMessage(data.message);
  364. }
  365. },
  366. error: function () {
  367. errorMessage('系统错误!');
  368. }
  369. });
  370. }
  371. //status 1退回,2通过,3不通过
  372. function audit(status) {
  373. $("#status").val(status);
  374. if ($("#approval_comment").val() && $("#approval_comment").val().length > 5000) {
  375. errorMessage('审核意见最多支持5000个字符!');
  376. return false;
  377. }
  378. if (status == 1 || status == 3) {
  379. //退回、不通过审核意见必填
  380. if ($.trim($("#approval_comment").val()) == "") {
  381. errorMessage('请填写审核意见!');
  382. return false;
  383. }
  384. var str = "确定操作吗?"
  385. if (status == 1) {
  386. str = "确定退回吗?"
  387. } else if (status == 3) {
  388. str = "确定不通过吗?"
  389. }
  390. layer.confirm(str, function (index) {
  391. $("#form-approve").submit();
  392. layer.close(index);
  393. });
  394. } else if (status == 2) {
  395. $("#form-approve").submit();
  396. }
  397. }
  398. $(function () {
  399. $("#form-approve").validate({
  400. rules: {},
  401. messages: {},
  402. onkeyup: false,
  403. focusCleanup: true,
  404. success: "valid",
  405. submitHandler: function (form) {
  406. $(form).ajaxSubmit({
  407. type: 'post',
  408. url: pagePath + "/land_supply/approve",
  409. dataType: "json",
  410. success: function (data) {
  411. if (data.success) {
  412. succeedMessage(data.message);
  413. setTimeClose();
  414. } else {
  415. errorMessage(data.message);
  416. }
  417. },
  418. error: function () {
  419. errorMessage('系统错误!');
  420. }
  421. });
  422. return false; // 非常重要,如果是false,则表明是不跳转,在本页上处理,也就是ajax,如果是非false,则传统的form跳转。
  423. }
  424. });
  425. //查看完整意见
  426. $(".viewComment").on("click", function () {
  427. layer.alert(
  428. $(this).attr('data'),
  429. {area: ['800px', '500px']}
  430. )
  431. });
  432. });
  433. var departmentList = [[${consulDepartmentList}]];
  434. var index = departmentList.length;
  435. function addQuestionLine(divId) {
  436. var length = index;
  437. if ($("#" + divId).find('.add_file_line>tr').length > 0) {
  438. var html = "<i class='Hui-iconfont' onclick='removeLine(this)'>&#xe6a1; 删除</i>";
  439. $("#" + divId).find(".add_file_line tr:eq(0)").clone().insertAfter($("#" + divId).find('.add_file_line>tr').eq(-1))
  440. .find(".consultation").removeAttr("name").attr("name", "consultationList[" + length + "].consultation").val("").end()
  441. .find(".department_id").removeAttr("name").attr("name", "consultationList[" + length + "].department_id").end()
  442. .find(".icon_font").html(html).end();
  443. } else {
  444. var str = "";
  445. str += "<tr class='text-c'>"
  446. str += "<td class='td_material'>"
  447. str += "<input type='text' class='input-text consultation' placeholder='请输入咨询的问题' name='consultationList[" + length + "].consultation'/>"
  448. str += "<input class='department_id' type='hidden' value='" + divId.split("department")[1] + "' name='consultationList[" + length + "].department_id' />"
  449. str += "</td>"
  450. str += "<td class='icon_font'><i class='Hui-iconfont' onclick='removeLine(this)'>&#xe6a1; 删除</i>"
  451. str += "</td>"
  452. str += "</tr>"
  453. $("#tbody_" + divId).html(str);
  454. }
  455. $('#layui-layer2').height(48);
  456. index++;
  457. }
  458. var fileList = [[${data.fileList}]];
  459. var file_index = fileList.length;
  460. function addFileLine(divId) {
  461. if (file_index == undefined) {
  462. file_index = 0
  463. }
  464. var length = file_index;
  465. if ($("#" + divId).find('.add_file_line>tr').length > 0) {
  466. var html = "<i class='Hui-iconfont' onclick='removeLine(this)'>&#xe6a1; 删除</i>";
  467. $("#" + divId).find(".add_file_line tr:eq(0)").clone().insertAfter($("#" + divId).find('.add_file_line>tr').eq(-1))
  468. .find(".uploadFileId").removeAttr("name").attr("name", "fileList[" + length + "].file_id").val("").end()
  469. .find(".uploadFileName").val("上传文件").end()
  470. .find(".icon_font").html(html).end();
  471. } else {
  472. var str = "";
  473. str += "<tr class='text-c'>"
  474. str += "<td class='td_material'>"
  475. str += "<div>"
  476. str += "<input class='uploadFileName btn btn-upload radius' name='uploadFileName' readonly='readonly' type='text' value='上传文件' onclick=\"addFileByName('/land_supply/addApplyFile',this);\"/>"
  477. str += "<input class='uploadFileId' hidden name='fileList[" + length + "].file_id'/>"
  478. str += "</div>"
  479. str += "</td>"
  480. str += "<td class='icon_font'><i class='Hui-iconfont' onclick='removeLine(this)'>&#xe6a1; 删除</i>"
  481. str += "</td>"
  482. str += "</tr>"
  483. $("#tbody_" + divId).html(str);
  484. }
  485. $('#layui-layer2').height(48);
  486. file_index++;
  487. }
  488. // function addFileLine(divId) {
  489. // // var length = $("#" + divId).find(".add_file_line tr").length;
  490. // var length = index;
  491. // var html = "<i class='Hui-iconfont' onclick='removeLine(this)'>&#xe6a1;</i>";
  492. // $("#" + divId).find(".add_file_line tr:eq(0)").clone().insertAfter($("#" + divId).find('.add_file_line>tr').eq(-1))
  493. // .find(".consultation").removeAttr("name").attr("name", "consultationList[" + length + "].consultation").val("").end()
  494. // .find(".department_id").removeAttr("name").attr("name", "consultationList[" + length + "].department_id").end()
  495. // .find(".icon_font").html(html).end();
  496. // $('#layui-layer2').height(48);
  497. // index++;
  498. // }
  499. // function addFileLine(divId) {
  500. // var length = $("#" + divId).find(".add_file_line tr").length;
  501. // var html = "<i class='Hui-iconfont' onclick='removeLine(this)'>&#xe6a1;</i>";
  502. // $("#" + divId).find(".add_file_line tr:eq(0)").clone().insertAfter($("#" + divId).find('.add_file_line>tr').eq(-1))
  503. // .find(".consultation").removeAttr("name").attr("name", divId + "[" + length + "].consultation").val("").end()
  504. // .find(".department_id").removeAttr("name").attr("name", divId + "[" + length + "].department_id").end()
  505. // .find(".icon_font").html(html).end();
  506. // $('#layui-layer2').height(48);
  507. // }
  508. //添加相应name的文件
  509. function addFileByName(url, obj) {
  510. var name = $(obj).next().attr("name");
  511. url += "?fileIdName=" + name;
  512. layer_show('添加文件', pagePath + url, 800, 350);
  513. }
  514. function removeLine(obj) {
  515. $(obj).parent().parent().remove();
  516. }
  517. </script>
  518. </body>
  519. </html>