duty_measure.js 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. // 初始化表格参数配置
  5. //$('.btn-add').data('area',['100%','100%']);
  6. $('.btn-edit').data('area',['40%','20%']);
  7. Table.api.init({
  8. extend: {
  9. index_url: 'duty_measure/index' + location.search,
  10. add_url: 'duty_measure/add',
  11. edit_url: 'duty_measure/edit',
  12. del_url: 'duty_measure/del',
  13. multi_url: 'duty_measure/multi',
  14. import_url: 'duty_measure/import',
  15. table: 'duty_measure',
  16. }
  17. });
  18. var table = $("#table");
  19. // 初始化表格
  20. table.bootstrapTable({
  21. url: $.fn.bootstrapTable.defaults.extend.index_url,
  22. pk: 'id',
  23. sortName: 'id',
  24. columns: [
  25. [
  26. {checkbox: true},
  27. {field: 'id', title: __('Id')},
  28. {field: 'yl_zscb', title: __('Yl_zscb'), operate: 'LIKE'},
  29. {field: 'yl_cxyz', title: __('Yl_cxyz'), operate: 'LIKE'},
  30. {field: 'yl_zcnl', title: __('Yl_zcnl'), operate: 'LIKE'},
  31. {field: 'jx_zscb', title: __('Jx_zscb'), operate: 'LIKE'},
  32. {field: 'jx_cxyz', title: __('Jx_cxyz'), operate: 'LIKE'},
  33. {field: 'jx_zcnl', title: __('Jx_zcnl'), operate: 'LIKE'},
  34. {field: 'zbj_zscb', title: __('Zbj_zscb'), operate: 'LIKE'},
  35. {field: 'wswz_zscb', title: __('Wswz_zscb'), operate: 'LIKE'},
  36. {field: 'wswz_cxyz', title: __('Wswz_cxyz'), operate: 'LIKE'},
  37. {field: 'dy_ccl', title: __('Dy_ccl'), operate: 'LIKE'},
  38. {field: 'wx_ccl', title: __('Wx_ccl'), operate: 'LIKE'},
  39. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  40. ]
  41. ]
  42. });
  43. // 为表格绑定事件
  44. Table.api.bindevent(table);
  45. },
  46. add: function () {
  47. Controller.api.bindevent();
  48. },
  49. edit: function () {
  50. Controller.api.bindevent();
  51. },
  52. api: {
  53. bindevent: function () {
  54. Form.api.bindevent($("form[role=form]"));
  55. }
  56. }
  57. };
  58. return Controller;
  59. });