cnhis-design-vue 3.1.27-beta.6 → 3.1.28-beta.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 +123 -123
- package/es/components/field-set/index.d.ts +4 -4
- package/es/components/field-set/src/FieldSet.js +3 -5
- package/es/components/field-set/src/FieldSet.vue.d.ts +1 -1
- package/es/components/iho-table/index.d.ts +16 -0
- package/es/components/iho-table/src/IhoTable.js +5 -3
- package/es/components/iho-table/src/IhoTable.vue.d.ts +16 -0
- package/es/components/iho-table/src/components/IhoTableColumn.d.ts +7 -0
- package/es/components/iho-table/src/components/IhoTableColumn.js +36 -3
- package/es/components/iho-table/src/plugins/defaultConfigPlugin/index.js +2 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/widgets/checkRendererPlugin.js +1 -0
- package/es/components/iho-table/src/plugins/rendererPlugins/widgets/seqRendererPlugin.js +5 -0
- package/es/components/iho-table/src/types/index.d.ts +3 -1
- package/es/components/iho-table/style/index.css +1 -1
- package/es/components/index.css +1 -1
- package/es/components/scale-view/src/components/formitem/standard-modal.d.ts +2 -2
- package/es/components/scale-view/src/hooks/use-component.d.ts +3 -3
- package/es/components/select-label/index.d.ts +5 -5
- package/es/components/select-label/src/LabelFormContent.vue.d.ts +2 -2
- package/es/components/select-label/src/SelectLabel.vue.d.ts +3 -3
- package/es/components/select-person/index.d.ts +97 -327
- package/es/components/select-person/src/SelectPerson.vue.d.ts +97 -329
- package/es/components/select-person/src/SelectPerson.vue_vue_type_script_setup_true_lang.js +203 -883
- package/es/components/select-person/src/utils/index.d.ts +2 -12
- package/es/components/select-person/src/utils/index.js +39 -79
- package/es/components/select-person/style/index.css +1 -1
- package/es/components/steps-wheel/src/StepsWheel.js +19 -20
- package/es/components/steps-wheel/style/index.css +1 -1
- package/es/shared/assets/img/failure.js +1 -1
- package/es/shared/assets/img/icon-asc.js +1 -1
- package/es/shared/assets/img/icon-desc.js +1 -1
- package/es/shared/assets/img/no-permission.js +1 -1
- package/es/shared/assets/img/nodata.js +1 -1
- package/es/shared/assets/img/notfound.js +1 -1
- package/es/shared/assets/img/qr.js +1 -1
- package/es/shared/assets/img/success.js +1 -1
- package/es/shared/assets/img/video.js +1 -1
- package/es/shared/assets/img/video_default_cover.js +1 -1
- package/es/shared/assets/img/video_hover.js +1 -1
- package/es/shared/assets/img/video_play_hover.js +1 -1
- package/es/shared/assets/img/xb_big.js +1 -1
- package/es/shared/assets/img/xb_small.js +1 -1
- package/es/shared/utils/index.d.ts +1 -0
- package/es/shared/utils/index.js +9 -2
- package/package.json +2 -2
- package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
- package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +0 -1
- package/es/components/bpmn-workflow/types/ModelingModule.d.ts +0 -1
- package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +0 -1
- package/es/components/fabric-chart/src/utils/index.d.ts +0 -6823
- package/es/components/select-person/src/SearchTree.js +0 -6
- package/es/components/select-person/src/SearchTree.vue_vue_type_script_setup_true_lang.js +0 -233
- package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +0 -86
- package/es/shared/utils/tapable/index.d.ts +0 -139
|
@@ -1,37 +1,21 @@
|
|
|
1
|
-
import { defineComponent, ref,
|
|
2
|
-
import { useMessage,
|
|
1
|
+
import { defineComponent, ref, computed, watch, openBlock, createBlock, unref, withCtx, createVNode, withKeys, createTextVNode, toDisplayString, createCommentVNode, createElementBlock, createElementVNode, Fragment, renderList } from 'vue';
|
|
2
|
+
import { useMessage, NGrid, NGi, NSpace, NInputGroup, NInput, NButton, NCheckbox, NTree, NIcon, NTooltip } from 'naive-ui';
|
|
3
3
|
import { CloseCircleSharp } from '@vicons/ionicons5';
|
|
4
|
-
import XEUtils from 'xe-utils';
|
|
5
|
-
import 'moment';
|
|
6
|
-
import SearchTree from './SearchTree.js';
|
|
7
4
|
import { filterTree } from './utils/index.js';
|
|
5
|
+
import { cloneDeep } from 'lodash-es';
|
|
8
6
|
|
|
9
7
|
const _hoisted_1 = {
|
|
10
|
-
|
|
8
|
+
key: 0
|
|
11
9
|
};
|
|
12
10
|
const _hoisted_2 = {
|
|
13
|
-
class: "
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
18
|
-
const _hoisted_4 = {
|
|
19
|
-
class: "people-tree-item"
|
|
20
|
-
};
|
|
21
|
-
const _hoisted_5 = {
|
|
22
|
-
key: 0
|
|
11
|
+
class: "c-select-person__scroll",
|
|
12
|
+
style: {
|
|
13
|
+
"height": "342px"
|
|
14
|
+
}
|
|
23
15
|
};
|
|
24
16
|
var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
25
17
|
__name: "SelectPerson",
|
|
26
18
|
props: {
|
|
27
|
-
visible: {
|
|
28
|
-
type: Boolean,
|
|
29
|
-
default: false
|
|
30
|
-
},
|
|
31
|
-
isDetail: {
|
|
32
|
-
type: Boolean,
|
|
33
|
-
default: false
|
|
34
|
-
},
|
|
35
19
|
defaultList: {
|
|
36
20
|
type: Array,
|
|
37
21
|
default: () => []
|
|
@@ -56,19 +40,6 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
56
40
|
type: Object,
|
|
57
41
|
default: () => ({})
|
|
58
42
|
},
|
|
59
|
-
SearchLoadMore: {
|
|
60
|
-
type: Boolean,
|
|
61
|
-
default: false
|
|
62
|
-
},
|
|
63
|
-
queryMainTreeData: {
|
|
64
|
-
type: Function
|
|
65
|
-
},
|
|
66
|
-
queryLoadChildData: {
|
|
67
|
-
type: Function
|
|
68
|
-
},
|
|
69
|
-
queryTreeSearch: {
|
|
70
|
-
type: Function
|
|
71
|
-
},
|
|
72
43
|
showCount: {
|
|
73
44
|
type: Boolean,
|
|
74
45
|
default: true
|
|
@@ -80,889 +51,238 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
80
51
|
multiple: {
|
|
81
52
|
type: Boolean,
|
|
82
53
|
default: true
|
|
54
|
+
},
|
|
55
|
+
queryLoadChildData: {
|
|
56
|
+
type: Function,
|
|
57
|
+
default: void 0
|
|
58
|
+
},
|
|
59
|
+
queryTreeSearch: {
|
|
60
|
+
type: Function,
|
|
61
|
+
default: () => Promise.resolve([])
|
|
83
62
|
}
|
|
84
63
|
},
|
|
85
|
-
emits: ["check"
|
|
64
|
+
emits: ["check"],
|
|
86
65
|
setup(__props, {
|
|
87
66
|
emit
|
|
88
67
|
}) {
|
|
89
68
|
const props = __props;
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
const
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
dataListKeys: {
|
|
112
|
-
main: [],
|
|
113
|
-
other: []
|
|
114
|
-
},
|
|
115
|
-
records: 0
|
|
116
|
-
},
|
|
117
|
-
searchValue: "",
|
|
118
|
-
searchPage: 1,
|
|
119
|
-
searchNoMore: false,
|
|
120
|
-
title: "",
|
|
121
|
-
checkedLeafKeys: [],
|
|
122
|
-
spinning: false,
|
|
123
|
-
loadMorenLoadinng: false,
|
|
124
|
-
errorMsg: "",
|
|
125
|
-
defaultShowList: [],
|
|
126
|
-
checkedKeysMain: [],
|
|
127
|
-
cacheParentIdObj: {},
|
|
128
|
-
singleChecked: false,
|
|
129
|
-
indeterminate: false,
|
|
130
|
-
searchIndeterminate: false,
|
|
131
|
-
searchChecked: false
|
|
132
|
-
});
|
|
133
|
-
const searchTreeVisable = computed(() => state.search.status == 2);
|
|
134
|
-
const dataListMainKeys = computed(() => {
|
|
135
|
-
if (!state.dataList.main.length)
|
|
136
|
-
return [];
|
|
137
|
-
return state.dataList.main.map((i) => i.key);
|
|
138
|
-
});
|
|
139
|
-
const dataListOtherKeys = computed(() => {
|
|
140
|
-
if (!state.dataList.other.length)
|
|
141
|
-
return [];
|
|
142
|
-
return state.dataList.other.map((i) => i.key);
|
|
143
|
-
});
|
|
144
|
-
const checkedTreeItem = computed(() => {
|
|
145
|
-
let otherItems = state.dataList.other.filter((item) => {
|
|
146
|
-
return state.checkedKeys.other.includes(item.key);
|
|
147
|
-
});
|
|
148
|
-
let mainItems = state.dataList.main.filter((item) => {
|
|
149
|
-
let {
|
|
150
|
-
isLeaf,
|
|
151
|
-
key
|
|
152
|
-
} = item;
|
|
153
|
-
let parentId = getParentId(item);
|
|
154
|
-
let showKeys = [...state.checkedKeys.main, ...otherItems];
|
|
155
|
-
let checked = showKeys.includes(key);
|
|
156
|
-
if (isLeaf && parentId && state.checkedKeys.main.some((v) => v == parentId)) {
|
|
157
|
-
checked = false;
|
|
69
|
+
useMessage();
|
|
70
|
+
const keyword = ref("");
|
|
71
|
+
const checkedAll = ref(false);
|
|
72
|
+
const checkedKeys = ref([]);
|
|
73
|
+
const expandedKeys = ref([]);
|
|
74
|
+
const treeData = ref([]);
|
|
75
|
+
const tagData = ref([]);
|
|
76
|
+
const temp = cloneDeep(props.data);
|
|
77
|
+
let allCheckedKeys = [];
|
|
78
|
+
const isRemote = computed(() => props.queryLoadChildData ? true : false);
|
|
79
|
+
init();
|
|
80
|
+
function init() {
|
|
81
|
+
transformTree(temp);
|
|
82
|
+
treeData.value = temp;
|
|
83
|
+
if (props.defaultList.length > 0) {
|
|
84
|
+
if (isRemote.value) {
|
|
85
|
+
props.defaultList.forEach((key) => checkedKeys.value.push(key.key));
|
|
86
|
+
tagData.value = cloneDeep(props.defaultList);
|
|
87
|
+
} else {
|
|
88
|
+
props.defaultList.forEach((key) => checkedKeys.value.push(key));
|
|
89
|
+
setTagData(temp);
|
|
158
90
|
}
|
|
159
|
-
return checked;
|
|
160
|
-
});
|
|
161
|
-
let list = uniqArrObj([...mainItems, ...otherItems], "key");
|
|
162
|
-
return list;
|
|
163
|
-
});
|
|
164
|
-
const wordbookConfig = computed(() => {
|
|
165
|
-
const {
|
|
166
|
-
parent_id_obj,
|
|
167
|
-
parent_name_obj
|
|
168
|
-
} = props.wordbook || {};
|
|
169
|
-
const {
|
|
170
|
-
user_id_obj,
|
|
171
|
-
user_name_obj
|
|
172
|
-
} = props.wordbookChild || {};
|
|
173
|
-
return {
|
|
174
|
-
parent_id_obj,
|
|
175
|
-
parent_name_obj,
|
|
176
|
-
user_id_obj,
|
|
177
|
-
user_name_obj
|
|
178
|
-
};
|
|
179
|
-
});
|
|
180
|
-
const getLoadChildData = computed(() => {
|
|
181
|
-
if (typeof props.queryLoadChildData == "function") {
|
|
182
|
-
return onLoadData;
|
|
183
91
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
92
|
+
}
|
|
93
|
+
function transformTree(tree) {
|
|
94
|
+
tree.forEach((item) => {
|
|
95
|
+
var _a, _b;
|
|
96
|
+
item.title = getLabelName(item);
|
|
97
|
+
if (!item.key)
|
|
98
|
+
item.key = item[props.wordbookChild.user_id_obj] || item[props.wordbook.parent_id_obj] || Date.now();
|
|
99
|
+
if ((_a = item.children) == null ? void 0 : _a.length) {
|
|
100
|
+
transformTree(item.children);
|
|
101
|
+
} else if (((_b = item.children) == null ? void 0 : _b.length) === 0) {
|
|
102
|
+
Reflect.deleteProperty(item, "children");
|
|
103
|
+
}
|
|
104
|
+
if (!item.disabled && !item.children)
|
|
105
|
+
allCheckedKeys.push(item.key);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
function renderLabel({
|
|
187
109
|
option
|
|
188
|
-
})
|
|
189
|
-
|
|
110
|
+
}) {
|
|
111
|
+
var _a;
|
|
112
|
+
if (option.isLeaf || !((_a = option.children) == null ? void 0 : _a.length)) {
|
|
190
113
|
return createVNode(NTooltip, {
|
|
191
114
|
"trigger": "hover"
|
|
192
115
|
}, {
|
|
193
|
-
default: () =>
|
|
194
|
-
trigger: () => createVNode("span", null, [
|
|
195
|
-
"class": "c-title"
|
|
196
|
-
}, [option.title || option.key, createTextVNode("\u2009 ")]), createVNode("span", {
|
|
197
|
-
"class": "c-sub-title"
|
|
198
|
-
}, [option.sub_title])])
|
|
116
|
+
default: () => createVNode("span", null, [option.title]),
|
|
117
|
+
trigger: () => createVNode("span", null, [option.title])
|
|
199
118
|
});
|
|
200
119
|
} else {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
}, [createVNode("span", null, [option.title || option.key]), treeCount(option.count)]);
|
|
120
|
+
const count = props.wordbook.user_count_obj ? option[props.wordbook.user_count_obj] || "" : "";
|
|
121
|
+
return createVNode("span", null, [`${option.title}${count}`]);
|
|
204
122
|
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
123
|
+
}
|
|
124
|
+
function getLabelName(option) {
|
|
125
|
+
return option[props.wordbookChild.user_name_obj] || option[props.wordbook.parent_name_obj] || option["orgName"] || option["title"] || "";
|
|
126
|
+
}
|
|
127
|
+
function setAllCheckedKeys(tree) {
|
|
128
|
+
tree.forEach((item) => {
|
|
129
|
+
var _a;
|
|
130
|
+
((_a = item.children) == null ? void 0 : _a.length) && setAllCheckedKeys(item.children);
|
|
131
|
+
if (!item.disabled && !item.children)
|
|
132
|
+
allCheckedKeys.push(item.key);
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
async function searchClick() {
|
|
136
|
+
if (!isRemote.value) {
|
|
137
|
+
treeData.value = filterTree(temp, keyword.value);
|
|
138
|
+
allCheckedKeys = [];
|
|
139
|
+
setAllCheckedKeys(treeData.value);
|
|
140
|
+
setCheckedAll();
|
|
209
141
|
} else {
|
|
210
|
-
|
|
211
|
-
state.checkedKeys.main = [...props.defaultList];
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
const getDefaultList = () => {
|
|
216
|
-
let copy = JSON.parse(JSON.stringify(props.defaultList));
|
|
217
|
-
if (Array.isArray(copy)) {
|
|
218
|
-
copy.forEach((v) => {
|
|
219
|
-
handleDefMapping(v);
|
|
220
|
-
getuniqKey(v);
|
|
221
|
-
let pId = getParentId(v);
|
|
222
|
-
state.cacheParentIdObj[pId] = pId;
|
|
223
|
-
});
|
|
224
|
-
state.defaultShowList = copy;
|
|
142
|
+
treeData.value = await props.queryTreeSearch(keyword.value);
|
|
225
143
|
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
user_name_obj
|
|
233
|
-
} = wordbookConfig.value || {};
|
|
234
|
-
const {
|
|
235
|
-
parent_id_obj_key,
|
|
236
|
-
parent_name_obj_key
|
|
237
|
-
} = props.wordbook;
|
|
238
|
-
const {
|
|
239
|
-
user_id_obj_key,
|
|
240
|
-
user_name_obj_key
|
|
241
|
-
} = props.wordbookChild;
|
|
242
|
-
v[parent_id_obj] = v[parent_id_obj_key] || v.parent_id;
|
|
243
|
-
v[parent_name_obj] = v[parent_name_obj_key] || v.parent_name;
|
|
244
|
-
v[user_id_obj] = v[user_id_obj_key] || v.user_id;
|
|
245
|
-
v[user_name_obj] = v[user_name_obj_key] || v.user_name;
|
|
246
|
-
};
|
|
247
|
-
const staticDataInit = () => {
|
|
248
|
-
if (!Array.isArray(props.data) || props.data.length == 0)
|
|
249
|
-
return;
|
|
250
|
-
state.treeData.main = JSON.parse(JSON.stringify(props.data));
|
|
251
|
-
generateDataList(state.treeData.main, state.dataList.main);
|
|
252
|
-
generateDataList(state.treeData.main, state.dataList.other);
|
|
253
|
-
};
|
|
254
|
-
const getcheckedKeys = () => {
|
|
255
|
-
let checkedKeysMain = [], checkedKeysOther = [];
|
|
256
|
-
let copy = JSON.parse(JSON.stringify(props.defaultList));
|
|
257
|
-
if (Array.isArray(copy)) {
|
|
258
|
-
copy.forEach((v) => {
|
|
259
|
-
handleDefMapping(v);
|
|
260
|
-
let key = getuniqKey(v);
|
|
261
|
-
checkedKeysMain.push(key);
|
|
262
|
-
if (String(key).includes(FIXEDKEY)) {
|
|
263
|
-
checkedKeysOther.push(key);
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
return {
|
|
268
|
-
checkedKeysMain,
|
|
269
|
-
checkedKeysOther
|
|
270
|
-
};
|
|
271
|
-
};
|
|
272
|
-
const loadSelected = async () => {
|
|
273
|
-
try {
|
|
274
|
-
let list = await Promise.all(state.treeData.main.map(async (v) => {
|
|
275
|
-
const {
|
|
276
|
-
parent_id_obj
|
|
277
|
-
} = props.wordbook || {};
|
|
278
|
-
if ([v.key, v[parent_id_obj], String(v[parent_id_obj])].includes(state.cacheParentIdObj[v[parent_id_obj]])) {
|
|
279
|
-
await onLoadData(v);
|
|
280
|
-
return v;
|
|
144
|
+
}
|
|
145
|
+
function setTreeCheckd(tree, checked) {
|
|
146
|
+
tree.forEach((item) => {
|
|
147
|
+
if (!item.disabled && (!item.children || item.isLeaf)) {
|
|
148
|
+
if (checked && !checkedKeys.value.includes(item.key)) {
|
|
149
|
+
checkedKeys.value.push(item.key);
|
|
281
150
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
return Promise.resolve();
|
|
286
|
-
}
|
|
287
|
-
};
|
|
288
|
-
const onLoadData = (option) => {
|
|
289
|
-
return new Promise(async (resolve) => {
|
|
290
|
-
if (option.children) {
|
|
291
|
-
resolve();
|
|
292
|
-
return;
|
|
293
|
-
}
|
|
294
|
-
option.children = await handleLoadChildData(option.key, option);
|
|
295
|
-
hanldeFilterDefaultShowList(option.children);
|
|
296
|
-
nextTick(() => {
|
|
297
|
-
state.treeData.main = [...state.treeData.main];
|
|
298
|
-
});
|
|
299
|
-
addCheckedKeysChildrenMain(option);
|
|
300
|
-
generateDataList(option.children || [], state.dataList.main);
|
|
301
|
-
resolve();
|
|
302
|
-
});
|
|
303
|
-
};
|
|
304
|
-
const getUsers = async () => {
|
|
305
|
-
try {
|
|
306
|
-
if (typeof props.queryMainTreeData !== "function") {
|
|
307
|
-
return;
|
|
308
|
-
}
|
|
309
|
-
state.spinning = true;
|
|
310
|
-
const {
|
|
311
|
-
parent_id_obj
|
|
312
|
-
} = wordbookConfig.value || {};
|
|
313
|
-
let rows = await props.queryMainTreeData();
|
|
314
|
-
let list = uniqArrObj(rows || [], parent_id_obj);
|
|
315
|
-
state.treeData.main = list;
|
|
316
|
-
generateDataList(state.treeData.main, state.dataList.main);
|
|
317
|
-
await loadSelected();
|
|
318
|
-
let {
|
|
319
|
-
checkedKeysMain,
|
|
320
|
-
checkedKeysOther
|
|
321
|
-
} = getcheckedKeys();
|
|
322
|
-
state.checkedKeys.main.push(...checkedKeysMain);
|
|
323
|
-
state.checkedKeys.other = [...checkedKeysOther];
|
|
324
|
-
state.treeData.main.forEach((f) => {
|
|
325
|
-
if (f && f.children && f.children.length) {
|
|
326
|
-
let flag = f.children.every((c) => checkedKeysMain.includes(c.key));
|
|
327
|
-
if (flag && f.key) {
|
|
328
|
-
state.checkedKeys.main.push(f.key);
|
|
329
|
-
}
|
|
151
|
+
if (!checked) {
|
|
152
|
+
const keyIndex = checkedKeys.value.findIndex((key) => key === item.key);
|
|
153
|
+
checkedKeys.value.splice(keyIndex, 1);
|
|
330
154
|
}
|
|
331
|
-
});
|
|
332
|
-
state.spinning = false;
|
|
333
|
-
} catch (error) {
|
|
334
|
-
state.spinning = false;
|
|
335
|
-
$message.error("\u67E5\u8BE2\u5F02\u5E38");
|
|
336
|
-
}
|
|
337
|
-
};
|
|
338
|
-
const loadMainChildData = (searchResultTreeData) => {
|
|
339
|
-
return new Promise(async (resolve) => {
|
|
340
|
-
let promises = searchResultTreeData.map(async (item) => {
|
|
341
|
-
if (item.users) {
|
|
342
|
-
let mainTreeItem = state.treeData.main.find((mainItem) => mainItem.key == item.key);
|
|
343
|
-
if (!mainTreeItem || mainTreeItem && !mainTreeItem.children) {
|
|
344
|
-
if (!mainTreeItem) {
|
|
345
|
-
mainTreeItem = {
|
|
346
|
-
...item
|
|
347
|
-
};
|
|
348
|
-
}
|
|
349
|
-
mainTreeItem.children = await handleLoadChildData(item.key, mainTreeItem);
|
|
350
|
-
generateDataList(mainTreeItem.children, state.dataList.main);
|
|
351
|
-
addCheckedKeysChildrenMain(mainTreeItem);
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
});
|
|
355
|
-
await Promise.all(promises);
|
|
356
|
-
resolve();
|
|
357
|
-
});
|
|
358
|
-
};
|
|
359
|
-
const handleLoadChildData = async (key, option) => {
|
|
360
|
-
let rows = props.queryLoadChildData && await props.queryLoadChildData(key, option);
|
|
361
|
-
let list = rows;
|
|
362
|
-
return list;
|
|
363
|
-
};
|
|
364
|
-
const generateDataList = (data, dataList) => {
|
|
365
|
-
for (let i = 0; i < data.length; i++) {
|
|
366
|
-
const node = data[i];
|
|
367
|
-
if (node.children) {
|
|
368
|
-
generateDataList(node.children, dataList);
|
|
369
|
-
} else {
|
|
370
|
-
!node.disabled && dataList.push({
|
|
371
|
-
parentId: getParentId(node),
|
|
372
|
-
...node
|
|
373
|
-
});
|
|
374
155
|
}
|
|
375
|
-
|
|
376
|
-
};
|
|
377
|
-
const addCheckedKeysChildrenMain = (item) => {
|
|
378
|
-
if (!item.key)
|
|
379
|
-
return;
|
|
380
|
-
if (!state.checkedKeys.main.includes(String(item.key)))
|
|
381
|
-
return false;
|
|
382
|
-
if (!Array.isArray(item.children))
|
|
383
|
-
return false;
|
|
384
|
-
item.children.forEach(({
|
|
385
|
-
key
|
|
386
|
-
}) => {
|
|
387
|
-
if (state.checkedKeys.main.includes(key) || !key)
|
|
388
|
-
return false;
|
|
389
|
-
state.checkedKeys.main.push(key);
|
|
156
|
+
item.children && setTreeCheckd(item.children, checked);
|
|
390
157
|
});
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
staticDataSearch();
|
|
398
|
-
state.spinning = false;
|
|
399
|
-
isSearchAllCheck();
|
|
400
|
-
return;
|
|
401
|
-
}
|
|
402
|
-
if (!state.searchValue) {
|
|
403
|
-
state.search.status = 0;
|
|
404
|
-
state.search.defaultExpandedKeys = [];
|
|
405
|
-
state.expandedKeys = [];
|
|
406
|
-
state.spinning = false;
|
|
407
|
-
state.searchNoMore = false;
|
|
408
|
-
return false;
|
|
409
|
-
}
|
|
410
|
-
if (!config.loadMoren) {
|
|
411
|
-
state.search.status = 1;
|
|
412
|
-
} else {
|
|
413
|
-
state.loadMorenLoadinng = true;
|
|
414
|
-
}
|
|
415
|
-
let rows = await props.queryTreeSearch(state.searchValue, data);
|
|
416
|
-
let searchResultTreeData = rows;
|
|
417
|
-
state.loadMorenLoadinng = false;
|
|
418
|
-
if (!searchResultTreeData || !searchResultTreeData.length) {
|
|
419
|
-
if (state.searchPage == 1) {
|
|
420
|
-
state.search.defaultExpandedKeys = [];
|
|
421
|
-
state.search.status = 3;
|
|
422
|
-
} else {
|
|
423
|
-
state.search.status = 2;
|
|
424
|
-
state.searchNoMore = true;
|
|
425
|
-
}
|
|
426
|
-
state.spinning = false;
|
|
427
|
-
isSearchAllCheck();
|
|
428
|
-
return false;
|
|
429
|
-
}
|
|
430
|
-
const {
|
|
431
|
-
parent_id_obj,
|
|
432
|
-
parent_name_obj,
|
|
433
|
-
user_count_obj
|
|
434
|
-
} = props.wordbook || {};
|
|
435
|
-
props.wordbookChild || {};
|
|
436
|
-
let pObj = {};
|
|
437
|
-
searchResultTreeData.forEach((item) => {
|
|
438
|
-
item[parent_id_obj] && (pObj[item[parent_id_obj]] = {
|
|
439
|
-
key: item[parent_id_obj],
|
|
440
|
-
users: []
|
|
441
|
-
});
|
|
442
|
-
if (item.users) {
|
|
443
|
-
insertSearchTreeData(item);
|
|
444
|
-
} else {
|
|
445
|
-
insertSearchTreeDataOther(item);
|
|
446
|
-
}
|
|
447
|
-
});
|
|
448
|
-
let pList = [];
|
|
449
|
-
Object.keys(pObj || {}).forEach((v) => {
|
|
450
|
-
if (v) {
|
|
451
|
-
pList.push({
|
|
452
|
-
...pObj[v]
|
|
453
|
-
});
|
|
454
|
-
}
|
|
455
|
-
});
|
|
456
|
-
state.treeData.search.length || 0;
|
|
457
|
-
if (props.SearchLoadMore) {
|
|
458
|
-
state.searchNoMore = false;
|
|
459
|
-
} else {
|
|
460
|
-
state.searchNoMore = true;
|
|
461
|
-
}
|
|
462
|
-
await loadMainChildData(pList);
|
|
463
|
-
generateSearchDataListKeys(searchResultTreeData);
|
|
464
|
-
hanldeFilterDefaultShowList(searchResultTreeData);
|
|
465
|
-
refreshSearchTree();
|
|
466
|
-
state.search.status = 2;
|
|
467
|
-
state.spinning = false;
|
|
468
|
-
isSearchAllCheck();
|
|
469
|
-
};
|
|
470
|
-
const refreshSearchTree = () => {
|
|
471
|
-
if (!searchTreeVisable.value)
|
|
472
|
-
return false;
|
|
473
|
-
searchTree.value.setDefaultCheckedKeys();
|
|
474
|
-
nextTick(() => {
|
|
475
|
-
isSearchAllCheck();
|
|
476
|
-
});
|
|
477
|
-
};
|
|
478
|
-
const generateSearchDataListKeys = (searchResultTreeData) => {
|
|
479
|
-
searchResultTreeData.forEach((item) => {
|
|
480
|
-
if (!dataListMainKeys.value.includes(item.key)) {
|
|
481
|
-
state.search.dataListKeys.other.push(item.key);
|
|
482
|
-
item.children && item.children.forEach((childItem) => {
|
|
483
|
-
state.search.dataListKeys.other.push(childItem.key);
|
|
484
|
-
});
|
|
485
|
-
return;
|
|
486
|
-
}
|
|
487
|
-
state.search.dataListKeys.main.push(item.key);
|
|
488
|
-
item.children && item.children.forEach((childItem) => {
|
|
489
|
-
state.search.dataListKeys.main.push(childItem.key);
|
|
490
|
-
});
|
|
491
|
-
});
|
|
492
|
-
};
|
|
493
|
-
const insertSearchTreeData = (item) => {
|
|
494
|
-
const {
|
|
495
|
-
user_count_obj
|
|
496
|
-
} = props.wordbook || {};
|
|
497
|
-
state.search.defaultExpandedKeys.push(item.key);
|
|
498
|
-
hanldeFilterDefaultShowList(item.children || []);
|
|
499
|
-
if (item[user_count_obj] == item.children.length) {
|
|
500
|
-
item.disableCheckbox = false;
|
|
501
|
-
}
|
|
502
|
-
state.treeData.search.push(item);
|
|
503
|
-
};
|
|
504
|
-
const insertSearchTreeDataOther = (item) => {
|
|
505
|
-
let formatItem = Object.assign({}, item, {
|
|
506
|
-
isLeaf: true
|
|
507
|
-
});
|
|
508
|
-
state.treeData.search.push(formatItem);
|
|
509
|
-
if (dataListOtherKeys.value.includes(formatItem.key))
|
|
510
|
-
return false;
|
|
511
|
-
generateDataList([formatItem], state.dataList.other);
|
|
512
|
-
};
|
|
513
|
-
const isSearchAllCheck = () => {
|
|
514
|
-
nextTick(() => {
|
|
515
|
-
let skeyArr = state.treeData.search.map((item) => item.key);
|
|
516
|
-
let serchCheckedKeys = searchTree.value.checkedKeys;
|
|
517
|
-
state.searchIndeterminate = !!serchCheckedKeys.length && serchCheckedKeys.length < skeyArr.length;
|
|
518
|
-
state.searchChecked = serchCheckedKeys.length === skeyArr.length;
|
|
519
|
-
});
|
|
520
|
-
};
|
|
521
|
-
const staticDataSearch = () => {
|
|
522
|
-
state.expandedKeys = [];
|
|
523
|
-
if (!state.title) {
|
|
524
|
-
state.treeData.main = JSON.parse(JSON.stringify(props.data));
|
|
525
|
-
state.dataList.main = [];
|
|
526
|
-
generateDataList(state.treeData.main, state.dataList.main);
|
|
527
|
-
state.checkedKeys.main = state.checkedKeys.other.slice();
|
|
528
|
-
isAllCheck();
|
|
529
|
-
return;
|
|
530
|
-
}
|
|
531
|
-
let copyData = JSON.parse(JSON.stringify(props.data));
|
|
532
|
-
state.treeData.main = filterTree({
|
|
533
|
-
value: state.title,
|
|
534
|
-
data: copyData,
|
|
535
|
-
prop: "title",
|
|
536
|
-
filter: true,
|
|
537
|
-
callback: (child) => {
|
|
538
|
-
var _a;
|
|
539
|
-
child.visible && ((_a = child.children) == null ? void 0 : _a.length) && state.expandedKeys.push(child.key);
|
|
540
|
-
}
|
|
541
|
-
}) || [];
|
|
542
|
-
state.dataList.main = [];
|
|
543
|
-
generateDataList(state.treeData.main, state.dataList.main);
|
|
544
|
-
const currentKeys = state.checkedKeys.other.slice();
|
|
545
|
-
state.checkedKeys.main = [];
|
|
546
|
-
const setCheckedKeys = (data) => {
|
|
547
|
-
if (!(data == null ? void 0 : data.length))
|
|
548
|
-
return;
|
|
549
|
-
data.forEach((item) => {
|
|
550
|
-
var _a;
|
|
551
|
-
currentKeys.includes(item.key) && !item.disabled && state.checkedKeys.main.push(item.key);
|
|
552
|
-
((_a = item.children) == null ? void 0 : _a.length) && setCheckedKeys(item.children);
|
|
553
|
-
});
|
|
554
|
-
};
|
|
555
|
-
setCheckedKeys(state.treeData.main);
|
|
556
|
-
state.checkedKeys.other = currentKeys;
|
|
557
|
-
};
|
|
558
|
-
const onExpand = (expandedKeys) => {
|
|
559
|
-
state.expandedKeys = expandedKeys;
|
|
560
|
-
state.autoExpandParent = false;
|
|
561
|
-
};
|
|
562
|
-
const searchClick = () => {
|
|
563
|
-
state.searchValue = state.title;
|
|
564
|
-
state.treeData.search = [];
|
|
565
|
-
state.search.dataListKeys.other = [];
|
|
566
|
-
state.search.dataListKeys.main = [];
|
|
567
|
-
state.search.defaultExpandedKeys = [];
|
|
568
|
-
state.spinning = true;
|
|
569
|
-
state.searchPage = 1;
|
|
570
|
-
searchFetch();
|
|
571
|
-
};
|
|
572
|
-
const isAllCheck = (checkedKeys = [], isTo = false) => {
|
|
573
|
-
if (!checkedKeys || checkedKeys.length == 0 && !isTo) {
|
|
574
|
-
state.indeterminate = false;
|
|
575
|
-
state.singleChecked = false;
|
|
576
|
-
} else {
|
|
577
|
-
const getAllKeys = (tree) => {
|
|
578
|
-
if (!(tree == null ? void 0 : tree.length))
|
|
579
|
-
return 0;
|
|
580
|
-
let n = 0;
|
|
581
|
-
tree.forEach((item) => {
|
|
582
|
-
var _a;
|
|
583
|
-
if (!((_a = item == null ? void 0 : item.children) == null ? void 0 : _a.length) && !item.disabled) {
|
|
584
|
-
n++;
|
|
585
|
-
} else {
|
|
586
|
-
n += getAllKeys(item.children);
|
|
587
|
-
}
|
|
588
|
-
});
|
|
589
|
-
return n;
|
|
590
|
-
};
|
|
591
|
-
let keys = getAllKeys(state.treeData.main);
|
|
592
|
-
state.indeterminate = !(keys == state.checkedKeys.main.length);
|
|
593
|
-
state.singleChecked = keys == state.checkedKeys.main.length;
|
|
594
|
-
if (typeof props.queryTreeSearch !== "function") {
|
|
595
|
-
state.checkedKeys.other = [...new Set(state.checkedKeys.other.concat(state.checkedKeys.main))];
|
|
596
|
-
state.checkedKeys.other = state.checkedKeys.other.filter((v) => {
|
|
597
|
-
return state.checkedKeys.main.includes(v) || !state.checkedKeys.main.includes(v) && state.dataList.main.findIndex((item) => item.key == v) == -1;
|
|
598
|
-
});
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
};
|
|
602
|
-
const addCheckedkeysMain = (keys) => {
|
|
603
|
-
let checkedKeys = state.checkedKeys.main;
|
|
604
|
-
let filterKey = (keys || {}).filter(Boolean);
|
|
605
|
-
filterKey.forEach((key) => {
|
|
158
|
+
}
|
|
159
|
+
function checkedAllChange(checked) {
|
|
160
|
+
setTreeCheckd(treeData.value, checked);
|
|
161
|
+
}
|
|
162
|
+
function setTagData(tree) {
|
|
163
|
+
tree.forEach((item) => {
|
|
606
164
|
var _a;
|
|
607
|
-
checkedKeys.
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
return;
|
|
611
|
-
let parent = state.treeData.main.filter((item) => {
|
|
612
|
-
return item.key == _getParentKey;
|
|
613
|
-
});
|
|
614
|
-
let allCheck = (((_a = parent[0]) == null ? void 0 : _a.children) || []).every((item) => {
|
|
615
|
-
return checkedKeys.includes(item.key);
|
|
165
|
+
checkedKeys.value.includes(item.key) && tagData.value.push({
|
|
166
|
+
key: item.key,
|
|
167
|
+
name: item.title
|
|
616
168
|
});
|
|
617
|
-
|
|
169
|
+
((_a = item.children) == null ? void 0 : _a.length) && setTagData(item.children);
|
|
618
170
|
});
|
|
619
|
-
}
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
return parentKey;
|
|
627
|
-
}
|
|
628
|
-
if (node.children) {
|
|
629
|
-
if (node.children.some((item) => item.key == key)) {
|
|
630
|
-
parentKey = node.key;
|
|
631
|
-
} else if (getParentKey(key, node.children)) {
|
|
632
|
-
parentKey = getParentKey(key, node.children);
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
return parentKey;
|
|
637
|
-
};
|
|
638
|
-
const radioChange = (checked) => {
|
|
639
|
-
if (searchTreeVisable.value) {
|
|
640
|
-
state.searchChecked = checked;
|
|
641
|
-
} else {
|
|
642
|
-
state.singleChecked = checked;
|
|
643
|
-
}
|
|
644
|
-
checkAll(checked ? 1 : 2);
|
|
645
|
-
};
|
|
646
|
-
const checkAll = (type) => {
|
|
647
|
-
if (checkAllSearchTree(type))
|
|
648
|
-
return false;
|
|
649
|
-
if (type == 1) {
|
|
650
|
-
state.expandedKeys = [];
|
|
651
|
-
state.dataList.main = [];
|
|
652
|
-
generateDataList(state.treeData.main, state.dataList.main);
|
|
653
|
-
state.checkedKeys.main = dataListMainKeys.value;
|
|
654
|
-
} else if (type == 2) {
|
|
655
|
-
state.checkedKeys.main = [];
|
|
656
|
-
state.autoExpandParent = true;
|
|
657
|
-
isAllCheck([], true);
|
|
658
|
-
}
|
|
659
|
-
};
|
|
660
|
-
const checkAllSearchTree = (type) => {
|
|
661
|
-
if (!searchTreeVisable.value)
|
|
662
|
-
return false;
|
|
663
|
-
if (type == 1) {
|
|
664
|
-
let allSearchkeysMain = state.search.dataListKeys.main.filter((key) => {
|
|
665
|
-
return !state.search.defaultExpandedKeys.includes(key);
|
|
666
|
-
});
|
|
667
|
-
let allSearchkeysOther = state.search.dataListKeys.other;
|
|
668
|
-
state.checkedKeys.main = XEUtils.uniq([...state.checkedKeys.main, ...allSearchkeysMain]);
|
|
669
|
-
state.checkedKeys.other = XEUtils.uniq([...state.checkedKeys.other, ...allSearchkeysOther]);
|
|
670
|
-
state.search.dataListKeys.main.forEach((key) => {
|
|
671
|
-
let parentKey = getParentKey(key, state.treeData.main);
|
|
672
|
-
let parent = state.treeData.main.filter((item) => {
|
|
673
|
-
return item.key == parentKey;
|
|
674
|
-
});
|
|
675
|
-
let allCheck = parent[0].children.every((item) => {
|
|
676
|
-
return state.checkedKeys.main.includes(item.key);
|
|
677
|
-
});
|
|
678
|
-
allCheck && state.checkedKeys.main.push(parentKey);
|
|
679
|
-
});
|
|
680
|
-
refreshSearchTree();
|
|
681
|
-
} else if (type == 2) {
|
|
682
|
-
searchTree.value.emptyCheckedKeys();
|
|
683
|
-
state.autoExpandParent = true;
|
|
684
|
-
}
|
|
685
|
-
isSearchAllCheck();
|
|
686
|
-
return true;
|
|
687
|
-
};
|
|
688
|
-
const removeCheckedkeysMain = (keys) => {
|
|
689
|
-
let checkedKeysMain = XEUtils.clone(state.checkedKeys.main, true);
|
|
690
|
-
keys.forEach((key) => {
|
|
691
|
-
let index = checkedKeysMain.findIndex((mainKey) => mainKey == key);
|
|
692
|
-
if (index !== -1) {
|
|
693
|
-
checkedKeysMain.splice(index, 1);
|
|
694
|
-
state.checkedKeys.main = [...checkedKeysMain];
|
|
695
|
-
}
|
|
696
|
-
let parentKey = getParentKey(key, state.treeData.main);
|
|
697
|
-
let parentIndex = checkedKeysMain.findIndex((mainKey) => mainKey == parentKey);
|
|
698
|
-
if (parentIndex !== -1) {
|
|
699
|
-
checkedKeysMain.splice(parentIndex, 1);
|
|
700
|
-
}
|
|
701
|
-
});
|
|
702
|
-
state.checkedKeys.main = [...checkedKeysMain];
|
|
703
|
-
};
|
|
704
|
-
const addCheckedkeysOther = (keys) => {
|
|
705
|
-
state.checkedKeys.other.push(...keys);
|
|
706
|
-
};
|
|
707
|
-
const removeCheckedkeysOther = (keys) => {
|
|
708
|
-
let checkedKeys = state.checkedKeys.other;
|
|
709
|
-
keys.forEach((key) => {
|
|
710
|
-
let index = checkedKeys.findIndex((otherKey) => otherKey == key);
|
|
711
|
-
checkedKeys.splice(index, 1);
|
|
712
|
-
handleDeldefaultShowList(key);
|
|
713
|
-
});
|
|
714
|
-
removeCheckedkeysMain(keys);
|
|
715
|
-
};
|
|
716
|
-
const handleDeldefaultShowList = (key) => {
|
|
717
|
-
var _a;
|
|
718
|
-
let len = ((_a = state == null ? void 0 : state.defaultShowList) == null ? void 0 : _a.length) || 0;
|
|
719
|
-
if (len > 0) {
|
|
720
|
-
for (let i = len - 1; i >= 0; i--) {
|
|
721
|
-
let d = state.defaultShowList[i];
|
|
722
|
-
if (`${d.parent_id}_${d.user_id}` == key) {
|
|
723
|
-
closeDefaultTag(d, i);
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
};
|
|
728
|
-
const closeDefaultTag = (tag, i) => {
|
|
729
|
-
state.defaultShowList.splice(i, 1);
|
|
730
|
-
closeTag({
|
|
731
|
-
parentId: getParentId(tag),
|
|
732
|
-
...tag
|
|
733
|
-
});
|
|
734
|
-
};
|
|
735
|
-
const closeTag = (removedTag) => {
|
|
736
|
-
removedCheckedkeysMain(removedTag);
|
|
737
|
-
removedCheckedkeysOther(removedTag);
|
|
738
|
-
refreshSearchTree();
|
|
739
|
-
};
|
|
171
|
+
}
|
|
172
|
+
function updateTreeChecked(keys) {
|
|
173
|
+
checkedKeys.value = keys;
|
|
174
|
+
}
|
|
175
|
+
function setCheckedAll() {
|
|
176
|
+
checkedAll.value = allCheckedKeys.every((key) => tagData.value.findIndex((tag) => tag.key === key) > -1);
|
|
177
|
+
}
|
|
740
178
|
function clearAll() {
|
|
741
|
-
|
|
742
|
-
state.indeterminate = state.singleChecked = false;
|
|
743
|
-
checkedTreeItem.value.forEach((tag) => closeTag(tag));
|
|
179
|
+
checkedKeys.value = [];
|
|
744
180
|
}
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
return !needRemoveChildKeys.includes(i);
|
|
754
|
-
});
|
|
755
|
-
};
|
|
756
|
-
const removedCheckedkeysMain = (tag) => {
|
|
757
|
-
let checkedKeys = state.checkedKeys.main;
|
|
758
|
-
let parentId = getParentId(tag);
|
|
759
|
-
for (let i = 0; i < checkedKeys.length; i++) {
|
|
760
|
-
if (tag.key == checkedKeys[i] && tag.key == parentId) {
|
|
761
|
-
removeCheckedkeysIncludeChildren(tag.key);
|
|
762
|
-
return false;
|
|
763
|
-
} else if (tag.key == checkedKeys[i]) {
|
|
764
|
-
checkedKeys.splice(i, 1);
|
|
765
|
-
return false;
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
};
|
|
769
|
-
const removedCheckedkeysOther = (tag) => {
|
|
770
|
-
let checkedKeys = state.checkedKeys.other;
|
|
771
|
-
if (checkedKeys.includes(tag.key)) {
|
|
772
|
-
for (let i = 0; i < checkedKeys.length; i++) {
|
|
773
|
-
if (tag.key == checkedKeys[i]) {
|
|
774
|
-
checkedKeys.splice(i, 1);
|
|
775
|
-
return false;
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
} else {
|
|
779
|
-
OtherRemoveCheckedkeysIncludeChildren(tag.key);
|
|
780
|
-
}
|
|
781
|
-
};
|
|
782
|
-
const OtherRemoveCheckedkeysIncludeChildren = (parentKey) => {
|
|
783
|
-
let needRemoveChildKeys = state.dataList.main.filter((i) => {
|
|
784
|
-
let parentId = getParentId(i);
|
|
785
|
-
return parentId == parentKey || i.key == parentKey;
|
|
786
|
-
}).map((i) => {
|
|
787
|
-
return i.key;
|
|
788
|
-
});
|
|
789
|
-
state.checkedKeys.other = state.checkedKeys.other.filter((i) => {
|
|
790
|
-
return !needRemoveChildKeys.includes(i);
|
|
791
|
-
});
|
|
792
|
-
};
|
|
793
|
-
const searchOnloadMore = () => {
|
|
794
|
-
state.searchPage = state.searchPage + 1;
|
|
795
|
-
searchFetch({
|
|
796
|
-
page: state.searchPage
|
|
797
|
-
}, {
|
|
798
|
-
loadMoren: true
|
|
799
|
-
});
|
|
800
|
-
};
|
|
801
|
-
const treeCount = (count) => {
|
|
802
|
-
if (!count)
|
|
803
|
-
return "";
|
|
804
|
-
return `(${count})`;
|
|
805
|
-
};
|
|
806
|
-
const getParentId = (v) => {
|
|
807
|
-
const {
|
|
808
|
-
parent_id_obj
|
|
809
|
-
} = wordbookConfig.value || {};
|
|
810
|
-
return `${v[parent_id_obj]}`;
|
|
811
|
-
};
|
|
812
|
-
const uniqArrObj = (arr, name) => {
|
|
813
|
-
let obj = {};
|
|
814
|
-
return arr.reduce((cur, next) => {
|
|
815
|
-
obj[next[name]] ? "" : obj[next[name]] = cur.push(next);
|
|
816
|
-
return cur;
|
|
817
|
-
}, []);
|
|
818
|
-
};
|
|
819
|
-
const getuniqKey = (v) => {
|
|
820
|
-
const {
|
|
821
|
-
user_id_obj
|
|
822
|
-
} = wordbookConfig.value || {};
|
|
823
|
-
return `${getParentId(v)}_${v[user_id_obj]}`;
|
|
824
|
-
};
|
|
825
|
-
watch(() => props.defaultList, (val) => {
|
|
826
|
-
if (!val)
|
|
827
|
-
return;
|
|
828
|
-
initDefault();
|
|
829
|
-
}, {
|
|
830
|
-
immediate: true
|
|
831
|
-
});
|
|
832
|
-
watch(() => state.checkedKeys.main, (val) => {
|
|
833
|
-
if (!searchTreeVisable.value) {
|
|
834
|
-
isAllCheck(val);
|
|
835
|
-
} else {
|
|
836
|
-
isSearchAllCheck();
|
|
837
|
-
}
|
|
838
|
-
const checkedKeys = [.../* @__PURE__ */ new Set([...state.checkedKeys.other, ...val])];
|
|
839
|
-
emit("check", checkedKeys);
|
|
181
|
+
function closeTag(tag) {
|
|
182
|
+
checkedKeys.value = checkedKeys.value.filter((key) => key !== tag.key);
|
|
183
|
+
}
|
|
184
|
+
watch(() => checkedKeys, (value) => {
|
|
185
|
+
tagData.value = [];
|
|
186
|
+
value.value.length && setTagData(isRemote.value ? treeData.value : temp);
|
|
187
|
+
setCheckedAll();
|
|
188
|
+
emit("check", value.value);
|
|
840
189
|
}, {
|
|
841
|
-
immediate: true,
|
|
842
190
|
deep: true
|
|
843
191
|
});
|
|
844
|
-
watch(() => props.data, (val) => {
|
|
845
|
-
staticDataInit();
|
|
846
|
-
}, {
|
|
847
|
-
immediate: true
|
|
848
|
-
});
|
|
849
|
-
onMounted(() => {
|
|
850
|
-
getUsers();
|
|
851
|
-
});
|
|
852
192
|
return (_ctx, _cache) => {
|
|
853
|
-
return openBlock(),
|
|
854
|
-
|
|
193
|
+
return openBlock(), createBlock(unref(NGrid), {
|
|
194
|
+
cols: 2,
|
|
195
|
+
class: "c-select-person"
|
|
855
196
|
}, {
|
|
856
|
-
default: withCtx(() => [
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
}
|
|
860
|
-
}, {
|
|
861
|
-
default: withCtx(() => [createVNode(unref(NInput), {
|
|
197
|
+
default: withCtx(() => [createVNode(unref(NGi), null, {
|
|
198
|
+
default: withCtx(() => [createVNode(unref(NSpace), {
|
|
199
|
+
vertical: "",
|
|
862
200
|
style: {
|
|
863
|
-
"
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
value: state.title,
|
|
867
|
-
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => state.title = $event),
|
|
868
|
-
placeholder: __props.searchPlaceholder,
|
|
869
|
-
onKeyup: withKeys(searchClick, ["enter"])
|
|
870
|
-
}, null, 8, ["value", "placeholder", "onKeyup"]), createVNode(unref(NButton), {
|
|
871
|
-
type: "primary",
|
|
872
|
-
onClick: searchClick
|
|
201
|
+
"padding-right": "12px",
|
|
202
|
+
"border-right": "1px solid #e8e8e8"
|
|
203
|
+
}
|
|
873
204
|
}, {
|
|
874
|
-
default: withCtx(() => [
|
|
205
|
+
default: withCtx(() => [createVNode(unref(NInputGroup), {
|
|
206
|
+
style: {
|
|
207
|
+
"margin-bottom": "12px"
|
|
208
|
+
}
|
|
209
|
+
}, {
|
|
210
|
+
default: withCtx(() => [createVNode(unref(NInput), {
|
|
211
|
+
clearable: "",
|
|
212
|
+
value: keyword.value,
|
|
213
|
+
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => keyword.value = $event),
|
|
214
|
+
placeholder: __props.searchPlaceholder,
|
|
215
|
+
onKeyup: withKeys(searchClick, ["enter"])
|
|
216
|
+
}, null, 8, ["value", "placeholder", "onKeyup"]), createVNode(unref(NButton), {
|
|
217
|
+
type: "primary",
|
|
218
|
+
onClick: searchClick
|
|
219
|
+
}, {
|
|
220
|
+
default: withCtx(() => [createTextVNode(toDisplayString(__props.searchButtonText), 1)]),
|
|
221
|
+
_: 1
|
|
222
|
+
})]),
|
|
223
|
+
_: 1
|
|
224
|
+
}), __props.multiple ? (openBlock(), createBlock(unref(NCheckbox), {
|
|
225
|
+
key: 0,
|
|
226
|
+
checked: checkedAll.value,
|
|
227
|
+
"onUpdate:checked": [_cache[1] || (_cache[1] = ($event) => checkedAll.value = $event), checkedAllChange]
|
|
228
|
+
}, {
|
|
229
|
+
default: withCtx(() => [createTextVNode("\u5168\u9009")]),
|
|
230
|
+
_: 1
|
|
231
|
+
}, 8, ["checked"])) : createCommentVNode("v-if", true), createVNode(unref(NTree), {
|
|
232
|
+
class: "c-select-person__scroll",
|
|
233
|
+
"checked-keys": checkedKeys.value,
|
|
234
|
+
"expanded-keys": expandedKeys.value,
|
|
235
|
+
"onUpdate:expanded-keys": _cache[2] || (_cache[2] = ($event) => expandedKeys.value = $event),
|
|
236
|
+
checkable: __props.multiple,
|
|
237
|
+
cascade: "",
|
|
238
|
+
"allow-checking-not-loaded": "",
|
|
239
|
+
selectable: !__props.multiple,
|
|
240
|
+
"selected-keys": checkedKeys.value,
|
|
241
|
+
"onUpdate:selected-keys": _cache[3] || (_cache[3] = ($event) => checkedKeys.value = $event),
|
|
242
|
+
data: treeData.value,
|
|
243
|
+
"check-strategy": "child",
|
|
244
|
+
"render-label": renderLabel,
|
|
245
|
+
"onUpdate:checkedKeys": updateTreeChecked,
|
|
246
|
+
onLoad: __props.queryLoadChildData
|
|
247
|
+
}, null, 8, ["checked-keys", "expanded-keys", "checkable", "selectable", "selected-keys", "data", "onLoad"])]),
|
|
875
248
|
_: 1
|
|
876
249
|
})]),
|
|
877
250
|
_: 1
|
|
878
|
-
}), unref(
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
"render-label": renderLabel
|
|
910
|
-
}, null, 8, ["checked-keys", "expanded-keys", "checkable", "selectable", "selected-keys", "data", "check-strategy"]), [[vShow, state.search.status == 0]]), createCommentVNode(" search tree "), createVNode(SearchTree, mergeProps(_ctx.$attrs, {
|
|
911
|
-
ref_key: "searchTree",
|
|
912
|
-
ref: searchTree,
|
|
913
|
-
visible: unref(searchTreeVisable),
|
|
914
|
-
formatTreeData: state.treeData.search,
|
|
915
|
-
searchValue: state.searchValue,
|
|
916
|
-
allCheckedKeys: state.checkedKeys,
|
|
917
|
-
defaultExpandedKeys: state.search.defaultExpandedKeys,
|
|
918
|
-
dataListKeys: state.search.dataListKeys,
|
|
919
|
-
searchNoMore: state.searchNoMore,
|
|
920
|
-
loadMorenLoadinng: state.loadMorenLoadinng,
|
|
921
|
-
onAddCheckedkeysMain: addCheckedkeysMain,
|
|
922
|
-
onRemoveCheckedkeysMain: removeCheckedkeysMain,
|
|
923
|
-
onAddCheckedkeysOther: addCheckedkeysOther,
|
|
924
|
-
onRemoveCheckedkeysOther: removeCheckedkeysOther,
|
|
925
|
-
onSearchOnloadMore: searchOnloadMore
|
|
926
|
-
}), null, 16, ["visible", "formatTreeData", "searchValue", "allCheckedKeys", "defaultExpandedKeys", "dataListKeys", "searchNoMore", "loadMorenLoadinng"])]), createCommentVNode(" \u6811\u5DF2\u9009\u7684\u6570\u636E "), createElementVNode("div", _hoisted_4, [state.defaultShowList.length || unref(checkedTreeItem).length ? (openBlock(), createBlock(unref(NSpace), {
|
|
927
|
-
key: 0,
|
|
928
|
-
justify: "space-between",
|
|
929
|
-
style: {
|
|
930
|
-
"margin-bottom": "20px"
|
|
931
|
-
}
|
|
932
|
-
}, {
|
|
933
|
-
default: withCtx(() => [__props.showCount ? (openBlock(), createElementBlock("div", _hoisted_5, "\u5DF2\u9009\u62E9\uFF1A" + toDisplayString(state.defaultShowList.length + unref(checkedTreeItem).length), 1)) : createCommentVNode("v-if", true), __props.showClear ? (openBlock(), createElementBlock("div", {
|
|
934
|
-
key: 1,
|
|
935
|
-
class: "clear-btn",
|
|
936
|
-
onClick: clearAll
|
|
937
|
-
}, "\u6E05\u7A7A")) : createCommentVNode("v-if", true)]),
|
|
251
|
+
}), createVNode(unref(NGi), null, {
|
|
252
|
+
default: withCtx(() => [createVNode(unref(NSpace), {
|
|
253
|
+
vertical: "",
|
|
254
|
+
style: {
|
|
255
|
+
"padding-left": "12px"
|
|
256
|
+
}
|
|
257
|
+
}, {
|
|
258
|
+
default: withCtx(() => [createVNode(unref(NSpace), {
|
|
259
|
+
justify: "space-between",
|
|
260
|
+
style: {
|
|
261
|
+
"margin-bottom": "20px"
|
|
262
|
+
}
|
|
263
|
+
}, {
|
|
264
|
+
default: withCtx(() => [__props.showCount ? (openBlock(), createElementBlock("span", _hoisted_1, "\u5DF2\u9009\u62E9\uFF1A" + toDisplayString(tagData.value.length), 1)) : createCommentVNode("v-if", true), __props.showClear ? (openBlock(), createElementBlock("span", {
|
|
265
|
+
key: 1,
|
|
266
|
+
class: "c-select-person__clear-btn",
|
|
267
|
+
onClick: clearAll
|
|
268
|
+
}, "\u6E05\u7A7A")) : createCommentVNode("v-if", true)]),
|
|
269
|
+
_: 1
|
|
270
|
+
}), createElementVNode("div", _hoisted_2, [(openBlock(true), createElementBlock(Fragment, null, renderList(tagData.value, (tag) => {
|
|
271
|
+
return openBlock(), createElementBlock("span", {
|
|
272
|
+
class: "c-select-person__tag-item",
|
|
273
|
+
key: tag.key
|
|
274
|
+
}, [createTextVNode(toDisplayString(tag.name) + " ", 1), createVNode(unref(NIcon), {
|
|
275
|
+
class: "tag-close",
|
|
276
|
+
component: unref(CloseCircleSharp),
|
|
277
|
+
onClick: ($event) => closeTag(tag)
|
|
278
|
+
}, null, 8, ["component", "onClick"])]);
|
|
279
|
+
}), 128))])]),
|
|
280
|
+
_: 1
|
|
281
|
+
})]),
|
|
938
282
|
_: 1
|
|
939
|
-
}))
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
return openBlock(), createElementBlock("div", {
|
|
943
|
-
class: "tag-item def-item",
|
|
944
|
-
key: i
|
|
945
|
-
}, [createTextVNode(toDisplayString(tag.title || tag[__props.wordbookChild.user_name_obj]) + " ", 1), !__props.isDetail ? (openBlock(), createBlock(unref(NIcon), {
|
|
946
|
-
key: 0,
|
|
947
|
-
class: "tag-close",
|
|
948
|
-
component: unref(CloseCircleSharp),
|
|
949
|
-
onClick: ($event) => closeDefaultTag(tag, i)
|
|
950
|
-
}, null, 8, ["component", "onClick"])) : createCommentVNode("v-if", true)]);
|
|
951
|
-
}), 128))]) : createCommentVNode("v-if", true), (openBlock(true), createElementBlock(Fragment, null, renderList(unref(checkedTreeItem), (tag) => {
|
|
952
|
-
return openBlock(), createElementBlock("div", {
|
|
953
|
-
class: normalizeClass(["tag-item", {
|
|
954
|
-
isRoot: !tag.isLeaf
|
|
955
|
-
}]),
|
|
956
|
-
key: tag.key
|
|
957
|
-
}, [createTextVNode(toDisplayString(tag.title || tag.key) + " " + toDisplayString(treeCount(tag.count)) + " ", 1), !__props.isDetail ? (openBlock(), createBlock(unref(NIcon), {
|
|
958
|
-
key: 0,
|
|
959
|
-
class: "tag-close",
|
|
960
|
-
component: unref(CloseCircleSharp),
|
|
961
|
-
onClick: ($event) => closeTag(tag)
|
|
962
|
-
}, null, 8, ["component", "onClick"])) : createCommentVNode("v-if", true)], 2);
|
|
963
|
-
}), 128))])])]),
|
|
964
|
-
_: 3
|
|
965
|
-
}, 8, ["show"])]);
|
|
283
|
+
})]),
|
|
284
|
+
_: 1
|
|
285
|
+
});
|
|
966
286
|
};
|
|
967
287
|
}
|
|
968
288
|
});
|