durg_archives.js 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. $(".btn-add").data("area",["720px","520px"]);
  5. // 初始化表格参数配置
  6. Table.api.init({
  7. extend: {
  8. index_url: 'durg_archives/index' + location.search,
  9. add_url: 'durg_archives/add',
  10. edit_url: 'durg_archives/edit',
  11. del_url: 'durg_archives/del',
  12. multi_url: 'durg_archives/multi',
  13. import_url: 'durg_archives/import',
  14. table: 'durg_archives',
  15. }
  16. });
  17. var table = $("#table");
  18. // 初始化表格
  19. table.bootstrapTable({
  20. url: $.fn.bootstrapTable.defaults.extend.index_url,
  21. pk: 'id',
  22. sortName: 'id',
  23. columns: [
  24. [
  25. {checkbox: true},
  26. {field: 'order_number', title: __('序号')},
  27. {field: 'unit_id_text', title: __('Unit_id')},
  28. {field: 'durg_name', title: __('Durg_name'), operate: 'LIKE'},
  29. {field: 'durg_brand', title: __('Durg_brand'), operate: 'LIKE'},
  30. {field: 'specifications', title: __('Specifications'), operate: 'LIKE'},
  31. {field: 'manufacturer', title: __('Manufacturer'), operate: 'LIKE'},
  32. {field: 'product_introduction', title: __('Product_introduction'), operate: 'LIKE'},
  33. //{field: 'remarks', title: __('Remarks'), operate: 'LIKE'},
  34. {field: 'store_house_text', title: __('Store_house')},
  35. {field: 'amount', title: __('Amount')},
  36. {field: 'put_in', title: __('Put_in')},
  37. {field: 'put_out', title: __('Put_out')},
  38. {field: 'overdue', title: __('Overdue')},
  39. {field: 'admin_id_text', title: __('Admin_id')},
  40. //{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  41. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  42. ]
  43. ]
  44. });
  45. // 为表格绑定事件
  46. Table.api.bindevent(table);
  47. table.on('post-body.bs.table', function () {
  48. $(".btn-editone").data("area", ["720px", "520px"]);
  49. })
  50. },
  51. add: function () {
  52. Controller.api.bindevent();
  53. },
  54. edit: function () {
  55. Controller.api.bindevent();
  56. },
  57. api: {
  58. bindevent: function () {
  59. Form.api.bindevent($("form[role=form]"));
  60. }
  61. }
  62. };
  63. return Controller;
  64. });