active.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  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: 'active/index' + location.search,
  8. add_url: 'active/add',
  9. edit_url: 'active/edit',
  10. del_url: 'active/del',
  11. multi_url: 'active/multi',
  12. import_url: 'active/import',
  13. table: 'active',
  14. }
  15. });
  16. var table = $("#table");
  17. // 初始化表格
  18. table.bootstrapTable({
  19. url: $.fn.bootstrapTable.defaults.extend.index_url,
  20. pk: 'id',
  21. sortName: 'weigh desc, id desc',
  22. fixedColumns: true,
  23. fixedRightNumber: 1,
  24. columns: [
  25. [
  26. {checkbox: true},
  27. {field: 'id', title: __('Id')},
  28. {field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2')}, formatter: Table.api.formatter.normal},
  29. {field: 'title', title: __('Title'), operate: 'LIKE'},
  30. {field: 'desc', title: __('Desc'), operate: 'LIKE'},
  31. {field: 'remark', title: __('Remark'), operate: 'LIKE'},
  32. {field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
  33. {field: 'price', title: __('Price'), operate: 'LIKE'},
  34. {field: 'starttime', title: __('Starttime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  35. {field: 'endtime', title: __('Endtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  36. {field: 'collectionplace', title: __('Collectionplace'), operate: 'LIKE'},
  37. {field: 'collectiontime', title: __('Collectiontime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  38. {field: 'insurance', title: __('Insurance'), operate: 'LIKE'},
  39. {field: 'leader', title: __('Leader'), operate: 'LIKE'},
  40. {field: 'maxperson', title: __('Maxperson')},
  41. {field: 'minperson', title: __('最低成行人数')},
  42. {field: 'currentperson', title: __('Currentperson')},
  43. {field: 'signupendtime', title: __('Signupendtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  44. {field: 'refundendtime', title: __('Refundendtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  45. {field: 'is_free', title: __('Is_free'), searchList: {"0":__('Is_free 0'),"1":__('Is_free 1')}, formatter: Table.api.formatter.normal},
  46. {field: 'is_overlying', title: __('Is_overlying'), searchList: {"0":__('Is_overlying 0'),"1":__('Is_overlying 1')}, formatter: Table.api.formatter.normal},
  47. {field: 'girldiscount', title: __('Girldiscount')},
  48. {field: 'minage', title: __('Minage')},
  49. {field: 'maxage', title: __('Maxage')},
  50. {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3')}, formatter: Table.api.formatter.status},
  51. {field: 'weigh', title: __('Weigh'), operate: false},
  52. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  53. {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  54. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
  55. buttons: [
  56. {
  57. name: 'activeorder',
  58. text: '活动订单',
  59. title: __('活动订单'),
  60. extend: 'data-area=\'["85%", "85%"]\'',
  61. classname: 'btn btn-xs btn-success btn-dialog',
  62. icon: 'fa fa-list',
  63. url: 'activeorder/index',
  64. // callback: function (data) {
  65. // Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
  66. // }
  67. // success: function (data, ret) {
  68. // // Layer.alert(ret.msg + ",返回数据:" + JSON.stringify(data));
  69. // Layer.alert(ret.msg);
  70. // //如果需要阻止成功提示,则必须使用return false;
  71. // return false;
  72. // },
  73. // error: function (data, ret) {
  74. // // console.log(data, ret);
  75. // Layer.alert(ret.msg);
  76. // return false;
  77. // },
  78. // callback: function (data) {
  79. // Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
  80. // },
  81. // visible: function (row) {
  82. // if (row.status == 1 && row.purpose == 3) {
  83. // return true;
  84. // } else {
  85. // return false;
  86. // }
  87. // }
  88. },
  89. {
  90. name: 'activeorder',
  91. text: '报名人员',
  92. title: __('报名人员'),
  93. extend: 'data-area=\'["85%", "85%"]\'',
  94. classname: 'btn btn-xs btn-success btn-dialog',
  95. icon: 'fa fa-list',
  96. url: 'activepeople/index',
  97. // callback: function (data) {
  98. // Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
  99. // }
  100. // success: function (data, ret) {
  101. // // Layer.alert(ret.msg + ",返回数据:" + JSON.stringify(data));
  102. // Layer.alert(ret.msg);
  103. // //如果需要阻止成功提示,则必须使用return false;
  104. // return false;
  105. // },
  106. // error: function (data, ret) {
  107. // // console.log(data, ret);
  108. // Layer.alert(ret.msg);
  109. // return false;
  110. // },
  111. // callback: function (data) {
  112. // Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
  113. // },
  114. // visible: function (row) {
  115. // if (row.status == 1 && row.purpose == 3) {
  116. // return true;
  117. // } else {
  118. // return false;
  119. // }
  120. // }
  121. },
  122. {
  123. name: 'edit',
  124. text: '',
  125. title: __('编辑'),
  126. // extend: 'data-area=\'["85%", "85%"]\'',
  127. classname: 'btn btn-xs btn-success btn-editone',
  128. icon: 'fa fa-pencil',
  129. // confirm: '确认删除?',
  130. url: 'active/edit',
  131. refresh: true,
  132. // success: function (data, ret) {
  133. // // Layer.alert(ret.msg + ",返回数据:" + JSON.stringify(data));
  134. // Layer.alert(ret.msg);
  135. // //如果需要阻止成功提示,则必须使用return false;
  136. // return false;
  137. // },
  138. // error: function (data, ret) {
  139. // // console.log(data, ret);
  140. // Layer.alert(ret.msg);
  141. // return false;
  142. // },
  143. // callback: function (data) {
  144. // Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
  145. // },
  146. // visible: function (row) {
  147. // if (row.status == 0) {
  148. // return true;
  149. // } else {
  150. // return false;
  151. // }
  152. // }
  153. },
  154. {
  155. name: 'del',
  156. text: '',
  157. title: __('删除'),
  158. extend: 'data-area=\'["85%", "85%"]\'',
  159. classname: 'btn btn-xs btn-danger btn-delone',
  160. icon: 'fa fa-trash',
  161. confirm: '确认删除?',
  162. url: 'active/del',
  163. refresh: true,
  164. // success: function (data, ret) {
  165. // // Layer.alert(ret.msg + ",返回数据:" + JSON.stringify(data));
  166. // Layer.alert(ret.msg);
  167. // //如果需要阻止成功提示,则必须使用return false;
  168. // return false;
  169. // },
  170. // error: function (data, ret) {
  171. // // console.log(data, ret);
  172. // Layer.alert(ret.msg);
  173. // return false;
  174. // },
  175. // callback: function (data) {
  176. // Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
  177. // },
  178. visible: function (row) {
  179. if (row.status == 0) {
  180. return true;
  181. } else {
  182. return false;
  183. }
  184. }
  185. },
  186. {
  187. name: 'dragsort',
  188. text: '',
  189. title: __('拖动'),
  190. extend: 'data-area=\'["85%", "85%"]\'',
  191. classname: 'btn btn-xs btn-danger btn-delone',
  192. icon: 'fa fa-trash',
  193. confirm: '确认删除?',
  194. url: 'active/del',
  195. refresh: true,
  196. // success: function (data, ret) {
  197. // // Layer.alert(ret.msg + ",返回数据:" + JSON.stringify(data));
  198. // Layer.alert(ret.msg);
  199. // //如果需要阻止成功提示,则必须使用return false;
  200. // return false;
  201. // },
  202. // error: function (data, ret) {
  203. // // console.log(data, ret);
  204. // Layer.alert(ret.msg);
  205. // return false;
  206. // },
  207. // callback: function (data) {
  208. // Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
  209. // },
  210. visible: function (row) {
  211. return false;
  212. }
  213. }
  214. ]
  215. }
  216. ]
  217. ]
  218. });
  219. // 为表格绑定事件
  220. Table.api.bindevent(table);
  221. },
  222. add: function () {
  223. Controller.api.bindevent();
  224. },
  225. edit: function () {
  226. Controller.api.bindevent();
  227. },
  228. api: {
  229. bindevent: function () {
  230. Form.api.bindevent($("form[role=form]"));
  231. }
  232. }
  233. };
  234. return Controller;
  235. });