bm-admin-ui 1.2.52-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
|
@@ -19,6 +19,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
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 _default: import("vue").DefineComponent<{
|
|
|
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 _default: import("vue").DefineComponent<{
|
|
|
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 _default: import("vue").DefineComponent<{
|
|
|
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 _default: import("vue").DefineComponent<{
|
|
|
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 _default: import("vue").DefineComponent<{
|
|
|
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 _default: import("vue").DefineComponent<{
|
|
|
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
|
}>;
|
|
@@ -14,71 +14,71 @@ var _export_sfc = (sfc, props) => {
|
|
|
14
14
|
return target;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
const _sfc_main = vue.defineComponent({
|
|
18
|
-
name: 'BmCascader',
|
|
19
|
-
components: { DownOutlined: iconsVue.DownOutlined },
|
|
20
|
-
props: {
|
|
21
|
-
tipType: {
|
|
22
|
-
type: String,
|
|
23
|
-
default: () => {
|
|
24
|
-
return 'none'
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
width: {
|
|
28
|
-
type: Number,
|
|
29
|
-
default: () => {
|
|
30
|
-
return 200
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
setup(props, { emit, attrs }) {
|
|
35
|
-
const nameArr = (arr) => {
|
|
36
|
-
return arr.reduce(
|
|
37
|
-
(acc, cur) => acc.concat(Array.isArray(cur) ? nameArr(cur) : cur),
|
|
38
|
-
[]
|
|
39
|
-
)
|
|
40
|
-
};
|
|
41
|
-
const state = vue.reactive({
|
|
42
|
-
labelNameList: '',
|
|
43
|
-
visible: false,
|
|
44
|
-
});
|
|
45
|
-
const methods = {
|
|
46
|
-
onmouseover() {
|
|
47
|
-
state.labelNameList.length && (state.visible = true);
|
|
48
|
-
},
|
|
49
|
-
onmouseout() {
|
|
50
|
-
state.labelNameList.length && (state.visible = false);
|
|
51
|
-
},
|
|
52
|
-
onchange(value, selectedOptions) {
|
|
53
|
-
if (attrs.multiple === '' || attrs.multiple) {
|
|
54
|
-
let res = selectedOptions.map((v, k) => {
|
|
55
|
-
return v.map((e, i) => {
|
|
56
|
-
return e.label
|
|
57
|
-
})
|
|
58
|
-
});
|
|
59
|
-
state.labelNameList = nameArr(res).join(',');
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
vue.watch(
|
|
64
|
-
() => state.labelNameList.length,
|
|
65
|
-
(val) => {
|
|
66
|
-
if (!val) {
|
|
67
|
-
state.visible = false;
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
{ deep: true }
|
|
71
|
-
);
|
|
72
|
-
vue.onMounted(() => {
|
|
73
|
-
attrs.value?.length &&
|
|
74
|
-
(state.labelNameList = nameArr(attrs.value).join(','));
|
|
75
|
-
});
|
|
76
|
-
return {
|
|
77
|
-
...vue.toRefs(state),
|
|
78
|
-
...methods,
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
});
|
|
17
|
+
const _sfc_main = vue.defineComponent({
|
|
18
|
+
name: 'BmCascader',
|
|
19
|
+
components: { DownOutlined: iconsVue.DownOutlined },
|
|
20
|
+
props: {
|
|
21
|
+
tipType: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: () => {
|
|
24
|
+
return 'none'
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
width: {
|
|
28
|
+
type: Number,
|
|
29
|
+
default: () => {
|
|
30
|
+
return 200
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
setup(props, { emit, attrs }) {
|
|
35
|
+
const nameArr = (arr) => {
|
|
36
|
+
return arr.reduce(
|
|
37
|
+
(acc, cur) => acc.concat(Array.isArray(cur) ? nameArr(cur) : cur),
|
|
38
|
+
[]
|
|
39
|
+
)
|
|
40
|
+
};
|
|
41
|
+
const state = vue.reactive({
|
|
42
|
+
labelNameList: '',
|
|
43
|
+
visible: false,
|
|
44
|
+
});
|
|
45
|
+
const methods = {
|
|
46
|
+
onmouseover() {
|
|
47
|
+
state.labelNameList.length && (state.visible = true);
|
|
48
|
+
},
|
|
49
|
+
onmouseout() {
|
|
50
|
+
state.labelNameList.length && (state.visible = false);
|
|
51
|
+
},
|
|
52
|
+
onchange(value, selectedOptions) {
|
|
53
|
+
if (attrs.multiple === '' || attrs.multiple) {
|
|
54
|
+
let res = selectedOptions.map((v, k) => {
|
|
55
|
+
return v.map((e, i) => {
|
|
56
|
+
return e.label
|
|
57
|
+
})
|
|
58
|
+
});
|
|
59
|
+
state.labelNameList = nameArr(res).join(',');
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
vue.watch(
|
|
64
|
+
() => state.labelNameList.length,
|
|
65
|
+
(val) => {
|
|
66
|
+
if (!val) {
|
|
67
|
+
state.visible = false;
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
{ deep: true }
|
|
71
|
+
);
|
|
72
|
+
vue.onMounted(() => {
|
|
73
|
+
attrs.value?.length &&
|
|
74
|
+
(state.labelNameList = nameArr(attrs.value).join(','));
|
|
75
|
+
});
|
|
76
|
+
return {
|
|
77
|
+
...vue.toRefs(state),
|
|
78
|
+
...methods,
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
82
|
|
|
83
83
|
const _hoisted_1 = {
|
|
84
84
|
ref: "BmCascader",
|
|
@@ -99,18 +99,18 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
99
99
|
? (vue.openBlock(), vue.createBlock(_component_a_popover, {
|
|
100
100
|
key: 0,
|
|
101
101
|
visible: _ctx.visible,
|
|
102
|
-
"get-popup-container":
|
|
103
|
-
(triggerNode) => {
|
|
104
|
-
return triggerNode.parentNode
|
|
105
|
-
}
|
|
102
|
+
"get-popup-container":
|
|
103
|
+
(triggerNode) => {
|
|
104
|
+
return triggerNode.parentNode
|
|
105
|
+
}
|
|
106
106
|
|
|
107
107
|
}, vue.createSlots({
|
|
108
108
|
default: vue.withCtx(() => [
|
|
109
109
|
vue.createVNode(_component_a_cascader, vue.mergeProps(_ctx.$attrs, {
|
|
110
|
-
style: {
|
|
111
|
-
width:
|
|
112
|
-
_ctx.$attrs.multiple === '' || _ctx.$attrs.multiple ? _ctx.width + 'px' : 'auto',
|
|
113
|
-
minWidth: _ctx.width + 'px',
|
|
110
|
+
style: {
|
|
111
|
+
width:
|
|
112
|
+
_ctx.$attrs.multiple === '' || _ctx.$attrs.multiple ? _ctx.width + 'px' : 'auto',
|
|
113
|
+
minWidth: _ctx.width + 'px',
|
|
114
114
|
},
|
|
115
115
|
"show-arrow": true,
|
|
116
116
|
onMouseover: _ctx.onmouseover,
|
|
@@ -163,10 +163,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
163
163
|
}, vue.createSlots({
|
|
164
164
|
default: vue.withCtx(() => [
|
|
165
165
|
vue.createVNode(_component_a_cascader, vue.mergeProps(_ctx.$attrs, {
|
|
166
|
-
style: {
|
|
167
|
-
width:
|
|
168
|
-
_ctx.$attrs.multiple === '' || _ctx.$attrs.multiple ? _ctx.width + 'px' : 'auto',
|
|
169
|
-
minWidth: _ctx.width + 'px',
|
|
166
|
+
style: {
|
|
167
|
+
width:
|
|
168
|
+
_ctx.$attrs.multiple === '' || _ctx.$attrs.multiple ? _ctx.width + 'px' : 'auto',
|
|
169
|
+
minWidth: _ctx.width + 'px',
|
|
170
170
|
},
|
|
171
171
|
"show-arrow": true,
|
|
172
172
|
onMouseover: _ctx.onmouseover,
|
|
@@ -1078,7 +1078,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
1078
1078
|
vue.createVNode(vue.unref(BmOverTooltips__default["default"]), {
|
|
1079
1079
|
title: vue.unref(getShowValue)(item) || tmpForm.value[item.prop]
|
|
1080
1080
|
}, null, 8, ["title"]),
|
|
1081
|
-
vue.createCommentVNode(' <AutoTooltip\n :tooltip="getShowValue(item) || tmpForm[item.prop]"\n /> ')
|
|
1081
|
+
vue.createCommentVNode(' <AutoTooltip\r\n :tooltip="getShowValue(item) || tmpForm[item.prop]"\r\n /> ')
|
|
1082
1082
|
], 6)) : vue.createCommentVNode("v-if", true),
|
|
1083
1083
|
item.type === "multiText" ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
1084
1084
|
key: 15,
|
|
@@ -287,7 +287,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
287
287
|
vue.createElementVNode("span", {
|
|
288
288
|
class: vue.normalizeClass(["opeator", { active: __props.isCustom }])
|
|
289
289
|
}, [
|
|
290
|
-
vue.createCommentVNode(' <CopyOutlined\n @click.stop="\n () => {\n copyCallback()\n }\n " /> \u6682\u65F6\u5173\u95ED\u590D\u5236\u8282\u70B9 '),
|
|
290
|
+
vue.createCommentVNode(' <CopyOutlined\r\n @click.stop="\r\n () => {\r\n copyCallback()\r\n }\r\n " /> \u6682\u65F6\u5173\u95ED\u590D\u5236\u8282\u70B9 '),
|
|
291
291
|
vue.createVNode(vue.unref(iconsVue.CloseOutlined), {
|
|
292
292
|
onClick: _cache[0] || (_cache[0] = vue.withModifiers(
|
|
293
293
|
() => {
|
|
@@ -892,6 +892,7 @@ const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
|
|
|
892
892
|
"placeholder",
|
|
893
893
|
"defaultSelected",
|
|
894
894
|
"load",
|
|
895
|
+
"lazyload",
|
|
895
896
|
"disabled",
|
|
896
897
|
"fieldNames",
|
|
897
898
|
"immediateFetch",
|
|
@@ -942,11 +943,12 @@ const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
|
|
|
942
943
|
title: __props.title,
|
|
943
944
|
mode: __props.mode,
|
|
944
945
|
load: __props.load,
|
|
946
|
+
lazyload: __props.lazyload,
|
|
945
947
|
limit: __props.limit,
|
|
946
948
|
"immediate-fetch": __props.immediateFetch,
|
|
947
949
|
centered: _ctx.$props.centered,
|
|
948
950
|
"onUpdate:select": selectedChange
|
|
949
|
-
}, null, 8, ["visible", "select", "title", "mode", "load", "limit", "immediate-fetch", "centered"])
|
|
951
|
+
}, null, 8, ["visible", "select", "title", "mode", "load", "lazyload", "limit", "immediate-fetch", "centered"])
|
|
950
952
|
]);
|
|
951
953
|
};
|
|
952
954
|
}
|
|
@@ -18790,7 +18792,7 @@ const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
|
|
|
18790
18792
|
debounceFetch("");
|
|
18791
18793
|
return (_ctx, _cache) => {
|
|
18792
18794
|
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
18793
|
-
vue.createCommentVNode(' <Input\n v-model:value="inputValue"\n placeholder="\u8BF7\u8F93\u5165"\n :disabled="disabled"\n @change="debounceFn($event.target.value)"\n ></Input> '),
|
|
18795
|
+
vue.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> '),
|
|
18794
18796
|
vue.createVNode(vue.unref(antDesignVue.Select), {
|
|
18795
18797
|
value: __props.value,
|
|
18796
18798
|
placeholder: "\u8BF7\u9009\u62E9",
|
|
@@ -29450,9 +29452,14 @@ var department = {
|
|
|
29450
29452
|
unitStr: '个',
|
|
29451
29453
|
defaultSelected: data.value,
|
|
29452
29454
|
centered: true,
|
|
29453
|
-
|
|
29455
|
+
lazyload(_, params, list) {
|
|
29454
29456
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29455
|
-
return yield extraConfig.department.
|
|
29457
|
+
return yield extraConfig.department.lazyload(params, list);
|
|
29458
|
+
});
|
|
29459
|
+
},
|
|
29460
|
+
load(_, params) {
|
|
29461
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29462
|
+
return yield extraConfig.department.fetch(params);
|
|
29456
29463
|
});
|
|
29457
29464
|
},
|
|
29458
29465
|
fieldNames: (_a = extraConfig.department) === null || _a === void 0 ? void 0 : _a.fieldNames,
|
|
@@ -29499,9 +29506,14 @@ var department = {
|
|
|
29499
29506
|
unitStr: '个',
|
|
29500
29507
|
defaultSelected: data.value,
|
|
29501
29508
|
centered: true,
|
|
29502
|
-
|
|
29509
|
+
lazyload(_, params, list) {
|
|
29503
29510
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29504
|
-
return yield extraConfig.department.
|
|
29511
|
+
return yield extraConfig.department.lazyload(params, list);
|
|
29512
|
+
});
|
|
29513
|
+
},
|
|
29514
|
+
load(_, params) {
|
|
29515
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29516
|
+
return yield extraConfig.department.fetch(params);
|
|
29505
29517
|
});
|
|
29506
29518
|
},
|
|
29507
29519
|
fieldNames: (_a = extraConfig.department) === null || _a === void 0 ? void 0 : _a.fieldNames,
|
|
@@ -29553,6 +29565,11 @@ var department = {
|
|
|
29553
29565
|
row[field] = value;
|
|
29554
29566
|
},
|
|
29555
29567
|
defaultSelected: row[field],
|
|
29568
|
+
lazyload(params, list) {
|
|
29569
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29570
|
+
return yield extraConfig.department.lazyload(params, list);
|
|
29571
|
+
});
|
|
29572
|
+
},
|
|
29556
29573
|
load(params) {
|
|
29557
29574
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29558
29575
|
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
|
}>>;
|
|
@@ -36,6 +36,12 @@ const selectProps = {
|
|
|
36
36
|
return Promise.resolve([]);
|
|
37
37
|
},
|
|
38
38
|
},
|
|
39
|
+
lazyload: {
|
|
40
|
+
type: Function,
|
|
41
|
+
default: () => {
|
|
42
|
+
return Promise.resolve([]);
|
|
43
|
+
},
|
|
44
|
+
},
|
|
39
45
|
select: {
|
|
40
46
|
type: Array || Object,
|
|
41
47
|
defualt: () => [],
|
|
@@ -365,10 +371,17 @@ const _sfc_main$1 = vue.defineComponent({
|
|
|
365
371
|
selected: {
|
|
366
372
|
type: Array,
|
|
367
373
|
default: () => []
|
|
374
|
+
},
|
|
375
|
+
loadData: {
|
|
376
|
+
type: Function,
|
|
377
|
+
default: () => {
|
|
378
|
+
return Promise.resolve([]);
|
|
379
|
+
}
|
|
368
380
|
}
|
|
369
381
|
},
|
|
370
382
|
emits: ["fetchList", "update:selected"],
|
|
371
383
|
setup(props, { emit }) {
|
|
384
|
+
const allListData = vue.ref([]);
|
|
372
385
|
const treeRef = vue.ref();
|
|
373
386
|
const state = vue.reactive({
|
|
374
387
|
searchVal: "",
|
|
@@ -380,41 +393,102 @@ const _sfc_main$1 = vue.defineComponent({
|
|
|
380
393
|
const methods = {
|
|
381
394
|
search() {
|
|
382
395
|
let data = state.searchVal ? { searchVal: state.searchVal } : { searchVal: "" };
|
|
383
|
-
emit("fetchList",
|
|
396
|
+
emit("fetchList", {
|
|
397
|
+
...data,
|
|
398
|
+
area: "department"
|
|
399
|
+
});
|
|
384
400
|
}
|
|
385
401
|
};
|
|
402
|
+
function treeDataToMap(treeData, oldMap, oldSet) {
|
|
403
|
+
const nodeMap = /* @__PURE__ */ new Map();
|
|
404
|
+
const nodeSet = /* @__PURE__ */ new Set();
|
|
405
|
+
function traverseNode(node) {
|
|
406
|
+
if (typeof node === "object" && node !== null && node["id"] !== void 0) {
|
|
407
|
+
nodeMap.set(node["id"], node);
|
|
408
|
+
nodeSet.add(node["id"]);
|
|
409
|
+
} else {
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
if (Array.isArray(node["children"])) {
|
|
413
|
+
node["children"].forEach((childNode) => traverseNode(childNode));
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
if (Array.isArray(treeData)) {
|
|
417
|
+
treeData.forEach((rootNode) => traverseNode(rootNode));
|
|
418
|
+
} else {
|
|
419
|
+
traverseNode(treeData);
|
|
420
|
+
}
|
|
421
|
+
if (oldMap) {
|
|
422
|
+
nodeMap.forEach((node, id) => {
|
|
423
|
+
oldMap.set(id, node);
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
if (oldSet) {
|
|
427
|
+
nodeSet.forEach((node, id) => {
|
|
428
|
+
oldSet.add(id);
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
return {
|
|
432
|
+
nodeMap,
|
|
433
|
+
nodeSet
|
|
434
|
+
};
|
|
435
|
+
}
|
|
386
436
|
function changeTreeCheck(checkedKeys) {
|
|
387
|
-
|
|
388
|
-
let
|
|
437
|
+
console.log("checkedKeys:", checkedKeys, allListData.value);
|
|
438
|
+
let flatMap = treeDataToMap(
|
|
439
|
+
allListData.value,
|
|
440
|
+
selectState.dataMap,
|
|
441
|
+
null
|
|
442
|
+
).nodeMap;
|
|
443
|
+
selectState.dataMap.forEach((node, id) => {
|
|
444
|
+
flatMap.set(id, node);
|
|
445
|
+
});
|
|
446
|
+
selectState.dataMap = flatMap;
|
|
447
|
+
flatMap.forEach((node, id) => {
|
|
448
|
+
selectState.dataMap.set(id, node);
|
|
449
|
+
});
|
|
450
|
+
let curlistKeys = treeDataToMap(
|
|
451
|
+
allListData.value,
|
|
452
|
+
null,
|
|
453
|
+
selectState.curlistKeys
|
|
454
|
+
).nodeSet;
|
|
389
455
|
let hadselected = new Set(selectState.multipDepartment);
|
|
390
456
|
let curselect = new Set(checkedKeys);
|
|
391
|
-
console.log(hadselected, curselect);
|
|
392
457
|
for (let key of hadselected) {
|
|
393
|
-
if (curlistKeys.has(key) && (!curselect.has(key) || curselect.has(key) && curselect.has(flatMap.get(key)["parent"]))) {
|
|
458
|
+
if (curlistKeys.has(String(key)) && (!curselect.has(String(key)) || curselect.has(String(key)) && curselect.has(flatMap.get(String(key))["parent"]))) {
|
|
394
459
|
hadselected.delete(key);
|
|
395
460
|
}
|
|
396
461
|
}
|
|
397
462
|
for (let key of curselect) {
|
|
398
|
-
let obj = flatMap.get(key);
|
|
463
|
+
let obj = flatMap.get(String(key));
|
|
399
464
|
if (obj && !curselect.has(obj["parent"])) {
|
|
400
|
-
hadselected.add(key);
|
|
465
|
+
hadselected.add(String(key));
|
|
401
466
|
}
|
|
402
467
|
}
|
|
403
|
-
let arr = Array.from(hadselected) || [];
|
|
404
|
-
if (props.limit && props.limit > 0 && arr.length > props.limit) {
|
|
405
|
-
antDesignVue.message.error("\u52FE\u9009\u540E\u5C06\u8D85\u8FC7\u4EBA\u5458\u9650\u5236");
|
|
406
|
-
return;
|
|
407
|
-
}
|
|
408
468
|
selectState.multipDepartment = Array.from(hadselected) || [];
|
|
409
|
-
console.log(selectState.multipDepartment);
|
|
469
|
+
console.log("multipDepartment:", selectState.multipDepartment);
|
|
410
470
|
}
|
|
471
|
+
const realLoadData = (treeNode) => {
|
|
472
|
+
if (!props.loadData)
|
|
473
|
+
return Promise.resolve([]);
|
|
474
|
+
return props.loadData(treeNode, list);
|
|
475
|
+
};
|
|
476
|
+
vue.watch(
|
|
477
|
+
() => list.value,
|
|
478
|
+
(newVal) => {
|
|
479
|
+
if (newVal && newVal.length) {
|
|
480
|
+
allListData.value = [...allListData.value, ...newVal];
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
);
|
|
411
484
|
return {
|
|
412
485
|
changeTreeCheck,
|
|
413
486
|
...vue.toRefs(state),
|
|
414
487
|
...vue.toRefs(selectState),
|
|
415
488
|
treeRef,
|
|
416
489
|
list,
|
|
417
|
-
...methods
|
|
490
|
+
...methods,
|
|
491
|
+
realLoadData
|
|
418
492
|
};
|
|
419
493
|
}
|
|
420
494
|
});
|
|
@@ -445,19 +519,20 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
445
519
|
value: _ctx.searchVal,
|
|
446
520
|
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => _ctx.searchVal = $event),
|
|
447
521
|
placeholder: "\u8BF7\u8F93\u5165\u90E8\u95E8\u540D\u79F0",
|
|
448
|
-
|
|
522
|
+
onInput: _ctx.search
|
|
449
523
|
}, {
|
|
450
524
|
suffix: vue.withCtx(() => [
|
|
451
525
|
vue.createVNode(_component_search_outlined, { style: { color: "#9393A3" } })
|
|
452
526
|
]),
|
|
453
527
|
_: 1
|
|
454
|
-
}, 8, ["value", "
|
|
528
|
+
}, 8, ["value", "onInput"]),
|
|
455
529
|
vue.createElementVNode("div", _hoisted_4$1, [
|
|
456
530
|
vue.createVNode(_component_ATree, {
|
|
457
531
|
ref: "treeRef",
|
|
458
532
|
"checked-keys": _ctx.multipDepartment,
|
|
459
533
|
checkable: "",
|
|
460
534
|
"tree-data": _ctx.list,
|
|
535
|
+
"load-data": _ctx.realLoadData,
|
|
461
536
|
onCheck: _ctx.changeTreeCheck
|
|
462
537
|
}, {
|
|
463
538
|
title: vue.withCtx(({ title, key, description }) => [
|
|
@@ -467,7 +542,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
467
542
|
])
|
|
468
543
|
]),
|
|
469
544
|
_: 1
|
|
470
|
-
}, 8, ["checked-keys", "tree-data", "onCheck"]),
|
|
545
|
+
}, 8, ["checked-keys", "tree-data", "load-data", "onCheck"]),
|
|
471
546
|
_ctx.list && !_ctx.list.length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7, [
|
|
472
547
|
vue.createVNode(_component_Empty, { image: _ctx.emptyPic }, {
|
|
473
548
|
description: vue.withCtx(() => [
|
|
@@ -534,26 +609,20 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
534
609
|
list.value = [];
|
|
535
610
|
selectState.searched = !!params?.searchVal;
|
|
536
611
|
let isDepartTree = props.mode === MODE.DEPARTMENT;
|
|
537
|
-
if (isDepartTree) {
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
queues.push(...node.children);
|
|
552
|
-
}
|
|
553
|
-
list.value = result;
|
|
554
|
-
} else {
|
|
555
|
-
list.value = departNative.value;
|
|
556
|
-
}
|
|
612
|
+
if (params.area === "department" || isDepartTree) {
|
|
613
|
+
props.load({
|
|
614
|
+
departmentName: params.searchVal
|
|
615
|
+
}).then((data) => {
|
|
616
|
+
list.value = data?.map((x) => ({
|
|
617
|
+
...x,
|
|
618
|
+
title: x.name,
|
|
619
|
+
isLeaf: !x.isExistChild,
|
|
620
|
+
key: x.id,
|
|
621
|
+
parent: { key: x.id + Date.now() }
|
|
622
|
+
}));
|
|
623
|
+
departNative.value = data;
|
|
624
|
+
});
|
|
625
|
+
selectState.dataMap = flatListFunc(list.value);
|
|
557
626
|
return;
|
|
558
627
|
}
|
|
559
628
|
if (params.searchVal) {
|
|
@@ -640,6 +709,12 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
640
709
|
index > -1 && selectState.multipDepartment.splice(index, 1);
|
|
641
710
|
}
|
|
642
711
|
}
|
|
712
|
+
function onLoadData(treeNode, list2) {
|
|
713
|
+
if (props.lazyload) {
|
|
714
|
+
return props.lazyload(treeNode, list2);
|
|
715
|
+
}
|
|
716
|
+
return Promise.resolve([]);
|
|
717
|
+
}
|
|
643
718
|
vue.watch(
|
|
644
719
|
() => props.visible,
|
|
645
720
|
(val) => {
|
|
@@ -693,6 +768,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
693
768
|
selected: selected.value,
|
|
694
769
|
"onUpdate:selected": _cache[1] || (_cache[1] = ($event) => selected.value = $event),
|
|
695
770
|
limit: _ctx.limit,
|
|
771
|
+
"load-data": onLoadData,
|
|
696
772
|
onFetchList: fetch
|
|
697
773
|
}, null, 8, ["selected", "limit"])) : (vue.openBlock(), vue.createBlock(multipleCmp, {
|
|
698
774
|
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[];
|