adtec-core-package 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/api/BasicApi.ts +17 -0
- package/src/api/SysUserApi.ts +35 -0
- package/src/components/business/userSelect.vue +412 -0
- package/src/hooks/useDictHooks.ts +81 -0
- package/src/interface/IMdmDept.ts +82 -0
- package/src/interface/IOrgDeptInfo.ts +12 -0
- package/src/interface/ISysUserInfo.ts +70 -0
- package/src/mixin/globalMixin.ts +33 -31
- /package/src/components/autoToolTip/{index.vue → ElAutoToolTip.vue} +0 -0
package/package.json
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import request from '../utils/request'
|
|
2
|
+
import type { IOrgDeptInfo } from '../interface/IOrgDeptInfo'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Create by丁盼
|
|
6
|
+
* 说明: BasicApi 基础数据接口
|
|
7
|
+
* 创建时间: 2024/12/9 上午11:05
|
|
8
|
+
* 修改时间: 2024/12/9 上午11:05
|
|
9
|
+
*/
|
|
10
|
+
export default {
|
|
11
|
+
/**
|
|
12
|
+
* 获取MDM部门树
|
|
13
|
+
*/
|
|
14
|
+
getMdmOrgDeptTree(): Promise<IOrgDeptInfo[]> {
|
|
15
|
+
return request.post('/api/base/mdmDept/getMdmOrgDeptTree', {})
|
|
16
|
+
},
|
|
17
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import request from '../utils/request'
|
|
2
|
+
import type { ISysUserInfo } from '../interface/ISysUserInfo'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Create by丁盼
|
|
6
|
+
* 说明: SysUserApi
|
|
7
|
+
* 创建时间: 2024/11/5 上午11:13
|
|
8
|
+
* 修改时间: 2024/11/5 上午11:13
|
|
9
|
+
*/
|
|
10
|
+
const basePath = '/api/system/sysUserInfo/'
|
|
11
|
+
export default {
|
|
12
|
+
/**
|
|
13
|
+
* 保存用户信息
|
|
14
|
+
* @param obj
|
|
15
|
+
*/
|
|
16
|
+
add(obj: ISysUserInfo[]) {
|
|
17
|
+
return request.post<ISysUserInfo[]>(basePath + 'add', obj)
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 选择用户组件获取用户信息
|
|
23
|
+
* @param userIds
|
|
24
|
+
*/
|
|
25
|
+
getInitUserListComp(userIds: string[]) {
|
|
26
|
+
return request.post<ISysUserInfo[]>(basePath + 'getInitUserListComp', userIds)
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* 选择人员组件获取用户信息
|
|
31
|
+
*/
|
|
32
|
+
getSysUserInfoUserSelectComp(): Promise<ISysUserInfo[]> {
|
|
33
|
+
return request.post(basePath + 'getSysUserInfoUserSelectComp')
|
|
34
|
+
},
|
|
35
|
+
}
|
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
<!--创建人 丁盼-->
|
|
2
|
+
<!--说明: userSelect 人员选择-->
|
|
3
|
+
<!--创建时间: 2024/12/9 上午10:27-->
|
|
4
|
+
<!--修改时间: 2024/12/9 上午10:27-->
|
|
5
|
+
<template>
|
|
6
|
+
<el-drawer
|
|
7
|
+
v-if="viewType === 'drawer'"
|
|
8
|
+
:title="title"
|
|
9
|
+
v-model="dialogVisible"
|
|
10
|
+
:destroy-on-close="true"
|
|
11
|
+
size="800px"
|
|
12
|
+
@close="close"
|
|
13
|
+
@open="open"
|
|
14
|
+
>
|
|
15
|
+
<el-flex :vertical="true" v-loading="loading">
|
|
16
|
+
<el-flex :vertical="false">
|
|
17
|
+
<el-flex :vertical="true" style="padding-right: 15px">
|
|
18
|
+
<el-title title="人员列表" style="border-bottom: var(--border)"> </el-title>
|
|
19
|
+
<el-input v-model="filterText" placeholder="请输入用户名称或者编码进行搜索"></el-input>
|
|
20
|
+
<el-flex :vertical="true">
|
|
21
|
+
<el-tree
|
|
22
|
+
style="width: 100%"
|
|
23
|
+
:filter-node-method="filterNode"
|
|
24
|
+
show-checkbox
|
|
25
|
+
ref="ref_tree"
|
|
26
|
+
:data="deptUserTree"
|
|
27
|
+
@check-change="handleCheckChange"
|
|
28
|
+
node-key="id"
|
|
29
|
+
:default-expanded-keys="defaultExpandedKeys"
|
|
30
|
+
:default-checked-keys="defaultCheckedKeys"
|
|
31
|
+
:props="{
|
|
32
|
+
label: 'name',
|
|
33
|
+
children: 'children',
|
|
34
|
+
}"
|
|
35
|
+
>
|
|
36
|
+
<template #default="{ data }">
|
|
37
|
+
<el-flex align="center">
|
|
38
|
+
<el-flex align="center" justify="center" width="20px">
|
|
39
|
+
<el-icons
|
|
40
|
+
model-value="adtec-dept"
|
|
41
|
+
v-if="data.type === 'BM'"
|
|
42
|
+
:style="{ color: 'var(--el-color-primary)' }"
|
|
43
|
+
></el-icons>
|
|
44
|
+
<el-icons
|
|
45
|
+
model-value="adtec-user"
|
|
46
|
+
v-if="data.type === 'YH'"
|
|
47
|
+
:style="{ color: data.sex === '1' ? '#ef5fa6' : 'var(--el-color-primary)' }"
|
|
48
|
+
></el-icons>
|
|
49
|
+
</el-flex>
|
|
50
|
+
<el-flex align="center">
|
|
51
|
+
<el-text v-if="data.type === 'YH'">{{ data.name + `(${data.code})` }}</el-text>
|
|
52
|
+
<el-text v-else>{{ data.name }}</el-text>
|
|
53
|
+
</el-flex>
|
|
54
|
+
</el-flex>
|
|
55
|
+
</template>
|
|
56
|
+
</el-tree>
|
|
57
|
+
</el-flex>
|
|
58
|
+
</el-flex>
|
|
59
|
+
|
|
60
|
+
<el-flex :vertical="true" style="border-left: var(--border); padding-left: 15px">
|
|
61
|
+
<el-title
|
|
62
|
+
:title="`已选人员(${selectedUserList.length})`"
|
|
63
|
+
style="border-bottom: var(--border); margin-top: 5px"
|
|
64
|
+
></el-title>
|
|
65
|
+
<el-flex :vertical="true">
|
|
66
|
+
<template v-for="data of selectedUserList" :key="data.id">
|
|
67
|
+
<div class="user-select">
|
|
68
|
+
<el-flex height="50px" style="border-bottom: var(--border); cursor: pointer">
|
|
69
|
+
<el-flex align="center" width="30px">
|
|
70
|
+
<el-icons
|
|
71
|
+
model-value="adtec-user"
|
|
72
|
+
style="font-size: 20px"
|
|
73
|
+
:style="{ color: data.sex === '1' ? '#ef5fa6' : 'var(--el-color-primary)' }"
|
|
74
|
+
>
|
|
75
|
+
</el-icons>
|
|
76
|
+
</el-flex>
|
|
77
|
+
<el-flex align="center" :vertical="true" justify="flex-start">
|
|
78
|
+
<el-flex>
|
|
79
|
+
<el-text>{{ data.userName + `(${data.loginName})` }}</el-text>
|
|
80
|
+
</el-flex>
|
|
81
|
+
<el-flex align="flex-start" height="18px" style="overflow: hidden">
|
|
82
|
+
<el-text style="font-size: 12px; opacity: 0.8; margin-bottom: 8px">{{
|
|
83
|
+
data.deptName
|
|
84
|
+
}}</el-text>
|
|
85
|
+
</el-flex>
|
|
86
|
+
</el-flex>
|
|
87
|
+
<el-flex width="50px" align="center">
|
|
88
|
+
<el-icon-btn
|
|
89
|
+
@click="handleDelete(data)"
|
|
90
|
+
model-value="adtec-close"
|
|
91
|
+
style="opacity: 0.8; cursor: pointer"
|
|
92
|
+
></el-icon-btn>
|
|
93
|
+
</el-flex>
|
|
94
|
+
</el-flex>
|
|
95
|
+
</div>
|
|
96
|
+
</template>
|
|
97
|
+
</el-flex>
|
|
98
|
+
</el-flex>
|
|
99
|
+
</el-flex>
|
|
100
|
+
</el-flex>
|
|
101
|
+
<template #footer>
|
|
102
|
+
<el-button @click="cancel">取消</el-button>
|
|
103
|
+
<el-button type="primary" @click="success">确定</el-button>
|
|
104
|
+
</template>
|
|
105
|
+
</el-drawer>
|
|
106
|
+
<el-dialog
|
|
107
|
+
v-else
|
|
108
|
+
:title="title"
|
|
109
|
+
top="10vh"
|
|
110
|
+
v-model="dialogVisible"
|
|
111
|
+
width="1000px"
|
|
112
|
+
@close="close"
|
|
113
|
+
@open="open"
|
|
114
|
+
>
|
|
115
|
+
<el-flex :vertical="true" v-loading="loading" height="500px">
|
|
116
|
+
<el-flex :vertical="false">
|
|
117
|
+
<el-flex :vertical="true" style="padding-right: 15px">
|
|
118
|
+
<el-title title="人员列表" style="border-bottom: var(--border)"> </el-title>
|
|
119
|
+
<el-input v-model="filterText" placeholder="请输入用户名称或者编码进行搜索"></el-input>
|
|
120
|
+
<el-flex :vertical="true">
|
|
121
|
+
<el-tree
|
|
122
|
+
style="width: 100%"
|
|
123
|
+
:filter-node-method="filterNode"
|
|
124
|
+
show-checkbox
|
|
125
|
+
ref="ref_tree"
|
|
126
|
+
:data="deptUserTree"
|
|
127
|
+
@check-change="handleCheckChange"
|
|
128
|
+
node-key="id"
|
|
129
|
+
:default-expanded-keys="defaultExpandedKeys"
|
|
130
|
+
:default-checked-keys="defaultCheckedKeys"
|
|
131
|
+
:props="{
|
|
132
|
+
label: 'name',
|
|
133
|
+
children: 'children',
|
|
134
|
+
}"
|
|
135
|
+
>
|
|
136
|
+
<template #default="{ data }">
|
|
137
|
+
<el-flex align="center">
|
|
138
|
+
<el-flex align="center" justify="center" width="20px">
|
|
139
|
+
<el-icons
|
|
140
|
+
model-value="adtec-dept"
|
|
141
|
+
v-if="data.type === 'BM'"
|
|
142
|
+
:style="{ color: 'var(--el-color-primary)' }"
|
|
143
|
+
></el-icons>
|
|
144
|
+
<el-icons
|
|
145
|
+
model-value="adtec-user"
|
|
146
|
+
v-if="data.type === 'YH'"
|
|
147
|
+
:style="{ color: data.sex === '1' ? '#ef5fa6' : 'var(--el-color-primary)' }"
|
|
148
|
+
></el-icons>
|
|
149
|
+
</el-flex>
|
|
150
|
+
<el-flex align="center">
|
|
151
|
+
<el-text v-if="data.type === 'YH'">{{ data.name + `(${data.code})` }}</el-text>
|
|
152
|
+
<el-text v-else>{{ data.name }}</el-text>
|
|
153
|
+
</el-flex>
|
|
154
|
+
</el-flex>
|
|
155
|
+
</template>
|
|
156
|
+
</el-tree>
|
|
157
|
+
</el-flex>
|
|
158
|
+
</el-flex>
|
|
159
|
+
|
|
160
|
+
<el-flex :vertical="true" style="border-left: var(--border); padding-left: 15px">
|
|
161
|
+
<el-title
|
|
162
|
+
:title="`已选人员(${selectedUserList.length})`"
|
|
163
|
+
style="border-bottom: var(--border); margin-top: 5px"
|
|
164
|
+
></el-title>
|
|
165
|
+
<el-flex :vertical="true">
|
|
166
|
+
<template v-for="data of selectedUserList" :key="data.id">
|
|
167
|
+
<div class="user-select">
|
|
168
|
+
<el-flex height="50px" style="border-bottom: var(--border); cursor: pointer">
|
|
169
|
+
<el-flex align="center" width="30px">
|
|
170
|
+
<el-icons
|
|
171
|
+
model-value="adtec-user"
|
|
172
|
+
style="font-size: 20px"
|
|
173
|
+
:style="{ color: data.sex === '1' ? '#ef5fa6' : 'var(--el-color-primary)' }"
|
|
174
|
+
>
|
|
175
|
+
</el-icons>
|
|
176
|
+
</el-flex>
|
|
177
|
+
<el-flex align="center" :vertical="true" justify="flex-start">
|
|
178
|
+
<el-flex>
|
|
179
|
+
<el-text>{{ data.userName + `(${data.loginName})` }}</el-text>
|
|
180
|
+
</el-flex>
|
|
181
|
+
<el-flex align="flex-start" height="18px" style="overflow: hidden">
|
|
182
|
+
<el-text style="font-size: 12px; opacity: 0.8; margin-bottom: 8px">{{
|
|
183
|
+
data.deptName
|
|
184
|
+
}}</el-text>
|
|
185
|
+
</el-flex>
|
|
186
|
+
</el-flex>
|
|
187
|
+
<el-flex width="50px" align="center">
|
|
188
|
+
<el-icon-btn
|
|
189
|
+
@click="handleDelete(data)"
|
|
190
|
+
model-value="adtec-close"
|
|
191
|
+
style="opacity: 0.8; cursor: pointer"
|
|
192
|
+
></el-icon-btn>
|
|
193
|
+
</el-flex>
|
|
194
|
+
</el-flex>
|
|
195
|
+
</div>
|
|
196
|
+
</template>
|
|
197
|
+
</el-flex>
|
|
198
|
+
</el-flex>
|
|
199
|
+
</el-flex>
|
|
200
|
+
</el-flex>
|
|
201
|
+
<template #footer>
|
|
202
|
+
<el-button @click="cancel">取消</el-button>
|
|
203
|
+
<el-button type="primary" @click="success">确定</el-button>
|
|
204
|
+
</template>
|
|
205
|
+
</el-dialog>
|
|
206
|
+
</template>
|
|
207
|
+
<script setup lang="ts">
|
|
208
|
+
import { useVModel } from '@vueuse/core'
|
|
209
|
+
import { type PropType, ref, watch } from 'vue'
|
|
210
|
+
import basicApi from '../../api/BasicApi.ts'
|
|
211
|
+
import type { IOrgDeptInfo } from '../../interface/IOrgDeptInfo'
|
|
212
|
+
import type { ISysUserInfo } from '../../interface/ISysUserInfo'
|
|
213
|
+
import sysUserApi from '../../api/SysUserApi.ts'
|
|
214
|
+
import { ElMessage, type TreeInstance } from 'element-plus'
|
|
215
|
+
const loading = ref(false)
|
|
216
|
+
const userList = ref<ISysUserInfo[]>()
|
|
217
|
+
const orgDeptTree = ref<IOrgDeptInfo[]>([])
|
|
218
|
+
const deptUserTree = ref<any[]>([])
|
|
219
|
+
const selectedUserList = ref<ISysUserInfo[]>([])
|
|
220
|
+
const defaultExpandedKeys = ref<any[]>([])
|
|
221
|
+
const defaultCheckedKeys = ref<any[]>([])
|
|
222
|
+
const ref_tree = ref<TreeInstance>()
|
|
223
|
+
const filterText = ref('')
|
|
224
|
+
const props = defineProps({
|
|
225
|
+
modelValue: {
|
|
226
|
+
type: Boolean,
|
|
227
|
+
},
|
|
228
|
+
/**
|
|
229
|
+
* @description 已选人员id
|
|
230
|
+
* @default []
|
|
231
|
+
* @type Array
|
|
232
|
+
*/
|
|
233
|
+
selectedUserIds: {
|
|
234
|
+
type: Array as PropType<string[]>,
|
|
235
|
+
default: () => [] as string[],
|
|
236
|
+
},
|
|
237
|
+
/**
|
|
238
|
+
* @description 标题
|
|
239
|
+
* @default 人员选择
|
|
240
|
+
* @type String
|
|
241
|
+
*/
|
|
242
|
+
title: {
|
|
243
|
+
type: String,
|
|
244
|
+
default: '人员选择',
|
|
245
|
+
},
|
|
246
|
+
/**
|
|
247
|
+
* @description 视图类型
|
|
248
|
+
* @default drawer
|
|
249
|
+
@type {"drawer" | "dialog" }
|
|
250
|
+
**/
|
|
251
|
+
viewType: {
|
|
252
|
+
type: String,
|
|
253
|
+
default: 'drawer',
|
|
254
|
+
validator: (value: string) => ['drawer', 'dialog'].includes(value),
|
|
255
|
+
},
|
|
256
|
+
/**
|
|
257
|
+
* @description 是否允许多选
|
|
258
|
+
* @default false
|
|
259
|
+
* @type Boolean
|
|
260
|
+
*/
|
|
261
|
+
multiple: {
|
|
262
|
+
type: Boolean,
|
|
263
|
+
default: false,
|
|
264
|
+
},
|
|
265
|
+
})
|
|
266
|
+
watch(filterText, (val) => {
|
|
267
|
+
ref_tree.value!.filter(val)
|
|
268
|
+
})
|
|
269
|
+
|
|
270
|
+
const filterNode = (value: string, data: any) => {
|
|
271
|
+
if (!value) return true
|
|
272
|
+
return data.name.includes(value) || data.code.includes(value)
|
|
273
|
+
}
|
|
274
|
+
function success() {
|
|
275
|
+
emit('success', selectedUserList.value)
|
|
276
|
+
}
|
|
277
|
+
function cancel() {
|
|
278
|
+
emit('cancel')
|
|
279
|
+
}
|
|
280
|
+
function handleDelete(row: ISysUserInfo) {
|
|
281
|
+
const index = selectedUserList.value.findIndex((item) => item.id === row.id)
|
|
282
|
+
if (index !== -1) {
|
|
283
|
+
selectedUserList.value.splice(index, 1) // 删除该对象
|
|
284
|
+
const key = selectedUserList.value.map((item) => item.id)
|
|
285
|
+
ref_tree.value?.setCheckedKeys(key as any[])
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
const emit = defineEmits(['update:modelValue', 'success', 'cancel'])
|
|
289
|
+
const dialogVisible = useVModel(props, 'modelValue', emit)
|
|
290
|
+
const getInitUserList = async () => {
|
|
291
|
+
if (props.selectedUserIds) {
|
|
292
|
+
try {
|
|
293
|
+
selectedUserList.value = await sysUserApi.getInitUserListComp(props.selectedUserIds)
|
|
294
|
+
defaultCheckedKeys.value = []
|
|
295
|
+
selectedUserList.value.forEach((item) => {
|
|
296
|
+
defaultCheckedKeys.value.push(item.id)
|
|
297
|
+
})
|
|
298
|
+
} catch (err: any) {
|
|
299
|
+
ElMessage.error(err.msg)
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
const open = async () => {
|
|
304
|
+
loading.value = true
|
|
305
|
+
selectedUserList.value = []
|
|
306
|
+
userList.value = []
|
|
307
|
+
orgDeptTree.value = await basicApi.getMdmOrgDeptTree()
|
|
308
|
+
const userTreeList: any[] = []
|
|
309
|
+
const userTreeList1: any[] = []
|
|
310
|
+
orgDeptTree.value.forEach((item) => {
|
|
311
|
+
item.children?.forEach((item2) => {
|
|
312
|
+
item2.parentId = item.id
|
|
313
|
+
})
|
|
314
|
+
const list = flattenTreeToArray(item)
|
|
315
|
+
userTreeList.push(...list)
|
|
316
|
+
})
|
|
317
|
+
userList.value = await sysUserApi.getSysUserInfoUserSelectComp()
|
|
318
|
+
//根据部门关联岗位
|
|
319
|
+
userTreeList.forEach((item) => {
|
|
320
|
+
item.type = 'BM'
|
|
321
|
+
const f = userList.value?.filter((c) => c.mdmDeptId === item.id)
|
|
322
|
+
if (f) {
|
|
323
|
+
f.forEach((item2) => {
|
|
324
|
+
userTreeList1.push({
|
|
325
|
+
id: item2.id,
|
|
326
|
+
code: item2.loginName,
|
|
327
|
+
name: item2.userName,
|
|
328
|
+
parentId: item.id,
|
|
329
|
+
type: 'YH',
|
|
330
|
+
sex: item2.sex,
|
|
331
|
+
})
|
|
332
|
+
})
|
|
333
|
+
}
|
|
334
|
+
})
|
|
335
|
+
userTreeList.push(...userTreeList1)
|
|
336
|
+
const treeData = buildTree(userTreeList)
|
|
337
|
+
defaultExpandedKeys.value = []
|
|
338
|
+
treeData.forEach((item) => {
|
|
339
|
+
defaultExpandedKeys.value.push(item.id)
|
|
340
|
+
})
|
|
341
|
+
await getInitUserList()
|
|
342
|
+
deptUserTree.value = treeData
|
|
343
|
+
loading.value = false
|
|
344
|
+
}
|
|
345
|
+
function buildTree(flatArray: any[]) {
|
|
346
|
+
const map = new Map()
|
|
347
|
+
const tree: any[] = []
|
|
348
|
+
// 首先将平面数组的每个元素都放入 Map 中,以 id 为键,元素本身为值
|
|
349
|
+
flatArray.forEach((item) => {
|
|
350
|
+
map.set(item.id, { ...item, children: [] })
|
|
351
|
+
})
|
|
352
|
+
// 然后通过遍历每个元素,将它们归类到正确的父节点中
|
|
353
|
+
flatArray.forEach((item) => {
|
|
354
|
+
const node = map.get(item.id)
|
|
355
|
+
if (item.parentId === null) {
|
|
356
|
+
// 如果没有 parentId,说明是根节点
|
|
357
|
+
tree.push(node)
|
|
358
|
+
} else {
|
|
359
|
+
// 否则,将当前节点添加到它的父节点的 children 数组中
|
|
360
|
+
const parentNode = map.get(item.parentId)
|
|
361
|
+
if (parentNode) {
|
|
362
|
+
parentNode.children.push(node)
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
})
|
|
366
|
+
return tree
|
|
367
|
+
}
|
|
368
|
+
function flattenTreeToArray(tree: IOrgDeptInfo) {
|
|
369
|
+
const result: any = []
|
|
370
|
+
function traverse(node: IOrgDeptInfo) {
|
|
371
|
+
if (!node) return
|
|
372
|
+
// 将当前节点添加到结果数组
|
|
373
|
+
result.push({
|
|
374
|
+
id: node.id,
|
|
375
|
+
code: node.code,
|
|
376
|
+
name: node.name,
|
|
377
|
+
parentId: node.parentId,
|
|
378
|
+
})
|
|
379
|
+
// 如果有子节点,递归遍历子节点
|
|
380
|
+
if (node.children && node.children.length > 0) {
|
|
381
|
+
node.children.forEach((child) => traverse(child))
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
// 开始遍历树
|
|
385
|
+
traverse(tree)
|
|
386
|
+
return result
|
|
387
|
+
}
|
|
388
|
+
const handleCheckChange = () => {
|
|
389
|
+
const data = ref_tree.value?.getCheckedNodes().filter((c) => c.type === 'YH')
|
|
390
|
+
selectedUserList.value = []
|
|
391
|
+
if (data) {
|
|
392
|
+
data.forEach((item: any) => {
|
|
393
|
+
const f = userList.value?.find((c) => c.id === item.id)
|
|
394
|
+
if (f) {
|
|
395
|
+
selectedUserList.value.push(f)
|
|
396
|
+
}
|
|
397
|
+
})
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
const close = () => {
|
|
401
|
+
selectedUserList.value = []
|
|
402
|
+
}
|
|
403
|
+
</script>
|
|
404
|
+
<style scoped lang="scss">
|
|
405
|
+
.user-select {
|
|
406
|
+
//background: red;
|
|
407
|
+
width: 100%;
|
|
408
|
+
}
|
|
409
|
+
.user-select :hover {
|
|
410
|
+
background: #f5f7fa !important;
|
|
411
|
+
}
|
|
412
|
+
</style>
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 创建人 胡啸东
|
|
3
|
+
* 说明: 查询字典Hooks
|
|
4
|
+
* 创建时间: 2024/11/28 下午10:27
|
|
5
|
+
* 修改时间: 2024/11/28 下午10:27
|
|
6
|
+
*/
|
|
7
|
+
import { onBeforeUnmount, ref } from 'vue'
|
|
8
|
+
import type { ISysDictDataCacheVo } from '../interface/ISysDictDataCacheVo'
|
|
9
|
+
import { ElMessage } from 'element-plus'
|
|
10
|
+
import SysDictCacheApi from '../api/SysDictCacheApi.ts'
|
|
11
|
+
|
|
12
|
+
// 定义包含map的整体类型
|
|
13
|
+
export interface dictMapType {
|
|
14
|
+
[key: string]: ISysDictDataCacheVo[]
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default function useDictHooks(dictTypes: string[]) {
|
|
18
|
+
const dictMap = ref<dictMapType>({})
|
|
19
|
+
const dictDataMap = ref<Map<string, Map<string, ISysDictDataCacheVo>>>(new Map())
|
|
20
|
+
const dictDefaultValueMap = ref<Map<string, ISysDictDataCacheVo>>(new Map())
|
|
21
|
+
const getDict = async (dictTypes: string[]) => {
|
|
22
|
+
try {
|
|
23
|
+
const data = await SysDictCacheApi.batchGetSysDictDataCacheVo(dictTypes)
|
|
24
|
+
dictMap.value = { ...dictMap.value, ...data }
|
|
25
|
+
//获取默认值
|
|
26
|
+
Object.keys(data).forEach((item: string) => {
|
|
27
|
+
findDefaultValue(data[item], item)
|
|
28
|
+
const dataMap = new Map<string, ISysDictDataCacheVo>()
|
|
29
|
+
packageDictDataMap(dataMap, data[item])
|
|
30
|
+
dictDataMap.value.set(item, dataMap)
|
|
31
|
+
})
|
|
32
|
+
} catch (error: any) {
|
|
33
|
+
ElMessage.error(error.msg || error.message)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const packageDictDataMap = async (
|
|
38
|
+
map: Map<string, ISysDictDataCacheVo>,
|
|
39
|
+
list?: ISysDictDataCacheVo[],
|
|
40
|
+
) => {
|
|
41
|
+
if (list && list.length) {
|
|
42
|
+
list.forEach((item: ISysDictDataCacheVo) => {
|
|
43
|
+
map.set(item.value, { ...item, ...{ children: undefined } })
|
|
44
|
+
packageDictDataMap(map, item.children)
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const findDefaultValue = async (list: ISysDictDataCacheVo[], type: string) => {
|
|
49
|
+
const find = getDefaultValue(list)
|
|
50
|
+
find && dictDefaultValueMap.value.set(type, find)
|
|
51
|
+
}
|
|
52
|
+
const getDefaultValue = (list?: ISysDictDataCacheVo[]): ISysDictDataCacheVo | undefined => {
|
|
53
|
+
if (list && list.length) {
|
|
54
|
+
const find = list.find((item: ISysDictDataCacheVo) => item.isDefault === '1')
|
|
55
|
+
if (find) return find
|
|
56
|
+
for (const iSysDictDataCacheVo of list) {
|
|
57
|
+
const res = getDefaultValue(iSysDictDataCacheVo.children)
|
|
58
|
+
if (res) return res
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const getDictName = (value?: string, dictType?: string) => {
|
|
64
|
+
return dictDataMap.value.get(dictType!)?.get(value!)?.label || value
|
|
65
|
+
}
|
|
66
|
+
const getDictData = (value: string, dictType: string) => {
|
|
67
|
+
return dictDataMap.value.get(dictType)?.get(value)
|
|
68
|
+
}
|
|
69
|
+
getDict(dictTypes).then(() => {})
|
|
70
|
+
onBeforeUnmount(() => {
|
|
71
|
+
dictDefaultValueMap.value.clear()
|
|
72
|
+
dictDataMap.value.clear()
|
|
73
|
+
})
|
|
74
|
+
return {
|
|
75
|
+
dictMap,
|
|
76
|
+
dictDefaultValueMap,
|
|
77
|
+
getDict,
|
|
78
|
+
getDictName,
|
|
79
|
+
getDictData,
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { IpageDataQuery } from './PageData.ts'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 创建人 胡啸东
|
|
5
|
+
* 说明: Isss
|
|
6
|
+
* 创建时间: 2024/11/22 上午11:28
|
|
7
|
+
* 修改时间: 2024/11/22 上午11:28
|
|
8
|
+
*/
|
|
9
|
+
export interface IMdmDept extends IpageDataQuery {
|
|
10
|
+
/**
|
|
11
|
+
* 主键id
|
|
12
|
+
*/
|
|
13
|
+
id?: string
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 排序号 自增长,可修改
|
|
17
|
+
*/
|
|
18
|
+
orderNum?: string
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 父部门id
|
|
22
|
+
*/
|
|
23
|
+
parentId?: string
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* 部门编码
|
|
27
|
+
*/
|
|
28
|
+
code?: string
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 部门名称
|
|
32
|
+
*/
|
|
33
|
+
name?: string
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 部门简称
|
|
37
|
+
*/
|
|
38
|
+
shortName?: string
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* 部门类别 存部门类别字典“SysDeptClass”的值。
|
|
42
|
+
*/
|
|
43
|
+
deptClass?: string
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* 部门性质 存部门性质字典“SysDeptNature”的值。
|
|
47
|
+
*/
|
|
48
|
+
deptNature?: string
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* 是否有效 1=是,0=否。
|
|
52
|
+
*/
|
|
53
|
+
isValid?: string
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 组织id
|
|
57
|
+
*/
|
|
58
|
+
mdmOrgId?: string
|
|
59
|
+
|
|
60
|
+
// 是否删除,1=是,0=否。
|
|
61
|
+
isDelete?: string
|
|
62
|
+
|
|
63
|
+
// 创建者
|
|
64
|
+
createBy?: string
|
|
65
|
+
|
|
66
|
+
// 创建者
|
|
67
|
+
createByName?: string
|
|
68
|
+
|
|
69
|
+
// 创建时间
|
|
70
|
+
createTime?: string
|
|
71
|
+
|
|
72
|
+
// 更新者
|
|
73
|
+
updateBy?: string
|
|
74
|
+
|
|
75
|
+
// 更新时间
|
|
76
|
+
updateTime?: string
|
|
77
|
+
|
|
78
|
+
// 更新者
|
|
79
|
+
updateByName?: string
|
|
80
|
+
|
|
81
|
+
level?: string
|
|
82
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { BaseEntity } from './BaseEntity.ts'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Create by丁盼
|
|
5
|
+
* 说明: ISysUserInfo
|
|
6
|
+
* 创建时间: 2024/11/5 下午8:13
|
|
7
|
+
* 修改时间: 2024/11/5 下午8:13
|
|
8
|
+
*/
|
|
9
|
+
export interface ISysUserInfo extends BaseEntity {
|
|
10
|
+
// 主键id
|
|
11
|
+
id?: string
|
|
12
|
+
|
|
13
|
+
// 组织id
|
|
14
|
+
orgId?: string
|
|
15
|
+
|
|
16
|
+
// 登录名,存mdm_employee的code值。
|
|
17
|
+
loginName?: string
|
|
18
|
+
|
|
19
|
+
// 用户姓名
|
|
20
|
+
userName?: string
|
|
21
|
+
|
|
22
|
+
// 密码
|
|
23
|
+
password?: string
|
|
24
|
+
|
|
25
|
+
// 用户邮箱
|
|
26
|
+
email?: string
|
|
27
|
+
|
|
28
|
+
// 手机号码
|
|
29
|
+
phonenumber?: string
|
|
30
|
+
|
|
31
|
+
// 头像地址
|
|
32
|
+
avatar?: string
|
|
33
|
+
|
|
34
|
+
// 备注
|
|
35
|
+
remark?: string
|
|
36
|
+
|
|
37
|
+
// 最后登录IP
|
|
38
|
+
loginIp?: string
|
|
39
|
+
|
|
40
|
+
// 最后登录时间
|
|
41
|
+
loginDate?: string
|
|
42
|
+
|
|
43
|
+
//最近修改密码时间
|
|
44
|
+
updatePasswordTime?: string
|
|
45
|
+
|
|
46
|
+
// 是否有效,取值为 1(是)或 0(否)
|
|
47
|
+
isValid?: '1' | '0'
|
|
48
|
+
|
|
49
|
+
// 角色ID数组
|
|
50
|
+
roleIds?: string[]
|
|
51
|
+
|
|
52
|
+
sex?: string
|
|
53
|
+
|
|
54
|
+
orgName?: string
|
|
55
|
+
deptName?: string
|
|
56
|
+
postName?: string
|
|
57
|
+
/**
|
|
58
|
+
* 编码
|
|
59
|
+
*/
|
|
60
|
+
code?: string
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* 姓名
|
|
64
|
+
*/
|
|
65
|
+
name?: string
|
|
66
|
+
/**
|
|
67
|
+
* 部门ID
|
|
68
|
+
*/
|
|
69
|
+
mdmDeptId?: string
|
|
70
|
+
}
|
package/src/mixin/globalMixin.ts
CHANGED
|
@@ -1,31 +1,33 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 创建人:丁盼
|
|
3
|
-
* 说明: 全局混入
|
|
4
|
-
* 创建时间: 2024/8/29 下午2:31
|
|
5
|
-
* 修改时间: 2024/8/29 下午2:31
|
|
6
|
-
*/
|
|
7
|
-
import operationAuth from '../components/OperationAuth/operationAuth.vue'
|
|
8
|
-
import ElFlex from '../components/ElFlex/ElFlex.vue'
|
|
9
|
-
import ElSearch from '../components/Search/ElSearch.vue'
|
|
10
|
-
import ElTitle from '../components/Title/ElTitle.vue'
|
|
11
|
-
import ElIcons from '../components/icon/ElIcons.vue'
|
|
12
|
-
import ElIconBtn from '../components/icon/ElIconBtn.vue'
|
|
13
|
-
import ElIconSearch from '../components/Search/ElIconSearch.vue'
|
|
14
|
-
import ElTableColumnEdit from '../components/Table/ElTableColumnEdit.vue'
|
|
15
|
-
import vKeydown from '../directives/vKeydown'
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
1
|
+
/**
|
|
2
|
+
* 创建人:丁盼
|
|
3
|
+
* 说明: 全局混入
|
|
4
|
+
* 创建时间: 2024/8/29 下午2:31
|
|
5
|
+
* 修改时间: 2024/8/29 下午2:31
|
|
6
|
+
*/
|
|
7
|
+
import operationAuth from '../components/OperationAuth/operationAuth.vue'
|
|
8
|
+
import ElFlex from '../components/ElFlex/ElFlex.vue'
|
|
9
|
+
import ElSearch from '../components/Search/ElSearch.vue'
|
|
10
|
+
import ElTitle from '../components/Title/ElTitle.vue'
|
|
11
|
+
import ElIcons from '../components/icon/ElIcons.vue'
|
|
12
|
+
import ElIconBtn from '../components/icon/ElIconBtn.vue'
|
|
13
|
+
import ElIconSearch from '../components/Search/ElIconSearch.vue'
|
|
14
|
+
import ElTableColumnEdit from '../components/Table/ElTableColumnEdit.vue'
|
|
15
|
+
import vKeydown from '../directives/vKeydown'
|
|
16
|
+
import ElAutoToolTip from '../components/autoToolTip/ElAutoToolTip.vue'
|
|
17
|
+
//@ts-ignore
|
|
18
|
+
export const globalMixin = {
|
|
19
|
+
components: {
|
|
20
|
+
operationAuth,
|
|
21
|
+
ElFlex,
|
|
22
|
+
ElSearch,
|
|
23
|
+
ElTitle,
|
|
24
|
+
ElIcons,
|
|
25
|
+
ElIconBtn,
|
|
26
|
+
ElIconSearch,
|
|
27
|
+
ElTableColumnEdit,
|
|
28
|
+
ElAutoToolTip,
|
|
29
|
+
},
|
|
30
|
+
directives: {
|
|
31
|
+
keydown: vKeydown,
|
|
32
|
+
},
|
|
33
|
+
}
|
|
File without changes
|