bm-admin-ui 1.2.52-alpha → 1.2.54-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.
@@ -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 " />&nbsp;\u6682\u65F6\u5173\u95ED\u590D\u5236\u8282\u70B9 '),
279
+ createCommentVNode(' <CopyOutlined\r\n @click.stop="\r\n () => {\r\n copyCallback()\r\n }\r\n " />&nbsp;\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
- load() {
29441
+ lazyload(_, params, list) {
29440
29442
  return __awaiter(this, void 0, void 0, function* () {
29441
- return yield extraConfig.department.fetch();
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
- load() {
29495
+ lazyload(_, params, list) {
29489
29496
  return __awaiter(this, void 0, void 0, function* () {
29490
- return yield extraConfig.department.fetch();
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,13 @@ 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;
990
+ showTree: import("vue").Ref<boolean>;
976
991
  search(): void;
977
992
  treeRef: import("vue").Ref<any>;
978
993
  list: any;
@@ -1001,10 +1016,15 @@ declare const BmStaffsSelector: import("bm-admin-ui/es/utils/with-install").SFCW
1001
1016
  type: ArrayConstructor;
1002
1017
  default: () => never[];
1003
1018
  };
1019
+ loadData: {
1020
+ type: FunctionConstructor;
1021
+ default: () => Promise<never[]>;
1022
+ };
1004
1023
  }>> & {
1005
1024
  "onUpdate:selected"?: ((...args: any[]) => any) | undefined;
1006
1025
  onFetchList?: ((...args: any[]) => any) | undefined;
1007
1026
  }, {
1027
+ loadData: Function;
1008
1028
  selected: unknown[];
1009
1029
  limit: number;
1010
1030
  }>;
@@ -1030,6 +1050,10 @@ declare const BmStaffsSelector: import("bm-admin-ui/es/utils/with-install").SFCW
1030
1050
  type: FunctionConstructor;
1031
1051
  default: () => Promise<never[]>;
1032
1052
  };
1053
+ lazyload: {
1054
+ type: FunctionConstructor;
1055
+ default: () => Promise<never[]>;
1056
+ };
1033
1057
  select: {
1034
1058
  type: ArrayConstructor;
1035
1059
  defualt: () => never[];
@@ -1067,6 +1091,7 @@ declare const BmStaffsSelector: import("bm-admin-ui/es/utils/with-install").SFCW
1067
1091
  unitStr: string;
1068
1092
  limit: number;
1069
1093
  load: Function;
1094
+ lazyload: Function;
1070
1095
  forceStatic: boolean;
1071
1096
  immediateFetch: boolean;
1072
1097
  }>>;
@@ -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, message, Modal } from 'ant-design-vue';
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: "",
@@ -373,51 +386,126 @@ const _sfc_main$1 = defineComponent({
373
386
  emptyPic: Empty.PRESENTED_IMAGE_SIMPLE,
374
387
  isFulfill: false
375
388
  });
389
+ const showTree = ref(true);
390
+ let treeTimeout = null;
376
391
  const methods = {
377
392
  search() {
378
393
  let data = state.searchVal ? { searchVal: state.searchVal } : { searchVal: "" };
379
- emit("fetchList", data);
394
+ if (!state.searchVal) {
395
+ showTree.value = false;
396
+ if (treeTimeout)
397
+ clearTimeout(treeTimeout);
398
+ treeTimeout = setTimeout(() => {
399
+ showTree.value = true;
400
+ });
401
+ }
402
+ emit("fetchList", {
403
+ ...data,
404
+ area: "department"
405
+ });
380
406
  }
381
407
  };
408
+ function treeDataToMap(treeData, oldMap, oldSet) {
409
+ const nodeMap = /* @__PURE__ */ new Map();
410
+ const nodeSet = /* @__PURE__ */ new Set();
411
+ function traverseNode(node) {
412
+ if (typeof node === "object" && node !== null && node["id"] !== void 0) {
413
+ nodeMap.set(node["id"], node);
414
+ nodeSet.add(node["id"]);
415
+ } else {
416
+ return;
417
+ }
418
+ if (Array.isArray(node["children"])) {
419
+ node["children"].forEach((childNode) => traverseNode(childNode));
420
+ }
421
+ }
422
+ if (Array.isArray(treeData)) {
423
+ treeData.forEach((rootNode) => traverseNode(rootNode));
424
+ } else {
425
+ traverseNode(treeData);
426
+ }
427
+ if (oldMap) {
428
+ nodeMap.forEach((node, id) => {
429
+ oldMap.set(id, node);
430
+ });
431
+ }
432
+ if (oldSet) {
433
+ nodeSet.forEach((node, id) => {
434
+ oldSet.add(id);
435
+ });
436
+ }
437
+ return {
438
+ nodeMap,
439
+ nodeSet
440
+ };
441
+ }
382
442
  function changeTreeCheck(checkedKeys) {
383
- let flatMap = selectState.dataMap;
384
- let curlistKeys = selectState.curlistKeys;
443
+ console.log("checkedKeys:", checkedKeys, allListData.value);
444
+ let flatMap = treeDataToMap(
445
+ allListData.value,
446
+ selectState.dataMap,
447
+ null
448
+ ).nodeMap;
449
+ selectState.dataMap.forEach((node, id) => {
450
+ flatMap.set(id, node);
451
+ });
452
+ selectState.dataMap = flatMap;
453
+ flatMap.forEach((node, id) => {
454
+ selectState.dataMap.set(id, node);
455
+ });
456
+ let curlistKeys = treeDataToMap(
457
+ allListData.value,
458
+ null,
459
+ selectState.curlistKeys
460
+ ).nodeSet;
385
461
  let hadselected = new Set(selectState.multipDepartment);
386
462
  let curselect = new Set(checkedKeys);
387
- console.log(hadselected, curselect);
388
463
  for (let key of hadselected) {
389
- if (curlistKeys.has(key) && (!curselect.has(key) || curselect.has(key) && curselect.has(flatMap.get(key)["parent"]))) {
464
+ if (curlistKeys.has(String(key)) && (!curselect.has(String(key)) || curselect.has(String(key)) && curselect.has(flatMap.get(String(key))["parent"]))) {
390
465
  hadselected.delete(key);
391
466
  }
392
467
  }
393
468
  for (let key of curselect) {
394
- let obj = flatMap.get(key);
469
+ let obj = flatMap.get(String(key));
395
470
  if (obj && !curselect.has(obj["parent"])) {
396
- hadselected.add(key);
471
+ hadselected.add(String(key));
397
472
  }
398
473
  }
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
474
  selectState.multipDepartment = Array.from(hadselected) || [];
405
- console.log(selectState.multipDepartment);
475
+ console.log("multipDepartment:", selectState.multipDepartment);
406
476
  }
477
+ const realLoadData = (treeNode) => {
478
+ if (!props.loadData)
479
+ return Promise.resolve([]);
480
+ return props.loadData(treeNode, list);
481
+ };
482
+ watch(
483
+ () => list.value,
484
+ (newVal) => {
485
+ if (newVal && newVal.length) {
486
+ allListData.value = [...allListData.value, ...newVal];
487
+ }
488
+ }
489
+ );
407
490
  return {
408
491
  changeTreeCheck,
409
492
  ...toRefs(state),
410
493
  ...toRefs(selectState),
411
494
  treeRef,
412
495
  list,
413
- ...methods
496
+ ...methods,
497
+ realLoadData,
498
+ showTree
414
499
  };
415
500
  }
416
501
  });
417
502
  const _hoisted_1$1 = { class: "multiple-selector" };
418
503
  const _hoisted_2$1 = { class: "__selector-modal-panel" };
419
504
  const _hoisted_3$1 = { class: "__search-panel" };
420
- const _hoisted_4$1 = { class: "__selector-modal-options" };
505
+ const _hoisted_4$1 = {
506
+ key: 0,
507
+ class: "__selector-modal-options"
508
+ };
421
509
  const _hoisted_5$1 = { class: "department-option-item" };
422
510
  const _hoisted_6$1 = {
423
511
  key: 0,
@@ -441,29 +529,30 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
441
529
  value: _ctx.searchVal,
442
530
  "onUpdate:value": _cache[0] || (_cache[0] = ($event) => _ctx.searchVal = $event),
443
531
  placeholder: "\u8BF7\u8F93\u5165\u90E8\u95E8\u540D\u79F0",
444
- onBlur: _ctx.search
532
+ onInput: _ctx.search
445
533
  }, {
446
534
  suffix: withCtx(() => [
447
535
  createVNode(_component_search_outlined, { style: { color: "#9393A3" } })
448
536
  ]),
449
537
  _: 1
450
- }, 8, ["value", "onBlur"]),
451
- createElementVNode("div", _hoisted_4$1, [
538
+ }, 8, ["value", "onInput"]),
539
+ _ctx.showTree ? (openBlock(), createElementBlock("div", _hoisted_4$1, [
452
540
  createVNode(_component_ATree, {
453
541
  ref: "treeRef",
454
542
  "checked-keys": _ctx.multipDepartment,
455
543
  checkable: "",
456
544
  "tree-data": _ctx.list,
545
+ "load-data": _ctx.realLoadData,
457
546
  onCheck: _ctx.changeTreeCheck
458
547
  }, {
459
- title: withCtx(({ title, key, description }) => [
548
+ title: withCtx(({ title, description }) => [
460
549
  createElementVNode("div", _hoisted_5$1, [
461
- createElementVNode("span", null, toDisplayString(title) + toDisplayString(key ? `(${key})` : ""), 1),
550
+ createElementVNode("span", null, toDisplayString(title), 1),
462
551
  description ? (openBlock(), createElementBlock("p", _hoisted_6$1, toDisplayString(description), 1)) : createCommentVNode("v-if", true)
463
552
  ])
464
553
  ]),
465
554
  _: 1
466
- }, 8, ["checked-keys", "tree-data", "onCheck"]),
555
+ }, 8, ["checked-keys", "tree-data", "load-data", "onCheck"]),
467
556
  _ctx.list && !_ctx.list.length ? (openBlock(), createElementBlock("div", _hoisted_7, [
468
557
  createVNode(_component_Empty, { image: _ctx.emptyPic }, {
469
558
  description: withCtx(() => [
@@ -472,7 +561,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
472
561
  _: 1
473
562
  }, 8, ["image"])
474
563
  ])) : createCommentVNode("v-if", true)
475
- ])
564
+ ])) : createCommentVNode("v-if", true)
476
565
  ])
