follow_project.html 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725
  1. {extend name="common/base"/}
  2. <!-- 主体 -->
  3. {block name="body"}
  4. <div class="p-3">
  5. <div class="gg-form-bar border-t border-x">
  6. <form id="taskForm" class="layui-form" lay-filter="barsearchform">
  7. <div class="layui-input-inline" style="width:100px;">
  8. <select name="project_status" lay-filter="status">
  9. <option value="">项目状态</option>
  10. <option value="1">立项中</option>
  11. <option value="2">审批中</option>
  12. <option value="3">待接收</option>
  13. <option value="4">分配中</option>
  14. <option value="5">作业中</option>
  15. <option value="6">归档中</option>
  16. <option value="7">退审中</option>
  17. <option value="8">已归档</option>
  18. <option value="9">已退审</option>
  19. </select>
  20. </div>
  21. <div class="layui-input-inline" style="width:100px;">
  22. <select id="province" lay-filter="province" name="province">
  23. <option value="">省</option>
  24. </select>
  25. </div>
  26. <div class="layui-input-inline" style="width:100px;">
  27. <select id="city" lay-filter="city" name="city">
  28. <option value="">市</option>
  29. </select>
  30. </div>
  31. <div class="layui-input-inline" style="width:100px;">
  32. <select id="area" lay-filter="area" name="area">
  33. <option value="">县</option>
  34. </select>
  35. </div>
  36. <div id="time_date" class="layui-input-inline" style="margin: 0;">
  37. <div class="layui-input-inline" style="width:150px;">
  38. <input type="text" id="start_time" name="project_start_time" readonly placeholder="起始日期"
  39. class="layui-input" value="">
  40. </div>
  41. <div class="layui-input-inline">-</div>
  42. <div class="layui-input-inline" style="width:150px;">
  43. <input type="text" id="end_time" name="project_end_time" readonly placeholder="截止日期"
  44. class="layui-input" value="">
  45. </div>
  46. </div>
  47. <div class="layui-input-inline" style="width:200px;">
  48. <input type="text" name="sent_review_unit_name" placeholder="送审单位" class="layui-input"
  49. autocomplete="off"/>
  50. </div>
  51. <div class="layui-input-inline" style="width:200px;">
  52. <input type="text" name="review_unit_name" placeholder="评审机构" class="layui-input"
  53. autocomplete="off"/>
  54. </div>
  55. <div class="layui-input-inline" style="width:200px;">
  56. <input type="text" name="keyword" placeholder="项目名称关键字" class="layui-input" autocomplete="off"/>
  57. </div>
  58. <div class="layui-input-inline" style="width:150px;">
  59. <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform"><i
  60. class="layui-icon layui-icon-search mr-1"></i>搜索
  61. </button>
  62. <button class="layui-btn layui-btn-reset" lay-submit="" lay-filter="reset1">清空</button>
  63. </div>
  64. </form>
  65. </div>
  66. <table class="layui-hide" id="cost_project" lay-filter="cost_project"></table>
  67. </div>
  68. <!-- <script type="text/html" id="toolbarDemo">
  69. <div class="layui-btn-container">
  70. <span class="layui-btn layui-btn-sm" lay-event="add" data-title="添加造价项目">+ 添加造价项目</span>
  71. </div>
  72. </script> -->
  73. <script type="text/html" id="barDemo">
  74. </script>
  75. {/block}
  76. <!-- /主体 -->
  77. <!-- 脚本 -->
  78. {block name="script"}
  79. <script>
  80. const moduleInit = ['tool', 'oaTool'];
  81. function gouguInit() {
  82. var table = layui.table, tool = layui.tool, form = layui.form, oaTool = layui.oaTool;
  83. var allcount;
  84. layui.laydate.render({
  85. elem: '#time_date',
  86. range: ['#start_time', '#end_time'],
  87. rangeLinked: true
  88. });
  89. layui.pageTable = table.render({
  90. elem: '#cost_project',
  91. id: "demo",
  92. title: '造价项目列表',
  93. toolbar: '#toolbarDemo',
  94. url: '/admin/project.cost/followProject',
  95. page: true,
  96. limit: 20,
  97. cellMinWidth: 100,
  98. parseData: function (res) { // 数据解析回调函数
  99. // 在这里可以获取数据总数
  100. allcount = res.count;
  101. return {
  102. code: res.code, // 数据状态码
  103. msg: res.msg, // 状态信息
  104. count: res.count, // 数据总数
  105. data: res.data // 当前页数据
  106. };
  107. },
  108. cols: [
  109. [
  110. {
  111. fixed: 'left', field: 'id', title: '编号', align: 'center', width: 80,
  112. templet: function (d) {
  113. return allcount - (d.LAY_NUM - 1);
  114. }
  115. },
  116. {
  117. fixed: 'left',
  118. field: 'project_status',
  119. title: '项目状态',
  120. align: 'center',
  121. width: 100,
  122. templet: function (item) {
  123. var html = '';
  124. if (item.project_status === 1) {
  125. html = '<span class="layui-badge layui-bg-orange" style="background-color: #ffb800 !important">立项中</span> ';
  126. } else if (item.project_status === 2) {
  127. html = '<span class="layui-badge layui-bg-blue" style="background-color: #b30095 !important">审批中</span> ';
  128. } else if (item.project_status === -1) {
  129. html = '<span class="layui-badge layui-bg-red" style="background-color: #5825aa !important">待修改</span> ';
  130. } else if (item.project_status === 3) {
  131. html = '<span class="layui-badge layui-bg-green" style="background-color: #d37000 !important">待接收</span> ';
  132. } else if (item.project_status === 4) {
  133. html = '<span class="layui-badge" style="background-color: #005fa8 !important">分配中</span> ';
  134. } else if (item.project_status === 5) {
  135. html = '<span class="layui-badge layui-bg-blue" style="background-color: #1e9fff !important">作业中</span> ';
  136. } else if (item.project_status === 6) {
  137. html = '<span class="layui-badge" style="background-color: #007244 !important">归档中</span> ';
  138. } else if (item.project_status === 7) {
  139. html = '<span class="layui-badge" style="background-color: #881f1f !important">退审中</span> ';
  140. } else if (item.project_status === 8) {
  141. html = '<span class="layui-badge" style="background-color: #16b777 !important">已归档</span> ';
  142. } else if (item.project_status === 9) {
  143. html = '<span class="layui-badge" style="background-color: #d81e06 !important">已退审</span> ';
  144. }
  145. return html;
  146. }
  147. },
  148. {
  149. fixed: 'left',
  150. field: 'report_status',
  151. title: '报告状态',
  152. align: 'center',
  153. width: 100,
  154. hide: false,
  155. templet: function (item) {
  156. var html;
  157. if (item.report_status === 0) {
  158. html = '<span>初稿中</span> ';
  159. } else if (item.report_status === 1) {
  160. html = '<span>对数中</span> ';
  161. } else if (item.report_status === 2) {
  162. html = '<span>审定中</span> ';
  163. } else if (item.report_status === 3) {
  164. html = '<span>已审定</span> ';
  165. }else {
  166. html = '<span >未知</span> ';
  167. }
  168. return html;
  169. }
  170. },
  171. {
  172. fixed: 'left',
  173. field: 'project_name',
  174. title: '项目名称',
  175. align: 'center',
  176. width: 400,
  177. templet: function (d) {
  178. var html = "";
  179. if (d.red) {
  180. //判断是否有新消息,有就有new
  181. html = '<a class="side-a" lay-event="read" lay-event="read">' + d.project_name + ' <span class="layui-badge-dot hongdian"></span></a>';
  182. } else {
  183. html = '<a class="side-a" lay-event="read" lay-event="read">' + d.project_name + '</a>';
  184. }
  185. return '<div style="text-align:left;">' + html + '</div>'
  186. }
  187. },
  188. {
  189. field: 'project_num', title: '项目编号', align: 'center', width: 150,
  190. templet: function (d) {
  191. return '<div style="text-align:left">' + d.project_num + '</div>'
  192. }
  193. },
  194. {
  195. field: 'project_time', title: '项目周期', align: 'center', width: 250,
  196. templet: function (item) {
  197. if(!item.project_end_time && !item.project_start_time){
  198. return "";
  199. }
  200. let outcome = Math.round(new Date().getTime() / 1000).toString();
  201. var advent_time = item.project_end_time - outcome
  202. var time = getDuration(advent_time);
  203. var timestr = "<span style='color: green'>" + "剩余" + time + "</span>";
  204. if (advent_time < 0) {
  205. advent_time = -advent_time;
  206. time = getDuration(advent_time);
  207. timestr = "<span style='color: red'>" + "逾期" + time + "</span>";
  208. }
  209. var html;
  210. if (item.project_status == 8 || item.project_status == 9 ){
  211. html =
  212. "<div>" +
  213. layui.util.toDateString(item.project_start_time * 1000, 'yyyy-MM-dd') +
  214. "至" +
  215. layui.util.toDateString(item.project_end_time * 1000, 'yyyy-MM-dd') +
  216. "</div>";
  217. }else{
  218. html =
  219. "<div>" +
  220. layui.util.toDateString(item.project_start_time * 1000, 'yyyy-MM-dd') +
  221. "至" +
  222. layui.util.toDateString(item.project_end_time * 1000, 'yyyy-MM-dd') +
  223. "&nbsp;&nbsp;" + timestr +
  224. "</div>";
  225. }
  226. function getDuration(second) {
  227. var duration
  228. var days = Math.floor(second / 86400);
  229. var hours = Math.floor((second % 86400) / 3600);
  230. if (days > 0) duration = days + "天";
  231. else if (hours > 0) duration = "不足一天";
  232. else if (hours == 0) duration = "不足一天";
  233. return duration;
  234. }
  235. return html;
  236. }
  237. },
  238. {
  239. field: 'review_unit_name',
  240. title: '评审机构',
  241. align: 'center',
  242. width: 150,
  243. },
  244. {
  245. field: 'review_head_name',
  246. title: '评审机构负责人',
  247. align: 'center',
  248. width: 150,
  249. },
  250. {
  251. field: 'review_head_phone',
  252. title: '评审机构负责人电话',
  253. align: 'center',
  254. width: 150,
  255. },
  256. {
  257. field: 'sent_review_unit_name',
  258. title: '送审单位',
  259. align: 'center',
  260. width: 150,
  261. },
  262. {
  263. field: 'sent_review_head_name',
  264. title: '送审单位负责人',
  265. align: 'center',
  266. width: 150,
  267. },
  268. {
  269. field: 'sent_review_phone',
  270. title: '送审单位负责人电话',
  271. align: 'center',
  272. width: 150,
  273. },
  274. {
  275. field: 'construction_unit',
  276. title: '施工单位',
  277. align: 'center',
  278. width: 150,
  279. },
  280. {
  281. field: 'construction_head',
  282. title: '施工单位负责人',
  283. align: 'center',
  284. width: 150,
  285. },
  286. {
  287. field: 'construction_phone',
  288. title: '施工单位负责人电话',
  289. align: 'center',
  290. width: 150,
  291. },
  292. {field: 'project_scale', title: '项目规模', align: 'center', width: 150, },
  293. {
  294. field: 'engineering_category',
  295. title: '工程类别',
  296. align: 'center',
  297. width: 150,
  298. },
  299. {
  300. field: 'engineering_type',
  301. title: '项目类型',
  302. align: 'center',
  303. width: 150,
  304. },
  305. {
  306. field: 'project_region',
  307. title: '项目区域',
  308. align: 'center',
  309. width: 150,
  310. },
  311. {field: 'fiscal_nature', title: '财政性质', align: 'center', width: 150,},
  312. {
  313. field: 'sent_review_cost',
  314. title: '送审服务费',
  315. align: 'center',
  316. width: 100,
  317. },
  318. {
  319. field: 'sent_review_approver_amount',
  320. title: '送审单位承担审核费',
  321. align: 'center',
  322. width: 150,
  323. },
  324. {
  325. field: 'construction_approver_amount',
  326. title: '施工单位负责核减超5%评审费部分',
  327. align: 'center',
  328. width: 230,
  329. },
  330. {
  331. field: 'sent_review_amount',
  332. title: '送审金额',
  333. align: 'center',
  334. width: 150,
  335. },
  336. {
  337. field: 'authorize_amount',
  338. title: '审定金额',
  339. align: 'center',
  340. width: 150,
  341. },
  342. {
  343. field: 'review_add_amount',
  344. title: '审增额',
  345. align: 'center',
  346. width: 150,
  347. },
  348. {
  349. field: 'review_reduce_amount',
  350. title: '审减额',
  351. align: 'center',
  352. width: 150,
  353. },
  354. {
  355. field: 'review_add_reduce_rate',
  356. title: '审增减率',
  357. align: 'center',
  358. width: 150,
  359. },
  360. {
  361. field: 'report_time',
  362. title: '报告时间',
  363. align: 'center',
  364. width: 150,
  365. templet: function (d) {
  366. if (d.report_time) {
  367. return layui.util.toDateString(d.report_time * 1000, "yyyy-MM-dd")
  368. } else {
  369. return "";
  370. }
  371. }
  372. },
  373. {
  374. field: 'charge_standard',
  375. title: '收费标准',
  376. align: 'center',
  377. width: 150,
  378. },
  379. {
  380. field: 'operate_head_name',
  381. title: '作业负责人',
  382. align: 'center',
  383. width: 150,
  384. },
  385. {
  386. field: 'operate_team_names',
  387. title: '作业成员',
  388. align: 'center',
  389. width: 300,
  390. },
  391. {
  392. field: 'creator',
  393. title: '创建人',
  394. align: 'center',
  395. width: 150,
  396. },
  397. {
  398. field: 'create_time',
  399. title: '项目创建日期',
  400. align: 'center',
  401. width: 180,
  402. },
  403. {
  404. field: 'project_dead_time',
  405. title: '项目归档日期',
  406. align: 'center',
  407. width: 120,
  408. templet: function (d) {
  409. if (d.project_dead_time) {
  410. return layui.util.toDateString(d.project_dead_time * 1000, "yyyy-MM-dd")
  411. } else {
  412. return "";
  413. }
  414. }
  415. },
  416. {
  417. fixed: 'right', field: 'right', title: '操作', width: 136, align: 'center',
  418. templet: function (a) {
  419. var h = '';
  420. // 1全部-可查看可编辑,2全部-可查看,0与我有关
  421. if (a.self_id == 1) {
  422. if (a.project_status == 1) {
  423. h = '<div class="layui-btn-group"><a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a><a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a></div>'
  424. } else {
  425. h = '<div class="layui-btn-group"><a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a></div>'
  426. }
  427. } else if (a.self_id == 2) {
  428. h = '<div class="layui-btn-group"><a class="layui-btn layui-btn-xs layui-bg-blue" lay-event="read">查看</a></div>'
  429. } else if (a.self_id == 0 || a.self_id == 3) {
  430. if (a.project_status == 1) {
  431. h = '<div class="layui-btn-group"><a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a><a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a></div>'
  432. } else {
  433. h = '<div class="layui-btn-group"><a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a></div>'
  434. }
  435. }
  436. return h;
  437. }
  438. }
  439. ]
  440. ]
  441. });
  442. //监听表头工具栏事件
  443. table.on('toolbar(cost_project)', function (obj) {
  444. if (obj.event === 'add') {
  445. tool.side("/admin/project.cost/add");
  446. return false;
  447. }
  448. });
  449. //监听表格行工具事件
  450. table.on('tool(cost_project)', function (obj) {
  451. var data = obj.data;
  452. if (obj.event === 'read') {
  453. tool.side('/admin/project.cost/read?id=' + obj.data.id);
  454. } else if (obj.event === 'edit') {
  455. if (obj.data.project_status < 6) {
  456. tool.side('/admin/project.cost/edit?id=' + obj.data.id);
  457. } else {
  458. layer.msg("已归档/已退审")
  459. }
  460. } else if (obj.event === 'del') {
  461. layer.confirm('确定要删除该记录吗?', {
  462. icon: 3,
  463. title: '提示'
  464. }, function (index) {
  465. if (data.project_status == 1) {
  466. let callback = function (e) {
  467. layer.msg(e.msg);
  468. if (e.code == 0) {
  469. obj.del();
  470. }
  471. }
  472. tool.delete("/admin/project.cost/del", {id: data.id}, callback);
  473. layer.close(index);
  474. } else {
  475. layer.msg("已审核,无法删除");
  476. }
  477. });
  478. }
  479. return false;
  480. });
  481. //监听搜索提交
  482. form.on('submit(webform)', function (data) {
  483. // console.log(data.field)
  484. layui.pageTable.reload({where: data.field});
  485. return false;
  486. });
  487. form.on('submit(reset1)', function () {
  488. $(".layui-form").reset();
  489. layui.pageTable.reload();
  490. return false;
  491. });
  492. layui.use(['form', 'jquery'], function () {
  493. var form = layui.form;
  494. const $ = layui.jquery;
  495. let adress;
  496. $.ajax({
  497. type: "get", //使用get方式
  498. url: "/static/assets/layui/adress.json", //json文件相对于这个HTML的路径
  499. dataType: "json",
  500. async: false,
  501. success: function (data) {
  502. //这个data就是json数据
  503. adress = data
  504. var province = Object.keys(adress)
  505. var proStrs = '<option value="">省</option>';
  506. for (var i = 0; i < province.length; i++) {
  507. proStrs += '<option value="' + province[i] + '">' + province[i] + '</option>';
  508. }
  509. $("#province").html(proStrs);
  510. layui.form.render("select")
  511. },
  512. error: function () {
  513. layer.alert("地址请求失败!! ");
  514. }
  515. });
  516. function getFirstAttr(obj) {
  517. for (var k in obj) return k;
  518. }
  519. function selectOption(selectedProvince, selectedCity = '', selectedArea = '') {
  520. var proStr = '<option value="">省</option>', cityStr = '<option value="">市</option>',
  521. areaStr = '<option value="">县</option>';
  522. var pro = adress[selectedProvince], ci = adress[selectedProvince][selectedCity];
  523. for (var province in adress) {
  524. if (province == selectedProvince) proStr += '<option value="' + province + '" selected>' + province + '</option>';
  525. else proStr += '<option value="' + province + '">' + province + '</option>';
  526. }
  527. $("#province").html(proStr);
  528. for (var city in pro) {
  529. if (city == selectedCity) cityStr += '<option value="' + city + '" selected>' + city + '</option>';
  530. else cityStr += '<option value="' + city + '">' + city + '</option>';
  531. }
  532. $("#city").html(cityStr);
  533. for (var area in ci) {
  534. if (area == "remove") {
  535. continue;
  536. }
  537. if (ci[area] == selectedArea) areaStr += '<option value="' + ci[area] + '" selected>' + ci[area] + '</option>';
  538. else areaStr += '<option value="' + ci[area] + '">' + ci[area] + '</option>';
  539. }
  540. $("#area").html(areaStr);
  541. form.render();
  542. }
  543. /*selectOption(1,2, 3);*/
  544. form.on('select(province)', function (data) {
  545. let thisProvince = data.value;
  546. let thisCity = getFirstAttr(adress[thisProvince]);
  547. selectOption(data.value);
  548. });
  549. form.on('select(city)', function (data) {
  550. selectOption($("#province").val(), data.value, getFirstAttr(data.value));
  551. });
  552. window.hongdianselect = function () {
  553. let num = $(document).find('.hongdian').length
  554. console.log(num, '我是数量')
  555. if (num === 0) {
  556. parent.showhongdian()
  557. console.log('2执行了')
  558. }
  559. }
  560. })
  561. }
  562. </script>
  563. {/block}
  564. <!-- /脚本 -->