even.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. $(".btn-add").data("area", ["1000px", "690px"]);
  5. // 初始化表格参数配置
  6. Table.api.init({
  7. extend: {
  8. index_url: 'even/index' + location.search,
  9. add_url: 'even/add',
  10. edit_url: 'even/edit',
  11. del_url: 'even/del',
  12. multi_url: 'even/multi',
  13. import_url: 'even/import',
  14. table: 'even',
  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. },
  27. {
  28. field: 'order_number',
  29. title: __('序号')
  30. },
  31. {
  32. field: 'unit_id_text',
  33. title: __('单位')
  34. },
  35. {
  36. field: 'convoke_time',
  37. title: __('Convoke_time'),
  38. operate: 'RANGE',
  39. addclass: 'datetimerange',
  40. autocomplete: false
  41. },
  42. {
  43. field: 'address',
  44. title: __('Address'),
  45. operate: 'LIKE'
  46. },
  47. {
  48. field: 'compere_id_text',
  49. title: __('Compere_id')
  50. },
  51. {
  52. field: 'join_id_text',
  53. title: __('Join_id'),
  54. operate: 'LIKE'
  55. },
  56. {
  57. field: 'people_id_text',
  58. title: __('People_id')
  59. },
  60. {
  61. field: 'title',
  62. title: __('Title'),
  63. operate: 'LIKE'
  64. },
  65. //{field: 'updatetime', title: __('Updatetime'), operate: 'LIKE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  66. {
  67. field: 'operate',
  68. title: __('Operate'),
  69. table: table,
  70. events: Table.api.events.operate,
  71. buttons: [
  72. {
  73. name: '查看',
  74. text: '查看',
  75. title: '查看',
  76. classname: 'btn btn-xs btn-info btn-view btn-dialog ',
  77. icon: 'fa fa-search',
  78. url: 'even/details',
  79. refresh: true
  80. }
  81. ],
  82. formatter: Table.api.formatter.operate
  83. }
  84. ]
  85. ]
  86. });
  87. // 为表格绑定事件
  88. Table.api.bindevent(table);
  89. table.on('post-body.bs.table', function () {
  90. $(".btn-editone").data("area", ["1000px", "690px"]);
  91. })
  92. },
  93. add: function () {
  94. Controller.api.bindevent();
  95. $("#c-people_id,#c-compere_id,#c-join_id,#c-people_ids,#c-absent_ids").data("params", function (obj) {
  96. var unit_id = $('#J_unitselect').val();
  97. return {
  98. "custom[unit_id][0]": "in",
  99. "custom[unit_id][1]": unit_id
  100. };
  101. });
  102. },
  103. edit: function () {
  104. Controller.api.bindevent();
  105. $("#c-people_id,#c-compere_id,#c-join_id,#c-people_ids,#c-absent_ids").data("params", function (obj) {
  106. var unit_id = $('#J_unitselect').val();
  107. return {
  108. "custom[unit_id][0]": "in",
  109. "custom[unit_id][1]": unit_id
  110. };
  111. });
  112. },
  113. api: {
  114. bindevent: function () {
  115. Form.api.bindevent($("form[role=form]"));
  116. }
  117. }
  118. };
  119. return Controller;
  120. });