trainactive.js 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. // 初始化表格参数配置
  5. Table.api.init({
  6. extend: {
  7. index_url: 'trainactive/index' + location.search,
  8. add_url: 'trainactive/add',
  9. edit_url: 'trainactive/edit',
  10. del_url: 'trainactive/del',
  11. multi_url: 'trainactive/multi',
  12. import_url: 'trainactive/import',
  13. table: 'train_active',
  14. }
  15. });
  16. var table = $("#table");
  17. // 初始化表格
  18. table.bootstrapTable({
  19. url: $.fn.bootstrapTable.defaults.extend.index_url,
  20. pk: 'id',
  21. sortName: 'id',
  22. fixedColumns: true,
  23. fixedRightNumber: 1,
  24. columns: [
  25. [
  26. {checkbox: true},
  27. {field: 'id', title: __('Id')},
  28. {field: 'logo_image', title: __('Logo_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
  29. {field: 'title', title: __('Title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  30. {field: 'number', title: __('Number'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  31. {field: 'version', title: __('Version'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  32. {field: 'bianzhiren', title: __('Bianzhiren'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  33. {field: 'pizhunren', title: __('Pizhunren'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  34. {field: 'shenheren', title: __('Shenheren'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  35. {field: 'kongzhiren', title: __('Kongzhiren'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  36. {field: 'department', title: __('Department'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  37. {field: 'wenjianstatus', title: __('Wenjianstatus'), operate: 'LIKE', formatter: Table.api.formatter.status},
  38. {field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  39. {field: 'cate_id', title: __('Cate_id')},
  40. {field: 'level_id', title: __('Level_id')},
  41. {field: 'fangshi', title: __('Fangshi'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  42. {field: 'starttime', title: __('Starttime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  43. {field: 'endtime', title: __('Endtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  44. {field: 'address', title: __('Address'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  45. {field: 'zhuchiren', title: __('Zhuchiren'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  46. {field: 'zhujiangren', title: __('Zhujiangren'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  47. {field: 'type_id', title: __('Type_id')},
  48. {field: 'info', title: __('Info'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  49. {field: 'files', title: __('Files'), operate: false, formatter: Table.api.formatter.files},
  50. {field: 'pingjiaren', title: __('Pingjiaren'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  51. {field: 'pingjia_time', title: __('Pingjia_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  52. {field: 'pingjia_uid', title: __('Pingjia_uid')},
  53. {field: 'sign_starttime', title: __('Sign_starttime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  54. {field: 'sign_endtime', title: __('Sign_endtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  55. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  56. {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"0":__('Status 0')}, formatter: Table.api.formatter.status},
  57. {field: 'usercount', title: __('Usercount')},
  58. {field: 'userauth_status', title: __('Userauth_status'), searchList: {"0":__('Userauth_status 0'),"1":__('Userauth_status 1')}, formatter: Table.api.formatter.status},
  59. {field: 'cate.name', title: __('Cate.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  60. {field: 'level.name', title: __('Level.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  61. {field: 'type.name', title: __('Type.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  62. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  63. ]
  64. ]
  65. });
  66. // 为表格绑定事件
  67. Table.api.bindevent(table);
  68. },
  69. recyclebin: function () {
  70. // 初始化表格参数配置
  71. Table.api.init({
  72. extend: {
  73. 'dragsort_url': ''
  74. }
  75. });
  76. var table = $("#table");
  77. // 初始化表格
  78. table.bootstrapTable({
  79. url: 'trainactive/recyclebin' + location.search,
  80. pk: 'id',
  81. sortName: 'id',
  82. columns: [
  83. [
  84. {checkbox: true},
  85. {field: 'id', title: __('Id')},
  86. {field: 'title', title: __('Title'), align: 'left'},
  87. {
  88. field: 'deletetime',
  89. title: __('Deletetime'),
  90. operate: 'RANGE',
  91. addclass: 'datetimerange',
  92. formatter: Table.api.formatter.datetime
  93. },
  94. {
  95. field: 'operate',
  96. width: '140px',
  97. title: __('Operate'),
  98. table: table,
  99. events: Table.api.events.operate,
  100. buttons: [
  101. {
  102. name: 'Restore',
  103. text: __('Restore'),
  104. classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
  105. icon: 'fa fa-rotate-left',
  106. url: 'trainactive/restore',
  107. refresh: true
  108. },
  109. {
  110. name: 'Destroy',
  111. text: __('Destroy'),
  112. classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
  113. icon: 'fa fa-times',
  114. url: 'trainactive/destroy',
  115. refresh: true
  116. }
  117. ],
  118. formatter: Table.api.formatter.operate
  119. }
  120. ]
  121. ]
  122. });
  123. // 为表格绑定事件
  124. Table.api.bindevent(table);
  125. },
  126. add: function () {
  127. Controller.api.bindevent();
  128. },
  129. edit: function () {
  130. Controller.api.bindevent();
  131. },
  132. api: {
  133. bindevent: function () {
  134. Form.api.bindevent($("form[role=form]"));
  135. }
  136. }
  137. };
  138. return Controller;
  139. });