datalist.html 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  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. <script type="text/html" id="barDemo">
  20. <div class="layui-btn-group">
  21. <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">查看</a>
  22. <a class="layui-btn layui-btn-xs" lay-event="receive">接收</a>
  23. <!-- <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>-->
  24. </div>
  25. </script>
  26. {/block}
  27. <!-- /主体 -->
  28. <!-- 脚本 -->
  29. {block name="script"}
  30. <script>
  31. const moduleInit = ['tool'];
  32. var listount;
  33. function gouguInit() {
  34. var table = layui.table, tool = layui.tool, form = layui.form;
  35. var allcount;
  36. layui.pageTable = table.render({
  37. elem: '#cost_project',
  38. title: '造价项目列表',
  39. toolbar: '#toolbarDemo',
  40. url: '/admin/project.approval/datalist',
  41. page: true,
  42. limit: 20,
  43. parseData: function (res) { // 数据解析回调函数
  44. // 在这里可以获取数据总数
  45. allcount = res.count;
  46. return {
  47. code: res.code, // 数据状态码
  48. msg: res.msg, // 状态信息
  49. count: res.count, // 数据总数
  50. data: res.data // 当前页数据
  51. };
  52. },
  53. cols: [
  54. [
  55. {
  56. fixed: 'left', field: 'id', title: '编号', align: 'center', width: 80,
  57. templet: function (d) {
  58. return allcount - (d.LAY_NUM - 1);
  59. }
  60. }, {
  61. field: 'project_status',
  62. title: '项目状态',
  63. align: 'center',
  64. width: 100,
  65. templet: function (item) {
  66. var html = '';
  67. if (item.project_status === 2) {
  68. html = '<span>审批中</span> ';
  69. } else if (item.project_status === 3) {
  70. html = '<span">待接收</span> ';
  71. } else if (item.project_status === 4) {
  72. html = '<span">分配中</span> ';
  73. } else if (item.project_status === 5) {
  74. html = '<span>作业中</span> ';
  75. } else if (item.project_status === 6) {
  76. html = '<span">归档中</span> ';
  77. } else if (item.project_status === 7) {
  78. html = '<span">退审中</span> ';
  79. } else if (item.project_status === 8) {
  80. html = '<span">已归档</span> ';
  81. } else if (item.project_status === 9) {
  82. html = '<span">已退审</span> ';
  83. } else if (item.project_status === 0) {
  84. html = '<span">立项中</span> ';
  85. } else if (item.project_status === 1) {
  86. html = '<span">立项中</span> ';
  87. }
  88. return html;
  89. }
  90. },
  91. {
  92. field: 'project_name',
  93. title: '项目名称',
  94. align: 'center',
  95. width: 200
  96. }, {
  97. field: 'project_num',
  98. title: '项目编号',
  99. align: 'center',
  100. width: 150
  101. }, {
  102. field: 'project_time',
  103. title: '项目周期',
  104. align: 'center',
  105. width: 250,
  106. templet: function (item) {
  107. var html;
  108. html =
  109. "<div>" +
  110. layui.util.toDateString(item.project_start_time * 1000, 'yyyy-MM-dd') +
  111. "~" +
  112. layui.util.toDateString(item.project_end_time * 1000, 'yyyy-MM-dd') +
  113. "</div>";
  114. return html;
  115. }
  116. }, {
  117. field: 'sent_review_unit_name',
  118. title: '委托单位',
  119. align: 'center',
  120. width: 150
  121. }, {
  122. field: 'sent_review_head_name',
  123. title: '委托单位负责人',
  124. align: 'center',
  125. width: 150
  126. }, {
  127. field: 'sent_review_phone',
  128. title: '委托单位负责人电话',
  129. align: 'center',
  130. width: 150
  131. }, {
  132. field: 'project_scale',
  133. title: '项目规模',
  134. align: 'center',
  135. width: 150
  136. }, {
  137. field: 'engineering_category',
  138. title: '工程类别',
  139. align: 'center',
  140. width: 150
  141. }, {
  142. field: 'engineering_type',
  143. title: '项目类型',
  144. align: 'center',
  145. width: 150
  146. }, {
  147. field: 'project_region',
  148. title: '项目区域',
  149. align: 'center',
  150. width: 150
  151. }, {
  152. field: 'fiscal_nature',
  153. title: '财政性质',
  154. align: 'center',
  155. width: 150
  156. }, {
  157. field: 'create_time',
  158. title: '项目创建日期',
  159. align: 'center',
  160. width: 120,
  161. templet: "<div>{{layui.util.toDateString(d.updated, 'yyyy-MM-dd')}}</div>"
  162. }, {
  163. field: 'project_dead_time',
  164. title: '项目归档日期',
  165. align: 'center',
  166. width: 120
  167. },
  168. {
  169. fixed: 'right',
  170. field: 'right',
  171. title: '操作',
  172. toolbar: '#barDemo',
  173. width: 136,
  174. align: 'center'
  175. }
  176. ]
  177. ],
  178. done: function (res, curr, count) {
  179. listount = count;
  180. }
  181. });
  182. //监听表格行工具事件
  183. table.on('tool(cost_project)', function (obj) {
  184. var data = obj.data;
  185. if (obj.event === 'read') {
  186. // console.log(obj.data.getTrusteeName.institution)
  187. tool.side('/admin/project.approval/read?id=' + obj.data.id);
  188. } else if (obj.event === 'edit') {
  189. tool.side('/admin/project.approval/edit?id=' + obj.data.id);
  190. } else if (obj.event === 'receive') {
  191. var index = layer.confirm("确认是否接收此项目?", function () {
  192. layer.close(index);
  193. let callback = function (e) {
  194. layer.msg(e.msg);
  195. listount--;
  196. if (listount == 0) {
  197. parent.showhongdian()
  198. }
  199. if (e.code == 0) {
  200. obj.del();
  201. }
  202. }
  203. tool.delete("/admin/project.approval/receive", {
  204. id: data.id,
  205. }, callback);
  206. })
  207. return false;
  208. }
  209. //监听搜索提交
  210. form.on('submit(searchform)', function (data) {
  211. layui.pageTable.reload({
  212. where: {
  213. keywords: data.field.keywords
  214. },
  215. page: {
  216. curr: 1
  217. }
  218. });
  219. return false;
  220. });
  221. })
  222. }
  223. </script>
  224. {/block}
  225. <!-- /脚本 -->