group.js 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. define(['jquery', 'table', 'form'], function($, Table, Form) {
  2. var Controller = {
  3. index: function() {
  4. Table.init = {
  5. table_elem: '#currentTable',
  6. table_render_id: 'currentTable',
  7. add_url: "user.group/add",
  8. edit_url: "user.group/edit",
  9. delete_url: "user.group/del",
  10. multi_url: 'user.group/multi',
  11. };
  12. Table.render({
  13. init: Table.init,
  14. toolbar: ['refresh', 'add', 'edit'],
  15. url: 'user.group/index',
  16. search: false,
  17. cols: [
  18. [
  19. { type: 'checkbox', fixed: 'left' },
  20. { field: 'id', width: 80, title: 'ID' },
  21. { field: 'name', minWidth: 120, align: "left", title: '会员组名' },
  22. { field: 'issystem', width: 100, title: '系统组', align: "center", templet: '#issystem' },
  23. { field: 'user_count', width: 100, align: "center", title: '会员数' },
  24. { field: 'point', width: 100, align: "center", title: '所需积分' },
  25. { field: 'create_time', width: 180, title: '创建时间', search: 'range' },
  26. { field: 'status', width: 80, title: '状态', templet: Table.formatter.status, selectList: { 0: '禁用', 1: '正常' }, search: false },
  27. {
  28. fixed: 'right',
  29. width: 85,
  30. title: '操作',
  31. templet: Table.formatter.tool,
  32. operat: [
  33. 'edit',
  34. {
  35. class: 'layui-btn layui-btn-danger layui-btn-xs',
  36. hidden: function(row) {
  37. //为true隐藏按钮
  38. return row.issystem == 1;
  39. },
  40. icon:'iconfont icon-delete-bin-line',
  41. auth: 'delete',
  42. text: "",
  43. title: '',
  44. extend: "lay-event='btn-delone'",
  45. }
  46. ]
  47. }
  48. ]
  49. ]
  50. });
  51. Table.api.bindevent();
  52. },
  53. add: function() {
  54. Controller.api.bindevent();
  55. },
  56. edit: function() {
  57. Controller.api.bindevent();
  58. },
  59. api: {
  60. bindevent: function() {
  61. Form.api.bindevent($("form.layui-form"));
  62. }
  63. }
  64. };
  65. return Controller;
  66. });