...
|
...
|
@@ -20,27 +20,64 @@ |
20
|
20
|
toolbar
|
21
|
21
|
/>
|
22
|
22
|
</template>
|
|
23
|
+ <template #roleSlot="{ model, field }">
|
|
24
|
+ <a-select
|
|
25
|
+ mode="multiple"
|
|
26
|
+ allowClear
|
|
27
|
+ placeholder="请选择角色"
|
|
28
|
+ v-model:value="model[field]"
|
|
29
|
+ :options="roleOptions.map((item) => ({ value: item.value, label: item.label }))"
|
|
30
|
+ >
|
|
31
|
+ <template #dropdownRender="{ menuNode: menu }">
|
|
32
|
+ <v-nodes :vnodes="menu" />
|
|
33
|
+ <a-divider style="margin: 4px 0" />
|
|
34
|
+ <div @click="handleOpenRole" style="padding: 4px 0; cursor: pointer">
|
|
35
|
+ <plus-outlined />
|
|
36
|
+ 新增角色
|
|
37
|
+ </div>
|
|
38
|
+ </template>
|
|
39
|
+ </a-select>
|
|
40
|
+ </template>
|
23
|
41
|
</BasicForm>
|
24
|
42
|
</div>
|
25
|
43
|
</BasicModal>
|
|
44
|
+ <RoleDrawer @register="registerRoleDrawer" @success="handleSuccess" />
|
26
|
45
|
</template>
|
27
|
46
|
<script lang="ts">
|
28
|
|
- import { defineComponent, ref, computed, unref, reactive } from 'vue';
|
|
47
|
+ import { defineComponent, ref, computed, unref, reactive, onMounted } from 'vue';
|
29
|
48
|
import { BasicModal, useModalInner } from '/@/components/Modal';
|
30
|
49
|
import { BasicForm, useForm } from '/@/components/Form/index';
|
31
|
50
|
import { accountFormSchema } from './account.data';
|
32
|
|
- import { findCurrentUserRelation, SaveOrUpdateUserInfo } from '/@/api/system/system';
|
|
51
|
+ import {
|
|
52
|
+ findCurrentUserRelation,
|
|
53
|
+ SaveOrUpdateUserInfo,
|
|
54
|
+ filterRoleList,
|
|
55
|
+ } from '/@/api/system/system';
|
33
|
56
|
import { BasicTree, TreeItem } from '/@/components/Tree';
|
34
|
57
|
import { findCurrentUserGroups } from '/@/api/system/group';
|
35
|
58
|
import { RoleOrOrganizationParam } from '/@/api/system/model/systemModel';
|
36
|
59
|
import { useMessage } from '/@/hooks/web/useMessage';
|
37
|
60
|
import { copyTransTreeFun } from '/@/utils/fnUtils';
|
|
61
|
+ import { TOption } from '/@/views/rule/linkedge/config/config.data';
|
|
62
|
+ import { PlusOutlined } from '@ant-design/icons-vue';
|
|
63
|
+ import { useDrawer } from '/@/components/Drawer';
|
|
64
|
+ import RoleDrawer from '../role/RoleDrawer.vue';
|
38
|
65
|
|
39
|
66
|
export default defineComponent({
|
40
|
67
|
name: 'AccountModal',
|
41
|
|
- components: { BasicModal, BasicForm, BasicTree },
|
|
68
|
+ components: {
|
|
69
|
+ BasicModal,
|
|
70
|
+ BasicForm,
|
|
71
|
+ BasicTree,
|
|
72
|
+ PlusOutlined,
|
|
73
|
+ RoleDrawer,
|
|
74
|
+ VNodes: (_, { attrs }) => {
|
|
75
|
+ return attrs.vnodes;
|
|
76
|
+ },
|
|
77
|
+ },
|
42
|
78
|
emits: ['success', 'register'],
|
43
|
79
|
setup(_, { emit }) {
|
|
80
|
+ const roleOptions = ref<TOption[]>([]);
|
44
|
81
|
const isUpdate = ref(true);
|
45
|
82
|
const rowId = ref('');
|
46
|
83
|
const organizationTreeData = ref<TreeItem[]>([]);
|
...
|
...
|
@@ -52,7 +89,29 @@ |
52
|
89
|
const singleEditPostPhoneNumber = reactive({
|
53
|
90
|
phoneNumber: '',
|
54
|
91
|
});
|
|
92
|
+ const getRoleList = async () => {
|
|
93
|
+ const res = await filterRoleList();
|
|
94
|
+ console.log(res);
|
|
95
|
+ roleOptions.value = res.map((m) => {
|
|
96
|
+ return {
|
|
97
|
+ label: m.name,
|
|
98
|
+ value: m.id,
|
|
99
|
+ };
|
|
100
|
+ });
|
|
101
|
+ };
|
|
102
|
+ onMounted(async () => {
|
|
103
|
+ await getRoleList();
|
|
104
|
+ });
|
|
105
|
+ const [registerRoleDrawer, { openDrawer }] = useDrawer();
|
55
|
106
|
|
|
107
|
+ const handleOpenRole = () => {
|
|
108
|
+ openDrawer(true, {
|
|
109
|
+ isUpdate: false,
|
|
110
|
+ });
|
|
111
|
+ };
|
|
112
|
+ const handleSuccess = async () => {
|
|
113
|
+ await getRoleList();
|
|
114
|
+ };
|
56
|
115
|
const [
|
57
|
116
|
registerForm,
|
58
|
117
|
{ setFieldsValue, updateSchema, resetFields, validate, getFieldsValue },
|
...
|
...
|
@@ -163,6 +222,10 @@ |
163
|
222
|
checkGroup,
|
164
|
223
|
basicTreeRef,
|
165
|
224
|
treeExpandData,
|
|
225
|
+ roleOptions,
|
|
226
|
+ registerRoleDrawer,
|
|
227
|
+ handleOpenRole,
|
|
228
|
+ handleSuccess,
|
166
|
229
|
};
|
167
|
230
|
},
|
168
|
231
|
});
|
...
|
...
|
@@ -171,9 +234,11 @@ |
171
|
234
|
:deep(.vben-basic-tree) {
|
172
|
235
|
width: 100% !important;
|
173
|
236
|
}
|
|
237
|
+
|
174
|
238
|
:deep(.is-unflod) {
|
175
|
239
|
display: none !important;
|
176
|
240
|
}
|
|
241
|
+
|
177
|
242
|
:deep(.is-flod) {
|
178
|
243
|
display: none !important;
|
179
|
244
|
}
|
...
|
...
|
|