Showing
1 changed file
with
17 additions
and
9 deletions
| @@ -21,13 +21,18 @@ | @@ -21,13 +21,18 @@ | ||
| 21 | </Authority> | 21 | </Authority> | 
| 22 | </template> | 22 | </template> | 
| 23 | <template #status="{ record }"> | 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 | </template> | 36 | </template> | 
| 32 | <template #action="{ record }"> | 37 | <template #action="{ record }"> | 
| 33 | <TableAction | 38 | <TableAction | 
| @@ -67,12 +72,14 @@ | @@ -67,12 +72,14 @@ | ||
| 67 | import { Authority } from '/@/components/Authority'; | 72 | import { Authority } from '/@/components/Authority'; | 
| 68 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; | 73 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; | 
| 69 | import { useMessage } from '/@/hooks/web/useMessage'; | 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 | export default defineComponent({ | 78 | export default defineComponent({ | 
| 73 | name: 'RoleManagement', | 79 | name: 'RoleManagement', | 
| 74 | - components: { BasicTable, RoleDrawer, TableAction, Authority, Switch, Popconfirm }, | 80 | + components: { BasicTable, RoleDrawer, TableAction, Authority, Switch, Popconfirm, Tag }, | 
| 75 | setup() { | 81 | setup() { | 
| 82 | + const { hasPermission } = usePermission(); | ||
| 76 | const [registerDrawer, { openDrawer }] = useDrawer(); | 83 | const [registerDrawer, { openDrawer }] = useDrawer(); | 
| 77 | function handleSuccess() { | 84 | function handleSuccess() { | 
| 78 | reload(); | 85 | reload(); | 
| @@ -157,6 +164,7 @@ | @@ -157,6 +164,7 @@ | ||
| 157 | hasBatchDelete, | 164 | hasBatchDelete, | 
| 158 | handleDeleteOrBatchDelete, | 165 | handleDeleteOrBatchDelete, | 
| 159 | statusChange, | 166 | statusChange, | 
| 167 | + hasPermission, | ||
| 160 | }; | 168 | }; | 
| 161 | }, | 169 | }, | 
| 162 | }); | 170 | }); |