dashboard.js 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. /*
  2. * @Author: yukai
  3. * @Date: 2023-04-26 12:25:56
  4. * @LastEditors: Please set LastEditors
  5. * @LastEditTime: 2023-09-11 13:36:02
  6. * @Description: 请填写简介
  7. */
  8. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  9. var Controller = {
  10. index: function () {
  11. // 初始化表格参数配置
  12. Table.api.init({
  13. extend: {
  14. index_url: 'qingdongams/customer/contract/index1',
  15. detail_url : 'qingdongams/customer/contract/detail',
  16. del_url: '',
  17. table: 'customer',
  18. }
  19. });
  20. var table = $("#table");
  21. // 初始化表格
  22. table.bootstrapTable({
  23. url: $.fn.bootstrapTable.defaults.extend.index_url,
  24. sortName: 'id',
  25. columns: [
  26. [
  27. {
  28. field: 'num', title: '合同编号', fixedColumns: true, formatter: function (value, row, index) {
  29. if (value == '') {
  30. value = '无';
  31. }
  32. return "<a href='javascript:void(0);' data-id='" + row.id + "' class='show-detail'>" + value + "</a>";
  33. }, operate: 'like'
  34. },
  35. {
  36. field: 'name', title: '合同名称', fixedColumns: true, formatter: function (value, row, index) {
  37. if (value == '') {
  38. value = '无';
  39. }
  40. return value;
  41. }, operate: false
  42. }
  43. ,
  44. { field: 'contract_status', title: '合同状态', operate: '=', searchList: { 0: '进行中', 1: '已完成', 2: '已作废' }, formatter: Table.api.formatter.status },
  45. { field: 'end_time', title: '合同结束时间', operate: 'RANGE', addclass: 'datetimerange', formatter: Table.api.formatter.datetime },
  46. ]
  47. ],
  48. search: false,
  49. pagination: false,
  50. //启用普通表单搜索
  51. commonSearch: false,
  52. searchFormVisible: false,
  53. onLoadSuccess: function () {
  54. // 这里就是数据渲染结束后的回调函数
  55. $('.fixed-table-toolbar').hide();
  56. $('.btn-editone').html('编辑');
  57. $('.fa-pencil').remove();
  58. $('.btn-delone').html('删除');
  59. $('.fa-trash').remove();
  60. $('.btn-editone').removeClass('btn-success')
  61. $('.btn-editone').removeClass('btn')
  62. $('.btn-delone').removeClass('btn')
  63. $('.btn-delone').removeClass('btn-danger')
  64. }
  65. });
  66. $(document).on('click', '.show-detail', function (data) {
  67. var area = ['95%', '95%'];
  68. var options = {
  69. shadeClose : false,
  70. shade : [0.3, '#393D49'],
  71. area : area,
  72. callback : function (value) {
  73. //在回调函数里可以调用你的业务代码实现前端的各种逻辑和效果
  74. console.log(value);
  75. }
  76. };
  77. Fast.api.open($.fn.bootstrapTable.defaults.extend.detail_url + "?ids=" + $(this).data('id'), '合同', options);
  78. })
  79. // 为表格绑定事件
  80. Table.api.bindevent(table);
  81. var table1 = $("#table1");
  82. // 初始化表格
  83. table1.bootstrapTable({
  84. url: "qingdongams/workorder/workorder/index1",
  85. sortName: 'id',
  86. columns: [
  87. [
  88. { field: 'workorder_type', title: '工单类型', operate: 'like' },
  89. { field: 'workorder_number', title: '工单编号', operate: 'like' },
  90. {
  91. field: 'status', title: '工单状态', formatter: Table.api.formatter.status,
  92. searchList: { 1: '待处理', 2: '处理中', 3: '已完成', 9: "已撤销" }
  93. },
  94. {
  95. field: 'title', title: '任务名称', fixedColumns: true, formatter: function (value, row, index) {
  96. return "<a href='javascript:void(0);' data-id='" + row.id + "' class='show-workdetail'>" + value + "</a>";
  97. }, operate: 'like'
  98. },
  99. { field: 'createtime', title: '通知时间', operate: 'RANGE', addclass: 'datetimerange', formatter: Table.api.formatter.date },
  100. { field: 'expected_end_time', title: '完成时间', operate: 'RANGE', addclass: 'datetimerange', formatter: Table.api.formatter.datetime },
  101. ]
  102. ],
  103. search: false,
  104. pagination: false,
  105. //启用普通表单搜索
  106. commonSearch: false,
  107. searchFormVisible: false,
  108. onLoadSuccess: function () {
  109. // 这里就是数据渲染结束后的回调函数
  110. $('.fixed-table-toolbar').hide();
  111. $('.btn-editone').html('编辑');
  112. $('.fa-pencil').remove();
  113. $('.btn-delone').html('删除');
  114. $('.fa-trash').remove();
  115. $('.btn-editone').removeClass('btn-success')
  116. $('.btn-editone').removeClass('btn')
  117. $('.btn-delone').removeClass('btn')
  118. $('.btn-delone').removeClass('btn-danger')
  119. }
  120. });
  121. $(document).on('click', '.show-detail', function (data) {
  122. var area = ['95%', '95%'];
  123. var options = {
  124. shadeClose : false,
  125. shade : [0.3, '#393D49'],
  126. area : area,
  127. callback : function (value) {
  128. //在回调函数里可以调用你的业务代码实现前端的各种逻辑和效果
  129. console.log(value);
  130. }
  131. };
  132. Fast.api.open($.fn.bootstrapTable.defaults.extend.detail_url + "?ids=" + $(this).data('id'), '合同', options);
  133. })
  134. $(document).on('click', '.show-workdetail', function (data) {
  135. var area = ['95%', '95%'];
  136. var options = {
  137. shadeClose : false,
  138. shade : [0.3, '#393D49'],
  139. area : area,
  140. callback : function (value) {
  141. //在回调函数里可以调用你的业务代码实现前端的各种逻辑和效果
  142. console.log(value);
  143. }
  144. };
  145. Fast.api.open("qingdongams/workorder/workorder/detail?ids=" + $(this).data('id'), '工单', options);
  146. })
  147. // 为表格绑定事件
  148. Table.api.bindevent(table1);
  149. },
  150. edit: function () {
  151. Controller.api.bindevent();
  152. },
  153. api: {
  154. bindevent: function () {
  155. Form.api.bindevent($("form[role=form]"));
  156. },
  157. formatter: {
  158. title: function (value, row, index) {
  159. value = value.toString().replace(/(&|&amp;)nbsp;/g, '&nbsp;');
  160. return value;
  161. },
  162. },
  163. }
  164. };
  165. return Controller;
  166. });