477
566
  ])
478
567
  ]);
@@ -530,26 +619,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
530
619
  list.value = [];
531
620
  selectState.searched = !!params?.searchVal;
532
621
  let isDepartTree = props.mode === MODE.DEPARTMENT;
533
- if (isDepartTree) {
534
- if (!departNative.value.length) {
535
- departNative.value = await props.load(params);
536
- selectState.dataMap = flatListFunc([...departNative.value]);
537
- }
538
- if (params.searchVal) {
539
- let result = [];
540
- let queues = [...departNative.value];
541
- while (queues.length) {
542
- let node = queues.shift();
543
- if (node["title"] && node["title"].includes(params?.searchVal || "")) {
544
- result.push({ ...node });
545
- }
546
- if (node.children)
547
- queues.push(...node.children);
548
- }
549
- list.value = result;
550
- } else {
551
- list.value = departNative.value;
552
- }
622
+ if (params.area === "department" || isDepartTree) {
623
+ props.load({
624
+ departmentName: params.searchVal
625
+ }).then((data) => {
626
+ list.value = data;
627
+ departNative.value = data;
628
+ });
629
+ selectState.dataMap = flatListFunc(list.value);
553
630
  return;
554
631
  }
555
632
  if (params.searchVal) {
@@ -636,6 +713,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
636
713
  index > -1 && selectState.multipDepartment.splice(index, 1);
637
714
  }
638
715
  }
