edit.html 25 KB

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