usertrainevaluate.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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: 'usertrainevaluate/index' + location.search,
  8. add_url: 'usertrainevaluate/add',
  9. edit_url: 'usertrainevaluate/edit',
  10. del_url: 'usertrainevaluate/del',
  11. multi_url: 'usertrainevaluate/multi',
  12. import_url: 'usertrainevaluate/import',
  13. table: 'user_train_evaluate',
  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. columns: [
  23. [
  24. {checkbox: true},
  25. {field: 'id', title: __('Id')},
  26. {field: 'train_id', title: __('Train_id')},
  27. {field: 'active.name', title: __('Active.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  28. {field: 'active.number', title: __('Active.number'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  29. {field: 'user_id', title: __('User_id')},
  30. // {field: 'user.username', title: __('User.username'), operate: 'LIKE'},
  31. {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
  32. // {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
  33. {field: 'user.avatar', title: __('User.avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
  34. {field: 'user.idcard_status', title: __('User.idcard_status'), searchList: {"-1":__('User.idcard_status -1'),"0":__('User.idcard_status 0'),"1":__('User.idcard_status 1'),"2":__('User.idcard_status 2')}, formatter: Table.api.formatter.status},
  35. {field: 'evaluate_time', title: __('Evaluate_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  36. {field: 'score', title: __('Score')},
  37. // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  38. ]
  39. ]
  40. });
  41. // 为表格绑定事件
  42. Table.api.bindevent(table);
  43. },
  44. add: function () {
  45. Controller.api.bindevent();
  46. },
  47. edit: function () {
  48. Controller.api.bindevent();
  49. },
  50. api: {
  51. bindevent: function () {
  52. Form.api.bindevent($("form[role=form]"));
  53. }
  54. }
  55. };
  56. return Controller;
  57. });