edit.html 32 KB

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