party.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. $(".btn-add").data("area",["980px","660px"]);
  5. // 初始化表格参数配置
  6. Table.api.init({
  7. extend: {
  8. index_url: 'party/index' + location.search,
  9. add_url: 'party/add',
  10. edit_url: 'party/edit',
  11. del_url: 'party/del',
  12. multi_url: 'party/multi',
  13. import_url: 'party/import',
  14. table: 'party',
  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: __('单位')},
  28. {field: 'convoke_time', title: __('Convoke_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  29. {field: 'address', title: __('Address'), operate: 'LIKE'},
  30. {field: 'compere_id_text', title: __('Compere_id')},
  31. {field: 'join_id_text', title: __('Join_id'), operate: 'LIKE'},
  32. {field: 'people_ids_text', title: __('People_ids'), operate: 'LIKE'},
  33. {field: 'absent_ids_text', title: __('Absent_ids'), operate: 'LIKE'},
  34. {field: 'people_id_text', title: __('People_id')},
  35. {field: 'title', title: __('Title'), operate: 'LIKE'},
  36. //{field: 'createtime', title: __('Createtime'), operate: 'LIKE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  37. //{field: 'updatetime', title: __('Updatetime'), operate: 'LIKE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  38. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,buttons: [
  39. {
  40. name: '查看',
  41. text: '查看',
  42. title: '查看',
  43. classname: 'btn btn-xs btn-info btn-view btn-dialog ',
  44. icon: 'fa fa-search',
  45. url: 'party/details',
  46. refresh: true
  47. }
  48. ], formatter: Table.api.formatter.operate}
  49. ]
  50. ]
  51. });
  52. // 为表格绑定事件
  53. Table.api.bindevent(table);
  54. table.on('post-body.bs.table',function(){
  55. $(".btn-editone").data("area",["980px","660px"]);
  56. })
  57. },
  58. add: function () {
  59. Controller.api.bindevent();
  60. $("#c-people_id,#c-compere_id,#c-join_id,#c-people_ids,#c-absent_ids").data("params", function (obj) {
  61. var unit_id = $('#J_unitselect').val();
  62. return {"custom[unit_id][0]":"in","custom[unit_id][1]":unit_id};
  63. });
  64. },
  65. edit: function () {
  66. Controller.api.bindevent();
  67. $("#c-people_id,#c-compere_id,#c-join_id,#c-people_ids,#c-absent_ids").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. api: {
  73. bindevent: function () {
  74. Form.api.bindevent($("form[role=form]"));
  75. }
  76. }
  77. };
  78. return Controller;
  79. });