maintain.js 6.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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: 'maintain/index' + location.search,
  8. add_url: 'maintain/add',
  9. edit_url: 'maintain/edit',
  10. // del_url: 'maintain/del',
  11. multi_url: 'maintain/multi',
  12. import_url: 'maintain/import',
  13. table: 'maintain',
  14. }
  15. });
  16. var table = $("#table");
  17. // 初始化表格
  18. table.bootstrapTable({
  19. url: $.fn.bootstrapTable.defaults.extend.index_url,
  20. pk: 'id',
  21. sortName: 'id',
  22. fixedColumns: true,
  23. fixedRightNumber: 1,
  24. columns: [
  25. [
  26. {checkbox: true},
  27. {field: 'id', title: __('Id')},
  28. {field: 'orderno', title: __('Orderno'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  29. {field: 'company_id', title: __('Company_id')},
  30. {field: 'company.companyname', title: __('Company.companyname'), operate: 'LIKE'},
  31. {field: 'user_id', title: __('User_id')},
  32. {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
  33. {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
  34. // {field: 'uc_id', title: __('Uc_id')},
  35. {field: 'usercompany.projectname', title: __('Usercompany.projectname'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  36. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  37. // {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  38. {field: 'info', title: __('Info'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  39. {field: 'mobile', title: __('Mobile'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  40. {field: 'address', title: __('Address'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  41. {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"2":__('Status 2'),"20":__('Status 20'),"22":__('Status 22'),"30":__('Status 30'),"40":__('Status 40'),"50":__('Status 50'),"60":__('Status 60'),"70":__('Status 70'),"80":__('Status 80'),"90":__('Status 90'),"92":__('Status 92'),"100":__('Status 100')}, formatter: Table.api.formatter.status},
  42. // {field: 'canceltime', title: __('Canceltime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  43. {field: 'finishtime', title: __('Finishtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  44. {field: 'baojia_confirmtime', title: __('Baojia_confirmtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  45. {field: 'worker_id', title: __('Worker_id')},
  46. {field: 'worker.truename', title: __('Worker.truename'), operate: 'LIKE'},
  47. {field: 'worker.mobile', title: __('Worker.mobile'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  48. // {field: 'cailiao_time', title: __('Cailiao_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  49. // {field: 'lingqu_time', title: __('Lingqu_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  50. // {field: 'lingqu_images', title: __('Lingqu_images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
  51. {field: 'shangmen_time', title: __('Shangmen_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  52. {field: 'weixiu_times', title: __('Weixiu_times')},
  53. // {field: 'weixiu_id', title: __('Weixiu_id')},
  54. {field: 'wancheng_time', title: __('Wancheng_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  55. // {field: 'eva_info', title: __('Eva_info'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  56. // {field: 'eva_time', title: __('Eva_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  57. {field: 'eva_score', title: __('Eva_score')},
  58. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  59. ]
  60. ]
  61. });
  62. // 为表格绑定事件
  63. Table.api.bindevent(table);
  64. },
  65. add: function () {
  66. Controller.api.bindevent();
  67. },
  68. edit: function () {
  69. Controller.api.bindevent();
  70. },
  71. api: {
  72. bindevent: function () {
  73. Form.api.bindevent($("form[role=form]"));
  74. }
  75. }
  76. };
  77. return Controller;
  78. });