@jari-ace/element-plus-component 0.2.2 → 0.2.3
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/README.md +1 -1
- package/dist/components/rolePicker/baseRolePicker.vue.d.ts.map +1 -1
- package/dist/components/rolePicker/baseRolePicker.vue.js +4 -2
- package/dist/components/rolePicker/baseRolePicker.vue.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/index.js +297 -297
- package/lib/index.umd.cjs +2 -2
- package/package.json +61 -61
- package/packages/components/autoComplete/JaAutoComplete.vue +47 -47
- package/packages/components/autoComplete/index.ts +5 -5
- package/packages/components/avatar/JaAvatar.vue +126 -126
- package/packages/components/avatar/avatarToken.ts +11 -11
- package/packages/components/avatar/defaultImg.ts +14 -14
- package/packages/components/avatar/index.ts +7 -7
- package/packages/components/button/JaButton.vue +51 -51
- package/packages/components/button/index.ts +4 -4
- package/packages/components/channelPicker/index.ts +7 -7
- package/packages/components/channelPicker/src/ChannelPicker.vue +43 -43
- package/packages/components/channelPicker/src/JaChannelPicker.vue +42 -42
- package/packages/components/checkbox/JaCheckbox.vue +73 -73
- package/packages/components/checkbox/index.ts +4 -4
- package/packages/components/checkboxGroup/JaCheckboxGroup.vue +45 -45
- package/packages/components/checkboxGroup/index.ts +4 -4
- package/packages/components/customGroupTree/index.ts +10 -10
- package/packages/components/customGroupTree/src/customGroupTree.vue +91 -91
- package/packages/components/datePicker/JaDatePicker.vue +52 -52
- package/packages/components/datePicker/index.ts +4 -4
- package/packages/components/departmentPicker/index.ts +4 -4
- package/packages/components/departmentPicker/src/DepartmentPicker.vue +107 -107
- package/packages/components/departmentPicker/src/consts.ts +2 -2
- package/packages/components/departmentTree/index.ts +10 -10
- package/packages/components/departmentTree/src/departmentTree.vue +135 -135
- package/packages/components/dropdownButton/JaDropdownButton.vue +59 -59
- package/packages/components/dropdownButton/index.ts +4 -4
- package/packages/components/enumList/EnumListInput.vue +107 -107
- package/packages/components/enumList/JaEnumList.vue +39 -39
- package/packages/components/enumList/index.ts +7 -7
- package/packages/components/enumPicker/index.ts +5 -5
- package/packages/components/enumPicker/src/EnumPicker.vue +103 -103
- package/packages/components/form/JaForm.vue +146 -146
- package/packages/components/form/index.ts +5 -5
- package/packages/components/form/types.ts +4 -4
- package/packages/components/formItem/JaFormItem.vue +87 -87
- package/packages/components/formItem/index.ts +4 -4
- package/packages/components/index.ts +34 -34
- package/packages/components/input/JaInput.vue +143 -143
- package/packages/components/input/index.ts +4 -4
- package/packages/components/inputI18n/I18nBundleEditor.vue +76 -76
- package/packages/components/inputI18n/InputI18n.vue +146 -146
- package/packages/components/inputI18n/JaInputI18n.vue +50 -50
- package/packages/components/inputI18n/index.ts +8 -8
- package/packages/components/inputNumber/JaInputNumber.vue +98 -98
- package/packages/components/inputNumber/index.ts +4 -4
- package/packages/components/mapItemList/JaMapItemList.vue +35 -35
- package/packages/components/mapItemList/MapItemListInput.vue +191 -191
- package/packages/components/mapItemList/index.ts +7 -7
- package/packages/components/numberList/JaNumberList.vue +36 -36
- package/packages/components/numberList/NumberListInput.vue +111 -111
- package/packages/components/numberList/index.ts +7 -7
- package/packages/components/properyPicker/JaPropertyPicker.vue +38 -38
- package/packages/components/properyPicker/PropertyPicker.vue +314 -314
- package/packages/components/properyPicker/index.ts +7 -7
- package/packages/components/radioGroup/JaRadioGroup.vue +50 -50
- package/packages/components/radioGroup/index.ts +4 -4
- package/packages/components/rolePicker/RoleEditor.vue +129 -129
- package/packages/components/rolePicker/RolePicker.vue +44 -44
- package/packages/components/rolePicker/RolePickerRaw.vue +56 -56
- package/packages/components/rolePicker/baseRolePicker.vue +91 -87
- package/packages/components/rolePicker/index.ts +10 -10
- package/packages/components/scrollbar/Scrollbar.vue +89 -89
- package/packages/components/scrollbar/index.ts +5 -5
- package/packages/components/scrollbar/utils.ts +17 -17
- package/packages/components/select/JaSelect.vue +48 -48
- package/packages/components/select/index.ts +4 -4
- package/packages/components/stringList/JaStringList.vue +36 -36
- package/packages/components/stringList/StringListInput.vue +96 -96
- package/packages/components/stringList/index.ts +7 -7
- package/packages/components/switch/JaSwitch.vue +50 -50
- package/packages/components/switch/index.ts +4 -4
- package/packages/components/timePicker/JaTimePicker.vue +52 -52
- package/packages/components/timePicker/index.ts +5 -5
- package/packages/components/tip/index.ts +4 -4
- package/packages/components/tip/src/AceTip.vue +43 -43
- package/packages/components/upload/index.ts +6 -6
- package/packages/components/upload/src/Upload.vue +25 -25
- package/packages/components/upload/src/type.ts +3 -3
- package/packages/components/userGroupPicker/index.ts +4 -4
- package/packages/components/userGroupPicker/src/UserGroupPicker.vue +94 -94
- package/packages/components/userGroupTree/index.ts +10 -10
- package/packages/components/userGroupTree/src/userGroupTree.vue +149 -149
- package/packages/components/userPicker/index.ts +10 -10
- package/packages/components/userPicker/src/CustomGroupManager.vue +189 -189
- package/packages/components/userPicker/src/JaUserList.vue +317 -317
- package/packages/components/userPicker/src/JaUserPicker.vue +40 -40
- package/packages/components/userPicker/src/UserPicker.vue +472 -472
- package/packages/components/userSelectDialog/index.ts +6 -6
- package/packages/components/userSelectDialog/src/userSelectDialog.vue +462 -462
- package/packages/components/userTag/UserInfoTag.vue +397 -397
- package/packages/components/userTag/index.ts +6 -6
- package/packages/components/userTag/sharedAxios.ts +8 -8
- package/packages/directives/auth/index.ts +41 -41
- package/packages/directives/autofocus/index.ts +29 -29
- package/packages/directives/index.ts +10 -10
- package/packages/directives/shortcut/index.ts +192 -192
- package/packages/hooks/useAppInstances.ts +34 -34
- package/packages/hooks/useBackendValidations.ts +81 -81
- package/packages/hooks/useBridage.ts +157 -157
- package/packages/hooks/useClassificationLevels.ts +62 -62
- package/packages/hooks/useDateTimeShortCuts.ts +65 -65
- package/packages/hooks/useRealms.ts +28 -28
- package/packages/hooks/useTreeData.ts +45 -45
- package/packages/hooks/useUserRefQuery.ts +232 -232
- package/packages/index.ts +24 -24
- package/packages/list.json +7 -7
- package/packages/types/custom.d.ts +13 -13
- package/packages/types/window.d.ts +16 -16
- package/packages/utils/install.ts +43 -43
- package/packages/utils/objectUtils.ts +31 -31
- package/theme-style/fonts/iconfont.json +5196 -5196
- package/theme-style/index.scss +10 -10
- package/theme-style/styles/element-plus-var.scss +1419 -1419
- package/theme-style/styles/iconfont.css +2979 -2979
- package/theme-style/styles/theme-var.scss +72 -72
- package/theme-style/styles/transition.scss +122 -122
|
@@ -1,472 +1,472 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
ElButton,
|
|
4
|
-
ElIcon,
|
|
5
|
-
ElInput,
|
|
6
|
-
ElPopover,
|
|
7
|
-
ElText,
|
|
8
|
-
ElSpace,
|
|
9
|
-
} from "element-plus";
|
|
10
|
-
|
|
11
|
-
import type { PopoverInstance } from 'element-plus'
|
|
12
|
-
|
|
13
|
-
import {computed, ref, shallowRef, watch} from "vue"
|
|
14
|
-
import {
|
|
15
|
-
Delete,
|
|
16
|
-
Finished,
|
|
17
|
-
Notebook,
|
|
18
|
-
Plus,
|
|
19
|
-
Search, Setting,
|
|
20
|
-
StarFilled
|
|
21
|
-
} from "@element-plus/icons-vue";
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
import {
|
|
26
|
-
type BooleanResultExpression,
|
|
27
|
-
createAxiosWithoutCache,
|
|
28
|
-
QUser, useLoginUser,
|
|
29
|
-
type UserReference,
|
|
30
|
-
useUserApi, useUserQueryBuilder
|
|
31
|
-
} from "@jari-ace/app-bolts";
|
|
32
|
-
import {useUserRefQuery} from "../../../hooks/useUserRefQuery";
|
|
33
|
-
import vShortcut from "../../../directives/shortcut"
|
|
34
|
-
import {JaUserInfoTag} from "../../userTag"
|
|
35
|
-
import {JaButton} from "../../button";
|
|
36
|
-
import {JaUserSelectDialog} from "../../userSelectDialog";
|
|
37
|
-
import {JaScrollbar} from "../../scrollbar";
|
|
38
|
-
import CustomGroupManager from "./CustomGroupManager.vue";
|
|
39
|
-
import JaUserList from "./JaUserList.vue";
|
|
40
|
-
import {useRealms} from '../../../hooks/useRealms'
|
|
41
|
-
|
|
42
|
-
const props = withDefaults( defineProps<{
|
|
43
|
-
/**
|
|
44
|
-
* Popover 弹出框的触发方式
|
|
45
|
-
*/
|
|
46
|
-
trigger?:'click' | 'focus' | 'hover' | 'contextmenu',
|
|
47
|
-
/**
|
|
48
|
-
* 可选择用户的用户域ID
|
|
49
|
-
*/
|
|
50
|
-
realmId?:string,
|
|
51
|
-
/**
|
|
52
|
-
* 弹出下拉选框的快捷键
|
|
53
|
-
*/
|
|
54
|
-
shortcut?:string,
|
|
55
|
-
/**
|
|
56
|
-
* 是否多选模式
|
|
57
|
-
*/
|
|
58
|
-
multiple?:boolean
|
|
59
|
-
/**
|
|
60
|
-
* 密级过滤
|
|
61
|
-
*/
|
|
62
|
-
classificationLevel?:number
|
|
63
|
-
/**
|
|
64
|
-
* 自定义筛选过滤条件,可以在此回调方法内使用qUser参数构造自定义的查询条件。例如 qUser => qUser.fullName.startWith('王')
|
|
65
|
-
*/
|
|
66
|
-
customFilter?:(qUser: InstanceType<typeof QUser>) => BooleanResultExpression,
|
|
67
|
-
/**
|
|
68
|
-
* 最多显示多少已选中的用户数量
|
|
69
|
-
*/
|
|
70
|
-
maxShowCount?:number,
|
|
71
|
-
/**
|
|
72
|
-
* 高度,默认100%
|
|
73
|
-
*/
|
|
74
|
-
height?:number|string
|
|
75
|
-
/**
|
|
76
|
-
* 最大高度
|
|
77
|
-
*/
|
|
78
|
-
maxHeight?: number|string,
|
|
79
|
-
/**
|
|
80
|
-
* 是否显示已选用户标签
|
|
81
|
-
*/
|
|
82
|
-
showUserTag?:boolean
|
|
83
|
-
|
|
84
|
-
}>(),{
|
|
85
|
-
trigger:'hover',
|
|
86
|
-
shortcut: "Ctrl+Alt+U",
|
|
87
|
-
multiple:false,
|
|
88
|
-
classificationLevel: 0,
|
|
89
|
-
maxShowCount: 20,
|
|
90
|
-
maxHeight: '100%',
|
|
91
|
-
showUserTag: true,
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
// const props = defineProps({
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* 可选择用户的用户域ID
|
|
98
|
-
*/
|
|
99
|
-
// realmId: {type: String, required: false},
|
|
100
|
-
/**
|
|
101
|
-
* 弹出下拉选框的快捷键
|
|
102
|
-
*/
|
|
103
|
-
// shortcut: {type: String, required: false, default: "Ctrl+Alt+U"},
|
|
104
|
-
/**
|
|
105
|
-
* 是否多选模式
|
|
106
|
-
*/
|
|
107
|
-
// multiple: {type: Boolean, required: false, default: false},
|
|
108
|
-
/**
|
|
109
|
-
* 密级过滤
|
|
110
|
-
*/
|
|
111
|
-
// classificationLevel: {type: Number, required: false, default: 0},
|
|
112
|
-
/**
|
|
113
|
-
* 自定义筛选过滤条件,可以在此回调方法内使用qUser参数构造自定义的查询条件。例如 qUser => qUser.fullName.startWith('王')
|
|
114
|
-
*/
|
|
115
|
-
// customFilter: {
|
|
116
|
-
// type: Function as PropType<(qUser: InstanceType<typeof QUser>) => BooleanResultExpression>,
|
|
117
|
-
// required: false
|
|
118
|
-
// },
|
|
119
|
-
/**
|
|
120
|
-
* 最多显示多少已选中的用户数量
|
|
121
|
-
*/
|
|
122
|
-
// maxShowCount: {type: Number, required: false, default: 20},
|
|
123
|
-
/**
|
|
124
|
-
* 高度,默认100%
|
|
125
|
-
*/
|
|
126
|
-
// height: {type: [Number, String], required: false, default: '100%'},
|
|
127
|
-
/**
|
|
128
|
-
* 最大高度
|
|
129
|
-
*/
|
|
130
|
-
// maxHeight: {type: [Number, String], required: false},
|
|
131
|
-
// })
|
|
132
|
-
|
|
133
|
-
const localRealmId = ref<string>();
|
|
134
|
-
|
|
135
|
-
const bookmarkDropdown = ref<PopoverInstance>()
|
|
136
|
-
|
|
137
|
-
async function loadRealmId() {
|
|
138
|
-
if (props.realmId) {
|
|
139
|
-
localRealmId.value = props.realmId;
|
|
140
|
-
} else {
|
|
141
|
-
const defaultRealm = await useRealms().getDefaultRealm();
|
|
142
|
-
localRealmId.value = defaultRealm.id;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
loadRealmId();
|
|
147
|
-
|
|
148
|
-
watch(() => props.realmId, loadRealmId)
|
|
149
|
-
|
|
150
|
-
const minLengthToTriggerUserQuery = 0;
|
|
151
|
-
const axios = createAxiosWithoutCache();
|
|
152
|
-
const api = useUserApi(axios);
|
|
153
|
-
const users = shallowRef<UserReference[]>([]);
|
|
154
|
-
const selectedUsers = defineModel<UserReference[] | UserReference | null>({
|
|
155
|
-
required: true
|
|
156
|
-
});
|
|
157
|
-
const inputSearchText = ref<typeof ElInput>();
|
|
158
|
-
const popoverVisible = ref(false);
|
|
159
|
-
const {queryResult, queryParams, pageParams, loading} = useUserRefQuery(
|
|
160
|
-
() => queryParams.value.name != undefined && queryParams.value.name.length
|
|
161
|
-
> minLengthToTriggerUserQuery,
|
|
162
|
-
props.customFilter,
|
|
163
|
-
(r, paramsChanged) => {
|
|
164
|
-
if (r) {
|
|
165
|
-
users.value = queryResult.value.users;
|
|
166
|
-
if (paramsChanged) {
|
|
167
|
-
scrollbar.value?.elScrollbar?.scrollTo(0, 0);
|
|
168
|
-
}
|
|
169
|
-
} else {
|
|
170
|
-
onPopoverShow();
|
|
171
|
-
}
|
|
172
|
-
}, true, axios, false);
|
|
173
|
-
const btn = ref<typeof ElButton>();
|
|
174
|
-
const scrollbar = ref<InstanceType<typeof JaScrollbar>>();
|
|
175
|
-
const dialogUserSelector = ref<InstanceType<typeof JaUserSelectDialog>>();
|
|
176
|
-
const dlgCustomGroupManager = ref<InstanceType<typeof CustomGroupManager>>();
|
|
177
|
-
const userList = ref<InstanceType<typeof JaUserList>>();
|
|
178
|
-
|
|
179
|
-
function switchUserSelect(u: UserReference) {
|
|
180
|
-
if (props.multiple) {
|
|
181
|
-
if (!Array.isArray(selectedUsers.value)) {
|
|
182
|
-
throw new Error("UserPicker组件设置为多选模式(multiple)时,v-model必须绑定UserReference数组")
|
|
183
|
-
}
|
|
184
|
-
const index = selectedUsers.value.findIndex(su => su.id == u.id);
|
|
185
|
-
if (index < 0) {
|
|
186
|
-
selectedUsers.value.push(u);
|
|
187
|
-
} else {
|
|
188
|
-
selectedUsers.value.splice(index, 1);
|
|
189
|
-
}
|
|
190
|
-
} else {
|
|
191
|
-
if (Array.isArray(selectedUsers.value)) {
|
|
192
|
-
throw new Error("UserPicker组件设置为单选模式时,v-model必须绑定UserReference对象或者null")
|
|
193
|
-
}
|
|
194
|
-
if(selectedUsers.value!==null&&u.id===selectedUsers.value.id){
|
|
195
|
-
selectedUsers.value = null;
|
|
196
|
-
}else{
|
|
197
|
-
selectedUsers.value = u;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
function onPopoverShow() {
|
|
204
|
-
if (props.realmId) {
|
|
205
|
-
queryParams.value.realmId = props.realmId
|
|
206
|
-
}
|
|
207
|
-
if (queryParams.value.name && queryParams.value.name.length > minLengthToTriggerUserQuery) {
|
|
208
|
-
queryParams.value.name = undefined;
|
|
209
|
-
}
|
|
210
|
-
const builder = useUserQueryBuilder();
|
|
211
|
-
if (props.customFilter) {
|
|
212
|
-
const qUser = builder.getQEntity();
|
|
213
|
-
builder.and(props.customFilter(qUser));
|
|
214
|
-
}
|
|
215
|
-
api.getBookmarkedUsers(builder.build()).then(r => {
|
|
216
|
-
users.value = r;
|
|
217
|
-
})
|
|
218
|
-
setTimeout(() => {
|
|
219
|
-
inputSearchText.value?.focus();
|
|
220
|
-
}, 300)
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
function onPopoverHide() {
|
|
224
|
-
popoverVisible.value = false
|
|
225
|
-
btn.value?.$el.focus();
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
function onSaveToCustomGroupClick() {
|
|
229
|
-
dlgCustomGroupManager.value?.show();
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
function onDeselected(uid?: string) {
|
|
233
|
-
if (Array.isArray(selectedUsers.value)) {
|
|
234
|
-
const index = selectedUsers.value.findIndex(su => su.id == uid);
|
|
235
|
-
if (index >= 0) {
|
|
236
|
-
selectedUsers.value.splice(index, 1)
|
|
237
|
-
}
|
|
238
|
-
} else {
|
|
239
|
-
selectedUsers.value = null;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
function onInputArrowDown() {
|
|
244
|
-
userList.value.scrollDown();
|
|
245
|
-
inputSearchText.value?.focus();
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
function onInputArrowUp() {
|
|
249
|
-
userList.value.scrollUp();
|
|
250
|
-
inputSearchText.value?.focus();
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
function onInputKeyEnter() {
|
|
254
|
-
switchUserSelect(users.value[userList.value?.activeIndex]);
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
function popup() {
|
|
258
|
-
popoverVisible.value = true;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
function selectAll() {
|
|
262
|
-
const arr = (
|
|
263
|
-
selectedUsers.value as UserReference[]
|
|
264
|
-
);
|
|
265
|
-
arr.push(...users.value.filter(u => !arr.some(su => su.id === u.id)));
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
function clearSelection() {
|
|
269
|
-
if (props.multiple) {
|
|
270
|
-
selectedUsers.value = [];
|
|
271
|
-
} else {
|
|
272
|
-
selectedUsers.value = null;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
function onArrowKeyDown() {
|
|
277
|
-
inputSearchText.value?.focus();
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
const selectedForBinding = computed(() => {
|
|
281
|
-
if (props.multiple && Array.isArray(selectedUsers.value)) {
|
|
282
|
-
return selectedUsers.value;
|
|
283
|
-
} else if (!props.multiple && !Array.isArray(selectedUsers.value)) {
|
|
284
|
-
if (selectedUsers.value) {
|
|
285
|
-
return [selectedUsers.value as UserReference];
|
|
286
|
-
} else {
|
|
287
|
-
return [] as UserReference[];
|
|
288
|
-
}
|
|
289
|
-
} else {
|
|
290
|
-
throw new Error("UserPicker组件设置为多选模式(multiple)时,v-model必须绑定UserReference数组")
|
|
291
|
-
}
|
|
292
|
-
})
|
|
293
|
-
|
|
294
|
-
function showUserSelectDialog() {
|
|
295
|
-
dialogUserSelector.value?.show();
|
|
296
|
-
popoverVisible.value = false;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
function handleMouseOver() {
|
|
300
|
-
popoverVisible.value = true
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
const selectedUsersForRender = computed(() => selectedForBinding.value.slice(0, props.maxShowCount))
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
watch(()=>props.classificationLevel, ()=>{
|
|
309
|
-
queryParams.value.classificationLevel = props.classificationLevel
|
|
310
|
-
})
|
|
311
|
-
|
|
312
|
-
</script>
|
|
313
|
-
|
|
314
|
-
<template>
|
|
315
|
-
<ja-scrollbar :max-height="props.maxHeight" :height="props.height" v-bind="$attrs"
|
|
316
|
-
style="overflow-x: hidden;">
|
|
317
|
-
<div class="ja-user-picker__root" v-shortcut:[props.shortcut]="popup">
|
|
318
|
-
|
|
319
|
-
<el-popover ref="bookmarkDropdown" @show="onPopoverShow" @hide="onPopoverHide"
|
|
320
|
-
v-model:visible="popoverVisible"
|
|
321
|
-
width="auto" teleported
|
|
322
|
-
:trigger="props.trigger"
|
|
323
|
-
>
|
|
324
|
-
<template #reference>
|
|
325
|
-
<div style="display: flex;align-items: center;">
|
|
326
|
-
<slot
|
|
327
|
-
v-if="$slots.default"
|
|
328
|
-
name="default"></slot>
|
|
329
|
-
<el-button v-else circle :icon="Plus" :size="'small'" ref="btn"
|
|
330
|
-
@mouseover="handleMouseOver">
|
|
331
|
-
</el-button>
|
|
332
|
-
</div>
|
|
333
|
-
|
|
334
|
-
</template>
|
|
335
|
-
<template #default>
|
|
336
|
-
<div class="ja-user-picker-bookmark__dropdown">
|
|
337
|
-
<div
|
|
338
|
-
style="width: 100%; display: flex; align-content: center; justify-content: end; margin-bottom: 4px;">
|
|
339
|
-
<el-space style="flex:auto">
|
|
340
|
-
<ja-button circle size="small" @click="showUserSelectDialog" plain
|
|
341
|
-
type="primary" tooltip="对话框筛选(大批量选择)"
|
|
342
|
-
shortcut="Ctrl+Alt+I" :icon="Notebook">
|
|
343
|
-
</ja-button>
|
|
344
|
-
<ja-button circle size="small" @click="clearSelection" type="danger"
|
|
345
|
-
plain :icon="Delete"
|
|
346
|
-
tooltip="清空选择" shortcut="Alt+C">
|
|
347
|
-
</ja-button>
|
|
348
|
-
<ja-button circle size="small" @click="selectAll" type="success"
|
|
349
|
-
plain :icon="Finished"
|
|
350
|
-
tooltip="全选(已加载的数据)" shortcut="Ctrl+A"
|
|
351
|
-
v-if="props.multiple">
|
|
352
|
-
</ja-button>
|
|
353
|
-
<ja-button circle size="small" @click="onSaveToCustomGroupClick"
|
|
354
|
-
type="warning" :icon="Setting" plain
|
|
355
|
-
tooltip="将已选中用户保存为自定义组,方便以后选择使用">
|
|
356
|
-
</ja-button>
|
|
357
|
-
</el-space>
|
|
358
|
-
<div style="color: var(--el-color-info-light-5);">
|
|
359
|
-
弹出快捷键:{{ props.shortcut }}
|
|
360
|
-
</div>
|
|
361
|
-
</div>
|
|
362
|
-
<el-input v-model="queryParams.name" ref="inputSearchText"
|
|
363
|
-
:suffix-icon="Search"
|
|
364
|
-
placeholder="请输入拼音名、姓名或手机号查询"
|
|
365
|
-
autocomplete="off"
|
|
366
|
-
@keydown.enter="onInputKeyEnter"
|
|
367
|
-
@keydown.up.stop.prevent="onInputArrowUp"
|
|
368
|
-
@keydown.down.stop.prevent="onInputArrowDown">
|
|
369
|
-
</el-input>
|
|
370
|
-
|
|
371
|
-
<div class="dropdown-header">
|
|
372
|
-
<el-text>
|
|
373
|
-
<el-icon
|
|
374
|
-
v-if="queryParams.name && queryParams.name.length > minLengthToTriggerUserQuery">
|
|
375
|
-
<Search></Search>
|
|
376
|
-
</el-icon>
|
|
377
|
-
<el-icon v-else color="#FFBF29">
|
|
378
|
-
<StarFilled></StarFilled>
|
|
379
|
-
</el-icon>
|
|
380
|
-
{{
|
|
381
|
-
queryParams.name && queryParams.name.length
|
|
382
|
-
> minLengthToTriggerUserQuery ? "查询结果" : "常用人员"
|
|
383
|
-
}}
|
|
384
|
-
</el-text>
|
|
385
|
-
</div>
|
|
386
|
-
<ja-user-list
|
|
387
|
-
ref="userList"
|
|
388
|
-
:total="queryResult.total"
|
|
389
|
-
:empty-text="queryParams.name && queryParams.name.length > minLengthToTriggerUserQuery ? undefined : '无可选常用人员'"
|
|
390
|
-
:page-size="pageParams.pageSize"
|
|
391
|
-
:loading="loading"
|
|
392
|
-
:users="users"
|
|
393
|
-
:height="300"
|
|
394
|
-
v-model="selectedUsers"
|
|
395
|
-
v-model:page="pageParams.currentPage"
|
|
396
|
-
:multiple="props.multiple"
|
|
397
|
-
@item-clicked="onArrowKeyDown"
|
|
398
|
-
@arrow-key-down="onArrowKeyDown"></ja-user-list>
|
|
399
|
-
</div>
|
|
400
|
-
</template>
|
|
401
|
-
</el-popover>
|
|
402
|
-
<div v-if="props.showUserTag" class="ja-user-picker__tag-container">
|
|
403
|
-
<ja-user-info-tag v-for="u in selectedUsersForRender" :key="u.id" :user-id="u.id"
|
|
404
|
-
:full-name="u.fullName" closable :has-avatar="u.hasAvatar"
|
|
405
|
-
@closed="onDeselected">
|
|
406
|
-
</ja-user-info-tag>
|
|
407
|
-
<div class="more-tag" v-if="selectedForBinding.length > props.maxShowCount">
|
|
408
|
-
+{{ selectedForBinding.length - props.maxShowCount }}人
|
|
409
|
-
</div>
|
|
410
|
-
<div v-if="selectedForBinding.length === 0">
|
|
411
|
-
<el-text type="info"> <暂无选中人员></el-text>
|
|
412
|
-
</div>
|
|
413
|
-
</div>
|
|
414
|
-
|
|
415
|
-
<ja-user-select-dialog ref="dialogUserSelector"
|
|
416
|
-
:multiple="props.multiple"
|
|
417
|
-
:realm-id="localRealmId"
|
|
418
|
-
:classificationLevel="props.classificationLevel"
|
|
419
|
-
:customFilter="props.customFilter"
|
|
420
|
-
v-model="selectedUsers"></ja-user-select-dialog>
|
|
421
|
-
</div>
|
|
422
|
-
</ja-scrollbar>
|
|
423
|
-
<custom-group-manager ref="dlgCustomGroupManager"
|
|
424
|
-
:users="Array.isArray(selectedUsers)? selectedUsers as UserReference[] : (selectedUsers ? [selectedUsers] : null)"></custom-group-manager>
|
|
425
|
-
</template>
|
|
426
|
-
|
|
427
|
-
<style scoped lang="scss">
|
|
428
|
-
.ja-user-picker__root {
|
|
429
|
-
display: flex;
|
|
430
|
-
//flex-wrap: wrap;
|
|
431
|
-
justify-content: left;
|
|
432
|
-
//align-items: center;
|
|
433
|
-
gap: 8px;
|
|
434
|
-
padding: 8px 0;
|
|
435
|
-
.ja-user-picker__tag-container{
|
|
436
|
-
display: flex;
|
|
437
|
-
flex-wrap: wrap;
|
|
438
|
-
justify-content: left;
|
|
439
|
-
align-items: center;
|
|
440
|
-
gap: 4px;
|
|
441
|
-
}
|
|
442
|
-
.more-tag {
|
|
443
|
-
border-radius: 28px;
|
|
444
|
-
height: 28px;
|
|
445
|
-
padding: 2px 5px;
|
|
446
|
-
background-color: #E8F5FF;
|
|
447
|
-
color: #00164D;
|
|
448
|
-
border: 1px solid #C1CCD7;
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
:deep(.el-popover) {
|
|
453
|
-
padding: 0 !important;
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
.ja-user-picker-bookmark__dropdown {
|
|
457
|
-
padding: 0;
|
|
458
|
-
margin: 0;
|
|
459
|
-
|
|
460
|
-
.dropdown-header {
|
|
461
|
-
padding: 8px 0;
|
|
462
|
-
width: 280px;
|
|
463
|
-
cursor: default;
|
|
464
|
-
font-weight: 600;
|
|
465
|
-
|
|
466
|
-
.el-text {
|
|
467
|
-
font-weight: 600;
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
}
|
|
472
|
-
</style>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
ElButton,
|
|
4
|
+
ElIcon,
|
|
5
|
+
ElInput,
|
|
6
|
+
ElPopover,
|
|
7
|
+
ElText,
|
|
8
|
+
ElSpace,
|
|
9
|
+
} from "element-plus";
|
|
10
|
+
|
|
11
|
+
import type { PopoverInstance } from 'element-plus'
|
|
12
|
+
|
|
13
|
+
import {computed, ref, shallowRef, watch} from "vue"
|
|
14
|
+
import {
|
|
15
|
+
Delete,
|
|
16
|
+
Finished,
|
|
17
|
+
Notebook,
|
|
18
|
+
Plus,
|
|
19
|
+
Search, Setting,
|
|
20
|
+
StarFilled
|
|
21
|
+
} from "@element-plus/icons-vue";
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
import {
|
|
26
|
+
type BooleanResultExpression,
|
|
27
|
+
createAxiosWithoutCache,
|
|
28
|
+
QUser, useLoginUser,
|
|
29
|
+
type UserReference,
|
|
30
|
+
useUserApi, useUserQueryBuilder
|
|
31
|
+
} from "@jari-ace/app-bolts";
|
|
32
|
+
import {useUserRefQuery} from "../../../hooks/useUserRefQuery";
|
|
33
|
+
import vShortcut from "../../../directives/shortcut"
|
|
34
|
+
import {JaUserInfoTag} from "../../userTag"
|
|
35
|
+
import {JaButton} from "../../button";
|
|
36
|
+
import {JaUserSelectDialog} from "../../userSelectDialog";
|
|
37
|
+
import {JaScrollbar} from "../../scrollbar";
|
|
38
|
+
import CustomGroupManager from "./CustomGroupManager.vue";
|
|
39
|
+
import JaUserList from "./JaUserList.vue";
|
|
40
|
+
import {useRealms} from '../../../hooks/useRealms'
|
|
41
|
+
|
|
42
|
+
const props = withDefaults( defineProps<{
|
|
43
|
+
/**
|
|
44
|
+
* Popover 弹出框的触发方式
|
|
45
|
+
*/
|
|
46
|
+
trigger?:'click' | 'focus' | 'hover' | 'contextmenu',
|
|
47
|
+
/**
|
|
48
|
+
* 可选择用户的用户域ID
|
|
49
|
+
*/
|
|
50
|
+
realmId?:string,
|
|
51
|
+
/**
|
|
52
|
+
* 弹出下拉选框的快捷键
|
|
53
|
+
*/
|
|
54
|
+
shortcut?:string,
|
|
55
|
+
/**
|
|
56
|
+
* 是否多选模式
|
|
57
|
+
*/
|
|
58
|
+
multiple?:boolean
|
|
59
|
+
/**
|
|
60
|
+
* 密级过滤
|
|
61
|
+
*/
|
|
62
|
+
classificationLevel?:number
|
|
63
|
+
/**
|
|
64
|
+
* 自定义筛选过滤条件,可以在此回调方法内使用qUser参数构造自定义的查询条件。例如 qUser => qUser.fullName.startWith('王')
|
|
65
|
+
*/
|
|
66
|
+
customFilter?:(qUser: InstanceType<typeof QUser>) => BooleanResultExpression,
|
|
67
|
+
/**
|
|
68
|
+
* 最多显示多少已选中的用户数量
|
|
69
|
+
*/
|
|
70
|
+
maxShowCount?:number,
|
|
71
|
+
/**
|
|
72
|
+
* 高度,默认100%
|
|
73
|
+
*/
|
|
74
|
+
height?:number|string
|
|
75
|
+
/**
|
|
76
|
+
* 最大高度
|
|
77
|
+
*/
|
|
78
|
+
maxHeight?: number|string,
|
|
79
|
+
/**
|
|
80
|
+
* 是否显示已选用户标签
|
|
81
|
+
*/
|
|
82
|
+
showUserTag?:boolean
|
|
83
|
+
|
|
84
|
+
}>(),{
|
|
85
|
+
trigger:'hover',
|
|
86
|
+
shortcut: "Ctrl+Alt+U",
|
|
87
|
+
multiple:false,
|
|
88
|
+
classificationLevel: 0,
|
|
89
|
+
maxShowCount: 20,
|
|
90
|
+
maxHeight: '100%',
|
|
91
|
+
showUserTag: true,
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
// const props = defineProps({
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* 可选择用户的用户域ID
|
|
98
|
+
*/
|
|
99
|
+
// realmId: {type: String, required: false},
|
|
100
|
+
/**
|
|
101
|
+
* 弹出下拉选框的快捷键
|
|
102
|
+
*/
|
|
103
|
+
// shortcut: {type: String, required: false, default: "Ctrl+Alt+U"},
|
|
104
|
+
/**
|
|
105
|
+
* 是否多选模式
|
|
106
|
+
*/
|
|
107
|
+
// multiple: {type: Boolean, required: false, default: false},
|
|
108
|
+
/**
|
|
109
|
+
* 密级过滤
|
|
110
|
+
*/
|
|
111
|
+
// classificationLevel: {type: Number, required: false, default: 0},
|
|
112
|
+
/**
|
|
113
|
+
* 自定义筛选过滤条件,可以在此回调方法内使用qUser参数构造自定义的查询条件。例如 qUser => qUser.fullName.startWith('王')
|
|
114
|
+
*/
|
|
115
|
+
// customFilter: {
|
|
116
|
+
// type: Function as PropType<(qUser: InstanceType<typeof QUser>) => BooleanResultExpression>,
|
|
117
|
+
// required: false
|
|
118
|
+
// },
|
|
119
|
+
/**
|
|
120
|
+
* 最多显示多少已选中的用户数量
|
|
121
|
+
*/
|
|
122
|
+
// maxShowCount: {type: Number, required: false, default: 20},
|
|
123
|
+
/**
|
|
124
|
+
* 高度,默认100%
|
|
125
|
+
*/
|
|
126
|
+
// height: {type: [Number, String], required: false, default: '100%'},
|
|
127
|
+
/**
|
|
128
|
+
* 最大高度
|
|
129
|
+
*/
|
|
130
|
+
// maxHeight: {type: [Number, String], required: false},
|
|
131
|
+
// })
|
|
132
|
+
|
|
133
|
+
const localRealmId = ref<string>();
|
|
134
|
+
|
|
135
|
+
const bookmarkDropdown = ref<PopoverInstance>()
|
|
136
|
+
|
|
137
|
+
async function loadRealmId() {
|
|
138
|
+
if (props.realmId) {
|
|
139
|
+
localRealmId.value = props.realmId;
|
|
140
|
+
} else {
|
|
141
|
+
const defaultRealm = await useRealms().getDefaultRealm();
|
|
142
|
+
localRealmId.value = defaultRealm.id;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
loadRealmId();
|
|
147
|
+
|
|
148
|
+
watch(() => props.realmId, loadRealmId)
|
|
149
|
+
|
|
150
|
+
const minLengthToTriggerUserQuery = 0;
|
|
151
|
+
const axios = createAxiosWithoutCache();
|
|
152
|
+
const api = useUserApi(axios);
|
|
153
|
+
const users = shallowRef<UserReference[]>([]);
|
|
154
|
+
const selectedUsers = defineModel<UserReference[] | UserReference | null>({
|
|
155
|
+
required: true
|
|
156
|
+
});
|
|
157
|
+
const inputSearchText = ref<typeof ElInput>();
|
|
158
|
+
const popoverVisible = ref(false);
|
|
159
|
+
const {queryResult, queryParams, pageParams, loading} = useUserRefQuery(
|
|
160
|
+
() => queryParams.value.name != undefined && queryParams.value.name.length
|
|
161
|
+
> minLengthToTriggerUserQuery,
|
|
162
|
+
props.customFilter,
|
|
163
|
+
(r, paramsChanged) => {
|
|
164
|
+
if (r) {
|
|
165
|
+
users.value = queryResult.value.users;
|
|
166
|
+
if (paramsChanged) {
|
|
167
|
+
scrollbar.value?.elScrollbar?.scrollTo(0, 0);
|
|
168
|
+
}
|
|
169
|
+
} else {
|
|
170
|
+
onPopoverShow();
|
|
171
|
+
}
|
|
172
|
+
}, true, axios, false);
|
|
173
|
+
const btn = ref<typeof ElButton>();
|
|
174
|
+
const scrollbar = ref<InstanceType<typeof JaScrollbar>>();
|
|
175
|
+
const dialogUserSelector = ref<InstanceType<typeof JaUserSelectDialog>>();
|
|
176
|
+
const dlgCustomGroupManager = ref<InstanceType<typeof CustomGroupManager>>();
|
|
177
|
+
const userList = ref<InstanceType<typeof JaUserList>>();
|
|
178
|
+
|
|
179
|
+
function switchUserSelect(u: UserReference) {
|
|
180
|
+
if (props.multiple) {
|
|
181
|
+
if (!Array.isArray(selectedUsers.value)) {
|
|
182
|
+
throw new Error("UserPicker组件设置为多选模式(multiple)时,v-model必须绑定UserReference数组")
|
|
183
|
+
}
|
|
184
|
+
const index = selectedUsers.value.findIndex(su => su.id == u.id);
|
|
185
|
+
if (index < 0) {
|
|
186
|
+
selectedUsers.value.push(u);
|
|
187
|
+
} else {
|
|
188
|
+
selectedUsers.value.splice(index, 1);
|
|
189
|
+
}
|
|
190
|
+
} else {
|
|
191
|
+
if (Array.isArray(selectedUsers.value)) {
|
|
192
|
+
throw new Error("UserPicker组件设置为单选模式时,v-model必须绑定UserReference对象或者null")
|
|
193
|
+
}
|
|
194
|
+
if(selectedUsers.value!==null&&u.id===selectedUsers.value.id){
|
|
195
|
+
selectedUsers.value = null;
|
|
196
|
+
}else{
|
|
197
|
+
selectedUsers.value = u;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
function onPopoverShow() {
|
|
204
|
+
if (props.realmId) {
|
|
205
|
+
queryParams.value.realmId = props.realmId
|
|
206
|
+
}
|
|
207
|
+
if (queryParams.value.name && queryParams.value.name.length > minLengthToTriggerUserQuery) {
|
|
208
|
+
queryParams.value.name = undefined;
|
|
209
|
+
}
|
|
210
|
+
const builder = useUserQueryBuilder();
|
|
211
|
+
if (props.customFilter) {
|
|
212
|
+
const qUser = builder.getQEntity();
|
|
213
|
+
builder.and(props.customFilter(qUser));
|
|
214
|
+
}
|
|
215
|
+
api.getBookmarkedUsers(builder.build()).then(r => {
|
|
216
|
+
users.value = r;
|
|
217
|
+
})
|
|
218
|
+
setTimeout(() => {
|
|
219
|
+
inputSearchText.value?.focus();
|
|
220
|
+
}, 300)
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function onPopoverHide() {
|
|
224
|
+
popoverVisible.value = false
|
|
225
|
+
btn.value?.$el.focus();
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function onSaveToCustomGroupClick() {
|
|
229
|
+
dlgCustomGroupManager.value?.show();
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function onDeselected(uid?: string) {
|
|
233
|
+
if (Array.isArray(selectedUsers.value)) {
|
|
234
|
+
const index = selectedUsers.value.findIndex(su => su.id == uid);
|
|
235
|
+
if (index >= 0) {
|
|
236
|
+
selectedUsers.value.splice(index, 1)
|
|
237
|
+
}
|
|
238
|
+
} else {
|
|
239
|
+
selectedUsers.value = null;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function onInputArrowDown() {
|
|
244
|
+
userList.value.scrollDown();
|
|
245
|
+
inputSearchText.value?.focus();
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function onInputArrowUp() {
|
|
249
|
+
userList.value.scrollUp();
|
|
250
|
+
inputSearchText.value?.focus();
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function onInputKeyEnter() {
|
|
254
|
+
switchUserSelect(users.value[userList.value?.activeIndex]);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
function popup() {
|
|
258
|
+
popoverVisible.value = true;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
function selectAll() {
|
|
262
|
+
const arr = (
|
|
263
|
+
selectedUsers.value as UserReference[]
|
|
264
|
+
);
|
|
265
|
+
arr.push(...users.value.filter(u => !arr.some(su => su.id === u.id)));
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
function clearSelection() {
|
|
269
|
+
if (props.multiple) {
|
|
270
|
+
selectedUsers.value = [];
|
|
271
|
+
} else {
|
|
272
|
+
selectedUsers.value = null;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
function onArrowKeyDown() {
|
|
277
|
+
inputSearchText.value?.focus();
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
const selectedForBinding = computed(() => {
|
|
281
|
+
if (props.multiple && Array.isArray(selectedUsers.value)) {
|
|
282
|
+
return selectedUsers.value;
|
|
283
|
+
} else if (!props.multiple && !Array.isArray(selectedUsers.value)) {
|
|
284
|
+
if (selectedUsers.value) {
|
|
285
|
+
return [selectedUsers.value as UserReference];
|
|
286
|
+
} else {
|
|
287
|
+
return [] as UserReference[];
|
|
288
|
+
}
|
|
289
|
+
} else {
|
|
290
|
+
throw new Error("UserPicker组件设置为多选模式(multiple)时,v-model必须绑定UserReference数组")
|
|
291
|
+
}
|
|
292
|
+
})
|
|
293
|
+
|
|
294
|
+
function showUserSelectDialog() {
|
|
295
|
+
dialogUserSelector.value?.show();
|
|
296
|
+
popoverVisible.value = false;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function handleMouseOver() {
|
|
300
|
+
popoverVisible.value = true
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
const selectedUsersForRender = computed(() => selectedForBinding.value.slice(0, props.maxShowCount))
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
watch(()=>props.classificationLevel, ()=>{
|
|
309
|
+
queryParams.value.classificationLevel = props.classificationLevel
|
|
310
|
+
})
|
|
311
|
+
|
|
312
|
+
</script>
|
|
313
|
+
|
|
314
|
+
<template>
|
|
315
|
+
<ja-scrollbar :max-height="props.maxHeight" :height="props.height" v-bind="$attrs"
|
|
316
|
+
style="overflow-x: hidden;">
|
|
317
|
+
<div class="ja-user-picker__root" v-shortcut:[props.shortcut]="popup">
|
|
318
|
+
|
|
319
|
+
<el-popover ref="bookmarkDropdown" @show="onPopoverShow" @hide="onPopoverHide"
|
|
320
|
+
v-model:visible="popoverVisible"
|
|
321
|
+
width="auto" teleported
|
|
322
|
+
:trigger="props.trigger"
|
|
323
|
+
>
|
|
324
|
+
<template #reference>
|
|
325
|
+
<div style="display: flex;align-items: center;">
|
|
326
|
+
<slot
|
|
327
|
+
v-if="$slots.default"
|
|
328
|
+
name="default"></slot>
|
|
329
|
+
<el-button v-else circle :icon="Plus" :size="'small'" ref="btn"
|
|
330
|
+
@mouseover="handleMouseOver">
|
|
331
|
+
</el-button>
|
|
332
|
+
</div>
|
|
333
|
+
|
|
334
|
+
</template>
|
|
335
|
+
<template #default>
|
|
336
|
+
<div class="ja-user-picker-bookmark__dropdown">
|
|
337
|
+
<div
|
|
338
|
+
style="width: 100%; display: flex; align-content: center; justify-content: end; margin-bottom: 4px;">
|
|
339
|
+
<el-space style="flex:auto">
|
|
340
|
+
<ja-button circle size="small" @click="showUserSelectDialog" plain
|
|
341
|
+
type="primary" tooltip="对话框筛选(大批量选择)"
|
|
342
|
+
shortcut="Ctrl+Alt+I" :icon="Notebook">
|
|
343
|
+
</ja-button>
|
|
344
|
+
<ja-button circle size="small" @click="clearSelection" type="danger"
|
|
345
|
+
plain :icon="Delete"
|
|
346
|
+
tooltip="清空选择" shortcut="Alt+C">
|
|
347
|
+
</ja-button>
|
|
348
|
+
<ja-button circle size="small" @click="selectAll" type="success"
|
|
349
|
+
plain :icon="Finished"
|
|
350
|
+
tooltip="全选(已加载的数据)" shortcut="Ctrl+A"
|
|
351
|
+
v-if="props.multiple">
|
|
352
|
+
</ja-button>
|
|
353
|
+
<ja-button circle size="small" @click="onSaveToCustomGroupClick"
|
|
354
|
+
type="warning" :icon="Setting" plain
|
|
355
|
+
tooltip="将已选中用户保存为自定义组,方便以后选择使用">
|
|
356
|
+
</ja-button>
|
|
357
|
+
</el-space>
|
|
358
|
+
<div style="color: var(--el-color-info-light-5);">
|
|
359
|
+
弹出快捷键:{{ props.shortcut }}
|
|
360
|
+
</div>
|
|
361
|
+
</div>
|
|
362
|
+
<el-input v-model="queryParams.name" ref="inputSearchText"
|
|
363
|
+
:suffix-icon="Search"
|
|
364
|
+
placeholder="请输入拼音名、姓名或手机号查询"
|
|
365
|
+
autocomplete="off"
|
|
366
|
+
@keydown.enter="onInputKeyEnter"
|
|
367
|
+
@keydown.up.stop.prevent="onInputArrowUp"
|
|
368
|
+
@keydown.down.stop.prevent="onInputArrowDown">
|
|
369
|
+
</el-input>
|
|
370
|
+
|
|
371
|
+
<div class="dropdown-header">
|
|
372
|
+
<el-text>
|
|
373
|
+
<el-icon
|
|
374
|
+
v-if="queryParams.name && queryParams.name.length > minLengthToTriggerUserQuery">
|
|
375
|
+
<Search></Search>
|
|
376
|
+
</el-icon>
|
|
377
|
+
<el-icon v-else color="#FFBF29">
|
|
378
|
+
<StarFilled></StarFilled>
|
|
379
|
+
</el-icon>
|
|
380
|
+
{{
|
|
381
|
+
queryParams.name && queryParams.name.length
|
|
382
|
+
> minLengthToTriggerUserQuery ? "查询结果" : "常用人员"
|
|
383
|
+
}}
|
|
384
|
+
</el-text>
|
|
385
|
+
</div>
|
|
386
|
+
<ja-user-list
|
|
387
|
+
ref="userList"
|
|
388
|
+
:total="queryResult.total"
|
|
389
|
+
:empty-text="queryParams.name && queryParams.name.length > minLengthToTriggerUserQuery ? undefined : '无可选常用人员'"
|
|
390
|
+
:page-size="pageParams.pageSize"
|
|
391
|
+
:loading="loading"
|
|
392
|
+
:users="users"
|
|
393
|
+
:height="300"
|
|
394
|
+
v-model="selectedUsers"
|
|
395
|
+
v-model:page="pageParams.currentPage"
|
|
396
|
+
:multiple="props.multiple"
|
|
397
|
+
@item-clicked="onArrowKeyDown"
|
|
398
|
+
@arrow-key-down="onArrowKeyDown"></ja-user-list>
|
|
399
|
+
</div>
|
|
400
|
+
</template>
|
|
401
|
+
</el-popover>
|
|
402
|
+
<div v-if="props.showUserTag" class="ja-user-picker__tag-container">
|
|
403
|
+
<ja-user-info-tag v-for="u in selectedUsersForRender" :key="u.id" :user-id="u.id"
|
|
404
|
+
:full-name="u.fullName" closable :has-avatar="u.hasAvatar"
|
|
405
|
+
@closed="onDeselected">
|
|
406
|
+
</ja-user-info-tag>
|
|
407
|
+
<div class="more-tag" v-if="selectedForBinding.length > props.maxShowCount">
|
|
408
|
+
+{{ selectedForBinding.length - props.maxShowCount }}人
|
|
409
|
+
</div>
|
|
410
|
+
<div v-if="selectedForBinding.length === 0">
|
|
411
|
+
<el-text type="info"> <暂无选中人员></el-text>
|
|
412
|
+
</div>
|
|
413
|
+
</div>
|
|
414
|
+
|
|
415
|
+
<ja-user-select-dialog ref="dialogUserSelector"
|
|
416
|
+
:multiple="props.multiple"
|
|
417
|
+
:realm-id="localRealmId"
|
|
418
|
+
:classificationLevel="props.classificationLevel"
|
|
419
|
+
:customFilter="props.customFilter"
|
|
420
|
+
v-model="selectedUsers"></ja-user-select-dialog>
|
|
421
|
+
</div>
|
|
422
|
+
</ja-scrollbar>
|
|
423
|
+
<custom-group-manager ref="dlgCustomGroupManager"
|
|
424
|
+
:users="Array.isArray(selectedUsers)? selectedUsers as UserReference[] : (selectedUsers ? [selectedUsers] : null)"></custom-group-manager>
|
|
425
|
+
</template>
|
|
426
|
+
|
|
427
|
+
<style scoped lang="scss">
|
|
428
|
+
.ja-user-picker__root {
|
|
429
|
+
display: flex;
|
|
430
|
+
//flex-wrap: wrap;
|
|
431
|
+
justify-content: left;
|
|
432
|
+
//align-items: center;
|
|
433
|
+
gap: 8px;
|
|
434
|
+
padding: 8px 0;
|
|
435
|
+
.ja-user-picker__tag-container{
|
|
436
|
+
display: flex;
|
|
437
|
+
flex-wrap: wrap;
|
|
438
|
+
justify-content: left;
|
|
439
|
+
align-items: center;
|
|
440
|
+
gap: 4px;
|
|
441
|
+
}
|
|
442
|
+
.more-tag {
|
|
443
|
+
border-radius: 28px;
|
|
444
|
+
height: 28px;
|
|
445
|
+
padding: 2px 5px;
|
|
446
|
+
background-color: #E8F5FF;
|
|
447
|
+
color: #00164D;
|
|
448
|
+
border: 1px solid #C1CCD7;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
:deep(.el-popover) {
|
|
453
|
+
padding: 0 !important;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
.ja-user-picker-bookmark__dropdown {
|
|
457
|
+
padding: 0;
|
|
458
|
+
margin: 0;
|
|
459
|
+
|
|
460
|
+
.dropdown-header {
|
|
461
|
+
padding: 8px 0;
|
|
462
|
+
width: 280px;
|
|
463
|
+
cursor: default;
|
|
464
|
+
font-weight: 600;
|
|
465
|
+
|
|
466
|
+
.el-text {
|
|
467
|
+
font-weight: 600;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
}
|
|
472
|
+
</style>
|