antiepidemic_archives.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. $(".btn-add").data("area", ["735px", "420px"]);
  5. // 初始化表格参数配置
  6. Table.api.init({
  7. extend: {
  8. index_url: 'antiepidemic_archives/index' + location.search,
  9. add_url: 'antiepidemic_archives/add',
  10. edit_url: 'antiepidemic_archives/edit',
  11. del_url: 'antiepidemic_archives/del',
  12. multi_url: 'antiepidemic_archives/multi',
  13. import_url: 'antiepidemic_archives/import',
  14. table: 'antiepidemic_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: 'durg_name', title: __('Durg_name'), operate: 'LIKE'},
  28. {field: 'durg_brand', title: __('Durg_brand'), operate: 'LIKE'},
  29. {field: 'specifications', title: __('Specifications'), operate: 'LIKE'},
  30. {field: 'store_house_text', title: __('Store_house')},
  31. {field: 'unit_id_text', title: __('Unit_id')},
  32. {field: 'amount', title: __('Amount')},
  33. {field: 'put_in', title: __('Put_in')},
  34. {field: 'put_out', title: __('Put_out')},
  35. //{field: 'remarks', title: __('Remarks'), operate: 'LIKE'},
  36. {field: 'admin_id_text', title: __('Admin_id')},
  37. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  38. {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime,visible:false},
  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. table.on('post-body.bs.table', function () {
  46. $(".btn-editone").data("area", ["735px", "420px"]);
  47. })
  48. },
  49. add: function () {
  50. Controller.api.bindevent();
  51. },
  52. edit: function () {
  53. Controller.api.bindevent();
  54. },
  55. api: {
  56. bindevent: function () {
  57. Form.api.bindevent($("form[role=form]"));
  58. }
  59. }
  60. };
  61. return Controller;
  62. });