Showing
1 changed file
with
17 additions
and
9 deletions
... | ... | @@ -21,13 +21,18 @@ |
21 | 21 | </Authority> |
22 | 22 | </template> |
23 | 23 | <template #status="{ record }"> |
24 | - <Switch | |
25 | - :checked="record.status === 1" | |
26 | - :loading="record.pendingStatus" | |
27 | - checkedChildren="启用" | |
28 | - unCheckedChildren="禁用" | |
29 | - @change="(checked:boolean)=>statusChange(checked,record)" | |
30 | - /> | |
24 | + <Authority value="api:yt:role:status"> | |
25 | + <Switch | |
26 | + :checked="record.status === 1" | |
27 | + :loading="record.pendingStatus" | |
28 | + checkedChildren="启用" | |
29 | + unCheckedChildren="禁用" | |
30 | + @change="(checked:boolean)=>statusChange(checked,record)" | |
31 | + /> | |
32 | + </Authority> | |
33 | + <Tag v-if="!hasPermission('api:yt:role:status')" :color="record.status ? 'green' : 'red'"> | |
34 | + {{ record.status ? '启用' : '禁用' }} | |
35 | + </Tag> | |
31 | 36 | </template> |
32 | 37 | <template #action="{ record }"> |
33 | 38 | <TableAction |
... | ... | @@ -67,12 +72,14 @@ |
67 | 72 | import { Authority } from '/@/components/Authority'; |
68 | 73 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; |
69 | 74 | import { useMessage } from '/@/hooks/web/useMessage'; |
70 | - import { Switch, Popconfirm } from 'ant-design-vue'; | |
75 | + import { Switch, Popconfirm, Tag } from 'ant-design-vue'; | |
76 | + import { usePermission } from '/@/hooks/web/usePermission'; | |
71 | 77 | |
72 | 78 | export default defineComponent({ |
73 | 79 | name: 'RoleManagement', |
74 | - components: { BasicTable, RoleDrawer, TableAction, Authority, Switch, Popconfirm }, | |
80 | + components: { BasicTable, RoleDrawer, TableAction, Authority, Switch, Popconfirm, Tag }, | |
75 | 81 | setup() { |
82 | + const { hasPermission } = usePermission(); | |
76 | 83 | const [registerDrawer, { openDrawer }] = useDrawer(); |
77 | 84 | function handleSuccess() { |
78 | 85 | reload(); |
... | ... | @@ -157,6 +164,7 @@ |
157 | 164 | hasBatchDelete, |
158 | 165 | handleDeleteOrBatchDelete, |
159 | 166 | statusChange, |
167 | + hasPermission, | |
160 | 168 | }; |
161 | 169 | }, |
162 | 170 | }); | ... | ... |