datalist.html 26 KB

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