|
...
|
...
|
@@ -10,17 +10,17 @@ |
|
10
|
10
|
class="w-3/4 xl:w-4/5"
|
|
11
|
11
|
>
|
|
12
|
12
|
<template #toolbar>
|
|
13
|
|
- <Authority value="api:yt:user:post">
|
|
14
|
|
- <a-button type="primary" @click="handleCreate">新增租户</a-button>
|
|
|
13
|
+ <Authority value="api:yt:user:saveCommonTenant:post">
|
|
|
14
|
+ <a-button type="primary" @click="handleCreate">新增普通租户</a-button>
|
|
15
|
15
|
</Authority>
|
|
16
|
|
- <Authority value="api:yt:user:delete">
|
|
|
16
|
+ <Authority value="api:yt:admin:user:deleteTenantAdmin:delete">
|
|
17
|
17
|
<Popconfirm
|
|
18
|
18
|
title="您确定要批量删除数据"
|
|
19
|
19
|
ok-text="确定"
|
|
20
|
20
|
cancel-text="取消"
|
|
21
|
|
- @confirm="() => {}"
|
|
|
21
|
+ @confirm="handleDeleteOrBatchDelete(null)"
|
|
22
|
22
|
>
|
|
23
|
|
- <a-button color="error"> 批量删除 </a-button>
|
|
|
23
|
+ <a-button color="error" :disabled="hasBatchDelete"> 批量删除 </a-button>
|
|
24
|
24
|
</Popconfirm>
|
|
25
|
25
|
</Authority>
|
|
26
|
26
|
</template>
|
|
...
|
...
|
@@ -46,33 +46,23 @@ |
|
46
|
46
|
<template #action="{ record }">
|
|
47
|
47
|
<TableAction
|
|
48
|
48
|
:actions="[
|
|
49
|
|
- // {
|
|
50
|
|
- // label: '进入',
|
|
51
|
|
- // icon: 'ant-design:login-outlined',
|
|
52
|
|
- // tooltip: `以${!isAdmin(role) ? '客户' : '平台'}用户身份登录`,
|
|
53
|
|
- // onClick: handleLoginCustomAdmin.bind(null, record),
|
|
54
|
|
- // },
|
|
55
|
49
|
{
|
|
56
|
|
- label: '用户详情',
|
|
57
|
|
- auth: 'api:yt:user:get',
|
|
58
|
|
- icon: 'clarity:info-standard-line',
|
|
59
|
|
- tooltip: '用户详情',
|
|
60
|
|
- onClick: handledetail.bind(null, record),
|
|
61
|
|
- ifShow: record.level != 0,
|
|
|
50
|
+ label: '进入',
|
|
|
51
|
+ icon: 'ant-design:login-outlined',
|
|
|
52
|
+ tooltip: `以${!isAdmin(role) ? '租户' : '平台'}用户身份登录`,
|
|
|
53
|
+ onClick: handleLoginCustomAdmin.bind(null, record),
|
|
62
|
54
|
},
|
|
63
|
55
|
{
|
|
64
|
56
|
label: '编辑',
|
|
65
|
|
- auth: 'api:yt:user:update',
|
|
|
57
|
+ auth: 'api:yt:user:saveCommonTenant:post',
|
|
66
|
58
|
icon: 'clarity:note-edit-line',
|
|
67
|
59
|
tooltip: '编辑',
|
|
68
|
60
|
onClick: handleEdit.bind(null, record),
|
|
69
|
61
|
ifShow: record.level != 0,
|
|
70
|
62
|
},
|
|
71
|
|
- ]"
|
|
72
|
|
- :drop-down-actions="[
|
|
73
|
63
|
{
|
|
74
|
64
|
label: '删除',
|
|
75
|
|
- auth: 'api:yt:user:delete',
|
|
|
65
|
+ auth: 'api:yt:admin:user:deleteTenantAdmin:delete',
|
|
76
|
66
|
icon: 'ant-design:delete-outlined',
|
|
77
|
67
|
color: 'error',
|
|
78
|
68
|
tooltip: '删除',
|
|
...
|
...
|
@@ -82,17 +72,6 @@ |
|
82
|
72
|
confirm: handleDeleteOrBatchDelete.bind(null, record),
|
|
83
|
73
|
},
|
|
84
|
74
|
},
|
|
85
|
|
- {
|
|
86
|
|
- label: '清除密码',
|
|
87
|
|
- auth: 'api:yt:user:resetPassword',
|
|
88
|
|
- icon: 'ant-design:delete-outlined',
|
|
89
|
|
- color: 'error',
|
|
90
|
|
- tooltip: '清除密码',
|
|
91
|
|
- popConfirm: {
|
|
92
|
|
- title: '是否确认清除密码',
|
|
93
|
|
- confirm: handleClearPassword.bind(null, record),
|
|
94
|
|
- },
|
|
95
|
|
- },
|
|
96
|
75
|
]"
|
|
97
|
76
|
/>
|
|
98
|
77
|
</template>
|
|
...
|
...
|
@@ -107,20 +86,35 @@ |
|
107
|
86
|
import { getTenantList } from '/@/api/system/account';
|
|
108
|
87
|
import { columns, searchFormSchema } from './config';
|
|
109
|
88
|
import { useResetOrganizationTree, OrganizationIdTree } from '/@/views/common/organizationIdTree';
|
|
110
|
|
- import { reactive } from 'vue';
|
|
|
89
|
+ import { reactive, nextTick } from 'vue';
|
|
111
|
90
|
import { Authority } from '/@/components/Authority';
|
|
112
|
91
|
import { useUserStore } from '/@/store/modules/user';
|
|
113
|
92
|
import { PageWrapper } from '/@/components/Page';
|
|
|
93
|
+ import { useGo } from '/@/hooks/web/usePage';
|
|
114
|
94
|
import { Tag, Popconfirm } from 'ant-design-vue';
|
|
115
|
95
|
import TenantModal from './TenantModal.vue';
|
|
116
|
96
|
import { useModal } from '/@/components/Modal';
|
|
|
97
|
+ import { useFastEnter } from '/@/hooks/business/useFastEnter';
|
|
|
98
|
+ import { TenantListItemRecord } from '/@/api/tenant/tenantInfo';
|
|
|
99
|
+ import { isAdmin } from '/@/enums/roleEnum';
|
|
|
100
|
+ import { getAuthCache } from '/@/utils/auth';
|
|
|
101
|
+ import { useBatchDelete } from '/@/hooks/web/useBatchDelete';
|
|
|
102
|
+ import { deleteTenantAdmin } from '/@/api/tenant/tenantApi';
|
|
|
103
|
+ // import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
104
|
+
|
|
|
105
|
+ import { USER_INFO_KEY } from '/@/enums/cacheEnum';
|
|
117
|
106
|
|
|
118
|
107
|
const searchInfo = reactive<Recordable>({});
|
|
|
108
|
+ const go = useGo();
|
|
119
|
109
|
|
|
120
|
110
|
const { organizationIdTreeRef, resetFn } = useResetOrganizationTree(searchInfo);
|
|
121
|
111
|
|
|
|
112
|
+ const userRole: any = getAuthCache(USER_INFO_KEY);
|
|
|
113
|
+ const role: string = userRole?.roles[0];
|
|
|
114
|
+ // const { createMessage } = useMessage();
|
|
|
115
|
+
|
|
122
|
116
|
const userInfo = useUserStore();
|
|
123
|
|
- const [registerTable, { reload }] = useTable({
|
|
|
117
|
+ const [registerTable, { reload, setProps }] = useTable({
|
|
124
|
118
|
title: '租户账号列表',
|
|
125
|
119
|
columns,
|
|
126
|
120
|
api: getTenantList,
|
|
...
|
...
|
@@ -150,6 +144,14 @@ |
|
150
|
144
|
fixed: 'right',
|
|
151
|
145
|
},
|
|
152
|
146
|
});
|
|
|
147
|
+ const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete(
|
|
|
148
|
+ deleteTenantAdmin,
|
|
|
149
|
+ handleSuccess,
|
|
|
150
|
+ setProps
|
|
|
151
|
+ );
|
|
|
152
|
+ nextTick(() => {
|
|
|
153
|
+ setProps(selectionOptions);
|
|
|
154
|
+ });
|
|
153
|
155
|
|
|
154
|
156
|
const [registerModal, { openModal }] = useModal();
|
|
155
|
157
|
|
|
...
|
...
|
@@ -163,9 +165,32 @@ |
|
163
|
165
|
isAdd: true,
|
|
164
|
166
|
});
|
|
165
|
167
|
};
|
|
166
|
|
- const handledetail = (_data?: any[]) => {};
|
|
167
|
|
- const handleEdit = (_data?: any[]) => {};
|
|
168
|
|
- const handleDeleteOrBatchDelete = (_data?: any[]) => {};
|
|
169
|
|
- const handleClearPassword = (_data?: any[]) => {};
|
|
170
|
|
- const handleSuccess = () => {};
|
|
|
168
|
+ const handleLoginCustomAdmin = async (record: TenantListItemRecord) => {
|
|
|
169
|
+ try {
|
|
|
170
|
+ useFastEnter(record, go);
|
|
|
171
|
+ } catch (errpr) {
|
|
|
172
|
+ } finally {
|
|
|
173
|
+ }
|
|
|
174
|
+ };
|
|
|
175
|
+ const handleEdit = (record: Recordable) => {
|
|
|
176
|
+ openModal(true, {
|
|
|
177
|
+ isAdd: false,
|
|
|
178
|
+ record,
|
|
|
179
|
+ });
|
|
|
180
|
+ };
|
|
|
181
|
+ // const handleDeleteOrBatchDelete = (record: Recordable) => {
|
|
|
182
|
+ // deleteTenantAdmin([record.id]).then(() => {
|
|
|
183
|
+ // createMessage.success('删除成功');
|
|
|
184
|
+ // handleSuccess();
|
|
|
185
|
+ // });
|
|
|
186
|
+ // };
|
|
|
187
|
+ // const handleClearPassword = async (record: Recordable) => {
|
|
|
188
|
+ // const { id } = record;
|
|
|
189
|
+ // if (!id) return;
|
|
|
190
|
+ // const { message } = await clearUserPassword(id);
|
|
|
191
|
+ // createMessage.success(message);
|
|
|
192
|
+ // };
|
|
|
193
|
+ function handleSuccess() {
|
|
|
194
|
+ reload();
|
|
|
195
|
+ }
|
|
171
|
196
|
</script> |
...
|
...
|
|