secrecy.js 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. $(".btn-add").data("area",["1000px","360px"]);
  5. $(".btn-edit").data("area",["1000px","360px"]);
  6. // 初始化表格参数配置
  7. Table.api.init({
  8. extend: {
  9. index_url: 'secrecy/index' + location.search,
  10. add_url: 'secrecy/add',
  11. edit_url: 'secrecy/edit',
  12. del_url: 'secrecy/del',
  13. multi_url: 'secrecy/multi',
  14. import_url: 'secrecy/import',
  15. table: 'secrecy',
  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: 'order_number', title: __('Id')},
  28. {field: 'secrecy_type_text', title: __('Secrecy_type')},
  29. {field: 'number', title: __('Number'), operate: 'LIKE'},
  30. {field: 'name', title: __('Name'), operate: 'LIKE'},
  31. {field: 'kind', title: __('Kind'), operate: 'LIKE'},
  32. {field: 'version', title: __('Version'), operate: 'LIKE'},
  33. {field: 'confidential', title: __('Confidential'), operate: 'LIKE'},
  34. {field: 'people_id_text', title: __('People_id')},
  35. {field: 'people_id1_text', title: __('People_id1')},
  36. {field: 'people_id2_text', title: __('People_id2')},
  37. {field: 'start_time', title: __('Start_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  38. {field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  39. {field: 'hind_over_time', title: __('Hind_over_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  40. {field: 'unit_id_text', title: __('Unit_id')},
  41. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,buttons: [
  42. {
  43. name: '查看',
  44. text: '查看',
  45. title: '查看',
  46. classname: 'btn btn-xs btn-info btn-view btn-dialog ',
  47. icon: 'fa fa-search',
  48. url: 'secrecy/details',
  49. extend: 'data-area=\'["1100px","80%"]\'',
  50. refresh: true
  51. }
  52. ], formatter: Table.api.formatter.operate}
  53. ]
  54. ]
  55. });
  56. // 为表格绑定事件
  57. Table.api.bindevent(table);
  58. table.on('post-body.bs.table',function(){
  59. $(".btn-editone").data("area",["1000px","360px"]);
  60. })
  61. },
  62. add: function () {
  63. Controller.api.bindevent();
  64. $("#c-people_id,#c-people_id1,#c-people_id2").data("params", function (obj) {
  65. var unit_id = $('#J_unitselect').val();
  66. return {"custom[unit_id][0]":"in","custom[unit_id][1]":unit_id};
  67. });
  68. },
  69. edit: function () {
  70. Controller.api.bindevent();
  71. $("#c-people_id,#c-people_id1,#c-people_id2").data("params", function (obj) {
  72. var unit_id = $('#J_unitselect').val();
  73. return {"custom[unit_id][0]":"in","custom[unit_id][1]":unit_id};
  74. });
  75. },
  76. api: {
  77. bindevent: function () {
  78. Form.api.bindevent($("form[role=form]"));
  79. }
  80. }
  81. };
  82. return Controller;
  83. });