trainactive.js 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"0":__('Status 0')}, formatter: Table.api.formatter.status},
  29. {field: 'logo_image', title: __('Logo_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
  30. {field: 'title', title: __('Title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  31. {field: 'number', title: __('Number'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  32. {field: 'version', title: __('Version'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  33. {field: 'bianzhiren', title: __('Bianzhiren'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  34. {field: 'pizhunren', title: __('Pizhunren'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  35. {field: 'shenheren', title: __('Shenheren'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  36. {field: 'kongzhiren', title: __('Kongzhiren'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  37. {field: 'department', title: __('Department'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  38. {field: 'wenjianstatus', title: __('Wenjianstatus'), operate: 'LIKE', formatter: Table.api.formatter.status},
  39. {field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  40. // {field: 'cate_id', title: __('Cate_id')},
  41. {field: 'cate.name', title: __('Cate.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  42. // {field: 'level_id', title: __('Level_id')},
  43. {field: 'level.name', title: __('Level.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  44. {field: 'fangshi', title: __('Fangshi'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  45. {field: 'starttime', title: __('Starttime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  46. {field: 'endtime', title: __('Endtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  47. {field: 'address', title: __('Address'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  48. {field: 'zhuchiren', title: __('Zhuchiren'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  49. {field: 'zhujiangren', title: __('Zhujiangren'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  50. // {field: 'type_id', title: __('Type_id')},
  51. {field: 'type.name', title: __('Type.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  52. {field: 'info', title: __('Info'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  53. {field: 'files', title: __('Files'), operate: false, formatter: Table.api.formatter.files},
  54. {field: 'pingjia_image', title: __('Pingjia_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
  55. {field: 'pingjia_time', title: __('Pingjia_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  56. {field: 'pingjia_uid', title: __('Pingjia_uid')},
  57. {field: 'sign_starttime', title: __('Sign_starttime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  58. {field: 'sign_endtime', title: __('Sign_endtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  59. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  60. {field: 'usercount', title: __('Usercount')},
  61. {field: 'userauth_status', title: __('Userauth_status'), searchList: {"0":__('Userauth_status 0'),"1":__('Userauth_status 1')}, formatter: Table.api.formatter.status},
  62. {field: 'operate', title: __('Operate'), table: table,
  63. buttons:[
  64. {
  65. name:'qrcode',
  66. text:'二维码',
  67. title:'二维码',
  68. icon:'fa fa-exclamation-circle',
  69. classname:'btn btn-xs btn-info btn-dialog',
  70. url:'trainactive/qrcode/id/{ids}?dialog=1',
  71. target:'_self',
  72. }
  73. ],
  74. events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  75. ]
  76. ]
  77. });
  78. // 为表格绑定事件
  79. Table.api.bindevent(table);
  80. },
  81. recyclebin: function () {
  82. // 初始化表格参数配置
  83. Table.api.init({
  84. extend: {
  85. 'dragsort_url': ''
  86. }
  87. });
  88. var table = $("#table");
  89. // 初始化表格
  90. table.bootstrapTable({
  91. url: 'trainactive/recyclebin' + location.search,
  92. pk: 'id',
  93. sortName: 'id',
  94. columns: [
  95. [
  96. {checkbox: true},
  97. {field: 'id', title: __('Id')},
  98. {field: 'title', title: __('Title'), align: 'left'},
  99. {
  100. field: 'deletetime',
  101. title: __('Deletetime'),
  102. operate: 'RANGE',
  103. addclass: 'datetimerange',
  104. formatter: Table.api.formatter.datetime
  105. },
  106. {
  107. field: 'operate',
  108. width: '140px',
  109. title: __('Operate'),
  110. table: table,
  111. events: Table.api.events.operate,
  112. buttons: [
  113. {
  114. name: 'Restore',
  115. text: __('Restore'),
  116. classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
  117. icon: 'fa fa-rotate-left',
  118. url: 'trainactive/restore',
  119. refresh: true
  120. },
  121. {
  122. name: 'Destroy',
  123. text: __('Destroy'),
  124. classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
  125. icon: 'fa fa-times',
  126. url: 'trainactive/destroy',
  127. refresh: true
  128. }
  129. ],
  130. formatter: Table.api.formatter.operate
  131. }
  132. ]
  133. ]
  134. });
  135. // 为表格绑定事件
  136. Table.api.bindevent(table);
  137. },
  138. add: function () {
  139. Controller.api.bindevent();
  140. },
  141. qrcode: function () {
  142. Controller.api.bindevent();
  143. },
  144. edit: function () {
  145. Controller.api.bindevent();
  146. },
  147. api: {
  148. bindevent: function () {
  149. Form.api.bindevent($("form[role=form]"));
  150. }
  151. }
  152. };
  153. return Controller;
  154. });