@jari-ace/element-plus-component 0.2.2 → 0.3.0
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/autoComplete/JaAutoComplete.vue.d.ts +18 -18
- package/dist/components/button/JaButton.vue.d.ts +24 -24
- package/dist/components/customGroupTree/src/customGroupTree.vue.d.ts +1 -1
- package/dist/components/departmentPicker/src/DepartmentPicker.vue.d.ts +2 -2
- package/dist/components/departmentTree/src/departmentTree.vue.d.ts +1 -1
- package/dist/components/dropdownButton/JaDropdownButton.vue.d.ts +55 -55
- package/dist/components/enumList/EnumListInput.vue.d.ts +2 -2
- package/dist/components/enumPicker/src/EnumPicker.vue.d.ts +1 -1
- package/dist/components/form/JaForm.vue.d.ts +1 -1
- package/dist/components/formItem/JaFormItem.vue.d.ts +12 -12
- package/dist/components/input/JaInput.vue.d.ts +18 -18
- package/dist/components/inputI18n/I18nBundleEditor.vue.d.ts +1 -1
- package/dist/components/inputI18n/InputI18n.vue.d.ts +2 -2
- package/dist/components/inputI18n/JaInputI18n.vue.d.ts +70 -70
- package/dist/components/inputNumber/JaInputNumber.vue.d.ts +12 -12
- package/dist/components/mapItemList/MapItemListInput.vue.d.ts +2 -2
- package/dist/components/numberList/NumberListInput.vue.d.ts +2 -2
- package/dist/components/rolePicker/RoleEditor.vue.d.ts +1 -1
- package/dist/components/rolePicker/baseRolePicker.vue.d.ts +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/dist/components/scrollbar/Scrollbar.vue.d.ts +8 -8
- package/dist/components/select/JaSelect.vue.d.ts +70 -70
- package/dist/components/stringList/StringListInput.vue.d.ts +2 -2
- package/dist/components/tip/index.d.ts +6 -6
- package/dist/components/tip/src/AceTip.vue.d.ts +1 -1
- package/dist/components/upload/index.d.ts +23 -4
- package/dist/components/upload/index.d.ts.map +1 -1
- package/dist/components/upload/index.js +1 -3
- package/dist/components/upload/index.js.map +1 -1
- package/dist/components/upload/pdf-viewer/PdfViewerModal.vue.d.ts +27 -0
- package/dist/components/upload/pdf-viewer/PdfViewerModal.vue.d.ts.map +1 -0
- package/dist/components/upload/pdf-viewer/PdfViewerModal.vue.js +94 -0
- package/dist/components/upload/pdf-viewer/PdfViewerModal.vue.js.map +1 -0
- package/dist/components/upload/uploader-locale-zh-cn.d.ts +223 -0
- package/dist/components/upload/uploader-locale-zh-cn.d.ts.map +1 -0
- package/dist/components/upload/uploader-locale-zh-cn.js +224 -0
- package/dist/components/upload/uploader-locale-zh-cn.js.map +1 -0
- package/dist/components/upload/uploader.vue.d.ts +42 -0
- package/dist/components/upload/uploader.vue.d.ts.map +1 -0
- package/dist/components/upload/uploader.vue.js +713 -0
- package/dist/components/upload/uploader.vue.js.map +1 -0
- package/dist/components/userGroupPicker/src/UserGroupPicker.vue.d.ts +2 -2
- package/dist/components/userPicker/src/UserPicker.vue.d.ts +3 -3
- package/dist/components/userSelectDialog/src/userSelectDialog.vue.d.ts +1 -1
- package/dist/components/userTag/UserInfoTag.vue.d.ts +2 -2
- package/lib/index.css +9 -1
- package/lib/index.js +37354 -2740
- package/lib/index.umd.cjs +407 -2
- package/package.json +70 -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 +4 -6
- package/packages/components/upload/pdf-viewer/PdfViewerModal.vue +32 -0
- package/packages/components/upload/uploader-locale-zh-cn.ts +223 -0
- package/packages/components/upload/uploader.vue +513 -0
- 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
- package/packages/components/upload/src/Upload.vue +0 -25
- package/packages/components/upload/src/type.ts +0 -3
|
@@ -1,232 +1,232 @@
|
|
|
1
|
-
import {ref, watch} from 'vue';
|
|
2
|
-
import {
|
|
3
|
-
type BooleanResultExpression,
|
|
4
|
-
createAxiosWithoutCache,
|
|
5
|
-
type IAceAxios,
|
|
6
|
-
QUser,
|
|
7
|
-
type SortDescriptor,
|
|
8
|
-
useLoading,
|
|
9
|
-
type UserReference,
|
|
10
|
-
useUserApi,
|
|
11
|
-
useUserQueryBuilder
|
|
12
|
-
} from "@jari-ace/app-bolts";
|
|
13
|
-
import type {TreeNodeType} from "./useTreeData";
|
|
14
|
-
import {ALL_DEPARTMENT, NO_DEPARTMENT} from "../components/departmentPicker/src/consts";
|
|
15
|
-
import debounce from "lodash-es/debounce";
|
|
16
|
-
import { useRealms } from "./useRealms";
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* 用户查询hook,当查询参数变化时,会自动查询,订阅结果即可
|
|
20
|
-
* @param queryPrerequisites 执行查询的前提条件,只有此方法返回true时,查询才会执行
|
|
21
|
-
* @param customFilter 自定义查询过滤条件,可以通过这个回调方法,通过程序方式添加自定义的过滤条件
|
|
22
|
-
* @param onQueryResultReturned 查询成功时的回调方法,接收Page<UserReference>类型参数
|
|
23
|
-
* @param scroll 是否滚动模式,滚动模式下,翻页后新页数据会追加到queryState.users集合中,而不是直接赋予queryState.users
|
|
24
|
-
* @param axios 自定义axios实例
|
|
25
|
-
* @param notPaged 不分页
|
|
26
|
-
*/
|
|
27
|
-
export function useUserRefQuery(
|
|
28
|
-
queryPrerequisites?: () => boolean,
|
|
29
|
-
customFilter?: (qUser: InstanceType<typeof QUser>) => BooleanResultExpression,
|
|
30
|
-
onQueryResultReturned?: (result?: UserReference[], paramsChanged?: boolean) => void,
|
|
31
|
-
scroll?: boolean,
|
|
32
|
-
axios?: IAceAxios,
|
|
33
|
-
notPaged?: boolean) {
|
|
34
|
-
const queryParams = ref<{
|
|
35
|
-
/**
|
|
36
|
-
* 用户域Id查询参数
|
|
37
|
-
*/
|
|
38
|
-
realmId?: string,
|
|
39
|
-
/**
|
|
40
|
-
* 部门查询参数
|
|
41
|
-
*/
|
|
42
|
-
currentDept?: TreeNodeType,
|
|
43
|
-
/**
|
|
44
|
-
* 用户姓名、用户名或用户拼音过滤参数
|
|
45
|
-
*/
|
|
46
|
-
name?: string,
|
|
47
|
-
/**
|
|
48
|
-
* 排序描述符
|
|
49
|
-
*/
|
|
50
|
-
currentSort?: SortDescriptor,
|
|
51
|
-
/**
|
|
52
|
-
* 用户组查询参数
|
|
53
|
-
*/
|
|
54
|
-
currentGroup?: TreeNodeType,
|
|
55
|
-
/**
|
|
56
|
-
* 自定义组查询参数
|
|
57
|
-
*/
|
|
58
|
-
currentCustomGroup?: TreeNodeType,
|
|
59
|
-
/**
|
|
60
|
-
* 密级过滤
|
|
61
|
-
*/
|
|
62
|
-
classificationLevel?: number,
|
|
63
|
-
}>({})
|
|
64
|
-
|
|
65
|
-
const pageParams = ref<{
|
|
66
|
-
/**
|
|
67
|
-
* 当前页码
|
|
68
|
-
*/
|
|
69
|
-
currentPage: number,
|
|
70
|
-
/**
|
|
71
|
-
* 页内数据行数
|
|
72
|
-
*/
|
|
73
|
-
pageSize: number
|
|
74
|
-
}>({
|
|
75
|
-
currentPage: 1,
|
|
76
|
-
pageSize: 50
|
|
77
|
-
})
|
|
78
|
-
|
|
79
|
-
const queryResult = ref<{
|
|
80
|
-
/**
|
|
81
|
-
* 总数据量
|
|
82
|
-
*/
|
|
83
|
-
total: number,
|
|
84
|
-
/**
|
|
85
|
-
* 查询结果集
|
|
86
|
-
*/
|
|
87
|
-
users: UserReference[]
|
|
88
|
-
}>({
|
|
89
|
-
total: 0,
|
|
90
|
-
users: []
|
|
91
|
-
})
|
|
92
|
-
|
|
93
|
-
if (!axios) axios = createAxiosWithoutCache();
|
|
94
|
-
const userApi = useUserApi(axios);
|
|
95
|
-
const loading = useLoading(axios);
|
|
96
|
-
const queryParamChanged = ref<boolean>(false)
|
|
97
|
-
|
|
98
|
-
function doQuery() {
|
|
99
|
-
queryUsers().then(r => {
|
|
100
|
-
if (onQueryResultReturned) {
|
|
101
|
-
onQueryResultReturned(r, queryParamChanged.value);
|
|
102
|
-
}
|
|
103
|
-
queryParamChanged.value = false;
|
|
104
|
-
})
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const debounceDoQuery = debounce(doQuery, 300)
|
|
108
|
-
|
|
109
|
-
function queryOnParamsChanged() {
|
|
110
|
-
queryResult.value.total = 0;
|
|
111
|
-
queryResult.value.users = [];
|
|
112
|
-
if (pageParams.value.currentPage !== 1) {
|
|
113
|
-
pageParams.value.currentPage = 1;
|
|
114
|
-
} else {
|
|
115
|
-
debounceDoQuery();
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
watch(queryParams, () => {
|
|
120
|
-
queryParamChanged.value = true;
|
|
121
|
-
queryOnParamsChanged();
|
|
122
|
-
}, {
|
|
123
|
-
deep: true
|
|
124
|
-
})
|
|
125
|
-
|
|
126
|
-
watch(() => pageParams.value.pageSize, () => {
|
|
127
|
-
queryParamChanged.value = true;
|
|
128
|
-
queryOnParamsChanged();
|
|
129
|
-
})
|
|
130
|
-
|
|
131
|
-
watch(() => pageParams.value.currentPage, () => {
|
|
132
|
-
queryUsers().then(r => {
|
|
133
|
-
if (onQueryResultReturned) {
|
|
134
|
-
onQueryResultReturned(r, queryParamChanged.value);
|
|
135
|
-
}
|
|
136
|
-
queryParamChanged.value = false;
|
|
137
|
-
});
|
|
138
|
-
})
|
|
139
|
-
|
|
140
|
-
async function queryUsers() {
|
|
141
|
-
if (queryPrerequisites && !queryPrerequisites()) {
|
|
142
|
-
return Promise.resolve(undefined);
|
|
143
|
-
}
|
|
144
|
-
if (!queryParams.value.realmId) {
|
|
145
|
-
const defaultRealm = await useRealms().getDefaultRealm();
|
|
146
|
-
queryParams.value.realmId = defaultRealm.id;
|
|
147
|
-
}
|
|
148
|
-
const builder = useUserQueryBuilder();
|
|
149
|
-
const qUser = builder.getQEntity();
|
|
150
|
-
builder.and(qUser.realm.id.eq(queryParams.value.realmId)).and(qUser.recycled.eq(false));
|
|
151
|
-
const currentDept = queryParams.value.currentDept;
|
|
152
|
-
if (currentDept) {
|
|
153
|
-
// 1=1 and user.department.id = currentDepartmentId
|
|
154
|
-
if (currentDept.id == NO_DEPARTMENT) {
|
|
155
|
-
builder.and(qUser.department.isNull())
|
|
156
|
-
} else if (currentDept.id !== ALL_DEPARTMENT) {
|
|
157
|
-
builder.and(qUser.department.sortPath.startWith(currentDept.sortPath));
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
const classificationLevel = queryParams.value.classificationLevel;
|
|
161
|
-
if (classificationLevel) {
|
|
162
|
-
builder.and(qUser.classifiedLevel.loe(classificationLevel))
|
|
163
|
-
}
|
|
164
|
-
const currentGroup = queryParams.value.currentGroup;
|
|
165
|
-
if (currentGroup) {
|
|
166
|
-
builder.and(qUser.userGroups.any().group.sortPath.startWith(currentGroup.sortPath));
|
|
167
|
-
}
|
|
168
|
-
const currentCustomGroup = queryParams.value.currentCustomGroup;
|
|
169
|
-
if (currentCustomGroup) {
|
|
170
|
-
builder.and(qUser.customGroups.any().customGroup.sortPath
|
|
171
|
-
.startWith(currentCustomGroup.sortPath));
|
|
172
|
-
}
|
|
173
|
-
const name = queryParams.value.name;
|
|
174
|
-
if (name) {
|
|
175
|
-
// and (user.username like %nameQuery% or user.fullName like %nameQuery% or user.pinYinName like %nameQuery%
|
|
176
|
-
const queryText = "%" + name.split('').join('%') + "%"
|
|
177
|
-
builder.and(qUser.username.like(queryText)
|
|
178
|
-
.or(qUser.fullName.like(queryText))
|
|
179
|
-
.or(qUser.pinYinName.like(queryText))
|
|
180
|
-
.or(qUser.mobile.like(queryText)))
|
|
181
|
-
}
|
|
182
|
-
if (customFilter) {
|
|
183
|
-
builder.and(customFilter(qUser));
|
|
184
|
-
}
|
|
185
|
-
const currentSort = queryParams.value.currentSort;
|
|
186
|
-
if (currentSort) {
|
|
187
|
-
builder.orderBy(currentSort)
|
|
188
|
-
}
|
|
189
|
-
const filter = builder.build();
|
|
190
|
-
if (notPaged) {
|
|
191
|
-
return userApi.queryUserRefs(filter).then(res => {
|
|
192
|
-
queryResult.value.users = res;
|
|
193
|
-
return res;
|
|
194
|
-
})
|
|
195
|
-
} else {
|
|
196
|
-
const currentPage = pageParams.value.currentPage - 1;
|
|
197
|
-
return userApi.queryUserRefsPaged(filter, currentPage, pageParams.value.pageSize)
|
|
198
|
-
.then(res => {
|
|
199
|
-
if (scroll && currentPage > 0) {
|
|
200
|
-
queryResult.value.users.push(...res.content);
|
|
201
|
-
} else {
|
|
202
|
-
queryResult.value.users = res.content;
|
|
203
|
-
}
|
|
204
|
-
queryResult.value.total = res.totalElements;
|
|
205
|
-
return res.content;
|
|
206
|
-
})
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
return {
|
|
211
|
-
/**
|
|
212
|
-
* 查询的参数
|
|
213
|
-
*/
|
|
214
|
-
queryParams,
|
|
215
|
-
/**
|
|
216
|
-
* 分页参数
|
|
217
|
-
*/
|
|
218
|
-
pageParams,
|
|
219
|
-
/**
|
|
220
|
-
* 查询结果
|
|
221
|
-
*/
|
|
222
|
-
queryResult,
|
|
223
|
-
/**
|
|
224
|
-
* 查询方法
|
|
225
|
-
*/
|
|
226
|
-
queryUsers,
|
|
227
|
-
/**
|
|
228
|
-
* loading状态
|
|
229
|
-
*/
|
|
230
|
-
loading
|
|
231
|
-
}
|
|
232
|
-
}
|
|
1
|
+
import {ref, watch} from 'vue';
|
|
2
|
+
import {
|
|
3
|
+
type BooleanResultExpression,
|
|
4
|
+
createAxiosWithoutCache,
|
|
5
|
+
type IAceAxios,
|
|
6
|
+
QUser,
|
|
7
|
+
type SortDescriptor,
|
|
8
|
+
useLoading,
|
|
9
|
+
type UserReference,
|
|
10
|
+
useUserApi,
|
|
11
|
+
useUserQueryBuilder
|
|
12
|
+
} from "@jari-ace/app-bolts";
|
|
13
|
+
import type {TreeNodeType} from "./useTreeData";
|
|
14
|
+
import {ALL_DEPARTMENT, NO_DEPARTMENT} from "../components/departmentPicker/src/consts";
|
|
15
|
+
import debounce from "lodash-es/debounce";
|
|
16
|
+
import { useRealms } from "./useRealms";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 用户查询hook,当查询参数变化时,会自动查询,订阅结果即可
|
|
20
|
+
* @param queryPrerequisites 执行查询的前提条件,只有此方法返回true时,查询才会执行
|
|
21
|
+
* @param customFilter 自定义查询过滤条件,可以通过这个回调方法,通过程序方式添加自定义的过滤条件
|
|
22
|
+
* @param onQueryResultReturned 查询成功时的回调方法,接收Page<UserReference>类型参数
|
|
23
|
+
* @param scroll 是否滚动模式,滚动模式下,翻页后新页数据会追加到queryState.users集合中,而不是直接赋予queryState.users
|
|
24
|
+
* @param axios 自定义axios实例
|
|
25
|
+
* @param notPaged 不分页
|
|
26
|
+
*/
|
|
27
|
+
export function useUserRefQuery(
|
|
28
|
+
queryPrerequisites?: () => boolean,
|
|
29
|
+
customFilter?: (qUser: InstanceType<typeof QUser>) => BooleanResultExpression,
|
|
30
|
+
onQueryResultReturned?: (result?: UserReference[], paramsChanged?: boolean) => void,
|
|
31
|
+
scroll?: boolean,
|
|
32
|
+
axios?: IAceAxios,
|
|
33
|
+
notPaged?: boolean) {
|
|
34
|
+
const queryParams = ref<{
|
|
35
|
+
/**
|
|
36
|
+
* 用户域Id查询参数
|
|
37
|
+
*/
|
|
38
|
+
realmId?: string,
|
|
39
|
+
/**
|
|
40
|
+
* 部门查询参数
|
|
41
|
+
*/
|
|
42
|
+
currentDept?: TreeNodeType,
|
|
43
|
+
/**
|
|
44
|
+
* 用户姓名、用户名或用户拼音过滤参数
|
|
45
|
+
*/
|
|
46
|
+
name?: string,
|
|
47
|
+
/**
|
|
48
|
+
* 排序描述符
|
|
49
|
+
*/
|
|
50
|
+
currentSort?: SortDescriptor,
|
|
51
|
+
/**
|
|
52
|
+
* 用户组查询参数
|
|
53
|
+
*/
|
|
54
|
+
currentGroup?: TreeNodeType,
|
|
55
|
+
/**
|
|
56
|
+
* 自定义组查询参数
|
|
57
|
+
*/
|
|
58
|
+
currentCustomGroup?: TreeNodeType,
|
|
59
|
+
/**
|
|
60
|
+
* 密级过滤
|
|
61
|
+
*/
|
|
62
|
+
classificationLevel?: number,
|
|
63
|
+
}>({})
|
|
64
|
+
|
|
65
|
+
const pageParams = ref<{
|
|
66
|
+
/**
|
|
67
|
+
* 当前页码
|
|
68
|
+
*/
|
|
69
|
+
currentPage: number,
|
|
70
|
+
/**
|
|
71
|
+
* 页内数据行数
|
|
72
|
+
*/
|
|
73
|
+
pageSize: number
|
|
74
|
+
}>({
|
|
75
|
+
currentPage: 1,
|
|
76
|
+
pageSize: 50
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
const queryResult = ref<{
|
|
80
|
+
/**
|
|
81
|
+
* 总数据量
|
|
82
|
+
*/
|
|
83
|
+
total: number,
|
|
84
|
+
/**
|
|
85
|
+
* 查询结果集
|
|
86
|
+
*/
|
|
87
|
+
users: UserReference[]
|
|
88
|
+
}>({
|
|
89
|
+
total: 0,
|
|
90
|
+
users: []
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
if (!axios) axios = createAxiosWithoutCache();
|
|
94
|
+
const userApi = useUserApi(axios);
|
|
95
|
+
const loading = useLoading(axios);
|
|
96
|
+
const queryParamChanged = ref<boolean>(false)
|
|
97
|
+
|
|
98
|
+
function doQuery() {
|
|
99
|
+
queryUsers().then(r => {
|
|
100
|
+
if (onQueryResultReturned) {
|
|
101
|
+
onQueryResultReturned(r, queryParamChanged.value);
|
|
102
|
+
}
|
|
103
|
+
queryParamChanged.value = false;
|
|
104
|
+
})
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const debounceDoQuery = debounce(doQuery, 300)
|
|
108
|
+
|
|
109
|
+
function queryOnParamsChanged() {
|
|
110
|
+
queryResult.value.total = 0;
|
|
111
|
+
queryResult.value.users = [];
|
|
112
|
+
if (pageParams.value.currentPage !== 1) {
|
|
113
|
+
pageParams.value.currentPage = 1;
|
|
114
|
+
} else {
|
|
115
|
+
debounceDoQuery();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
watch(queryParams, () => {
|
|
120
|
+
queryParamChanged.value = true;
|
|
121
|
+
queryOnParamsChanged();
|
|
122
|
+
}, {
|
|
123
|
+
deep: true
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
watch(() => pageParams.value.pageSize, () => {
|
|
127
|
+
queryParamChanged.value = true;
|
|
128
|
+
queryOnParamsChanged();
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
watch(() => pageParams.value.currentPage, () => {
|
|
132
|
+
queryUsers().then(r => {
|
|
133
|
+
if (onQueryResultReturned) {
|
|
134
|
+
onQueryResultReturned(r, queryParamChanged.value);
|
|
135
|
+
}
|
|
136
|
+
queryParamChanged.value = false;
|
|
137
|
+
});
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
async function queryUsers() {
|
|
141
|
+
if (queryPrerequisites && !queryPrerequisites()) {
|
|
142
|
+
return Promise.resolve(undefined);
|
|
143
|
+
}
|
|
144
|
+
if (!queryParams.value.realmId) {
|
|
145
|
+
const defaultRealm = await useRealms().getDefaultRealm();
|
|
146
|
+
queryParams.value.realmId = defaultRealm.id;
|
|
147
|
+
}
|
|
148
|
+
const builder = useUserQueryBuilder();
|
|
149
|
+
const qUser = builder.getQEntity();
|
|
150
|
+
builder.and(qUser.realm.id.eq(queryParams.value.realmId)).and(qUser.recycled.eq(false));
|
|
151
|
+
const currentDept = queryParams.value.currentDept;
|
|
152
|
+
if (currentDept) {
|
|
153
|
+
// 1=1 and user.department.id = currentDepartmentId
|
|
154
|
+
if (currentDept.id == NO_DEPARTMENT) {
|
|
155
|
+
builder.and(qUser.department.isNull())
|
|
156
|
+
} else if (currentDept.id !== ALL_DEPARTMENT) {
|
|
157
|
+
builder.and(qUser.department.sortPath.startWith(currentDept.sortPath));
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
const classificationLevel = queryParams.value.classificationLevel;
|
|
161
|
+
if (classificationLevel) {
|
|
162
|
+
builder.and(qUser.classifiedLevel.loe(classificationLevel))
|
|
163
|
+
}
|
|
164
|
+
const currentGroup = queryParams.value.currentGroup;
|
|
165
|
+
if (currentGroup) {
|
|
166
|
+
builder.and(qUser.userGroups.any().group.sortPath.startWith(currentGroup.sortPath));
|
|
167
|
+
}
|
|
168
|
+
const currentCustomGroup = queryParams.value.currentCustomGroup;
|
|
169
|
+
if (currentCustomGroup) {
|
|
170
|
+
builder.and(qUser.customGroups.any().customGroup.sortPath
|
|
171
|
+
.startWith(currentCustomGroup.sortPath));
|
|
172
|
+
}
|
|
173
|
+
const name = queryParams.value.name;
|
|
174
|
+
if (name) {
|
|
175
|
+
// and (user.username like %nameQuery% or user.fullName like %nameQuery% or user.pinYinName like %nameQuery%
|
|
176
|
+
const queryText = "%" + name.split('').join('%') + "%"
|
|
177
|
+
builder.and(qUser.username.like(queryText)
|
|
178
|
+
.or(qUser.fullName.like(queryText))
|
|
179
|
+
.or(qUser.pinYinName.like(queryText))
|
|
180
|
+
.or(qUser.mobile.like(queryText)))
|
|
181
|
+
}
|
|
182
|
+
if (customFilter) {
|
|
183
|
+
builder.and(customFilter(qUser));
|
|
184
|
+
}
|
|
185
|
+
const currentSort = queryParams.value.currentSort;
|
|
186
|
+
if (currentSort) {
|
|
187
|
+
builder.orderBy(currentSort)
|
|
188
|
+
}
|
|
189
|
+
const filter = builder.build();
|
|
190
|
+
if (notPaged) {
|
|
191
|
+
return userApi.queryUserRefs(filter).then(res => {
|
|
192
|
+
queryResult.value.users = res;
|
|
193
|
+
return res;
|
|
194
|
+
})
|
|
195
|
+
} else {
|
|
196
|
+
const currentPage = pageParams.value.currentPage - 1;
|
|
197
|
+
return userApi.queryUserRefsPaged(filter, currentPage, pageParams.value.pageSize)
|
|
198
|
+
.then(res => {
|
|
199
|
+
if (scroll && currentPage > 0) {
|
|
200
|
+
queryResult.value.users.push(...res.content);
|
|
201
|
+
} else {
|
|
202
|
+
queryResult.value.users = res.content;
|
|
203
|
+
}
|
|
204
|
+
queryResult.value.total = res.totalElements;
|
|
205
|
+
return res.content;
|
|
206
|
+
})
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return {
|
|
211
|
+
/**
|
|
212
|
+
* 查询的参数
|
|
213
|
+
*/
|
|
214
|
+
queryParams,
|
|
215
|
+
/**
|
|
216
|
+
* 分页参数
|
|
217
|
+
*/
|
|
218
|
+
pageParams,
|
|
219
|
+
/**
|
|
220
|
+
* 查询结果
|
|
221
|
+
*/
|
|
222
|
+
queryResult,
|
|
223
|
+
/**
|
|
224
|
+
* 查询方法
|
|
225
|
+
*/
|
|
226
|
+
queryUsers,
|
|
227
|
+
/**
|
|
228
|
+
* loading状态
|
|
229
|
+
*/
|
|
230
|
+
loading
|
|
231
|
+
}
|
|
232
|
+
}
|
package/packages/index.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import {type App, type Plugin} from "vue";
|
|
2
|
-
import * as components from "./components";
|
|
3
|
-
import {installDirectives} from "./directives";
|
|
4
|
-
|
|
5
|
-
export * from "./components";
|
|
6
|
-
export const AceVueUI: Plugin = {
|
|
7
|
-
install(app: App<Element>) {
|
|
8
|
-
for (const [key, comp] of Object.entries(components)) {
|
|
9
|
-
app.component(key, comp);
|
|
10
|
-
}
|
|
11
|
-
installDirectives(app)
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export * from "./hooks/useBackendValidations"
|
|
16
|
-
export * from "./hooks/useTreeData"
|
|
17
|
-
export * from "./hooks/useAppInstances"
|
|
18
|
-
export * from "./directives"
|
|
19
|
-
export * from "./hooks/useDateTimeShortCuts"
|
|
20
|
-
export * from "./components/scrollbar/utils"
|
|
21
|
-
export * from "./hooks/useBridage"
|
|
22
|
-
export * from "./hooks/useRealms"
|
|
23
|
-
export * from "./hooks/useUserRefQuery"
|
|
24
|
-
export * from "./hooks/useClassificationLevels"
|
|
1
|
+
import {type App, type Plugin} from "vue";
|
|
2
|
+
import * as components from "./components";
|
|
3
|
+
import {installDirectives} from "./directives";
|
|
4
|
+
|
|
5
|
+
export * from "./components";
|
|
6
|
+
export const AceVueUI: Plugin = {
|
|
7
|
+
install(app: App<Element>) {
|
|
8
|
+
for (const [key, comp] of Object.entries(components)) {
|
|
9
|
+
app.component(key, comp);
|
|
10
|
+
}
|
|
11
|
+
installDirectives(app)
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export * from "./hooks/useBackendValidations"
|
|
16
|
+
export * from "./hooks/useTreeData"
|
|
17
|
+
export * from "./hooks/useAppInstances"
|
|
18
|
+
export * from "./directives"
|
|
19
|
+
export * from "./hooks/useDateTimeShortCuts"
|
|
20
|
+
export * from "./components/scrollbar/utils"
|
|
21
|
+
export * from "./hooks/useBridage"
|
|
22
|
+
export * from "./hooks/useRealms"
|
|
23
|
+
export * from "./hooks/useUserRefQuery"
|
|
24
|
+
export * from "./hooks/useClassificationLevels"
|
package/packages/list.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"compName": "DemoComponent",
|
|
4
|
-
"compZhName": "示例",
|
|
5
|
-
"compDesc": "这是一个示例组件",
|
|
6
|
-
"compClassName": "button"
|
|
7
|
-
}
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"compName": "DemoComponent",
|
|
4
|
+
"compZhName": "示例",
|
|
5
|
+
"compDesc": "这是一个示例组件",
|
|
6
|
+
"compClassName": "button"
|
|
7
|
+
}
|
|
8
8
|
]
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
type ShortcutHandlerType = (event: KeyboardEvent) => void;
|
|
2
|
-
|
|
3
|
-
interface ShortcutHandlerStackItem {
|
|
4
|
-
keys: string;
|
|
5
|
-
el: HTMLElement;
|
|
6
|
-
handler: ShortcutHandlerType;
|
|
7
|
-
prev?: ShortcutHandlerStackItem
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface HTMLElement {
|
|
11
|
-
__vueShortcutHandler__?: ShortcutHandlerStackItem;
|
|
12
|
-
__visibilityObserver__?: IntersectionObserver;
|
|
13
|
-
}
|
|
1
|
+
type ShortcutHandlerType = (event: KeyboardEvent) => void;
|
|
2
|
+
|
|
3
|
+
interface ShortcutHandlerStackItem {
|
|
4
|
+
keys: string;
|
|
5
|
+
el: HTMLElement;
|
|
6
|
+
handler: ShortcutHandlerType;
|
|
7
|
+
prev?: ShortcutHandlerStackItem
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface HTMLElement {
|
|
11
|
+
__vueShortcutHandler__?: ShortcutHandlerStackItem;
|
|
12
|
+
__visibilityObserver__?: IntersectionObserver;
|
|
13
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {type GlobalData, Jari, type MicroAppContext} from "@jari-ace/app-bolts";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
declare global {
|
|
5
|
-
interface Window {
|
|
6
|
-
appContext?: MicroAppContext;
|
|
7
|
-
microApp?: {
|
|
8
|
-
getGlobalData: () => GlobalData;
|
|
9
|
-
addGlobalDataListener: (data: (data: MicroAppContext) => void) => void;
|
|
10
|
-
addDataListener:any
|
|
11
|
-
} & any,
|
|
12
|
-
__MICRO_APP_ENVIRONMENT__: boolean,
|
|
13
|
-
rawWindow: Window,
|
|
14
|
-
appDescriptor: Jari.Ace.ApplicationDescriptor;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
1
|
+
import {type GlobalData, Jari, type MicroAppContext} from "@jari-ace/app-bolts";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
declare global {
|
|
5
|
+
interface Window {
|
|
6
|
+
appContext?: MicroAppContext;
|
|
7
|
+
microApp?: {
|
|
8
|
+
getGlobalData: () => GlobalData;
|
|
9
|
+
addGlobalDataListener: (data: (data: MicroAppContext) => void) => void;
|
|
10
|
+
addDataListener:any
|
|
11
|
+
} & any,
|
|
12
|
+
__MICRO_APP_ENVIRONMENT__: boolean,
|
|
13
|
+
rawWindow: Window,
|
|
14
|
+
appDescriptor: Jari.Ace.ApplicationDescriptor;
|
|
15
|
+
}
|
|
16
|
+
}
|