index.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. import { filterRoutes, generteMenus } from '@/utils/route'
  2. import router from '@/router'
  3. export const handleDisabled = (arr) => {
  4. arr.forEach((item) => {
  5. delete item.disabled
  6. if (item.children.length > 0) {
  7. handleDisabled(item.children)
  8. }
  9. })
  10. }
  11. export const Addrolerules = {
  12. roleName: [
  13. { required: true, message: '请填写角色名称', trigger: 'blur' },
  14. { min: 1, max: 15, message: '长度在1到15个字符', trigger: 'blur' }
  15. ],
  16. roleKey: [
  17. { required: true, message: '请填写角色标识', trigger: 'blur' },
  18. {
  19. type: 'string',
  20. pattern: /^[a-zA-Z]{1,15}$/g,
  21. message: '请输入1到15位的英文字母',
  22. trigger: 'blur'
  23. }
  24. ],
  25. remark: [{ message: '请填写角色描述', trigger: 'blur' }]
  26. }
  27. export const columns = (_this) => {
  28. return [
  29. {
  30. prop: 'roleKey',
  31. label: '角色标识',
  32. align: 'center'
  33. },
  34. {
  35. prop: 'roleName',
  36. label: '角色名称'
  37. },
  38. {
  39. prop: 'createTime',
  40. label: '创建时间'
  41. },
  42. {
  43. button: true,
  44. label: '操作',
  45. width: '200px',
  46. group: [
  47. {
  48. name: '配置菜单',
  49. type: 'text',
  50. round: false,
  51. plain: false,
  52. onClick: (row, index, scope) => {
  53. _this.menuClick(scope)
  54. }
  55. },
  56. {
  57. name: '编辑',
  58. type: 'text',
  59. round: false,
  60. plain: false,
  61. onClick: (row, index, scope) => {
  62. _this.edit(scope)
  63. }
  64. },
  65. {
  66. name: '删除',
  67. type: 'text',
  68. round: false,
  69. plain: false,
  70. onClick: (row, index, scope) => {
  71. _this.handRemove(row)
  72. }
  73. }
  74. ]
  75. }
  76. ]
  77. }
  78. export const options = {
  79. stripe: false, // 斑马纹
  80. mutiSelect: false, // 多选框
  81. index: false, // 显示序号, 多选则 mutiSelect
  82. loading: false, // 表格动画
  83. border: true,
  84. initTable: true, // 是否一挂载就加载数据
  85. height: 'calc(100vh - 345px)',
  86. cursor: 'pointer' // 行鼠标形状
  87. }
  88. export const rightColumns = (_this) => {
  89. return [
  90. {
  91. prop: 'nickName',
  92. label: '用户名称',
  93. align: 'center'
  94. },
  95. {
  96. prop: 'userName',
  97. label: '登录账号'
  98. },
  99. {
  100. prop: 'deptName',
  101. label: '所属组织机构'
  102. },
  103. {
  104. prop: 'majorName',
  105. label: '所属专业'
  106. },
  107. {
  108. prop: 'sex',
  109. label: '性别',
  110. width: '80px',
  111. render: (h, params) => {
  112. if (params.row.sex == 1) {
  113. return h('span', '男')
  114. } else {
  115. return h('span', '女')
  116. }
  117. }
  118. }
  119. ]
  120. }
  121. export const rightOptions = {
  122. stripe: false, // 斑马纹
  123. mutiSelect: true, // 多选框
  124. index: false, // 显示序号, 多选则 mutiSelect
  125. loading: false, // 表格动画
  126. border: true,
  127. initTable: false, // 是否一挂载就加载数据
  128. height: 'calc(100vh - 355px)'
  129. }