|
2 | 2 | <div>
|
3 | 3 | <BasicTable @register="registerTable" :class="$props.source === 1 ? prefixCls : ''">
|
4 | 4 | <template #toolbar>
|
5 |
| - <a-button type="primary" @click="handleCreate" v-auth="['sys:role:insert', 'sys:tenantRole:insert']" |
| 5 | + <a-button |
| 6 | + type="primary" |
| 7 | + @click="handleCreate" |
| 8 | + v-if=" |
| 9 | + (source === 1 && hasPermission('sys:tenantRole:insert')) || |
| 10 | + (source !== 1 && hasPermission('sys:role:insert')) |
| 11 | + " |
6 | 12 | >新增角色
|
7 | 13 | </a-button>
|
8 | 14 | </template>
|
|
13 | 19 | {
|
14 | 20 | icon: 'ant-design:edit-outlined',
|
15 | 21 | onClick: handleEdit.bind(null, record),
|
16 |
| - auth: ['sys:role:update', 'sys:tenantRole:update'] |
| 22 | + ifShow: |
| 23 | + (source === 1 && hasPermission('sys:tenantRole:update')) || |
| 24 | + (source !== 1 && hasPermission('sys:role:update')) |
17 | 25 | },
|
18 | 26 | {
|
19 | 27 | icon: 'ant-design:delete-outlined',
|
|
23 | 31 | placement: 'left',
|
24 | 32 | confirm: handleDelete.bind(null, record)
|
25 | 33 | },
|
26 |
| - ifShow: record.id !== '1' && hasPermission(['sys:role:delete', 'sys:tenantRole:delete']) |
| 34 | + ifShow: |
| 35 | + !isSuperRole(record.id) && |
| 36 | + ((source === 1 && hasPermission('sys:tenantRole:delete')) || |
| 37 | + (source !== 1 && hasPermission('sys:role:delete'))) |
27 | 38 | }
|
28 | 39 | ]"
|
29 | 40 | />
|
|
63 | 74 | default: null
|
64 | 75 | }
|
65 | 76 | });
|
66 |
| - const { hasPermission } = usePermission(); |
| 77 | + const { hasPermission, isSuperRole } = usePermission(); |
67 | 78 | const [registerModal, { openModal }] = useModal();
|
68 | 79 | const { prefixCls } = useDesign("role");
|
69 | 80 | const api = ref();
|
|
108 | 119 | });
|
109 | 120 | }
|
110 | 121 | const statusLoading = ref(false);
|
111 |
| - const statusDisabled = (record) => record.id === "1" || !hasPermission(["sys:role:update", "sys:tenantRole:update"]); |
| 122 | + const statusDisabled = (record) => |
| 123 | + isSuperRole(record.id) || |
| 124 | + !( |
| 125 | + (props.source === 1 && hasPermission("sys:tenantRole:update")) || |
| 126 | + (props.source !== 1 && hasPermission("sys:role:update")) |
| 127 | + ); |
112 | 128 |
|
113 | 129 | function handleStatus(record: SsoRole) {
|
114 | 130 | statusLoading.value = true;
|
|
0 commit comments