datalist.html 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  1. {extend name="common/base"/}
  2. <!-- 主体 -->
  3. {block name="body"}
  4. <div class="p-3">
  5. <form class="layui-form gg-form-bar border-t border-x">
  6. <div class="layui-input-inline" style="width:300px;">
  7. <input type="text" name="keywords" placeholder="请输入关键字" class="layui-input" autocomplete="off"/>
  8. </div>
  9. <div class="layui-input-inline">
  10. <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="searchform">提交搜索</button>
  11. </div>
  12. </form>
  13. <table class="layui-hide" id="cost_project" lay-filter="cost_project"></table>
  14. </div>
  15. <div id="selectBox" style="display: none;">
  16. <div id="financialSelect"></div>
  17. <button id="c">1111</button>
  18. </div>
  19. <div id="selectBox2" style="display: none;">
  20. <div id="companySelect2"></div>
  21. <button id="cc">1111</button>
  22. </div>
  23. <script type="text/html" id="toolbarDemo">
  24. <div class="layui-btn-container">
  25. </div>
  26. </script>
  27. {/block}
  28. <!-- /主体 -->
  29. <!-- 脚本 -->
  30. {block name="script"}
  31. <script>
  32. const moduleInit = ['tool'];
  33. var num_aaa =0;
  34. function gouguInit() {
  35. var table = layui.table, tool = layui.tool, form = layui.form;
  36. layui.pageTable = table.render({
  37. elem: '#cost_project',
  38. id: "cost_project",
  39. title: '造价项目列表',
  40. toolbar: '#toolbarDemo',
  41. url: '/admin/project.audit/datalist',
  42. page: true,
  43. limit: 20,
  44. parseData: function(res) { // 数据解析回调函数
  45. // 在这里可以获取数据总数
  46. allcount = res.count;
  47. return {
  48. code: res.code, // 数据状态码
  49. msg: res.msg, // 状态信息
  50. count: res.count, // 数据总数
  51. data: res.data // 当前页数据
  52. };
  53. },
  54. cols: [
  55. [
  56. {fixed: 'left', field: 'id', title: '编号', align: 'center', width: 100,
  57. templet: function(d){
  58. return allcount - (d.LAY_NUM-1);
  59. }
  60. },
  61. {
  62. field: 'project_status',
  63. title: '项目状态',
  64. align: 'center',
  65. width: 100,
  66. templet: function (item) {
  67. var html = '';
  68. if (item.project_status === 2) {
  69. html = '<span>审批中</span> ';
  70. } else if (item.project_status === 1) {
  71. html = '<span">立项中</span> ';
  72. } else if (item.project_status === 3) {
  73. html = '<span">待接收</span> ';
  74. } else if (item.project_status === 4) {
  75. html = '<span">分配中</span> ';
  76. } else if (item.project_status === 5) {
  77. html = '<span>作业中</span> ';
  78. } else if (item.project_status === 6) {
  79. html = '<span">归档中</span> ';
  80. } else if (item.project_status === 7) {
  81. html = '<span">退审中</span> ';
  82. } else if (item.project_status === 8) {
  83. html = '<span">已归档</span> ';
  84. } else if (item.project_status === 9) {
  85. html = '<span">已退审</span> ';
  86. }
  87. return html;
  88. }
  89. }, {
  90. field: 'audit_status',
  91. title: '审批状态',
  92. align: 'center',
  93. width: 100,
  94. templet: function (item) {
  95. var html = '';
  96. if (item.audit_status === 1) {
  97. num_aaa += 1;
  98. html = '<span class="layui-badge layui-bg-blue">待审核</span> ';
  99. } else if (item.audit_status === 2) {
  100. html = '<span class="layui-badge layui-bg-green">已通过</span> ';
  101. } else if (item.audit_status === 3) {
  102. html = '<span class="layui-badge layui-bg-red">已拒绝</span> ';
  103. }
  104. return html;
  105. }
  106. }, {
  107. field: 'project_name',
  108. title: '项目名称',
  109. align: 'center',
  110. width: 400,
  111. templet: function (d) {
  112. return '<div style="text-align:left">' + d.project_name + '</div>'
  113. }
  114. }, {
  115. field: 'audit_name',
  116. title: '流程名称',
  117. align: 'center',
  118. width: 150
  119. }, {
  120. field: 'else_name',
  121. title: '报告/联系函',
  122. align: 'center',
  123. width: 200
  124. }, {
  125. field: 'engineering_type',
  126. title: '项目类型',
  127. align: 'center',
  128. width: 150
  129. }, {
  130. field: 'sent_review_amount',
  131. title: '送审金额(元)',
  132. align: 'center',
  133. width: 150
  134. }, {
  135. field: 'sponsor',
  136. title: '发起人',
  137. align: 'center',
  138. width: 150
  139. }, {
  140. field: 'sponsor_unit',
  141. title: '发起单位/部门',
  142. align: 'center',
  143. width: 100
  144. }, {
  145. field: 'create_time',
  146. title: '发起时间',
  147. align: 'center',
  148. width: 150,
  149. templet: function (d) {
  150. // console.log(d.create_time)
  151. var date = new Date(d.create_time);
  152. var formatted = date.getFullYear() + '-' + (date.getMonth()+1) + '-' + date.getDate();
  153. return formatted;
  154. }
  155. }, {
  156. field: 'approver_name',
  157. title: '审批人',
  158. align: 'center',
  159. width: 150
  160. }, {
  161. field: 'audit_time',
  162. title: '审批时间',
  163. align: 'center',
  164. width: 100,
  165. templet: function (d) {
  166. if (d.audit_time) {
  167. return layui.util.toDateString(d.audit_time * 1000, "yyyy-MM-dd")
  168. } else {
  169. return "";
  170. }
  171. }
  172. }, {
  173. field: 'remark',
  174. title: '申请原因',
  175. align: 'center',
  176. width: 250,
  177. }, {
  178. field: 'audit_remark',
  179. title: '审批回执',
  180. align: 'center',
  181. width: 250,
  182. }, {
  183. fixed: 'right',
  184. field: 'right',
  185. title: '操作',
  186. width: 136,
  187. align: 'center',
  188. templet: function (item) {
  189. var h = '';
  190. if (item.audit_status === 1) {
  191. h = '<div class="layui-btn-group"> <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">查看</a> <a class="layui-btn layui-btn-xs" lay-event="edit">通过</a> <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="overrule">拒绝</a> </div>'
  192. } else {
  193. h = '<div class="layui-btn-group"> <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">查看</a></div>'
  194. }
  195. return h;
  196. }
  197. }
  198. ]
  199. ],
  200. done:function () {
  201. if(num_aaa === 0){
  202. parent.showhongdian()
  203. // console.log('2执行了')
  204. }
  205. }
  206. });
  207. let abc = 0;
  208. //监听表格行工具事件
  209. table.on('tool(cost_project)', function (obj) {
  210. var data = obj.data;
  211. if (obj.event === 'read') {
  212. if (data.audit_type == 1) {
  213. tool.side('/admin/project.audit/read?id=' + data.project_id);
  214. } else if (data.audit_type == 2) {
  215. tool.side('/admin/project.report/view?id=' + data.else_id);
  216. } else if (data.audit_type == 3) {
  217. tool.side(' /admin/project.contact/view?id=' + data.else_id);
  218. }else {
  219. layer.msg("审核内容不存在!")
  220. }
  221. } else if (obj.event === 'edit') {
  222. layer.confirm("确认是否审批通过?", function (index) {
  223. if (abc == 0) {
  224. let callback = function (e) {
  225. select_Data = [];
  226. abc = 0
  227. layer.msg(e.msg);
  228. setTimeout(function () {
  229. window.location.reload()
  230. layer.close(index);
  231. }, 1000)
  232. }
  233. if (data.audit_type == 1) {
  234. if (data.project_status == 2) {
  235. //立项审批
  236. tool.post("/admin/project.audit/project_edit_first", {
  237. id: data.id,
  238. else_id: data.else_id,
  239. audit_type: data.audit_type,
  240. project_id: data.project_id,
  241. project_status: data.project_status,
  242. }, callback);
  243. } else if (data.project_status == 6) {
  244. tool.post("/admin/project.audit/project_edit_second", {
  245. id: data.id,
  246. else_id: data.else_id,
  247. audit_type: data.audit_type,
  248. project_id: data.project_id,
  249. project_status: data.project_status,
  250. }, callback);
  251. } else if (data.project_status == 7) {
  252. //退审审批
  253. tool.post("/admin/project.audit/project_edit_third", {
  254. id: data.id,
  255. else_id: data.else_id,
  256. audit_type: data.audit_type,
  257. project_id: data.project_id,
  258. project_status: data.project_status,
  259. }, callback);
  260. }
  261. } else if (data.audit_type == 2) {
  262. if (data.else_status == 0) {
  263. //报告新建
  264. console.log(1)
  265. tool.post("/admin/project.report/agree_report", {
  266. id: data.id,
  267. else_id: data.else_id,
  268. audit_type: data.audit_type,
  269. project_id: data.project_id,
  270. project_status: data.project_status,
  271. type: 1000,
  272. }, callback);
  273. } else if (data.else_status == 3) {
  274. //报告删除
  275. tool.post("/admin/project.report/agree_delete", {
  276. id: data.id,
  277. else_id: data.else_id,
  278. audit_type: data.audit_type,
  279. project_id: data.project_id,
  280. project_status: data.project_status,
  281. type: 1000,
  282. }, callback);
  283. }
  284. } else if (data.audit_type == 3) {
  285. if (data.else_status == 0) {
  286. //联系函新建
  287. tool.post("/admin/project.contact/agree_contact", {
  288. id: data.id,
  289. else_id: data.else_id,
  290. audit_type: data.audit_type,
  291. project_id: data.project_id,
  292. project_status: data.project_status,
  293. type: 1000,
  294. }, callback);
  295. } else if (data.else_status == 3) {
  296. //联系函删除
  297. tool.post("/admin/project.contact/agree_delete", {
  298. id: data.id,
  299. else_id: data.else_id,
  300. audit_type: data.audit_type,
  301. project_id: data.project_id,
  302. project_status: data.project_status,
  303. type: 1000,
  304. }, callback);
  305. }
  306. }
  307. }
  308. console.log(abc, data.else_status)
  309. abc = 1;
  310. }, function () {
  311. abc = 0;
  312. })
  313. } else if (obj.event === 'overrule') {
  314. var ttxx = layer.prompt({
  315. title: '请输入<span style="color: red">拒绝</span>原因',
  316. formType: 2,
  317. area: ['35vw', '15vw']
  318. }, function (text, index) {
  319. if (text == '') {
  320. layer.msg('请先完善拒绝原因');
  321. return false;
  322. } else {
  323. let callback = function (e) {
  324. layer.msg(e.msg);
  325. setTimeout(function () {
  326. window.location.reload()
  327. layer.close(index);
  328. }, 2000)
  329. }
  330. if (data.audit_type == 1) {
  331. if (data.project_status == 2) {
  332. //立项
  333. tool.post("/admin/project.audit/project_overrule_first", {
  334. id: data.id,
  335. else_id: data.else_id,
  336. audit_type: data.audit_type,
  337. project_id: data.project_id,
  338. project_status: data.project_status,
  339. audit_remark: text,
  340. }, callback);
  341. } else if (data.project_status == 6) {
  342. //归档
  343. tool.post("/admin/project.audit/project_overrule_second", {
  344. id: data.id,
  345. else_id: data.else_id,
  346. audit_type: data.audit_type,
  347. project_id: data.project_id,
  348. project_status: data.project_status,
  349. audit_remark: text,
  350. }, callback);
  351. } else if (data.project_status == 7) {
  352. //退审
  353. tool.post("/admin/project.audit/project_overrule_third", {
  354. id: data.id,
  355. else_id: data.else_id,
  356. audit_type: data.audit_type,
  357. project_id: data.project_id,
  358. project_status: data.project_status,
  359. audit_remark: text,
  360. }, callback);
  361. }
  362. } else if (data.audit_type == 2) {
  363. if (data.else_status == 0) {
  364. //报告新建
  365. tool.post("/admin/project.report/un_report", {
  366. id: data.id,
  367. else_id: data.else_id,
  368. audit_type: data.audit_type,
  369. project_id: data.project_id,
  370. project_status: data.project_status,
  371. audit_remark: text,
  372. type: 1000,
  373. }, callback);
  374. } else if (data.else_status == 3) {
  375. //报告删除
  376. tool.post("/admin/project.report/un_delete", {
  377. id: data.id,
  378. else_id: data.else_id,
  379. audit_type: data.audit_type,
  380. project_id: data.project_id,
  381. project_status: data.project_status,
  382. audit_remark: text,
  383. type: 1000,
  384. }, callback);
  385. }
  386. } else if (data.audit_type == 3) {
  387. if (data.else_status == 0) {
  388. //联系函新建
  389. tool.post("/admin/project.contact/un_contact", {
  390. id: data.id,
  391. else_id: data.else_id,
  392. audit_type: data.audit_type,
  393. project_id: data.project_id,
  394. project_status: data.project_status,
  395. audit_remark: text,
  396. type: 1000,
  397. }, callback);
  398. } else if (data.else_status == 3) {
  399. //联系函删除
  400. tool.post("/admin/project.contact/un_delete", {
  401. id: data.id,
  402. else_id: data.else_id,
  403. audit_type: data.audit_type,
  404. project_id: data.project_id,
  405. project_status: data.project_status,
  406. audit_remark: text,
  407. type: 1000,
  408. }, callback);
  409. }
  410. }
  411. }
  412. })
  413. }
  414. return false;
  415. });
  416. //监听搜索提交
  417. form.on('submit(searchform)', function (data) {
  418. layui.pageTable.reload({
  419. where: {
  420. keywords: data.field.keywords
  421. },
  422. page: {
  423. curr: 1
  424. }
  425. });
  426. return false;
  427. });
  428. // setTimeout(()=>{
  429. // console.log(num_aaa ,'我是数量')
  430. // if(num_aaa === 0){
  431. // parent.showhongdian()
  432. // console.log('2执行了')
  433. // }
  434. // },1500)
  435. }
  436. </script>
  437. {/block}
  438. <!-- /脚本 -->