fault.js 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. // 初始化表格参数配置
  5. Table.api.init({
  6. extend: {
  7. index_url: 'fault/index' + location.search,
  8. add_url: 'fault/add',
  9. edit_url: 'fault/edit',
  10. del_url: 'fault/del',
  11. multi_url: 'fault/multi',
  12. import_url: 'fault/import',
  13. table: 'fault',
  14. }
  15. });
  16. var table = $("#table");
  17. // 初始化表格
  18. table.bootstrapTable({
  19. url: $.fn.bootstrapTable.defaults.extend.index_url,
  20. pk: 'fault_id',
  21. sortName: 'fault_id',
  22. fixedColumns: true,
  23. fixedRightNumber: 1,
  24. columns: [
  25. [
  26. {checkbox: true},
  27. {field: 'fault_id', title: __('Fault_id')},
  28. {field: 'parent_fault_id', title: __('Parent_fault_id')},
  29. {field: 'sim_type', title: __('Sim_type')},
  30. {field: 'fault_type', title: __('Fault_type')},
  31. {field: 'fault_state', title: __('Fault_state')},
  32. {field: 'conflict_fault_ids', title: __('Conflict_fault_ids'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  33. {field: 'replace_part', title: __('Replace_part')},
  34. {field: 'replace_name', title: __('Replace_name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  35. {field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  36. {field: 'bind_hardware_msg', title: __('Bind_hardware_msg')},
  37. {field: 'order_num', title: __('Order_num')},
  38. {field: 'create_by', title: __('Create_by'), operate: 'LIKE'},
  39. {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  40. {field: 'update_by', title: __('Update_by'), operate: 'LIKE'},
  41. {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  42. {field: 'remark', title: __('Remark'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  43. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  44. ]
  45. ]
  46. });
  47. // 为表格绑定事件
  48. Table.api.bindevent(table);
  49. },
  50. add: function () {
  51. Controller.api.bindevent();
  52. },
  53. edit: function () {
  54. Controller.api.bindevent();
  55. },
  56. api: {
  57. bindevent: function () {
  58. Form.api.bindevent($("form[role=form]"));
  59. }
  60. }
  61. };
  62. return Controller;
  63. });