trainactive.js 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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: 'pingjiaren', title: __('Pingjiaren'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  50. {field: 'pingjia_time', title: __('Pingjia_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  51. {field: 'pingjia_uid', title: __('Pingjia_uid')},
  52. {field: 'sign_starttime', title: __('Sign_starttime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  53. {field: 'sign_endtime', title: __('Sign_endtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  54. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  55. {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"0":__('Status 0')}, formatter: Table.api.formatter.status},
  56. {field: 'usercount', title: __('Usercount')},
  57. {field: 'userauth_status', title: __('Userauth_status'), searchList: {"0":__('Userauth_status 0'),"1":__('Userauth_status 1')}, formatter: Table.api.formatter.status},
  58. {field: 'cate.name', title: __('Cate.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  59. {field: 'level.name', title: __('Level.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  60. {field: 'type.name', title: __('Type.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  61. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  62. ]
  63. ]
  64. });
  65. // 为表格绑定事件
  66. Table.api.bindevent(table);
  67. },
  68. recyclebin: function () {
  69. // 初始化表格参数配置
  70. Table.api.init({
  71. extend: {
  72. 'dragsort_url': ''
  73. }
  74. });
  75. var table = $("#table");
  76. // 初始化表格
  77. table.bootstrapTable({
  78. url: 'trainactive/recyclebin' + location.search,
  79. pk: 'id',
  80. sortName: 'id',
  81. columns: [
  82. [
  83. {checkbox: true},
  84. {field: 'id', title: __('Id')},
  85. {field: 'title', title: __('Title'), align: 'left'},
  86. {
  87. field: 'deletetime',
  88. title: __('Deletetime'),
  89. operate: 'RANGE',
  90. addclass: 'datetimerange',
  91. formatter: Table.api.formatter.datetime
  92. },
  93. {
  94. field: 'operate',
  95. width: '140px',
  96. title: __('Operate'),
  97. table: table,
  98. events: Table.api.events.operate,
  99. buttons: [
  100. {
  101. name: 'Restore',
  102. text: __('Restore'),
  103. classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
  104. icon: 'fa fa-rotate-left',
  105. url: 'trainactive/restore',
  106. refresh: true
  107. },
  108. {
  109. name: 'Destroy',
  110. text: __('Destroy'),
  111. classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
  112. icon: 'fa fa-times',
  113. url: 'trainactive/destroy',
  114. refresh: true
  115. }
  116. ],
  117. formatter: Table.api.formatter.operate
  118. }
  119. ]
  120. ]
  121. });
  122. // 为表格绑定事件
  123. Table.api.bindevent(table);
  124. },
  125. add: function () {
  126. Controller.api.bindevent();
  127. },
  128. edit: function () {
  129. Controller.api.bindevent();
  130. },
  131. api: {
  132. bindevent: function () {
  133. Form.api.bindevent($("form[role=form]"));
  134. }
  135. }
  136. };
  137. return Controller;
  138. });