trainactive.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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. name:'showinfo',
  75. text:'打印',
  76. title:'打印',
  77. icon:'fa fa-exclamation-circle',
  78. classname:'btn btn-xs btn-info btn-dialog',
  79. url:'trainactive/showinfo/id/{ids}?dialog=1',
  80. target:'_self',
  81. }
  82. ],
  83. events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  84. ]
  85. ]
  86. });
  87. // 为表格绑定事件
  88. Table.api.bindevent(table);
  89. },
  90. recyclebin: function () {
  91. // 初始化表格参数配置
  92. Table.api.init({
  93. extend: {
  94. 'dragsort_url': ''
  95. }
  96. });
  97. var table = $("#table");
  98. // 初始化表格
  99. table.bootstrapTable({
  100. url: 'trainactive/recyclebin' + location.search,
  101. pk: 'id',
  102. sortName: 'id',
  103. columns: [
  104. [
  105. {checkbox: true},
  106. {field: 'id', title: __('Id')},
  107. {field: 'title', title: __('Title'), align: 'left'},
  108. {
  109. field: 'deletetime',
  110. title: __('Deletetime'),
  111. operate: 'RANGE',
  112. addclass: 'datetimerange',
  113. formatter: Table.api.formatter.datetime
  114. },
  115. {
  116. field: 'operate',
  117. width: '140px',
  118. title: __('Operate'),
  119. table: table,
  120. events: Table.api.events.operate,
  121. buttons: [
  122. {
  123. name: 'Restore',
  124. text: __('Restore'),
  125. classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
  126. icon: 'fa fa-rotate-left',
  127. url: 'trainactive/restore',
  128. refresh: true
  129. },
  130. {
  131. name: 'Destroy',
  132. text: __('Destroy'),
  133. classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
  134. icon: 'fa fa-times',
  135. url: 'trainactive/destroy',
  136. refresh: true
  137. }
  138. ],
  139. formatter: Table.api.formatter.operate
  140. }
  141. ]
  142. ]
  143. });
  144. // 为表格绑定事件
  145. Table.api.bindevent(table);
  146. },
  147. add: function () {
  148. Controller.api.bindevent();
  149. },
  150. qrcode: function () {
  151. Controller.api.bindevent();
  152. },
  153. edit: function () {
  154. Controller.api.bindevent();
  155. },
  156. showinfo: function () {
  157. Controller.api.bindevent();
  158. },
  159. api: {
  160. bindevent: function () {
  161. Form.api.bindevent($("form[role=form]"));
  162. }
  163. }
  164. };
  165. return Controller;
  166. });
  167. $('#left').click(function(){
  168. $('#left_table').show();
  169. $('#right_table').hide();
  170. })
  171. $('#right').click(function(){
  172. $('#left_table').hide();
  173. $('#right_table').show();
  174. })
  175. function jump(url){
  176. console.log(url);
  177. window.location.href = url;
  178. }