datalist_company.html 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  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="companySelect"></div>
  17. <button id="c">1111</button>
  18. </div>
  19. <!--tow-->
  20. <div id="selectBox2" style="display: none;">
  21. <div id="financialSelect2"></div>
  22. <div id="companySelect2"></div>
  23. <button id="cc">1111</button>
  24. </div>
  25. <script type="text/html" id="toolbarDemo">
  26. <div class="layui-btn-container">
  27. </div>
  28. </script>
  29. {/block}
  30. <!-- /主体 -->
  31. <!-- 脚本 -->
  32. {block name="script"}
  33. <script>
  34. const moduleInit = ['tool'];
  35. function gouguInit() {
  36. var num = 0;
  37. var table = layui.table, tool = layui.tool, form = layui.form;
  38. var allcount;
  39. layui.pageTable = table.render({
  40. elem: '#cost_project',
  41. title: '造价项目列表',
  42. toolbar: '#toolbarDemo',
  43. url: '/admin/project.audit/datalist_company',
  44. page: true,
  45. limit: 20,
  46. parseData: function(res) { // 数据解析回调函数
  47. // 在这里可以获取数据总数
  48. allcount = res.count;
  49. return {
  50. code: res.code, // 数据状态码
  51. msg: res.msg, // 状态信息
  52. count: res.count, // 数据总数
  53. data: res.data // 当前页数据
  54. };
  55. },
  56. cols: [
  57. [
  58. {fixed: 'left', field: 'id', title: '编号', align: 'center', width: 80,
  59. templet: function(d){
  60. return allcount - (d.LAY_NUM-1);
  61. }
  62. }, {
  63. field: 'audit_status',
  64. title: '审批状态',
  65. align: 'center',
  66. width: 100,
  67. templet: function (item) {
  68. var html = '';
  69. if (item.audit_status === 1) {
  70. num += 1;
  71. html = '<span class="layui-badge layui-bg-blue">待审核</span> ';
  72. } else if (item.audit_status === 2) {
  73. html = '<span class="layui-badge layui-bg-green">已通过</span> ';
  74. } else if (item.audit_status === 3) {
  75. html = '<span class="layui-badge layui-bg-red">已拒绝</span> ';
  76. } else if (item.audit_status === 4) {
  77. html = '<span class="layui-badge layui-bg-gray">作废</span> ';
  78. }
  79. return html;
  80. }
  81. }, {
  82. field: 'else_name',
  83. title: '审批项目',
  84. align: 'center',
  85. width: 200,
  86. templet: function (d) {
  87. return '<div style="text-align:left">' + d.else_name + '</div>'
  88. }
  89. }, {
  90. field: 'project_name',
  91. title: '关联项目名称',
  92. align: 'center',
  93. width: 300,
  94. templet: function (d) {
  95. return '<div style="text-align:left">' + d.project_name + '</div>'
  96. }
  97. }, {
  98. field: 'audit_name',
  99. title: '流程名称',
  100. align: 'center',
  101. width: 150
  102. }, {
  103. field: 'sponsor',
  104. title: '发起人',
  105. align: 'center',
  106. width: 150
  107. }, {
  108. field: 'sponsor_unit',
  109. title: '发起单位/部门',
  110. align: 'center',
  111. width: 100
  112. }, {
  113. field: 'create_time',
  114. title: '发起时间',
  115. align: 'center',
  116. width: 150,
  117. templet: function (d) {
  118. if (d.create_time) {
  119. return layui.util.toDateString(d.create_time * 1000, "yyyy-MM-dd")
  120. } else {
  121. return "";
  122. }
  123. }
  124. }, {
  125. field: 'approver_name',
  126. title: '审批人',
  127. align: 'center',
  128. width: 150
  129. }, {
  130. field: 'audit_time',
  131. title: '审批时间',
  132. align: 'center',
  133. width: 100,
  134. templet: function (d) {
  135. if (d.audit_time) {
  136. return layui.util.toDateString(d.audit_time * 1000, "yyyy-MM-dd")
  137. } else {
  138. return "";
  139. }
  140. }
  141. }, {
  142. field: 'remark',
  143. title: '申请原因',
  144. align: 'center',
  145. }, {
  146. field: 'audit_remark',
  147. title: '审批回执',
  148. align: 'center',
  149. }, {
  150. fixed: 'right',
  151. field: 'right',
  152. title: '操作',
  153. width: 136,
  154. align: 'center',
  155. templet: function (item) {
  156. var h = '';
  157. if (item.audit_status === 1) {
  158. 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>'
  159. } else {
  160. h = '<div class="layui-btn-group"> <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">查看</a></div>'
  161. }
  162. return h;
  163. }
  164. }
  165. ]
  166. ],
  167. done:function () {
  168. if(num === 0){
  169. parent.showhongdian()
  170. console.log('2执行了')
  171. }
  172. }
  173. });
  174. window.addEventListener('message', function (e) {
  175. select_Data = e.data;
  176. console.log(select_Data, 111)
  177. }, false);
  178. let abc = 0;
  179. //监听表格行工具事件
  180. table.on('tool(cost_project)', function (obj) {
  181. var data = obj.data;
  182. if (obj.event === 'read') {
  183. //这个包含了项目概览和请款
  184. let arrayData = [4,5,6,14,15];
  185. if (arrayData.indexOf(data.audit_type) !== -1) {
  186. tool.side('/admin/project.report/view_company?id=' + data.else_id);
  187. } else if (7 <= data.audit_type && data.audit_type <= 9) {
  188. tool.side('/admin/project.contact/view_company?id=' + data.else_id);
  189. } else if (10 <= data.audit_type && data.audit_type <= 12) {
  190. tool.side('/admin/project.audit/read_company?id=' + obj.data.project_id + '&type=' + obj.data.audit_type + '&project_id=' + obj.data.project_id);
  191. } else {
  192. layer.msg("审核内容不存在")
  193. }
  194. } else if (obj.event === 'edit') {
  195. var companySelect, financialSelect2, companySelect2;
  196. layer.confirm("确认是否审批通过?", function (index) {
  197. if (abc == 0) {
  198. let callback = function (e) {
  199. abc = 0
  200. select_Data = []
  201. layer.msg(e.msg);
  202. setTimeout(function () {
  203. window.location.reload()
  204. layer.close(index);
  205. }, 2000)
  206. }
  207. if (data.audit_type == 4) {
  208. //报告新建一审
  209. tool.post("/admin/project.audit/report_agree_first", {
  210. id: data.id,
  211. else_name: data.else_name,
  212. else_id: data.else_id,
  213. audit_type: data.audit_type,
  214. project_id: data.project_id,
  215. project_status: data.project_status,
  216. }, callback);
  217. } else if (data.audit_type == 5) {
  218. //报告新建二审
  219. tool.post("/admin/project.audit/report_agree_second", {
  220. id: data.id,
  221. else_name: data.else_name,
  222. else_id: data.else_id,
  223. audit_type: data.audit_type,
  224. project_id: data.project_id,
  225. project_status: data.project_status,
  226. }, callback);
  227. } else if (data.audit_type == 6) {
  228. //报告三审
  229. tool.post("/admin/project.audit/report_agree_third", {
  230. id: data.id,
  231. else_name: data.else_name,
  232. else_id: data.else_id,
  233. audit_type: data.audit_type,
  234. project_id: data.project_id,
  235. project_status: data.project_status,
  236. }, callback);
  237. } else if (data.audit_type == 7) {
  238. //联系函新建一审
  239. tool.post("/admin/project.audit/contact_agree_first", {
  240. id: data.id,
  241. else_name: data.else_name,
  242. else_id: data.else_id,
  243. audit_type: data.audit_type,
  244. project_id: data.project_id,
  245. project_status: data.project_status,
  246. }, callback);
  247. } else if (data.audit_type == 8) {
  248. //联系函二审
  249. tool.post("/admin/project.audit/contact_agree_second", {
  250. id: data.id,
  251. else_name: data.else_name,
  252. else_id: data.else_id,
  253. audit_type: data.audit_type,
  254. project_id: data.project_id,
  255. project_status: data.project_status,
  256. }, callback);
  257. } else if (data.audit_type == 9) {
  258. //联系函三审
  259. tool.post("/admin/project.audit/contact_agree_third", {
  260. id: data.id,
  261. else_name: data.else_name,
  262. else_id: data.else_id,
  263. audit_type: data.audit_type,
  264. project_id: data.project_id,
  265. project_status: data.project_status,
  266. }, callback);
  267. } else if (data.audit_type == 10) {
  268. //请款一审
  269. tool.post("/admin/project.audit/appropriation_agree_first", {
  270. id: data.id,
  271. else_name: data.else_name,
  272. else_id: data.else_id,
  273. audit_type: data.audit_type,
  274. project_id: data.project_id,
  275. project_status: data.project_status,
  276. }, callback);
  277. } else if (data.audit_type == 11) {
  278. //请款二审
  279. tool.post("/admin/project.audit/appropriation_agree_second", {
  280. id: data.id,
  281. else_name: data.else_name,
  282. else_id: data.else_id,
  283. audit_type: data.audit_type,
  284. project_id: data.project_id,
  285. project_status: data.project_status,
  286. }, callback);
  287. } else if (data.audit_type == 12) {
  288. //请款三审
  289. tool.post("/admin/project.audit/appropriation_agree_third", {
  290. id: data.id,
  291. else_name: data.else_name,
  292. else_id: data.else_id,
  293. audit_type: data.audit_type,
  294. project_id: data.project_id,
  295. project_status: data.project_status,
  296. }, callback);
  297. } else if (data.audit_type == 14) {
  298. //报告三审
  299. tool.post("/admin/project.audit/report_agree_fourth", {
  300. id: data.id,
  301. else_name: data.else_name,
  302. else_id: data.else_id,
  303. audit_type: data.audit_type,
  304. project_id: data.project_id,
  305. project_status: data.project_status,
  306. }, callback);
  307. } else if (data.audit_type == 15) {
  308. //报告三审
  309. tool.post("/admin/project.audit/report_agree_fifth", {
  310. id: data.id,
  311. else_name: data.else_name,
  312. else_id: data.else_id,
  313. audit_type: data.audit_type,
  314. project_id: data.project_id,
  315. project_status: data.project_status,
  316. }, callback);
  317. }else {
  318. layer.alert("意外问题,请联系管理员")
  319. }
  320. }
  321. abc = 1;
  322. }, function () {
  323. abc = 0
  324. })
  325. } else if (obj.event === 'overrule') {
  326. var ttxx = layer.prompt({
  327. title: '请输入<span style="color: red">拒绝</span>原因',
  328. formType: 2,
  329. area: ['35vw', '15vw']
  330. }, function (text, index) {
  331. if (text == '') {
  332. layer.msg('请先完善拒绝原因');
  333. return false;
  334. } else {
  335. let callback = function (e) {
  336. layer.msg(e.msg);
  337. setTimeout(function () {
  338. window.location.reload()
  339. layer.close(index);
  340. }, 2000)
  341. }
  342. if (data.audit_type == 4) {
  343. //报告新建一审
  344. tool.post("/admin/project.audit/report_disagree_first", {
  345. id: data.id,
  346. else_name: data.else_name,
  347. else_id: data.else_id,
  348. audit_type: data.audit_type,
  349. project_id: data.project_id,
  350. project_status: data.project_status,
  351. audit_remark: text,
  352. }, callback);
  353. } else if (data.audit_type == 5) {
  354. //报告新建二审
  355. tool.post("/admin/project.audit/report_disagree_second", {
  356. id: data.id,
  357. else_name: data.else_name,
  358. else_id: data.else_id,
  359. audit_type: data.audit_type,
  360. project_id: data.project_id,
  361. project_status: data.project_status,
  362. audit_remark: text,
  363. }, callback);
  364. } else if (data.audit_type == 6) {
  365. //报告新建三审
  366. tool.post("/admin/project.audit/report_disagree_third", {
  367. id: data.id,
  368. else_name: data.else_name,
  369. else_id: data.else_id,
  370. audit_type: data.audit_type,
  371. project_id: data.project_id,
  372. project_status: data.project_status,
  373. audit_remark: text,
  374. }, callback);
  375. } else if (data.audit_type == 7) {
  376. //联系函一审
  377. tool.post("/admin/project.audit/contact_disagree_first", {
  378. id: data.id,
  379. else_name: data.else_name,
  380. else_id: data.else_id,
  381. audit_type: data.audit_type,
  382. project_id: data.project_id,
  383. project_status: data.project_status,
  384. audit_remark: text,
  385. }, callback);
  386. } else if (data.audit_type == 8) {
  387. //联系函二审
  388. tool.post("/admin/project.audit/contact_disagree_second", {
  389. id: data.id,
  390. else_name: data.else_name,
  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. }, callback);
  397. } else if (data.audit_type == 9) {
  398. //联系函三审
  399. tool.post("/admin/project.audit/contact_disagree_third", {
  400. id: data.id,
  401. else_name: data.else_name,
  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. }, callback);
  408. } else if (data.audit_type == 10) {
  409. //请款一审
  410. tool.post("/admin/project.audit/appropriation_disagree_first", {
  411. id: data.id,
  412. else_name: data.else_name,
  413. else_id: data.else_id,
  414. audit_type: data.audit_type,
  415. project_id: data.project_id,
  416. project_status: data.project_status,
  417. audit_remark: text,
  418. }, callback);
  419. } else if (data.audit_type == 11) {
  420. //请款二审
  421. tool.post("/admin/project.audit/appropriation_disagree_second", {
  422. id: data.id,
  423. else_name: data.else_name,
  424. else_id: data.else_id,
  425. audit_type: data.audit_type,
  426. project_id: data.project_id,
  427. project_status: data.project_status,
  428. audit_remark: text,
  429. }, callback);
  430. } else if (data.audit_type == 12) {
  431. //请款三审
  432. tool.post("/admin/project.audit/appropriation_disagree_third", {
  433. id: data.id,
  434. else_name: data.else_name,
  435. else_id: data.else_id,
  436. audit_type: data.audit_type,
  437. project_id: data.project_id,
  438. project_status: data.project_status,
  439. audit_remark: text,
  440. }, callback);
  441. } else if (data.audit_type == 14) {
  442. //报告新建三审
  443. tool.post("/admin/project.audit/report_disagree_fourth", {
  444. id: data.id,
  445. else_name: data.else_name,
  446. else_id: data.else_id,
  447. audit_type: data.audit_type,
  448. project_id: data.project_id,
  449. project_status: data.project_status,
  450. audit_remark: text,
  451. }, callback);
  452. } else if (data.audit_type == 15) {
  453. //报告新建三审
  454. tool.post("/admin/project.audit/report_disagree_fifth", {
  455. id: data.id,
  456. else_name: data.else_name,
  457. else_id: data.else_id,
  458. audit_type: data.audit_type,
  459. project_id: data.project_id,
  460. project_status: data.project_status,
  461. audit_remark: text,
  462. }, callback);
  463. }else {
  464. layer.alert("意外问题,请联系管理员")
  465. }
  466. }
  467. })
  468. }
  469. return false;
  470. }
  471. )
  472. //监听搜索提交
  473. form.on('submit(searchform)', function (data) {
  474. layui.pageTable.reload({
  475. where: {
  476. keywords: data.field.keywords
  477. },
  478. page: {
  479. curr: 1
  480. }
  481. });
  482. return false;
  483. });
  484. // setTimeout(()=>{
  485. // console.log(num ,'我是数量')
  486. // if(num === 0){
  487. // parent.showhongdian()
  488. // console.log('2执行了')
  489. // }
  490. // },1500)
  491. }
  492. </script>
  493. {/block}
  494. <!-- /脚本 -->