datalist_proprietor.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  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. <script type="text/html" id="toolbarDemo">
  16. <div class="layui-btn-container">
  17. </div>
  18. </script>
  19. {/block}
  20. <!-- /主体 -->
  21. <!-- 脚本 -->
  22. {block name="script"}
  23. <script>
  24. const moduleInit = ['tool'];
  25. var num_aaa =0;
  26. function gouguInit() {
  27. var table = layui.table, tool = layui.tool, form = layui.form;
  28. layui.pageTable = table.render({
  29. elem: '#cost_project',
  30. id: "cost_project",
  31. title: '造价项目列表',
  32. toolbar: '#toolbarDemo',
  33. url: '/admin/project.audit/datalist_proprietor',
  34. page: true,
  35. limit: 20,
  36. parseData: function(res) { // 数据解析回调函数
  37. // 在这里可以获取数据总数
  38. allcount = res.count;
  39. return {
  40. code: res.code, // 数据状态码
  41. msg: res.msg, // 状态信息
  42. count: res.count, // 数据总数
  43. data: res.data // 当前页数据
  44. };
  45. },
  46. cols: [
  47. [
  48. {fixed: 'left', field: 'id', title: '编号', align: 'center', width: 100,
  49. templet: function(d){
  50. return allcount - (d.LAY_NUM-1);
  51. }
  52. },
  53. {
  54. field: 'project_status',
  55. title: '项目状态',
  56. align: 'center',
  57. width: 100,
  58. templet: function (item) {
  59. //console.log(item);
  60. var html = '';
  61. if (item.project_status === 1) {
  62. html = '<span class="layui-badge layui-bg-orange" style="background-color: #ffb800 !important">立项中</span> ';
  63. } else if (item.project_status === 2) {
  64. html = '<span class="layui-badge layui-bg-blue" style="background-color: #b30095 !important">审批中</span> ';
  65. } else if (item.project_status === -1) {
  66. html = '<span class="layui-badge layui-bg-red" style="background-color: #5825aa !important">待修改</span> ';
  67. } else if (item.project_status === 3) {
  68. html = '<span class="layui-badge layui-bg-green" style="background-color: #d37000 !important">待接收</span> ';
  69. } else if (item.project_status === 4) {
  70. html = '<span class="layui-badge" style="background-color: #005fa8 !important">分配中</span> ';
  71. } else if (item.project_status === 5) {
  72. html = '<span class="layui-badge layui-bg-blue" style="background-color: #1e9fff !important">作业中</span> ';
  73. } else if (item.project_status === 6) {
  74. html = '<span class="layui-badge" style="background-color: #007244 !important">归档中</span> ';
  75. } else if (item.project_status === 7) {
  76. html = '<span class="layui-badge" style="background-color: #881f1f !important">退审中</span> ';
  77. } else if (item.project_status === 8) {
  78. html = '<span class="layui-badge" style="background-color: #16b777 !important">已归档</span> ';
  79. } else if (item.project_status === 9) {
  80. html = '<span class="layui-badge" style="background-color: #d81e06 !important">已退审</span> ';
  81. } else if (item.project_status === 0) {
  82. html = '<span">业主端进行中</span> ';
  83. }
  84. return html;
  85. }
  86. }, {
  87. field: 'audit_status',
  88. title: '审批状态',
  89. align: 'center',
  90. width: 100,
  91. templet: function (item) {
  92. var html = '';
  93. if (item.audit_status === 1) {
  94. num_aaa += 1;
  95. html = '<span class="layui-badge layui-bg-blue">待审核</span> ';
  96. } else if (item.audit_status === 2) {
  97. html = '<span class="layui-badge layui-bg-green">已通过</span> ';
  98. } else if (item.audit_status === 3) {
  99. html = '<span class="layui-badge layui-bg-red">已拒绝</span> ';
  100. }
  101. return html;
  102. }
  103. }, {
  104. field: 'project_name',
  105. title: '项目名称',
  106. align: 'center',
  107. width: 100,
  108. templet: function (d) {
  109. return '<div style="text-align:left">' + d.project_name + '</div>'
  110. }
  111. }, {
  112. field: 'audit_name',
  113. title: '流程名称',
  114. align: 'center',
  115. width: 150
  116. }, {
  117. field: 'sponsor',
  118. title: '发起人',
  119. align: 'center',
  120. width: 150
  121. }, {
  122. field: 'create_time',
  123. title: '发起时间',
  124. align: 'center',
  125. width: 150,
  126. templet: function (d) {
  127. if (d.create_time) {
  128. return layui.util.toDateString(d.create_time * 1000, "yyyy-MM-dd")
  129. } else {
  130. return "";
  131. }
  132. }
  133. }, {
  134. field: 'approver_name',
  135. title: '审批人',
  136. align: 'center',
  137. width: 150
  138. }, {
  139. field: 'audit_time',
  140. title: '审批时间',
  141. align: 'center',
  142. width: 100,
  143. templet: function (d) {
  144. if (d.audit_time) {
  145. return layui.util.toDateString(d.audit_time * 1000, "yyyy-MM-dd")
  146. } else {
  147. return "";
  148. }
  149. }
  150. }, {
  151. field: 'remark',
  152. title: '申请原因',
  153. align: 'center',
  154. width: 250,
  155. }, {
  156. field: 'audit_remark',
  157. title: '审批回执',
  158. align: 'center',
  159. width: 250,
  160. }, {
  161. fixed: 'right',
  162. field: 'right',
  163. title: '操作',
  164. width: 136,
  165. align: 'center',
  166. templet: function (item) {
  167. var h = '';
  168. if (item.audit_status === 1) {
  169. 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>'
  170. } else {
  171. h = '<div class="layui-btn-group"> <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">查看</a></div>'
  172. }
  173. return h;
  174. }
  175. }
  176. ]
  177. ],
  178. done:function () {
  179. if(num_aaa === 0){
  180. parent.showhongdian()
  181. // console.log('2执行了')
  182. }
  183. }
  184. });
  185. let abc = 0;
  186. //监听表格行工具事件
  187. table.on('tool(cost_project)', function (obj) {
  188. var data = obj.data;
  189. if (obj.event === 'read') {
  190. tool.side('/admin/project.audit/read?id=' + data.project_id);
  191. } else if (obj.event === 'edit') {
  192. layer.confirm("确认是否审批通过?", function (index) {
  193. console.log(abc, data.else_status)
  194. let callback = function (e) {
  195. select_Data = [];
  196. abc = 0
  197. layer.msg(e.msg);
  198. setTimeout(function () {
  199. layui.pageTable.reload()
  200. layer.close(index);
  201. }, 1000)
  202. }
  203. if (data.audit_type ==1){
  204. tool.post("/admin/project.audit/proprietor_agree", {
  205. id: data.id,
  206. else_id: data.else_id,
  207. audit_type: data.audit_type,
  208. project_id: data.project_id,
  209. project_status: data.project_status,
  210. }, callback);
  211. }
  212. if (data.audit_type ==0){
  213. tool.post("/admin/project.audit/proprietor_agree2", {
  214. id: data.id,
  215. else_id: data.else_id,
  216. audit_type: data.audit_type,
  217. project_id: data.project_id,
  218. project_status: data.project_status,
  219. }, callback);
  220. }else if (data.audit_type == 2) {
  221. if (data.else_status == 1) {
  222. //业主审核报告新建
  223. console.log(1)
  224. tool.post("/admin/project.report/proprietor_agree_report", {
  225. id: data.id,
  226. else_id: data.else_id,
  227. audit_type: data.audit_type,
  228. project_id: data.project_id,
  229. project_status: data.project_status,
  230. type: 1000,
  231. }, callback);
  232. } else if (data.else_status == 4) {
  233. //业主审核报告删除
  234. tool.post("/admin/project.report/proprietor_agree_delete", {
  235. id: data.id,
  236. else_id: data.else_id,
  237. audit_type: data.audit_type,
  238. project_id: data.project_id,
  239. project_status: data.project_status,
  240. type: 1000,
  241. }, callback);
  242. }
  243. }
  244. abc = 1;
  245. }, function () {
  246. abc = 0;
  247. })
  248. } else if (obj.event === 'overrule') {
  249. var ttxx = layer.prompt({
  250. title: '请输入<span style="color: red">拒绝</span>原因',
  251. formType: 2,
  252. area: ['35vw', '15vw']
  253. }, function (text, index) {
  254. if (text == '') {
  255. layer.msg('请先完善拒绝原因');
  256. return false;
  257. } else {
  258. let callback = function (e) {
  259. layer.msg(e.msg);
  260. setTimeout(function () {
  261. layui.pageTable.reload()
  262. layer.close(index);
  263. }, 2000)
  264. }
  265. if (data.audit_type==1){
  266. tool.post("/admin/project.audit/proprietor_disagree", {
  267. id: data.id,
  268. else_id: data.else_id,
  269. audit_type: data.audit_type,
  270. project_id: data.project_id,
  271. project_status: data.project_status,
  272. audit_remark:text,
  273. }, callback);
  274. }else if (data.audit_type==0){
  275. ool.post("/admin/project.audit/proprietor_disagree2", {
  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. audit_remark:text,
  282. }, callback);
  283. }else if (data.audit_type == 2) {
  284. if (data.else_status == 1) {
  285. //财评报告新建通过,业主报告新建拒绝
  286. tool.post("/admin/project.report/proprietor_un_report", {
  287. id: data.id,
  288. else_id: data.else_id,
  289. audit_type: data.audit_type,
  290. project_id: data.project_id,
  291. project_status: data.project_status,
  292. audit_remark: text,
  293. type: 1000,
  294. }, callback);
  295. } else if (data.else_status == 4) {
  296. //财评报告删除通过,业主报告删除拒绝
  297. tool.post("/admin/project.report/proprietor_un_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. audit_remark: text,
  304. type: 1000,
  305. }, callback);
  306. }
  307. }
  308. }
  309. }, function () {
  310. abc = 0;
  311. })
  312. }
  313. return false;
  314. });
  315. //监听搜索提交
  316. form.on('submit(searchform)', function (data) {
  317. layui.pageTable.reload({
  318. where: {
  319. keywords: data.field.keywords
  320. },
  321. page: {
  322. curr: 1
  323. }
  324. });
  325. return false;
  326. });
  327. }
  328. </script>
  329. {/block}
  330. <!-- /脚本 -->