716
+ function onLoadData(treeNode, list2) {
717
+ if (props.lazyload) {
718
+ return props.lazyload(treeNode, list2);
719
+ }
720
+ return Promise.resolve([]);
721
+ }
639
722
  watch(
640
723
  () => props.visible,
641
724
  (val) => {
@@ -689,6 +772,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
689
772
  selected: selected.value,
690
773
  "onUpdate:selected": _cache[1] || (_cache[1] = ($event) => selected.value = $event),
691
774
  limit: _ctx.limit,
775
+ "load-data": onLoadData,
692
776
  onFetchList: fetch
693
777
  }, null, 8, ["selected", "limit"])) : (openBlock(), createBlock(multipleCmp, {
694
778
  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,13 @@ 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;
16
+ showTree: import("vue").Ref<boolean>;
11
17
  search(): void;
12
18
  treeRef: import("vue").Ref<any>;
13
19
  list: any;
@@ -36,10 +42,15 @@ declare const _default: import("vue").DefineComponent<{
36
42
  type: ArrayConstructor;
37
43
  default: () => never[];
38
44
  };
45
+ loadData: {
46
+ type: FunctionConstructor;
47
+ default: () => Promise<never[]>;
48
+ };
39
49
  }>> & {
40
50
  "onUpdate:selected"?: ((...args: any[]) => any) | undefined;
41
51
  onFetchList?: ((...args: any[]) => any) | undefined;
42
52
  }, {
53
+ loadData: Function;
43
54
  selected: unknown[];
44
55
  limit: number;
45
56
  }>;