add.html 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
  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. .ke-container-default {
  9. width: 100% !important
  10. }
  11. .ke-swfupload-body {
  12. height: 265px
  13. }
  14. .ke-dialog-body {
  15. height: 340px !important;
  16. }
  17. .ke-dialog-default {
  18. height: 410px !important;
  19. }
  20. .error {
  21. color: red;
  22. }
  23. multiple:hover .dropdown-clear-all, .dropdown-single:hover .dropdown-clear-all {
  24. display: none;
  25. }
  26. </style>
  27. </head>
  28. <body layout:fragment="content">
  29. <article class="page-container">
  30. <form class="form form-horizontal" id="form-add">
  31. <div class="row cl">
  32. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>申报项:</label>
  33. <div class="formControls col-xs-8 col-sm-6">
  34. <div class="select-box autocomplete">
  35. <select style="display:none" class="select" th:name="project_service_type"
  36. th:id="project_service_type" th:placeholder="请选择">
  37. <option value=""></option>
  38. </select>
  39. </div>
  40. </div>
  41. </div>
  42. <div class="row cl">
  43. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>项目来源:</label>
  44. <div class="formControls col-xs-8 col-sm-3">
  45. <span class="select-box">
  46. <select class="select" th:name="project_source" id="project_source">
  47. <option value="">-- 请选择项目来源 --</option>
  48. <option th:each="item : ${projectSourceList}" th:value="${item.value}" th:text="${item.name}">
  49. </select>
  50. </span>
  51. </div>
  52. </div>
  53. <div class="row cl">
  54. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>是否综合申报项目:</label>
  55. <div class="formControls col-xs-8 col-sm-9">
  56. <input type="radio" id="is_comprehensive1" name="is_comprehensive" th:value="1"
  57. onclick="changeDepartment()" checked>是
  58. <input type="radio" id="is_comprehensive2" name="is_comprehensive" th:value="0"
  59. onclick="changeDepartment()">否
  60. </div>
  61. </div>
  62. <div class="row cl" id="department" hidden>
  63. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>项目责任单位:</label>
  64. <div class="formControls col-xs-8 col-sm-3">
  65. <span class="select-box">
  66. <select class="select" th:name="department_id" id="department_id" required>
  67. <option value="">-- 请选择项目责任单位 --</option>
  68. <option th:each="item : ${departmentList}" th:value="${item.id}"
  69. th:text="${item.name}">
  70. </option>
  71. </select>
  72. </span>
  73. </div>
  74. </div>
  75. <div class="row cl" id="departmentAndType" hidden>
  76. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>项目类别及责任单位:</label>
  77. <div class="formControls col-xs-8 col-sm-3">
  78. <div><i class="Hui-iconfont" style="cursor: pointer;" onclick="addLine()">&#xe600;</i></div>
  79. <table class="table table-border table-bordered table-bg table-hover">
  80. <thead>
  81. <tr class="text-c">
  82. <th width="200">项目大类</th>
  83. <th width="200">项目小类</th>
  84. <th width="200">责任单位</th>
  85. <th width="100">操作</th>
  86. </tr>
  87. </thead>
  88. <tbody class="add_floor_line">
  89. <tr class="text-c ">
  90. <td><input type="text" class="name1" name="projectServiceCategory[0].project_type_name1"
  91. style="width: 100%;" required></td>
  92. <td><input type="text" class="name2" name="projectServiceCategory[0].project_type_name2"
  93. style="width: 100%;" required></td>
  94. <td>
  95. <div class="formControls col-sm-12 text-left">
  96. <span class="select-box">
  97. <select class="select department" name="projectServiceCategory[0].department_id"
  98. required>
  99. <option value="">-- 请选择项目责任单位 --</option>
  100. <option th:each="item : ${departmentList}" th:value="${item.id}"
  101. th:text="${item.name}" required></option>
  102. </select>
  103. </span>
  104. </div>
  105. </td>
  106. <td class="icon_font"></td>
  107. </tr>
  108. </tbody>
  109. </table>
  110. </div>
  111. </div>
  112. <div class="row cl">
  113. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>属地审核:</label>
  114. <div class="formControls col-xs-8 col-sm-9">
  115. <input type="radio" id="is_street_audit1" name="is_street_audit" th:value="1" checked>是
  116. <input type="radio" id="is_street_audit2" name="is_street_audit" th:value="0">否
  117. </div>
  118. </div>
  119. <div class="row cl">
  120. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>对应年份:</label>
  121. <div class="formControls col-xs-8 col-sm-3">
  122. <span class="select-box">
  123. <select class="select" th:name="year" id="year">
  124. <option value="">-- 请选年份 --</option>
  125. <option th:value="2028" th:text="2028"></option>
  126. <option th:value="2027" th:text="2027"></option>
  127. <option th:value="2026" th:text="2026"></option>
  128. <option th:value="2025" th:text="2025"></option>
  129. <option th:value="2024" th:text="2024"></option>
  130. <option th:value="2023" th:text="2023"></option>
  131. <option th:value="2022" th:text="2022"></option>
  132. <option th:value="2021" th:text="2021"></option>
  133. <option th:value="2020" th:text="2020"></option>
  134. <option th:value="2019" th:text="2019"></option>
  135. <option th:value="2018" th:text="2018"></option>
  136. </select>
  137. </span>
  138. </div>
  139. </div>
  140. <div class="row cl">
  141. <label class="form-label col-xs-4 col-sm-2">对应季月:</label>
  142. <div class="formControls col-xs-8 col-sm-3">
  143. <span class="select-box">
  144. <select class="select" th:name="season_or_month" th:id="season_or_month">
  145. <option value="">-- 请选择季度或月度 --</option>
  146. <option th:value="J" th:text="季度"></option>
  147. <option th:value="Y" th:text="月度"></option>
  148. </select>
  149. </span>
  150. </div>
  151. <div class="formControls col-xs-8 col-sm-3 season" hidden>
  152. <span class="select-box season" hidden>
  153. <select class="select" th:name="season" id="season" required>
  154. <option value="">-- 请选择季度 --</option>
  155. <option th:value="1" th:text="第一季度"></option>
  156. <option th:value="2" th:text="第二季度"></option>
  157. <option th:value="3" th:text="第三季度"></option>
  158. <option th:value="4" th:text="第四季度"></option>
  159. </select>
  160. </span>
  161. </div>
  162. <div class="formControls col-xs-8 col-sm-3 month" hidden>
  163. <span class="select-box month" hidden>
  164. <select class="select" th:name="month" id="month" required>
  165. <option value="">-- 请选择月份 --</option>
  166. <option th:value="1" th:text="一月"></option>
  167. <option th:value="2" th:text="二月"></option>
  168. <option th:value="3" th:text="三月"></option>
  169. <option th:value="4" th:text="四月"></option>
  170. <option th:value="5" th:text="五月"></option>
  171. <option th:value="6" th:text="六月"></option>
  172. <option th:value="7" th:text="七月"></option>
  173. <option th:value="8" th:text="八月"></option>
  174. <option th:value="9" th:text="九月"></option>
  175. <option th:value="10" th:text="十月"></option>
  176. <option th:value="11" th:text="十一月"></option>
  177. <option th:value="12" th:text="十二月"></option>
  178. </select>
  179. </span>
  180. </div>
  181. </div>
  182. <div class="row cl">
  183. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>项目标题:</label>
  184. <div class="formControls col-xs-8 col-sm-9">
  185. <input type="text" class="input-text" placeholder="请输入项目标题" id="project_name" name="project_name"/>
  186. </div>
  187. </div>
  188. <div class="row cl">
  189. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>项目内容:</label>
  190. <div class="formControls col-xs-8 col-sm-9">
  191. <textarea id="content" name="content" required></textarea>
  192. </div>
  193. </div>
  194. <div class="row cl">
  195. <label class="form-label col-xs-4 col-sm-2"><span>上传附件:</span></label>
  196. <div class="formControls col-xs-8 col-sm-9">
  197. <div class="uploader-thum-container">
  198. <div id="fileListPre" class="uploader-list"></div>
  199. <div id="filePicker">选择文件</div>
  200. </div>
  201. </div>
  202. </div>
  203. <div class="row cl">
  204. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>填报开始时间:</label>
  205. <div class="formControls col-xs-4 col-sm-1">
  206. <input class="Wdate input-text" type="text" th:id="apply_startdateIE" th:name="start_time"
  207. style="float:left; width: 150px;"
  208. onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',maxDate:'#F{$dp.$D(\'apply_enddateIE\')}',isShowClear:true,readOnly:true})"/>
  209. <input type="text" class="input-text" th:id="apply_startdate" th:name="start_time"
  210. style="float:left; width: 150px;"/>
  211. </div>
  212. </div>
  213. <div class="row cl">
  214. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>填报结束时间:</label>
  215. <div class="formControls col-xs-4 col-sm-1">
  216. <input class="Wdate input-text" type="text" th:id="apply_enddateIE" th:name="end_time"
  217. style="float:left; width: 150px;"
  218. onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'#F{$dp.$D(\'apply_startdateIE\')}',isShowClear:true,readOnly:true})"/>
  219. <input type="text" class="input-text pull-left" th:id="apply_enddate" th:name="end_time"
  220. style="float:left; width: 150px;"/>
  221. </div>
  222. </div>
  223. <div class="row cl">
  224. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>后续事项:</label>
  225. <div class="formControls col-xs-8 col-sm-3">
  226. <span class="select-box">
  227. <select class="select" th:name="next_step" id="next_step">
  228. <option value="">-- 请选择有无后续事项 --</option>
  229. <option th:value="0" th:text="线上申报后无后续事项"></option>
  230. <option th:value="1" th:text="线上申报后需企业来中心提交收据"></option>
  231. <option th:value="2" th:text="线上申报后需企业来中心领取奖牌"></option>
  232. </select>
  233. </span>
  234. </div>
  235. </div>
  236. <div class="row cl">
  237. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>显示在门户:</label>
  238. <div class="formControls col-xs-8 col-sm-9">
  239. <input type="radio" id="is_public1" name="is_public" th:value="1" checked>是
  240. <input type="radio" id="is_public2" name="is_public" th:value="0">否
  241. </div>
  242. </div>
  243. <div class="row cl push">
  244. <label class="form-label col-xs-4 col-sm-2"><span>推送对象:</span></label>
  245. <div class="formControls col-xs-8 col-sm-9">
  246. <a class="btn btn-primary radius"
  247. th:onclick="'javascript:notify_addPush(\'推送\',\'/government/projectProvinces/addPush\',\'800\',\'500\');'"><i
  248. class="Hui-iconfont">&#xe6df;</i>选择</a>
  249. <input id="pushCompanyIds" name="push_company_ids" type="hidden" value=""/>
  250. </div>
  251. <label class="form-label col-xs-4 col-sm-2"><span>已添加单位:</span></label>
  252. <div class="formControls col-xs-8 col-sm-9">
  253. <span id="pushNames"></span>
  254. </div>
  255. </div>
  256. <div class="row cl">
  257. <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
  258. <a type="submit" onclick="save()" class="btn btn-secondary radius"><i class="Hui-iconfont">&#xe632;</i>保存草稿</a>
  259. <a th:onclick="'javascript:preview(\'项目申报预览\',\'/government/projectProvinces/preview\',\'800\',\'600\');'"
  260. class="btn btn-secondary radius"><i class="Hui-iconfont">&#xe632;</i>预览</a>
  261. <a class="btn btn-primary radius" onclick="release()"><i class="Hui-iconfont">&#xe632;</i>发布 </a>
  262. <a onClick="removeIframe();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</a>
  263. </div>
  264. </div>
  265. </form>
  266. </article>
  267. <script type="text/javascript" th:src="@{/h-ui/lib/webuploader/0.1.5/webuploader.min.js}"></script>
  268. <script th:inline="javascript">
  269. //富文本kindeditor初始化
  270. var editor;
  271. KindEditor.ready(function (K) {
  272. editor = K.create('#content', {
  273. uploadJson: pagePath + '/upload/kindEditorUpload',
  274. allowFileManager: false,
  275. allowUpload: true,
  276. width: "100%",
  277. height: "350px",
  278. items: array,
  279. syncType: "auto",
  280. filterMode: false,
  281. afterBlur: function () {
  282. this.sync();
  283. }
  284. });
  285. });
  286. $(function () {
  287. // 初始化上传
  288. var options = {
  289. uploadBtnId: '#filePicker',
  290. picturePreId: 'fileListPre',
  291. hiddenPictureUrl: 'img',
  292. hiddenPictureName: 'imgName',
  293. width: 81,
  294. height: 81,
  295. fileSizeLimit: 100 * 1024 * 1024,
  296. fileSingleSizeLimit: 100 * 1024 * 1024
  297. };
  298. var webUploadDoc = new $WebUploadDoc(options);
  299. webUploadDoc.init();
  300. var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
  301. var isOpera = userAgent.indexOf("Opera") > -1;
  302. //判断是否IE浏览器
  303. if (userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera) {
  304. $("#apply_startdate").remove();
  305. $("#apply_enddate").remove();
  306. } else {
  307. $("#apply_startdateIE").remove();
  308. $("#apply_enddateIE").remove();
  309. var startDate = laydate.render({
  310. elem: '#apply_startdate',
  311. type: 'datetime',
  312. done: function (value, date) {
  313. setTimeout(function () {
  314. $("#form-add").validate().element($("#apply_startdate"));
  315. }, 100)
  316. if (value !== '') {
  317. endDate.config.min.year = date.year;
  318. endDate.config.min.month = date.month - 1;
  319. endDate.config.min.date = date.date;
  320. endDate.config.min.hours = date.hours;
  321. endDate.config.min.minutes = date.minutes;
  322. endDate.config.min.seconds = date.seconds;
  323. } else {
  324. endDate.config.min.year = '1900';
  325. endDate.config.min.month = '0';
  326. endDate.config.min.date = '1';
  327. endDate.config.min.hours = '0';
  328. endDate.config.min.minutes = '0';
  329. endDate.config.min.seconds = '0';
  330. }
  331. }
  332. });
  333. var endDate = laydate.render({
  334. elem: '#apply_enddate',
  335. type: 'datetime',
  336. done: function (value, date) {
  337. setTimeout(function () {
  338. $("#form-add").validate().element($("#apply_enddate"));
  339. }, 100)
  340. if (value !== '') {
  341. startDate.config.max.year = date.year;
  342. startDate.config.max.month = date.month - 1;
  343. startDate.config.max.date = date.date;
  344. startDate.config.max.hours = date.hours;
  345. startDate.config.max.minutes = date.minutes;
  346. startDate.config.max.seconds = date.seconds;
  347. } else {
  348. startDate.config.max.year = '2100';
  349. startDate.config.max.month = '0';
  350. startDate.config.max.date = '1';
  351. startDate.config.max.hours = '0';
  352. startDate.config.max.minutes = '0';
  353. startDate.config.max.seconds = '0';
  354. }
  355. }
  356. });
  357. }
  358. });
  359. //自动联想
  360. $('.autocomplete').dropdown({
  361. readOnly: true,
  362. //data: datas,
  363. input: '<input type="text" maxLength="20" placeholder="请输入关键字">',
  364. choice: function () {
  365. //$("span.placeholder").html($(".dropdown-chose")[0].innerText);
  366. $("#project_service_type").val($(".dropdown-chose").attr("data-value"));
  367. }
  368. });
  369. getServiceType()
  370. function getServiceType() {
  371. $.ajax({
  372. url: pagePath + "/government/projectProvinces/getProjectServicetype/1",
  373. type: "get",
  374. dataType: "json",
  375. data: {
  376. timeStamp: new Date()
  377. },
  378. success: function (result) {
  379. if (result.success) {
  380. var obj = result.obj;
  381. var typeArr = new Array();
  382. if (obj) {
  383. for (var i = 0; i < obj.length; i++) {
  384. var type = {
  385. "name": obj[i].service_type_name,
  386. "id": obj[i].id,
  387. "disabled": false,
  388. //"groupName": '分组名',
  389. //"groupId": 1,
  390. "selected": false
  391. }
  392. typeArr.push(type);
  393. }
  394. }
  395. //autoComplete(typeArr);
  396. $('.autocomplete').data('dropdown').update(typeArr, true);
  397. } else {
  398. errorMessage(result.message);
  399. }
  400. },
  401. error: function () {
  402. errorMessage('系统错误!');
  403. }
  404. });
  405. }
  406. //取消
  407. function removeIframe() {
  408. var index = parent.layer.getFrameIndex(window.name);
  409. parent.layer.close(index);
  410. }
  411. //默认状态为草稿
  412. var state = '0';
  413. $("#form-add").validate({
  414. rules: {
  415. project_service_type: {
  416. required: true,
  417. },
  418. project_source: {
  419. required: true,
  420. },
  421. is_comprehensive: {
  422. required: true,
  423. },
  424. is_street_audit: {
  425. required: true,
  426. },
  427. project_name: {
  428. required: true,
  429. },
  430. year: {
  431. required: true,
  432. },
  433. content: {
  434. required: true,
  435. },
  436. start_time: {
  437. required: true,
  438. },
  439. end_time: {
  440. required: true,
  441. },
  442. next_step: {
  443. required: true,
  444. },
  445. is_public: {
  446. required: true,
  447. },
  448. },
  449. onkeyup: false,
  450. focusCleanup: true,
  451. focusInvalid: false,
  452. success: "valid",
  453. submitHandler: function (form) {
  454. if ($("#project_service_type").val() == null) {
  455. errorMessage('请选择申报项');
  456. return false;
  457. }
  458. if (editor.isEmpty()) {
  459. errorMessage('请输入项目内容');
  460. return false;
  461. } else if (editor.text().length > 2000) {
  462. //errorMessage('项目内容最多2000字');
  463. //return false;
  464. }
  465. if (state == '1') {
  466. if ($('input[name="is_public"]:checked').val() == 0) {
  467. if ($("#pushNames").text().length <= 0) {
  468. errorMessage('请选择推送对象');
  469. return false;
  470. }
  471. }
  472. }
  473. $(form).ajaxSubmit({
  474. type: 'post',
  475. url: pagePath + "/government/projectProvinces/save",
  476. dataType: "json",
  477. data: {
  478. state: state
  479. },
  480. success: function (result) {
  481. if (result.success) {
  482. succeedMessage(result.message);
  483. setTimeClose();
  484. } else {
  485. // $(form).find(":submit").attr("disabled", false);
  486. errorMessage(result.message);
  487. }
  488. },
  489. error: function () {
  490. errorMessage('系统错误!');
  491. }
  492. });
  493. return false; // 非常重要,如果是false,则表明是不跳转,在本页上处理,也就是ajax,如果是非false,则传统的form跳转。
  494. }
  495. });
  496. //发布
  497. function release() {
  498. state = "1";
  499. $("#form-add").submit();
  500. }
  501. //保存草稿
  502. function save() {
  503. state = "0";
  504. $("#form-add").ajaxSubmit({
  505. type: 'post',
  506. url: pagePath + "/government/projectProvinces/save",
  507. dataType: "json",
  508. data: {
  509. state: state
  510. },
  511. success: function (data) {
  512. if (data.success) {
  513. succeedMessage(data.message);
  514. setTimeClose();
  515. } else {
  516. // $(form).find(":submit").attr("disabled", false);
  517. errorMessage(data.message);
  518. }
  519. },
  520. error: function () {
  521. errorMessage('系统错误!');
  522. }
  523. });
  524. }
  525. //推送
  526. function notify_addPush(title, url, w, h) {
  527. var index = layer_show(title, pagePath + url, w, h);
  528. layer.full(index);
  529. }
  530. //预览
  531. function preview(title, url, w, h) {
  532. layer_show(title, pagePath + url, w, h);
  533. }
  534. //选择季度或月度
  535. $("#season_or_month").change(function () {
  536. if ($('#season_or_month option:selected').val() == "J") {
  537. $(".season").show();
  538. $(".month").hide();
  539. } else if ($('#season_or_month option:selected').val() == "Y") {
  540. $(".month").show()
  541. $(".season").hide();
  542. } else {
  543. $(".month").hide()
  544. $(".season").hide();
  545. }
  546. });
  547. //是否综合
  548. $('#departmentAndType').show()
  549. function changeDepartment() {
  550. if ($("input[name='is_comprehensive']:checked").val() == 1) {
  551. $('#department').hide();
  552. $('#departmentAndType').show()
  553. } else if ($("input[name='is_comprehensive']:checked").val() == 0) {
  554. $('#departmentAndType').hide()
  555. $('#department').show()
  556. }
  557. }
  558. //添加属地相关
  559. function addLine(projectService) {
  560. if (projectService) {
  561. if (projectService.length > 0) {
  562. for (var i = 0; i < projectService.length; i++) {
  563. var length = i;
  564. var html = "<i class='Hui-iconfont' onclick='removeLine(this)'>&#xe6a1;</i>";
  565. $(".add_floor_line tr:eq(0)").clone().insertAfter($('.add_floor_line>tr').eq(-1))
  566. .find(".name1").removeAttr("name").attr("name", "projectServiceCategory[" + i + "].project_type_name1").end()
  567. .find(".name1").val(projectService[i].project_type_name1).end()
  568. .find(".name2").removeAttr("name").attr("name", "projectServiceCategory[" + i + "].project_type_name2").end()
  569. .find(".name2").val(projectService[i].project_type_name2).end()
  570. .find(".department").removeAttr("name").attr("name", "projectServiceCategory[" + i + "].department_id").end()
  571. .find(".icon_font").html(html).end();
  572. $(".add_floor_line tr:eq(" + (i + 1) + ")").find("option[value='" + projectService[i].department_id + "']").attr("selected", true);
  573. }
  574. $(".add_floor_line tr:eq(0)").remove();
  575. }
  576. } else {
  577. var length = $(".add_floor_line tr").length;
  578. var html = "<i class='Hui-iconfont' onclick='removeLine(this)'>&#xe6a1;</i>";
  579. $(".add_floor_line tr:eq(0)").clone().insertAfter($('.add_floor_line>tr').eq(-1))
  580. .find(".name1").removeAttr("name").attr("name", "projectServiceCategory[" + length + "].project_type_name1").end()
  581. .find(".name1").val("").end()
  582. .find(".name2").removeAttr("name").attr("name", "projectServiceCategory[" + length + "].project_type_name2").end()
  583. .find(".name2").val("").end()
  584. .find(".department").removeAttr("name").attr("name", "projectServiceCategory[" + length + "].department_id").end()
  585. .find(".icon_font").html(html).end();
  586. $('#layui-layer2').height(48);
  587. }
  588. }
  589. function removeLine(obj) {
  590. if ($(".add_floor_line").find("tr").length == 1) {
  591. errorMessage("至少添加一个类目");
  592. } else {
  593. $(obj).parent().parent().remove();
  594. }
  595. }
  596. </script>
  597. </body>
  598. </html>