file_management.js 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. // 初始化表格参数配置
  6. Table.api.init({
  7. extend: {
  8. index_url: 'file_management/index' + location.search,
  9. add_url: 'file_management/add',
  10. edit_url: 'file_management/edit',
  11. del_url: 'file_management/del',
  12. multi_url: 'file_management/multi',
  13. import_url: 'file_management/import',
  14. table: 'file_management',
  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: 'id', title: __('Id')},
  27. {field: 'number', title: __('Number'), operate: 'LIKE'},
  28. {field: 'name', title: __('Name'), operate: 'LIKE'},
  29. {field: 'incoming_dispatches_time', title: __('Incoming_dispatches_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  30. {field: 'confidential', title: __('Confidential'), operate: 'LIKE'},
  31. {field: 'copies', title: __('Copies')},
  32. {field: 'people_id_text', title: __('People_id')},
  33. {field: 'borrow_id', title: __('Borrow_id')},
  34. {field: 'loan_time', title: __('Loan_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  35. {field: 'return_time', title: __('return_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  36. {field: 'logout_id', title: __('Logout_id')},
  37. {field: 'unit_id_text', title: __('Unit_id')},
  38. {field: 'createtime', title: __('Createtime'), operate: 'LIKE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  39. //{field: 'updatetime', title: __('Updatetime'), operate: 'LIKE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  40. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,buttons: [
  41. {
  42. name: '查看',
  43. text: '查看',
  44. title: '查看',
  45. classname: 'btn btn-xs btn-info btn-view btn-dialog ',
  46. icon: 'fa fa-search',
  47. url: 'file_management/details',
  48. extend: 'data-area=\'["1000px","80%"]\'',
  49. refresh: true
  50. }
  51. ], formatter: Table.api.formatter.operate}
  52. ]
  53. ]
  54. });
  55. // 为表格绑定事件
  56. Table.api.bindevent(table);
  57. table.on('post-body.bs.table',function(){
  58. $(".btn-editone").data("area",["1000px","360px"]);
  59. })
  60. // $(".btn-dialog").data("area",["1000px","500px"]);
  61. table.on('post-body.bs.table',function(){
  62. $(".btn-dialog").data("area",["1100px","620px"]);
  63. })
  64. },
  65. add: function () {
  66. Controller.api.bindevent();
  67. $("#c-people_id,#c-borrow_id,#c-logout_id").data("params", function (obj) {
  68. var unit_id = $('#J_unitselect').val();
  69. return {"custom[unit_id][0]":"in","custom[unit_id][1]":unit_id};
  70. });
  71. },
  72. edit: function () {
  73. Controller.api.bindevent();
  74. $("#c-people_id,#c-borrow_id,#c-logout_id").data("params", function (obj) {
  75. var unit_id = $('#J_unitselect').val();
  76. return {"custom[unit_id][0]":"in","custom[unit_id][1]":unit_id};
  77. });
  78. },
  79. api: {
  80. bindevent: function () {
  81. Form.api.bindevent($("form[role=form]"));
  82. }
  83. }
  84. };
  85. return Controller;
  86. });