datalist_proprietor.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  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. var html = '';
  60. if (item.project_status === 2) {
  61. html = '<span>审批中</span> ';
  62. } else if (item.project_status === 3) {
  63. html = '<span">待接收</span> ';
  64. } else if (item.project_status === 4) {
  65. html = '<span">分配中</span> ';
  66. } else if (item.project_status === 5) {
  67. html = '<span>作业中</span> ';
  68. } else if (item.project_status === 6) {
  69. html = '<span">归档中</span> ';
  70. } else if (item.project_status === 7) {
  71. html = '<span">退审中</span> ';
  72. } else if (item.project_status === 8) {
  73. html = '<span">已归档</span> ';
  74. } else if (item.project_status === 9) {
  75. html = '<span">已退审</span> ';
  76. } else if (item.project_status === 0) {
  77. html = '<span">立项中</span> ';
  78. } else if (item.project_status === 1) {
  79. if(item.proprietor_status===2){
  80. html = '<span">接收中</span> ';
  81. }else {
  82. html = '<span">接收后立项中</span> ';
  83. }
  84. }
  85. return html;
  86. }
  87. }, {
  88. field: 'audit_status',
  89. title: '审批状态',
  90. align: 'center',
  91. width: 100,
  92. templet: function (item) {
  93. var html = '';
  94. if (item.audit_status === 1) {
  95. num_aaa += 1;
  96. html = '<span class="layui-badge layui-bg-blue">待审核</span> ';
  97. } else if (item.audit_status === 2) {
  98. html = '<span class="layui-badge layui-bg-green">已通过</span> ';
  99. } else if (item.audit_status === 3) {
  100. html = '<span class="layui-badge layui-bg-red">已拒绝</span> ';
  101. }
  102. return html;
  103. }
  104. }, {
  105. field: 'project_name',
  106. title: '项目名称',
  107. align: 'center',
  108. width: 100,
  109. templet: function (d) {
  110. return '<div style="text-align:left">' + d.project_name + '</div>'
  111. }
  112. }, {
  113. field: 'audit_name',
  114. title: '流程名称',
  115. align: 'center',
  116. width: 150
  117. }, {
  118. field: 'sponsor',
  119. title: '发起人',
  120. align: 'center',
  121. width: 150
  122. }, {
  123. field: 'create_time',
  124. title: '发起时间',
  125. align: 'center',
  126. width: 150,
  127. templet: function (d) {
  128. if (d.create_time) {
  129. return layui.util.toDateString(d.create_time * 1000, "yyyy-MM-dd")
  130. } else {
  131. return "";
  132. }
  133. }
  134. }, {
  135. field: 'approver_name',
  136. title: '审批人',
  137. align: 'center',
  138. width: 150
  139. }, {
  140. field: 'audit_time',
  141. title: '审批时间',
  142. align: 'center',
  143. width: 100,
  144. templet: function (d) {
  145. if (d.audit_time) {
  146. return layui.util.toDateString(d.audit_time * 1000, "yyyy-MM-dd")
  147. } else {
  148. return "";
  149. }
  150. }
  151. }, {
  152. field: 'remark',
  153. title: '申请原因',
  154. align: 'center',
  155. width: 250,
  156. }, {
  157. field: 'audit_remark',
  158. title: '审批回执',
  159. align: 'center',
  160. width: 250,
  161. }, {
  162. fixed: 'right',
  163. field: 'right',
  164. title: '操作',
  165. width: 136,
  166. align: 'center',
  167. templet: function (item) {
  168. var h = '';
  169. if (item.audit_status === 1) {
  170. 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>'
  171. } else {
  172. h = '<div class="layui-btn-group"> <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">查看</a></div>'
  173. }
  174. return h;
  175. }
  176. }
  177. ]
  178. ],
  179. done:function () {
  180. if(num_aaa === 0){
  181. parent.showhongdian()
  182. // console.log('2执行了')
  183. }
  184. }
  185. });
  186. let abc = 0;
  187. //监听表格行工具事件
  188. table.on('tool(cost_project)', function (obj) {
  189. var data = obj.data;
  190. if (obj.event === 'read') {
  191. tool.side('/admin/project.audit/read?id=' + data.project_id);
  192. } else if (obj.event === 'edit') {
  193. layer.confirm("确认是否审批通过?", function (index) {
  194. console.log(abc, data.else_status)
  195. let callback = function (e) {
  196. select_Data = [];
  197. abc = 0
  198. layer.msg(e.msg);
  199. setTimeout(function () {
  200. layui.pageTable.reload()
  201. layer.close(index);
  202. }, 1000)
  203. }
  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. abc = 1;
  212. }, function () {
  213. abc = 0;
  214. })
  215. } else if (obj.event === 'overrule') {
  216. var ttxx = layer.prompt({
  217. title: '请输入<span style="color: red">拒绝</span>原因',
  218. formType: 2,
  219. area: ['35vw', '15vw']
  220. }, function (text, index) {
  221. if (text == '') {
  222. layer.msg('请先完善拒绝原因');
  223. return false;
  224. } else {
  225. let callback = function (e) {
  226. layer.msg(e.msg);
  227. setTimeout(function () {
  228. layui.pageTable.reload()
  229. layer.close(index);
  230. }, 2000)
  231. }
  232. tool.post("/admin/project.audit/proprietor_disagree", {
  233. id: data.id,
  234. else_id: data.else_id,
  235. audit_type: data.audit_type,
  236. project_id: data.project_id,
  237. project_status: data.project_status,
  238. audit_remark:text,
  239. }, callback);
  240. }
  241. }, function () {
  242. abc = 0;
  243. })
  244. }
  245. return false;
  246. });
  247. //监听搜索提交
  248. form.on('submit(searchform)', function (data) {
  249. layui.pageTable.reload({
  250. where: {
  251. keywords: data.field.keywords
  252. },
  253. page: {
  254. curr: 1
  255. }
  256. });
  257. return false;
  258. });
  259. }
  260. </script>
  261. {/block}
  262. <!-- /脚本 -->