edit.html 25 KB

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