bm-admin-ui 1.2.51-alpha → 1.2.53-alpha
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/es/components/cascader/index.js +77 -77
- package/es/components/edit-form/index.js +1 -1
- package/es/components/flow-designer/index.js +1 -1
- package/es/components/form-create/index.js +23 -6
- package/es/components/staffs-selector/index.d.ts +24 -0
- package/es/components/staffs-selector/index.js +114 -38
- package/es/components/staffs-selector/src/action.d.ts +4 -0
- package/es/components/staffs-selector/src/departmentCmp.vue.d.ts +10 -0
- package/es/components/staffs-selector/src/staffs-selector.vue.d.ts +24 -0
- package/lib/components/cascader/index.js +77 -77
- package/lib/components/edit-form/index.js +1 -1
- package/lib/components/flow-designer/index.js +1 -1
- package/lib/components/form-create/index.js +23 -6
- package/lib/components/staffs-selector/index.d.ts +24 -0
- package/lib/components/staffs-selector/index.js +113 -37
- package/lib/components/staffs-selector/src/action.d.ts +4 -0
- package/lib/components/staffs-selector/src/departmentCmp.vue.d.ts +10 -0
- package/lib/components/staffs-selector/src/staffs-selector.vue.d.ts +24 -0
- package/package.json +34 -34
- package/types/components/staffs-selector/index.d.ts +24 -0
- package/types/components/staffs-selector/src/action.d.ts +4 -0
- package/types/components/staffs-selector/src/departmentCmp.vue.d.ts +10 -0
- package/types/components/staffs-selector/src/staffs-selector.vue.d.ts +24 -0
|
@@ -10,71 +10,71 @@ var _export_sfc = (sfc, props) => {
|
|
|
10
10
|
return target;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
const _sfc_main = defineComponent({
|
|
14
|
-
name: 'BmCascader',
|
|
15
|
-
components: { DownOutlined },
|
|
16
|
-
props: {
|
|
17
|
-
tipType: {
|
|
18
|
-
type: String,
|
|
19
|
-
default: () => {
|
|
20
|
-
return 'none'
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
width: {
|
|
24
|
-
type: Number,
|
|
25
|
-
default: () => {
|
|
26
|
-
return 200
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
setup(props, { emit, attrs }) {
|
|
31
|
-
const nameArr = (arr) => {
|
|
32
|
-
return arr.reduce(
|
|
33
|
-
(acc, cur) => acc.concat(Array.isArray(cur) ? nameArr(cur) : cur),
|
|
34
|
-
[]
|
|
35
|
-
)
|
|
36
|
-
};
|
|
37
|
-
const state = reactive({
|
|
38
|
-
labelNameList: '',
|
|
39
|
-
visible: false,
|
|
40
|
-
});
|
|
41
|
-
const methods = {
|
|
42
|
-
onmouseover() {
|
|
43
|
-
state.labelNameList.length && (state.visible = true);
|
|
44
|
-
},
|
|
45
|
-
onmouseout() {
|
|
46
|
-
state.labelNameList.length && (state.visible = false);
|
|
47
|
-
},
|
|
48
|
-
onchange(value, selectedOptions) {
|
|
49
|
-
if (attrs.multiple === '' || attrs.multiple) {
|
|
50
|
-
let res = selectedOptions.map((v, k) => {
|
|
51
|
-
return v.map((e, i) => {
|
|
52
|
-
return e.label
|
|
53
|
-
})
|
|
54
|
-
});
|
|
55
|
-
state.labelNameList = nameArr(res).join(',');
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
watch(
|
|
60
|
-
() => state.labelNameList.length,
|
|
61
|
-
(val) => {
|
|
62
|
-
if (!val) {
|
|
63
|
-
state.visible = false;
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
{ deep: true }
|
|
67
|
-
);
|
|
68
|
-
onMounted(() => {
|
|
69
|
-
attrs.value?.length &&
|
|
70
|
-
(state.labelNameList = nameArr(attrs.value).join(','));
|
|
71
|
-
});
|
|
72
|
-
return {
|
|
73
|
-
...toRefs(state),
|
|
74
|
-
...methods,
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
});
|
|
13
|
+
const _sfc_main = defineComponent({
|
|
14
|
+
name: 'BmCascader',
|
|
15
|
+
components: { DownOutlined },
|
|
16
|
+
props: {
|
|
17
|
+
tipType: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: () => {
|
|
20
|
+
return 'none'
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
width: {
|
|
24
|
+
type: Number,
|
|
25
|
+
default: () => {
|
|
26
|
+
return 200
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
setup(props, { emit, attrs }) {
|
|
31
|
+
const nameArr = (arr) => {
|
|
32
|
+
return arr.reduce(
|
|
33
|
+
(acc, cur) => acc.concat(Array.isArray(cur) ? nameArr(cur) : cur),
|
|
34
|
+
[]
|
|
35
|
+
)
|
|
36
|
+
};
|
|
37
|
+
const state = reactive({
|
|
38
|
+
labelNameList: '',
|
|
39
|
+
visible: false,
|
|
40
|
+
});
|
|
41
|
+
const methods = {
|
|
42
|
+
onmouseover() {
|
|
43
|
+
state.labelNameList.length && (state.visible = true);
|
|
44
|
+
},
|
|
45
|
+
onmouseout() {
|
|
46
|
+
state.labelNameList.length && (state.visible = false);
|
|
47
|
+
},
|
|
48
|
+
onchange(value, selectedOptions) {
|
|
49
|
+
if (attrs.multiple === '' || attrs.multiple) {
|
|
50
|
+
let res = selectedOptions.map((v, k) => {
|
|
51
|
+
return v.map((e, i) => {
|
|
52
|
+
return e.label
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
state.labelNameList = nameArr(res).join(',');
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
watch(
|
|
60
|
+
() => state.labelNameList.length,
|
|
61
|
+
(val) => {
|
|
62
|
+
if (!val) {
|
|
63
|
+
state.visible = false;
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
{ deep: true }
|
|
67
|
+
);
|
|
68
|
+
onMounted(() => {
|
|
69
|
+
attrs.value?.length &&
|
|
70
|
+
(state.labelNameList = nameArr(attrs.value).join(','));
|
|
71
|
+
});
|
|
72
|
+
return {
|
|
73
|
+
...toRefs(state),
|
|
74
|
+
...methods,
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
78
|
|
|
79
79
|
const _hoisted_1 = {
|
|
80
80
|
ref: "BmCascader",
|
|
@@ -95,18 +95,18 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
95
95
|
? (openBlock(), createBlock(_component_a_popover, {
|
|
96
96
|
key: 0,
|
|
97
97
|
visible: _ctx.visible,
|
|
98
|
-
"get-popup-container":
|
|
99
|
-
(triggerNode) => {
|
|
100
|
-
return triggerNode.parentNode
|
|
101
|
-
}
|
|
98
|
+
"get-popup-container":
|
|
99
|
+
(triggerNode) => {
|
|
100
|
+
return triggerNode.parentNode
|
|
101
|
+
}
|
|
102
102
|
|
|
103
103
|
}, createSlots({
|
|
104
104
|
default: withCtx(() => [
|
|
105
105
|
createVNode(_component_a_cascader, mergeProps(_ctx.$attrs, {
|
|
106
|
-
style: {
|
|
107
|
-
width:
|
|
108
|
-
_ctx.$attrs.multiple === '' || _ctx.$attrs.multiple ? _ctx.width + 'px' : 'auto',
|
|
109
|
-
minWidth: _ctx.width + 'px',
|
|
106
|
+
style: {
|
|
107
|
+
width:
|
|
108
|
+
_ctx.$attrs.multiple === '' || _ctx.$attrs.multiple ? _ctx.width + 'px' : 'auto',
|
|
109
|
+
minWidth: _ctx.width + 'px',
|
|
110
110
|
},
|
|
111
111
|
"show-arrow": true,
|
|
112
112
|
onMouseover: _ctx.onmouseover,
|
|
@@ -159,10 +159,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
159
159
|
}, createSlots({
|
|
160
160
|
default: withCtx(() => [
|
|
161
161
|
createVNode(_component_a_cascader, mergeProps(_ctx.$attrs, {
|
|
162
|
-
style: {
|
|
163
|
-
width:
|
|
164
|
-
_ctx.$attrs.multiple === '' || _ctx.$attrs.multiple ? _ctx.width + 'px' : 'auto',
|
|
165
|
-
minWidth: _ctx.width + 'px',
|
|
162
|
+
style: {
|
|
163
|
+
width:
|
|
164
|
+
_ctx.$attrs.multiple === '' || _ctx.$attrs.multiple ? _ctx.width + 'px' : 'auto',
|
|
165
|
+
minWidth: _ctx.width + 'px',
|
|
166
166
|
},
|
|
167
167
|
"show-arrow": true,
|
|
168
168
|
onMouseover: _ctx.onmouseover,
|
|
@@ -1070,7 +1070,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1070
1070
|
createVNode(unref(BmOverTooltips), {
|
|
1071
1071
|
title: unref(getShowValue)(item) || tmpForm.value[item.prop]
|
|
1072
1072
|
}, null, 8, ["title"]),
|
|
1073
|
-
createCommentVNode(' <AutoTooltip\n :tooltip="getShowValue(item) || tmpForm[item.prop]"\n /> ')
|
|
1073
|
+
createCommentVNode(' <AutoTooltip\r\n :tooltip="getShowValue(item) || tmpForm[item.prop]"\r\n /> ')
|
|
1074
1074
|
], 6)) : createCommentVNode("v-if", true),
|
|
1075
1075
|
item.type === "multiText" ? (openBlock(), createElementBlock("div", {
|
|
1076
1076
|
key: 15,
|
|
@@ -276,7 +276,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
276
276
|
createElementVNode("span", {
|
|
277
277
|
class: normalizeClass(["opeator", { active: __props.isCustom }])
|
|
278
278
|
}, [
|
|
279
|
-
createCommentVNode(' <CopyOutlined\n @click.stop="\n () => {\n copyCallback()\n }\n " /> \u6682\u65F6\u5173\u95ED\u590D\u5236\u8282\u70B9 '),
|
|
279
|
+
createCommentVNode(' <CopyOutlined\r\n @click.stop="\r\n () => {\r\n copyCallback()\r\n }\r\n " /> \u6682\u65F6\u5173\u95ED\u590D\u5236\u8282\u70B9 '),
|
|
280
280
|
createVNode(unref(CloseOutlined), {
|
|
281
281
|
onClick: _cache[0] || (_cache[0] = withModifiers(
|
|
282
282
|
() => {
|
|
@@ -878,6 +878,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
878
878
|
"placeholder",
|
|
879
879
|
"defaultSelected",
|
|
880
880
|
"load",
|
|
881
|
+
"lazyload",
|
|
881
882
|
"disabled",
|
|
882
883
|
"fieldNames",
|
|
883
884
|
"immediateFetch",
|
|
@@ -928,11 +929,12 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
928
929
|
title: __props.title,
|
|
929
930
|
mode: __props.mode,
|
|
930
931
|
load: __props.load,
|
|
932
|
+
lazyload: __props.lazyload,
|
|
931
933
|
limit: __props.limit,
|
|
932
934
|
"immediate-fetch": __props.immediateFetch,
|
|
933
935
|
centered: _ctx.$props.centered,
|
|
934
936
|
"onUpdate:select": selectedChange
|
|
935
|
-
}, null, 8, ["visible", "select", "title", "mode", "load", "limit", "immediate-fetch", "centered"])
|
|
937
|
+
}, null, 8, ["visible", "select", "title", "mode", "load", "lazyload", "limit", "immediate-fetch", "centered"])
|
|
936
938
|
]);
|
|
937
939
|
};
|
|
938
940
|
}
|
|
@@ -18776,7 +18778,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
18776
18778
|
debounceFetch("");
|
|
18777
18779
|
return (_ctx, _cache) => {
|
|
18778
18780
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
18779
|
-
createCommentVNode(' <Input\n v-model:value="inputValue"\n placeholder="\u8BF7\u8F93\u5165"\n :disabled="disabled"\n @change="debounceFn($event.target.value)"\n ></Input> '),
|
|
18781
|
+
createCommentVNode(' <Input\r\n v-model:value="inputValue"\r\n placeholder="\u8BF7\u8F93\u5165"\r\n :disabled="disabled"\r\n @change="debounceFn($event.target.value)"\r\n ></Input> '),
|
|
18780
18782
|
createVNode(unref(Select), {
|
|
18781
18783
|
value: __props.value,
|
|
18782
18784
|
placeholder: "\u8BF7\u9009\u62E9",
|
|
@@ -29436,9 +29438,14 @@ var department = {
|
|
|
29436
29438
|
unitStr: '个',
|
|
29437
29439
|
defaultSelected: data.value,
|
|
29438
29440
|
centered: true,
|
|
29439
|
-
|
|
29441
|
+
lazyload(_, params, list) {
|
|
29440
29442
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29441
|
-
return yield extraConfig.department.
|
|
29443
|
+
return yield extraConfig.department.lazyload(params, list);
|
|
29444
|
+
});
|
|
29445
|
+
},
|
|
29446
|
+
load(_, params) {
|
|
29447
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29448
|
+
return yield extraConfig.department.fetch(params);
|
|
29442
29449
|
});
|
|
29443
29450
|
},
|
|
29444
29451
|
fieldNames: (_a = extraConfig.department) === null || _a === void 0 ? void 0 : _a.fieldNames,
|
|
@@ -29485,9 +29492,14 @@ var department = {
|
|
|
29485
29492
|
unitStr: '个',
|
|
29486
29493
|
defaultSelected: data.value,
|
|
29487
29494
|
centered: true,
|
|
29488
|
-
|
|
29495
|
+
lazyload(_, params, list) {
|
|
29489
29496
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29490
|
-
return yield extraConfig.department.
|
|
29497
|
+
return yield extraConfig.department.lazyload(params, list);
|
|
29498
|
+
});
|
|
29499
|
+
},
|
|
29500
|
+
load(_, params) {
|
|
29501
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29502
|
+
return yield extraConfig.department.fetch(params);
|
|
29491
29503
|
});
|
|
29492
29504
|
},
|
|
29493
29505
|
fieldNames: (_a = extraConfig.department) === null || _a === void 0 ? void 0 : _a.fieldNames,
|
|
@@ -29539,6 +29551,11 @@ var department = {
|
|
|
29539
29551
|
row[field] = value;
|
|
29540
29552
|
},
|
|
29541
29553
|
defaultSelected: row[field],
|
|
29554
|
+
lazyload(params, list) {
|
|
29555
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29556
|
+
return yield extraConfig.department.lazyload(params, list);
|
|
29557
|
+
});
|
|
29558
|
+
},
|
|
29542
29559
|
load(params) {
|
|
29543
29560
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29544
29561
|
return yield extraConfig.department.fetch(params);
|
|
@@ -19,6 +19,10 @@ declare const BmStaffsSelector: import("bm-admin-ui/es/utils/with-install").SFCW
|
|
|
19
19
|
type: FunctionConstructor;
|
|
20
20
|
default: () => Promise<never[]>;
|
|
21
21
|
};
|
|
22
|
+
lazyload: {
|
|
23
|
+
type: FunctionConstructor;
|
|
24
|
+
default: () => Promise<never[]>;
|
|
25
|
+
};
|
|
22
26
|
select: {
|
|
23
27
|
type: ArrayConstructor;
|
|
24
28
|
defualt: () => never[];
|
|
@@ -65,6 +69,10 @@ declare const BmStaffsSelector: import("bm-admin-ui/es/utils/with-install").SFCW
|
|
|
65
69
|
type: FunctionConstructor;
|
|
66
70
|
default: () => Promise<never[]>;
|
|
67
71
|
};
|
|
72
|
+
lazyload: {
|
|
73
|
+
type: FunctionConstructor;
|
|
74
|
+
default: () => Promise<never[]>;
|
|
75
|
+
};
|
|
68
76
|
select: {
|
|
69
77
|
type: ArrayConstructor;
|
|
70
78
|
defualt: () => never[];
|
|
@@ -109,6 +117,7 @@ declare const BmStaffsSelector: import("bm-admin-ui/es/utils/with-install").SFCW
|
|
|
109
117
|
summitSelect: () => void;
|
|
110
118
|
getOptionName: (key: any) => any;
|
|
111
119
|
deleteOptions: (key: any) => void;
|
|
120
|
+
onLoadData: (treeNode: any, list: any) => any;
|
|
112
121
|
AModal: {
|
|
113
122
|
new (...args: any[]): {
|
|
114
123
|
$: import("vue").ComponentInternalInstance;
|
|
@@ -972,7 +981,12 @@ declare const BmStaffsSelector: import("bm-admin-ui/es/utils/with-install").SFCW
|
|
|
972
981
|
type: ArrayConstructor;
|
|
973
982
|
default: () => never[];
|
|
974
983
|
};
|
|
984
|
+
loadData: {
|
|
985
|
+
type: FunctionConstructor;
|
|
986
|
+
default: () => Promise<never[]>;
|
|
987
|
+
};
|
|
975
988
|
}, {
|
|
989
|
+
realLoadData: (treeNode: any) => any;
|
|
976
990
|
search(): void;
|
|
977
991
|
treeRef: import("vue").Ref<any>;
|
|
978
992
|
list: any;
|
|
@@ -1001,10 +1015,15 @@ declare const BmStaffsSelector: import("bm-admin-ui/es/utils/with-install").SFCW
|
|
|
1001
1015
|
type: ArrayConstructor;
|
|
1002
1016
|
default: () => never[];
|
|
1003
1017
|
};
|
|
1018
|
+
loadData: {
|
|
1019
|
+
type: FunctionConstructor;
|
|
1020
|
+
default: () => Promise<never[]>;
|
|
1021
|
+
};
|
|
1004
1022
|
}>> & {
|
|
1005
1023
|
"onUpdate:selected"?: ((...args: any[]) => any) | undefined;
|
|
1006
1024
|
onFetchList?: ((...args: any[]) => any) | undefined;
|
|
1007
1025
|
}, {
|
|
1026
|
+
loadData: Function;
|
|
1008
1027
|
selected: unknown[];
|
|
1009
1028
|
limit: number;
|
|
1010
1029
|
}>;
|
|
@@ -1030,6 +1049,10 @@ declare const BmStaffsSelector: import("bm-admin-ui/es/utils/with-install").SFCW
|
|
|
1030
1049
|
type: FunctionConstructor;
|
|
1031
1050
|
default: () => Promise<never[]>;
|
|
1032
1051
|
};
|
|
1052
|
+
lazyload: {
|
|
1053
|
+
type: FunctionConstructor;
|
|
1054
|
+
default: () => Promise<never[]>;
|
|
1055
|
+
};
|
|
1033
1056
|
select: {
|
|
1034
1057
|
type: ArrayConstructor;
|
|
1035
1058
|
defualt: () => never[];
|
|
@@ -1067,6 +1090,7 @@ declare const BmStaffsSelector: import("bm-admin-ui/es/utils/with-install").SFCW
|
|
|
1067
1090
|
unitStr: string;
|
|
1068
1091
|
limit: number;
|
|
1069
1092
|
load: Function;
|
|
1093
|
+
lazyload: Function;
|
|
1070
1094
|
forceStatic: boolean;
|
|
1071
1095
|
immediateFetch: boolean;
|
|
1072
1096
|
}>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { withInstall } from 'bm-admin-ui/es/utils/with-install';
|
|
2
2
|
import { readonly, ref, reactive, defineComponent, watch, toRefs, resolveComponent, openBlock, createElementBlock, createElementVNode, createVNode, withCtx, withDirectives, createTextVNode, vShow, Fragment, renderList, toDisplayString, createCommentVNode, computed, createBlock, unref, withModifiers } from 'vue';
|
|
3
|
-
import { Checkbox, Empty, Radio, Input, RadioGroup, Tree,
|
|
3
|
+
import { Checkbox, Empty, Radio, Input, RadioGroup, Tree, Modal } from 'ant-design-vue';
|
|
4
4
|
import { SearchOutlined, CloseCircleFilled } from '@ant-design/icons-vue';
|
|
5
5
|
|
|
6
6
|
const MODE = {
|
|
@@ -32,6 +32,12 @@ const selectProps = {
|
|
|
32
32
|
return Promise.resolve([]);
|
|
33
33
|
},
|
|
34
34
|
},
|
|
35
|
+
lazyload: {
|
|
36
|
+
type: Function,
|
|
37
|
+
default: () => {
|
|
38
|
+
return Promise.resolve([]);
|
|
39
|
+
},
|
|
40
|
+
},
|
|
35
41
|
select: {
|
|
36
42
|
type: Array || Object,
|
|
37
43
|
defualt: () => [],
|
|
@@ -361,10 +367,17 @@ const _sfc_main$1 = defineComponent({
|
|
|
361
367
|
selected: {
|
|
362
368
|
type: Array,
|
|
363
369
|
default: () => []
|
|
370
|
+
},
|
|
371
|
+
loadData: {
|
|
372
|
+
type: Function,
|
|
373
|
+
default: () => {
|
|
374
|
+
return Promise.resolve([]);
|
|
375
|
+
}
|
|
364
376
|
}
|
|
365
377
|
},
|
|
366
378
|
emits: ["fetchList", "update:selected"],
|
|
367
379
|
setup(props, { emit }) {
|
|
380
|
+
const allListData = ref([]);
|
|
368
381
|
const treeRef = ref();
|
|
369
382
|
const state = reactive({
|
|
370
383
|
searchVal: "",
|
|
@@ -376,41 +389,102 @@ const _sfc_main$1 = defineComponent({
|
|
|
376
389
|
const methods = {
|
|
377
390
|
search() {
|
|
378
391
|
let data = state.searchVal ? { searchVal: state.searchVal } : { searchVal: "" };
|
|
379
|
-
emit("fetchList",
|
|
392
|
+
emit("fetchList", {
|
|
393
|
+
...data,
|
|
394
|
+
area: "department"
|
|
395
|
+
});
|
|
380
396
|
}
|
|
381
397
|
};
|
|
398
|
+
function treeDataToMap(treeData, oldMap, oldSet) {
|
|
399
|
+
const nodeMap = /* @__PURE__ */ new Map();
|
|
400
|
+
const nodeSet = /* @__PURE__ */ new Set();
|
|
401
|
+
function traverseNode(node) {
|
|
402
|
+
if (typeof node === "object" && node !== null && node["id"] !== void 0) {
|
|
403
|
+
nodeMap.set(node["id"], node);
|
|
404
|
+
nodeSet.add(node["id"]);
|
|
405
|
+
} else {
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
if (Array.isArray(node["children"])) {
|
|
409
|
+
node["children"].forEach((childNode) => traverseNode(childNode));
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
if (Array.isArray(treeData)) {
|
|
413
|
+
treeData.forEach((rootNode) => traverseNode(rootNode));
|
|
414
|
+
} else {
|
|
415
|
+
traverseNode(treeData);
|
|
416
|
+
}
|
|
417
|
+
if (oldMap) {
|
|
418
|
+
nodeMap.forEach((node, id) => {
|
|
419
|
+
oldMap.set(id, node);
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
if (oldSet) {
|
|
423
|
+
nodeSet.forEach((node, id) => {
|
|
424
|
+
oldSet.add(id);
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
return {
|
|
428
|
+
nodeMap,
|
|
429
|
+
nodeSet
|
|
430
|
+
};
|
|
431
|
+
}
|
|
382
432
|
function changeTreeCheck(checkedKeys) {
|
|
383
|
-
|
|
384
|
-
let
|
|
433
|
+
console.log("checkedKeys:", checkedKeys, allListData.value);
|
|
434
|
+
let flatMap = treeDataToMap(
|
|
435
|
+
allListData.value,
|
|
436
|
+
selectState.dataMap,
|
|
437
|
+
null
|
|
438
|
+
).nodeMap;
|
|
439
|
+
selectState.dataMap.forEach((node, id) => {
|
|
440
|
+
flatMap.set(id, node);
|
|
441
|
+
});
|
|
442
|
+
selectState.dataMap = flatMap;
|
|
443
|
+
flatMap.forEach((node, id) => {
|
|
444
|
+
selectState.dataMap.set(id, node);
|
|
445
|
+
});
|
|
446
|
+
let curlistKeys = treeDataToMap(
|
|
447
|
+
allListData.value,
|
|
448
|
+
null,
|
|
449
|
+
selectState.curlistKeys
|
|
450
|
+
).nodeSet;
|
|
385
451
|
let hadselected = new Set(selectState.multipDepartment);
|
|
386
452
|
let curselect = new Set(checkedKeys);
|
|
387
|
-
console.log(hadselected, curselect);
|
|
388
453
|
for (let key of hadselected) {
|
|
389
|
-
if (curlistKeys.has(key) && (!curselect.has(key) || curselect.has(key) && curselect.has(flatMap.get(key)["parent"]))) {
|
|
454
|
+
if (curlistKeys.has(String(key)) && (!curselect.has(String(key)) || curselect.has(String(key)) && curselect.has(flatMap.get(String(key))["parent"]))) {
|
|
390
455
|
hadselected.delete(key);
|
|
391
456
|
}
|
|
392
457
|
}
|
|
393
458
|
for (let key of curselect) {
|
|
394
|
-
let obj = flatMap.get(key);
|
|
459
|
+
let obj = flatMap.get(String(key));
|
|
395
460
|
if (obj && !curselect.has(obj["parent"])) {
|
|
396
|
-
hadselected.add(key);
|
|
461
|
+
hadselected.add(String(key));
|
|
397
462
|
}
|
|
398
463
|
}
|
|
399
|
-
let arr = Array.from(hadselected) || [];
|
|
400
|
-
if (props.limit && props.limit > 0 && arr.length > props.limit) {
|
|
401
|
-
message.error("\u52FE\u9009\u540E\u5C06\u8D85\u8FC7\u4EBA\u5458\u9650\u5236");
|
|
402
|
-
return;
|
|
403
|
-
}
|
|
404
464
|
selectState.multipDepartment = Array.from(hadselected) || [];
|
|
405
|
-
console.log(selectState.multipDepartment);
|
|
465
|
+
console.log("multipDepartment:", selectState.multipDepartment);
|
|
406
466
|
}
|
|
467
|
+
const realLoadData = (treeNode) => {
|
|
468
|
+
if (!props.loadData)
|
|
469
|
+
return Promise.resolve([]);
|
|
470
|
+
return props.loadData(treeNode, list);
|
|
471
|
+
};
|
|
472
|
+
watch(
|
|
473
|
+
() => list.value,
|
|
474
|
+
(newVal) => {
|
|
475
|
+
if (newVal && newVal.length) {
|
|
476
|
+
allListData.value = [...allListData.value, ...newVal];
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
);
|
|
407
480
|
return {
|
|
408
481
|
changeTreeCheck,
|
|
409
482
|
...toRefs(state),
|
|
410
483
|
...toRefs(selectState),
|
|
411
484
|
treeRef,
|
|
412
485
|
list,
|
|
413
|
-
...methods
|
|
486
|
+
...methods,
|
|
487
|
+
realLoadData
|
|
414
488
|
};
|
|
415
489
|
}
|
|
416
490
|
});
|
|
@@ -441,19 +515,20 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
441
515
|
value: _ctx.searchVal,
|
|
442
516
|
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => _ctx.searchVal = $event),
|
|
443
517
|
placeholder: "\u8BF7\u8F93\u5165\u90E8\u95E8\u540D\u79F0",
|
|
444
|
-
|
|
518
|
+
onInput: _ctx.search
|
|
445
519
|
}, {
|
|
446
520
|
suffix: withCtx(() => [
|
|
447
521
|
createVNode(_component_search_outlined, { style: { color: "#9393A3" } })
|
|
448
522
|
]),
|
|
449
523
|
_: 1
|
|
450
|
-
}, 8, ["value", "
|
|
524
|
+
}, 8, ["value", "onInput"]),
|
|
451
525
|
createElementVNode("div", _hoisted_4$1, [
|
|
452
526
|
createVNode(_component_ATree, {
|
|
453
527
|
ref: "treeRef",
|
|
454
528
|
"checked-keys": _ctx.multipDepartment,
|
|
455
529
|
checkable: "",
|
|
456
530
|
"tree-data": _ctx.list,
|
|
531
|
+
"load-data": _ctx.realLoadData,
|
|
457
532
|
onCheck: _ctx.changeTreeCheck
|
|
458
533
|
}, {
|
|
459
534
|
title: withCtx(({ title, key, description }) => [
|
|
@@ -463,7 +538,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
463
538
|
])
|
|
464
539
|
]),
|
|
465
540
|
_: 1
|
|
466
|
-
}, 8, ["checked-keys", "tree-data", "onCheck"]),
|
|
541
|
+
}, 8, ["checked-keys", "tree-data", "load-data", "onCheck"]),
|
|
467
542
|
_ctx.list && !_ctx.list.length ? (openBlock(), createElementBlock("div", _hoisted_7, [
|
|
468
543
|
createVNode(_component_Empty, { image: _ctx.emptyPic }, {
|
|
469
544
|
description: withCtx(() => [
|
|
@@ -530,26 +605,20 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
530
605
|
list.value = [];
|
|
531
606
|
selectState.searched = !!params?.searchVal;
|
|
532
607
|
let isDepartTree = props.mode === MODE.DEPARTMENT;
|
|
533
|
-
if (isDepartTree) {
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
queues.push(...node.children);
|
|
548
|
-
}
|
|
549
|
-
list.value = result;
|
|
550
|
-
} else {
|
|
551
|
-
list.value = departNative.value;
|
|
552
|
-
}
|
|
608
|
+
if (params.area === "department" || isDepartTree) {
|
|
609
|
+
props.load({
|
|
610
|
+
departmentName: params.searchVal
|
|
611
|
+
}).then((data) => {
|
|
612
|
+
list.value = data?.map((x) => ({
|
|
613
|
+
...x,
|
|
614
|
+
title: x.name,
|
|
615
|
+
isLeaf: !x.isExistChild,
|
|
616
|
+
key: x.id,
|
|
617
|
+
parent: { key: x.id + Date.now() }
|
|
618
|
+
}));
|
|
619
|
+
departNative.value = data;
|
|
620
|
+
});
|
|
621
|
+
selectState.dataMap = flatListFunc(list.value);
|
|
553
622
|
return;
|
|
554
623
|
}
|
|
555
624
|
if (params.searchVal) {
|
|
@@ -636,6 +705,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
636
705
|
index > -1 && selectState.multipDepartment.splice(index, 1);
|
|
637
706
|
}
|
|
638
707
|
}
|
|
708
|
+
function onLoadData(treeNode, list2) {
|
|
709
|
+
if (props.lazyload) {
|
|
710
|
+
return props.lazyload(treeNode, list2);
|
|
711
|
+
}
|
|
712
|
+
return Promise.resolve([]);
|
|
713
|
+
}
|
|
639
714
|
watch(
|
|
640
715
|
() => props.visible,
|
|
641
716
|
(val) => {
|
|
@@ -689,6 +764,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
689
764
|
selected: selected.value,
|
|
690
765
|
"onUpdate:selected": _cache[1] || (_cache[1] = ($event) => selected.value = $event),
|
|
691
766
|
limit: _ctx.limit,
|
|
767
|
+
"load-data": onLoadData,
|
|
692
768
|
onFetchList: fetch
|
|
693
769
|
}, null, 8, ["selected", "limit"])) : (openBlock(), createBlock(multipleCmp, {
|
|
694
770
|
key: 2,
|
|
@@ -25,6 +25,10 @@ export declare const selectProps: {
|
|
|
25
25
|
type: FunctionConstructor;
|
|
26
26
|
default: () => Promise<never[]>;
|
|
27
27
|
};
|
|
28
|
+
lazyload: {
|
|
29
|
+
type: FunctionConstructor;
|
|
30
|
+
default: () => Promise<never[]>;
|
|
31
|
+
};
|
|
28
32
|
select: {
|
|
29
33
|
type: ArrayConstructor;
|
|
30
34
|
defualt: () => never[];
|
|
@@ -7,7 +7,12 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
7
7
|
type: ArrayConstructor;
|
|
8
8
|
default: () => never[];
|
|
9
9
|
};
|
|
10
|
+
loadData: {
|
|
11
|
+
type: FunctionConstructor;
|
|
12
|
+
default: () => Promise<never[]>;
|
|
13
|
+
};
|
|
10
14
|
}, {
|
|
15
|
+
realLoadData: (treeNode: any) => any;
|
|
11
16
|
search(): void;
|
|
12
17
|
treeRef: import("vue").Ref<any>;
|
|
13
18
|
list: any;
|
|
@@ -36,10 +41,15 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
36
41
|
type: ArrayConstructor;
|
|
37
42
|
default: () => never[];
|
|
38
43
|
};
|
|
44
|
+
loadData: {
|
|
45
|
+
type: FunctionConstructor;
|
|
46
|
+
default: () => Promise<never[]>;
|
|
47
|
+
};
|
|
39
48
|
}>> & {
|
|
40
49
|
"onUpdate:selected"?: ((...args: any[]) => any) | undefined;
|
|
41
50
|
onFetchList?: ((...args: any[]) => any) | undefined;
|
|
42
51
|
}, {
|
|
52
|
+
loadData: Function;
|
|
43
53
|
selected: unknown[];
|
|
44
54
|
limit: number;
|
|
45
55
|
}>;
|