archive.html 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. {extend name="common/base"/}
  2. <!-- 主体 -->
  3. {block name="body"}
  4. <div class="p-3">
  5. <form class="layui-form gg-form-bar border-x border-t">
  6. <div class="layui-input-inline" style="width:150px;">
  7. <select name="cate_id">
  8. <option value="">请选择合同类别</option>
  9. {volist name="cate" id="v"}
  10. <option value="{$v.id}">{$v.title}</option>
  11. {/volist}
  12. </select>
  13. </div>
  14. <div class="layui-input-inline" style="width:150px;">
  15. <select name="type">
  16. <option value="">请选择合同性质</option>
  17. <option value="1">普通合同</option>
  18. <option value="2">框架合同</option>
  19. <option value="3">补充协议</option>
  20. <option value="4">其他合同</option>
  21. </select>
  22. </div>
  23. <div class="layui-input-inline" style="width:240px;">
  24. <input type="text" name="keywords" placeholder="输入关键字" class="layui-input" autocomplete="off" />
  25. </div>
  26. <div class="layui-input-inline" style="width:150px;">
  27. <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform"><i class="layui-icon layui-icon-search mr-1"></i>搜索</button>
  28. <button type="reset" class="layui-btn layui-btn-reset" lay-filter="reset">清空</button>
  29. </div>
  30. </form>
  31. <table class="layui-hide" id="test" lay-filter="test"></table>
  32. </div>
  33. {/block}
  34. <!-- /主体 -->
  35. <!-- 脚本 -->
  36. {block name="script"}
  37. <script>
  38. const moduleInit = ['tool'];
  39. function gouguInit() {
  40. var table = layui.table, tool = layui.tool ,form = layui.form;
  41. var allcount;
  42. layui.pageTable = table.render({
  43. elem: '#test',
  44. title: '合同归档列表',
  45. url: "/admin/contract.index/archive", //数据接口
  46. cellMinWidth: 80,
  47. parseData: function (res) { // 数据解析回调函数
  48. // 在这里可以获取数据总数
  49. allcount = res.data.length;
  50. return {
  51. code: res.code, // 数据状态码
  52. msg: res.msg, // 状态信息
  53. count: res.count, // 数据总数
  54. data: res.data // 当前页数据
  55. };
  56. },
  57. page: true, //开启分页
  58. limit: 20,
  59. cols: [
  60. [ //表头
  61. {
  62. field: 'id',
  63. title: '编号',
  64. align: 'center',
  65. width: 80,
  66. templet: function (d) {
  67. console.log(allcount,d.LAY_NUM)
  68. return allcount - (d.LAY_NUM - 1);
  69. }
  70. },{ field: 'check_status', title: '状态', align: 'center', width: 80, templet: function (d) {
  71. var html = '<span class="layui-btn layui-btn-xs layui-bg-' + d.check_status + '">' + d.status_name + '</span>';
  72. return html;
  73. }
  74. },{
  75. field: 'code',
  76. title: '合同编号',
  77. width: 160
  78. },{
  79. field: 'name',
  80. title: '合同名称',
  81. minWidth:240,
  82. templet: '<div><a data-href="/admin/contract.index/view?id={{d.id}}" class="side-a">{{d.name}}</a></div>'
  83. }, {
  84. field: 'cate_title',
  85. title: '合同类别',
  86. align: 'center',
  87. width: 100
  88. }, {
  89. field: 'type_name',
  90. title: '合同性质',
  91. align: 'center',
  92. width: 80,
  93. templet: function (d) {
  94. var html = '<span class="layui-color-' + d.type + '">' + d.type_name + '</span>';
  95. return html;
  96. }
  97. },{
  98. field: 'cost',
  99. title: '合同金额/元',
  100. align: 'right',
  101. width: 100
  102. }, {
  103. field: 'sign_name',
  104. title: '签定人',
  105. align: 'center',
  106. width: 80
  107. },{
  108. field: 'keeper_name',
  109. title: '保管人',
  110. align: 'center',
  111. width: 80
  112. }, {
  113. field: 'sign_time',
  114. title: '签订时间',
  115. align: 'center',
  116. width: 100
  117. }, {
  118. field: 'right',
  119. fixed:'right',
  120. title: '操作',
  121. width: 100,
  122. align: 'center',
  123. templet: function (d) {
  124. return '<span class="layui-btn layui-btn-normal layui-btn-xs" lay-event="view">详情</span>';
  125. }
  126. }
  127. ]
  128. ]
  129. });
  130. //表头工具栏事件
  131. table.on('toolbar(test)', function(obj){
  132. if (obj.event === 'add') {
  133. selectType();
  134. return;
  135. }
  136. });
  137. //监听行工具事件
  138. table.on('tool(test)', function(obj) {
  139. var data = obj.data;
  140. if(obj.event === 'view'){
  141. tool.side('/admin/contract.index/view?id='+data.id);
  142. return;
  143. }
  144. });
  145. //监听搜索提交
  146. form.on('submit(webform)', function(data) {
  147. layui.pageTable.reload({
  148. where: {
  149. keywords: data.field.keywords,
  150. cate_id: data.field.cate_id,
  151. type: data.field.type
  152. },
  153. page: {
  154. curr: 1
  155. }
  156. });
  157. return false;
  158. });
  159. }
  160. </script>
  161. {/block}
  162. <!-- /脚本 -->