index.html 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <el-card shadow="never">
  3. <template #header>
  4. <el-alert effect="dark" :closable="false" title="使用说明">角色组可以有多个,角色有上下级层级关系,如果子角色有角色组和管理员的权限则可以派生属于自己组别的下级角色组或管理员</el-alert>
  5. </template>
  6. <yun-table
  7. :columns="columns"
  8. :common-search="false"
  9. :pagination="false"
  10. order="asc"
  11. ref="yuntable"
  12. :is-tree="true"
  13. :tree-expand-all="true"
  14. toolbar="refresh,add,del"
  15. :auth="auth"
  16. :extend="extend">
  17. </yun-table>
  18. </el-card>
  19. </template>
  20. <script>
  21. import table from "@components/Table.js";
  22. import {inArray} from "@util.js";
  23. const doCheck=function (tree,checkKey){
  24. tree.forEach(res=>{
  25. checkKey.push(res.id);
  26. if(res.children && res.children.length>0){
  27. doCheck(res.children,checkKey);
  28. }
  29. });
  30. }
  31. export default{
  32. components:{'YunTable':table},
  33. data:{
  34. auth:{
  35. add:Yunqi.auth.check('app\\admin\\controller\\auth\\Group','add'),
  36. edit:Yunqi.auth.check('app\\admin\\controller\\auth\\Group','edit'),
  37. del:Yunqi.auth.check('app\\admin\\controller\\auth\\Group','del'),
  38. multi:Yunqi.auth.check('app\\admin\\controller\\auth\\Group','multi'),
  39. },
  40. extend:{
  41. index_url: 'auth/group/index',
  42. add_url: 'auth/group/add',
  43. edit_url: 'auth/group/edit',
  44. del_url: 'auth/group/del',
  45. multi_url: 'auth/group/multi'
  46. },
  47. columns:[
  48. {checkbox: true,selectable:function (row,index){
  49. if(inArray(Yunqi.data.groupids,row.id)){
  50. return false;
  51. }
  52. return true;
  53. }},
  54. {field: 'id',title: __('ID'),width:80},
  55. {field: 'name', title: __('名称'),align:'left'},
  56. {field: 'status', title: __('状态'),searchList: {'normal': __('正常'),'hidden': __('隐藏')},formatter:function(data,row){
  57. let sw=Yunqi.formatter.switch;
  58. sw.activeValue='normal';
  59. sw.inactiveValue='hidden';
  60. sw.value=row.status;
  61. if(inArray(Yunqi.data.groupids,row.id)){
  62. sw.disabled=true;
  63. }else{
  64. sw.disabled=false;
  65. }
  66. return sw;
  67. }},
  68. {treeExpand: true},
  69. {
  70. field: 'operate',
  71. title: __('操作'),
  72. width:150,
  73. action:{
  74. edit:function(row){
  75. return !inArray(Yunqi.data.groupids,row.id);
  76. },
  77. del:function(row){
  78. return !inArray(Yunqi.data.groupids,row.id);
  79. }
  80. }
  81. }
  82. ]
  83. },
  84. methods: {
  85. }
  86. }
  87. </script>
  88. <style>
  89. </style>