bm-admin-ui 1.0.65-alpha → 1.0.66-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.
Files changed (29) hide show
  1. package/es/components/editor/index.js +8 -4
  2. package/es/components/form-create/index.js +19 -15
  3. package/es/components/form-designer/index.js +3 -2
  4. package/es/components/staffs-selector/index.d.ts +51 -11
  5. package/es/components/staffs-selector/index.js +293 -223
  6. package/es/components/staffs-selector/src/action.d.ts +2 -0
  7. package/es/components/staffs-selector/src/departmentCmp.vue.d.ts +49 -0
  8. package/es/components/staffs-selector/src/multipleCmp.vue.d.ts +1 -10
  9. package/es/components/staffs-selector/src/staffs-selector.vue.d.ts +51 -11
  10. package/es/components/staffs-selector/src/variedCmp.vue.d.ts +1 -0
  11. package/es/components/upload/index.js +8 -4
  12. package/lib/components/editor/index.js +8 -4
  13. package/lib/components/form-create/index.js +19 -15
  14. package/lib/components/form-designer/index.js +3 -2
  15. package/lib/components/staffs-selector/index.d.ts +51 -11
  16. package/lib/components/staffs-selector/index.js +291 -221
  17. package/lib/components/staffs-selector/src/action.d.ts +2 -0
  18. package/lib/components/staffs-selector/src/departmentCmp.vue.d.ts +49 -0
  19. package/lib/components/staffs-selector/src/multipleCmp.vue.d.ts +1 -10
  20. package/lib/components/staffs-selector/src/staffs-selector.vue.d.ts +51 -11
  21. package/lib/components/staffs-selector/src/variedCmp.vue.d.ts +1 -0
  22. package/lib/components/upload/index.js +8 -4
  23. package/package.json +1 -1
  24. package/types/components/staffs-selector/index.d.ts +51 -11
  25. package/types/components/staffs-selector/src/action.d.ts +2 -0
  26. package/types/components/staffs-selector/src/departmentCmp.vue.d.ts +49 -0
  27. package/types/components/staffs-selector/src/multipleCmp.vue.d.ts +1 -10
  28. package/types/components/staffs-selector/src/staffs-selector.vue.d.ts +51 -11
  29. package/types/components/staffs-selector/src/variedCmp.vue.d.ts +1 -0
@@ -1,12 +1,13 @@
1
1
  import { withInstall } from 'bm-admin-ui/es/utils/with-install';
2
- import { readonly, ref, reactive, defineComponent, watch, toRefs, resolveComponent, openBlock, createElementBlock, createElementVNode, createVNode, withCtx, Fragment, withDirectives, createTextVNode, vShow, renderList, toDisplayString, createBlock, createCommentVNode, h, computed, normalizeClass, withModifiers, unref } from 'vue';
3
- import { Checkbox, Empty, Tree, message, Radio, Input, RadioGroup, Modal } from 'ant-design-vue';
2
+ import { readonly, ref, reactive, defineComponent, watch, toRefs, resolveComponent, openBlock, createElementBlock, createElementVNode, createVNode, withCtx, withDirectives, createTextVNode, vShow, Fragment, renderList, toDisplayString, createCommentVNode, createBlock, h, computed, normalizeClass, withModifiers, unref } from 'vue';
3
+ import { Checkbox, Empty, Radio, Input, RadioGroup, Tree, message, Modal } from 'ant-design-vue';
4
4
  import { SearchOutlined, LoadingOutlined, CloseCircleFilled } from '@ant-design/icons-vue';
5
5
 
6
6
  const MODE = {
7
7
  RADIO: 'radio',
8
8
  MULTIPLE: 'multiple',
9
9
  VARIED: 'varied',
10
+ DEPARTMENT: 'department',
10
11
  };
11
12
  const selectProps = {
12
13
  visible: {
@@ -69,6 +70,7 @@ const selectState = reactive({
69
70
  dataMap: new Map(),
70
71
  curlistKeys: new Set(),
71
72
  activeKey: 0,
73
+ fetchLoading: false,
72
74
  });
73
75
  const list = ref([]);
74
76
  const departNative = ref([]);
@@ -81,8 +83,8 @@ var _export_sfc = (sfc, props) => {
81
83
  return target;
82
84
  };
83
85
 
84
- const _sfc_main$3 = defineComponent({
85
- components: { SearchOutlined, Checkbox, Empty, ATree: Tree },
86
+ const _sfc_main$4 = defineComponent({
87
+ components: { SearchOutlined, Checkbox, Empty },
86
88
  props: {
87
89
  limit: {
88
90
  type: Number,
@@ -91,10 +93,6 @@ const _sfc_main$3 = defineComponent({
91
93
  selected: {
92
94
  type: Array,
93
95
  default: () => []
94
- },
95
- isTree: {
96
- type: Boolean,
97
- default: false
98
96
  }
99
97
  },
100
98
  emits: ["fetchList", "update:selected"],
@@ -117,7 +115,7 @@ const _sfc_main$3 = defineComponent({
117
115
  });
118
116
  },
119
117
  search() {
120
- let data = state.searchVal ? { searchVal: state.searchVal } : false;
118
+ let data = { searchVal: state.searchVal || "" };
121
119
  emit("fetchList", data);
122
120
  },
123
121
  setState() {
@@ -152,35 +150,11 @@ const _sfc_main$3 = defineComponent({
152
150
  watch(
153
151
  () => list,
154
152
  () => {
155
- !props.isTree && methods.setState();
153
+ methods.setState();
156
154
  },
157
155
  { deep: true }
158
156
  );
159
- function changeTreeCheck(checkedKeys) {
160
- let flatMap = selectState.dataMap;
161
- let curlistKeys = selectState.curlistKeys;
162
- let hadselected = new Set(selectState.multipDepartment);
163
- let curselect = new Set(checkedKeys);
164
- for (let key of hadselected) {
165
- if (curlistKeys.has(String(key)) && (!curselect.has(String(key)) || curselect.has(String(key)) && curselect.has(flatMap.get(String(key))["parent"]))) {
166
- hadselected.delete(String(key));
167
- }
168
- }
169
- for (let key of curselect) {
170
- let obj = flatMap.get(String(key));
171
- if (obj && !curselect.has(obj["parent"])) {
172
- hadselected.add(String(key));
173
- }
174
- }
175
- let arr = Array.from(hadselected) || [];
176
- if (props.limit && props.limit > 0 && arr.length > props.limit) {
177
- message.error("\u52FE\u9009\u540E\u5C06\u8D85\u8FC7\u4EBA\u5458\u9650\u5236");
178
- return;
179
- }
180
- selectState.multipDepartment = Array.from(hadselected) || [];
181
- }
182
157
  return {
183
- changeTreeCheck,
184
158
  ...toRefs(state),
185
159
  ...toRefs(selectState),
186
160
  list,
@@ -188,31 +162,25 @@ const _sfc_main$3 = defineComponent({
188
162
  };
189
163
  }
190
164
  });
191
- const _hoisted_1$3 = { class: "multiple-selector" };
192
- const _hoisted_2$3 = { class: "__selector-modal-panel" };
193
- const _hoisted_3$3 = { class: "__search-panel" };
194
- const _hoisted_4$3 = { class: "__selector-modal-options" };
195
- const _hoisted_5$3 = { class: "__selector-modal-options-item fixed-option" };
196
- const _hoisted_6$2 = { class: "department-option-item" };
197
- const _hoisted_7$1 = {
165
+ const _hoisted_1$4 = { class: "multiple-selector" };
166
+ const _hoisted_2$4 = { class: "__selector-modal-panel" };
167
+ const _hoisted_3$4 = { class: "__search-panel" };
168
+ const _hoisted_4$4 = { class: "__selector-modal-options" };
169
+ const _hoisted_5$4 = { class: "__selector-modal-options-item fixed-option" };
170
+ const _hoisted_6$3 = {
198
171
  key: 0,
199
- class: "department-desc"
200
- };
201
- const _hoisted_8$1 = {
202
- key: 2,
203
172
  class: "noData",
204
173
  style: { "height": "280px" }
205
174
  };
206
- const _hoisted_9$1 = { style: { "color": "#9393a3", "font-size": "12px", "font-weight": "400" } };
207
- function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
175
+ const _hoisted_7$2 = { style: { "color": "#9393a3", "font-size": "12px", "font-weight": "400" } };
176
+ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
208
177
  const _component_search_outlined = resolveComponent("search-outlined");
209
178
  const _component_AInput = resolveComponent("AInput");
210
179
  const _component_Checkbox = resolveComponent("Checkbox");
211
- const _component_ATree = resolveComponent("ATree");
212
180
  const _component_Empty = resolveComponent("Empty");
213
- return openBlock(), createElementBlock("div", _hoisted_1$3, [
214
- createElementVNode("div", _hoisted_2$3, [
215
- createElementVNode("div", _hoisted_3$3, [
181
+ return openBlock(), createElementBlock("div", _hoisted_1$4, [
182
+ createElementVNode("div", _hoisted_2$4, [
183
+ createElementVNode("div", _hoisted_3$4, [
216
184
  createVNode(_component_AInput, {
217
185
  value: _ctx.searchVal,
218
186
  "onUpdate:value": _cache[0] || (_cache[0] = ($event) => _ctx.searchVal = $event),
@@ -224,60 +192,44 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
224
192
  ]),
225
193
  _: 1
226
194
  }, 8, ["value", "onChange"]),
227
- createElementVNode("div", _hoisted_4$3, [
228
- !_ctx.isTree ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
229
- createElementVNode("div", _hoisted_5$3, [
230
- withDirectives(createVNode(_component_Checkbox, {
231
- checked: _ctx.selectAll,
232
- "onUpdate:checked": _cache[1] || (_cache[1] = ($event) => _ctx.selectAll = $event),
233
- indeterminate: _ctx.indeterminate,
234
- onChange: _ctx.changeAllOption
195
+ createElementVNode("div", _hoisted_4$4, [
196
+ createElementVNode("div", _hoisted_5$4, [
197
+ withDirectives(createVNode(_component_Checkbox, {
198
+ checked: _ctx.selectAll,
199
+ "onUpdate:checked": _cache[1] || (_cache[1] = ($event) => _ctx.selectAll = $event),
200
+ indeterminate: _ctx.indeterminate,
201
+ onChange: _ctx.changeAllOption
202
+ }, {
203
+ default: withCtx(() => [
204
+ createTextVNode("\u5168\u9009")
205
+ ]),
206
+ _: 1
207
+ }, 8, ["checked", "indeterminate", "onChange"]), [
208
+ [vShow, _ctx.list.length]
209
+ ])
210
+ ]),
211
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.list, (item) => {
212
+ return openBlock(), createElementBlock("div", {
213
+ key: item.key,
214
+ class: "__selector-modal-options-item"
215
+ }, [
216
+ createVNode(_component_Checkbox, {
217
+ checked: _ctx.multipleChecked[item.key],
218
+ "onUpdate:checked": ($event) => _ctx.multipleChecked[item.key] = $event,
219
+ class: "__selector-modal-option-check",
220
+ disabled: _ctx.isFulfill
235
221
  }, {
236
222
  default: withCtx(() => [
237
- createTextVNode("\u5168\u9009")
223
+ createTextVNode(toDisplayString(item?.fullTitle || item.title), 1)
238
224
  ]),
239
- _: 1
240
- }, 8, ["checked", "indeterminate", "onChange"]), [
241
- [vShow, _ctx.list.length]
242
- ])
243
- ]),
244
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.list, (item) => {
245
- return openBlock(), createElementBlock("div", {
246
- key: item.key,
247
- class: "__selector-modal-options-item"
248
- }, [
249
- createVNode(_component_Checkbox, {
250
- checked: _ctx.multipleChecked[item.key],
251
- "onUpdate:checked": ($event) => _ctx.multipleChecked[item.key] = $event,
252
- class: "__selector-modal-option-check",
253
- disabled: _ctx.isFulfill
254
- }, {
255
- default: withCtx(() => [
256
- createTextVNode(toDisplayString(item?.fullTitle || item.title), 1)
257
- ]),
258
- _: 2
259
- }, 1032, ["checked", "onUpdate:checked", "disabled"])
260
- ]);
261
- }), 128))
262
- ], 64)) : _ctx.isTree ? (openBlock(), createBlock(_component_ATree, {
263
- key: 1,
264
- "checked-keys": _ctx.multipDepartment,
265
- checkable: "",
266
- "tree-data": _ctx.list,
267
- onCheck: _ctx.changeTreeCheck
268
- }, {
269
- title: withCtx(({ title, key, description }) => [
270
- createElementVNode("div", _hoisted_6$2, [
271
- createElementVNode("span", null, toDisplayString(title) + toDisplayString(key ? `(${key})` : ""), 1),
272
- description ? (openBlock(), createElementBlock("p", _hoisted_7$1, toDisplayString(description), 1)) : createCommentVNode("v-if", true)
273
- ])
274
- ]),
275
- _: 1
276
- }, 8, ["checked-keys", "tree-data", "onCheck"])) : createCommentVNode("v-if", true),
277
- _ctx.list && !_ctx.list.length ? (openBlock(), createElementBlock("div", _hoisted_8$1, [
225
+ _: 2
226
+ }, 1032, ["checked", "onUpdate:checked", "disabled"])
227
+ ]);
228
+ }), 128)),
229
+ _ctx.list && !_ctx.list.length ? (openBlock(), createElementBlock("div", _hoisted_6$3, [
278
230
  createVNode(_component_Empty, { image: _ctx.emptyPic }, {
279
231
  description: withCtx(() => [
280
- createElementVNode("span", _hoisted_9$1, toDisplayString(!!_ctx.searchVal ? "\u6682\u65E0\u6570\u636E" : "\u8BF7\u5148\u641C\u7D22\u4EBA\u5458\u5173\u952E\u5B57"), 1)
232
+ createElementVNode("span", _hoisted_7$2, toDisplayString(!!_ctx.searchVal ? "\u6682\u65E0\u6570\u636E" : "\u8BF7\u5148\u641C\u7D22\u4EBA\u5458\u5173\u952E\u5B57"), 1)
281
233
  ]),
282
234
  _: 1
283
235
  }, 8, ["image"])
@@ -287,9 +239,9 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
287
239
  ])
288
240
  ]);
289
241
  }
290
- var multipleCmp = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$2], ["__file", "multipleCmp.vue"]]);
242
+ var multipleCmp = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$3], ["__file", "multipleCmp.vue"]]);
291
243
 
292
- const _sfc_main$2 = defineComponent({
244
+ const _sfc_main$3 = defineComponent({
293
245
  name: "RadioCmp",
294
246
  components: { ARadio: Radio, AInput: Input, ARadioGroup: RadioGroup, Empty, SearchOutlined },
295
247
  props: {
@@ -307,11 +259,11 @@ const _sfc_main$2 = defineComponent({
307
259
  const searchVal = ref("");
308
260
  const emptyPic = Empty.PRESENTED_IMAGE_SIMPLE;
309
261
  function search() {
310
- let data = searchVal.value ? { searchVal: searchVal.value } : false;
262
+ let data = { searchVal: searchVal.value || "" };
311
263
  emit("fetchList", data);
312
264
  }
313
265
  function radioChange(e) {
314
- emit("update:selected", e.target.value);
266
+ emit("update:selected", String(e.target.value));
315
267
  }
316
268
  return {
317
269
  searchVal,
@@ -321,25 +273,25 @@ const _sfc_main$2 = defineComponent({
321
273
  };
322
274
  }
323
275
  });
324
- const _hoisted_1$2 = { class: "radio-selector-panel" };
325
- const _hoisted_2$2 = { class: "__search-panel withoutpad" };
326
- const _hoisted_3$2 = {
276
+ const _hoisted_1$3 = { class: "radio-selector-panel" };
277
+ const _hoisted_2$3 = { class: "__search-panel withoutpad" };
278
+ const _hoisted_3$3 = {
327
279
  key: 0,
328
280
  class: "__selector-modal-options __radio-panel"
329
281
  };
330
- const _hoisted_4$2 = {
282
+ const _hoisted_4$3 = {
331
283
  key: 1,
332
284
  class: "noData"
333
285
  };
334
- const _hoisted_5$2 = { style: { "color": "#9393a3", "font-size": "12px", "font-weight": "400" } };
335
- function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
286
+ const _hoisted_5$3 = { style: { "color": "#9393a3", "font-size": "12px", "font-weight": "400" } };
287
+ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
336
288
  const _component_search_outlined = resolveComponent("search-outlined");
337
289
  const _component_a_input = resolveComponent("a-input");
338
290
  const _component_ARadio = resolveComponent("ARadio");
339
291
  const _component_ARadioGroup = resolveComponent("ARadioGroup");
340
292
  const _component_Empty = resolveComponent("Empty");
341
- return openBlock(), createElementBlock("div", _hoisted_1$2, [
342
- createElementVNode("div", _hoisted_2$2, [
293
+ return openBlock(), createElementBlock("div", _hoisted_1$3, [
294
+ createElementVNode("div", _hoisted_2$3, [
343
295
  createVNode(_component_a_input, {
344
296
  value: _ctx.searchVal,
345
297
  "onUpdate:value": _cache[0] || (_cache[0] = ($event) => _ctx.searchVal = $event),
@@ -351,7 +303,7 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
351
303
  ]),
352
304
  _: 1
353
305
  }, 8, ["value", "onChange"]),
354
- _ctx.list && _ctx.list.length ? (openBlock(), createElementBlock("div", _hoisted_3$2, [
306
+ _ctx.list && _ctx.list.length ? (openBlock(), createElementBlock("div", _hoisted_3$3, [
355
307
  createVNode(_component_ARadioGroup, {
356
308
  value: _ctx.selected,
357
309
  style: { width: "100%" },
@@ -374,10 +326,10 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
374
326
  _: 1
375
327
  }, 8, ["value", "onChange"])
376
328
  ])) : createCommentVNode("v-if", true),
377
- _ctx.list && !_ctx.list.length ? (openBlock(), createElementBlock("div", _hoisted_4$2, [
329
+ _ctx.list && !_ctx.list.length ? (openBlock(), createElementBlock("div", _hoisted_4$3, [
378
330
  createVNode(_component_Empty, { image: _ctx.emptyPic }, {
379
331
  description: withCtx(() => [
380
- createElementVNode("span", _hoisted_5$2, toDisplayString(!!_ctx.searchVal ? "\u6682\u65E0\u6570\u636E" : "\u8BF7\u5148\u641C\u7D22\u4EBA\u5458\u5173\u952E\u5B57"), 1)
332
+ createElementVNode("span", _hoisted_5$3, toDisplayString(!!_ctx.searchVal ? "\u6682\u65E0\u6570\u636E" : "\u8BF7\u5148\u641C\u7D22\u4EBA\u5458\u5173\u952E\u5B57"), 1)
381
333
  ]),
382
334
  _: 1
383
335
  }, 8, ["image"])
@@ -385,9 +337,9 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
385
337
  ])
386
338
  ]);
387
339
  }
388
- var radioCmp = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$1], ["__file", "radioCmp.vue"]]);
340
+ var radioCmp = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$2], ["__file", "radioCmp.vue"]]);
389
341
 
390
- const _sfc_main$1 = defineComponent({
342
+ const _sfc_main$2 = defineComponent({
391
343
  props: {
392
344
  list: {
393
345
  type: Array,
@@ -433,7 +385,7 @@ const _sfc_main$1 = defineComponent({
433
385
  }
434
386
  function search() {
435
387
  emit("fetchList", {
436
- searchVal: searchVal.value,
388
+ searchVal: searchVal.value || "",
437
389
  area: areas[selectState.activeKey].paramStr
438
390
  });
439
391
  }
@@ -479,17 +431,17 @@ const _sfc_main$1 = defineComponent({
479
431
  };
480
432
  }
481
433
  });
482
- const _hoisted_1$1 = { class: "varied-selector-panel" };
483
- const _hoisted_2$1 = { class: "__selector-modal-panel-withGroup" };
484
- const _hoisted_3$1 = { class: "varied-area-tabs" };
485
- const _hoisted_4$1 = ["onClick"];
486
- const _hoisted_5$1 = { class: "area-panel" };
487
- const _hoisted_6$1 = {
434
+ const _hoisted_1$2 = { class: "varied-selector-panel" };
435
+ const _hoisted_2$2 = { class: "__selector-modal-panel-withGroup" };
436
+ const _hoisted_3$2 = { class: "varied-area-tabs" };
437
+ const _hoisted_4$2 = ["onClick"];
438
+ const _hoisted_5$2 = { class: "area-panel" };
439
+ const _hoisted_6$2 = {
488
440
  key: 0,
489
441
  class: "noData"
490
442
  };
491
- const _hoisted_7 = { style: { "color": "#9393a3", "font-size": "12px", "font-weight": "400" } };
492
- const _hoisted_8 = {
443
+ const _hoisted_7$1 = { style: { "color": "#9393a3", "font-size": "12px", "font-weight": "400" } };
444
+ const _hoisted_8$1 = {
493
445
  key: 0,
494
446
  class: "__selector-modal-options"
495
447
  };
@@ -511,22 +463,22 @@ const _hoisted_13 = {
511
463
  key: 3,
512
464
  class: "__selector-modal-options"
513
465
  };
514
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
466
+ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
515
467
  const _component_search_outlined = resolveComponent("search-outlined");
516
468
  const _component_a_input = resolveComponent("a-input");
517
469
  const _component_Empty = resolveComponent("Empty");
518
470
  const _component_Checkbox = resolveComponent("Checkbox");
519
471
  const _component_Spin = resolveComponent("Spin");
520
472
  const _component_a_tree = resolveComponent("a-tree");
521
- return openBlock(), createElementBlock("div", _hoisted_1$1, [
522
- createElementVNode("div", _hoisted_2$1, [
523
- createElementVNode("div", _hoisted_3$1, [
473
+ return openBlock(), createElementBlock("div", _hoisted_1$2, [
474
+ createElementVNode("div", _hoisted_2$2, [
475
+ createElementVNode("div", _hoisted_3$2, [
524
476
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.areas, (item) => {
525
477
  return openBlock(), createElementBlock("div", {
526
478
  key: item.key,
527
479
  class: normalizeClass(["area-tabs-item", { active: item.key === _ctx.activeKey }]),
528
480
  onClick: withModifiers(($event) => _ctx.changeArea(item), ["stop"])
529
- }, toDisplayString(item.title), 11, _hoisted_4$1);
481
+ }, toDisplayString(item.title), 11, _hoisted_4$2);
530
482
  }), 128))
531
483
  ]),
532
484
  createVNode(_component_a_input, {
@@ -540,16 +492,16 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
540
492
  ]),
541
493
  _: 1
542
494
  }, 8, ["value", "placeholder", "onChange"]),
543
- createElementVNode("div", _hoisted_5$1, [
544
- _ctx.list && !_ctx.list.length ? (openBlock(), createElementBlock("div", _hoisted_6$1, [
495
+ createElementVNode("div", _hoisted_5$2, [
496
+ _ctx.list && !_ctx.list.length ? (openBlock(), createElementBlock("div", _hoisted_6$2, [
545
497
  createVNode(_component_Empty, { image: _ctx.emptyPic }, {
546
498
  description: withCtx(() => [
547
- createElementVNode("span", _hoisted_7, toDisplayString(!!_ctx.searchVal ? "\u6682\u65E0\u6570\u636E" : "\u8BF7\u5148\u641C\u7D22\u4EBA\u5458\u5173\u952E\u5B57"), 1)
499
+ createElementVNode("span", _hoisted_7$1, toDisplayString(!!_ctx.searchVal ? "\u6682\u65E0\u6570\u636E" : "\u8BF7\u5148\u641C\u7D22\u4EBA\u5458\u5173\u952E\u5B57"), 1)
548
500
  ]),
549
501
  _: 1
550
502
  }, 8, ["image"])
551
503
  ])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
552
- _ctx.activeKey === 0 ? (openBlock(), createElementBlock("div", _hoisted_8, [
504
+ _ctx.activeKey === 0 ? (openBlock(), createElementBlock("div", _hoisted_8$1, [
553
505
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.list, (item) => {
554
506
  return openBlock(), createElementBlock("div", {
555
507
  key: item.key,
@@ -630,11 +582,136 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
630
582
  ])
631
583
  ]);
632
584
  }
633
- var VariedCmp = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render], ["__file", "variedCmp.vue"]]);
585
+ var VariedCmp = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$1], ["__file", "variedCmp.vue"]]);
586
+
587
+ const _sfc_main$1 = defineComponent({
588
+ components: { SearchOutlined, Empty, ATree: Tree },
589
+ props: {
590
+ limit: {
591
+ type: Number,
592
+ default: 0
593
+ },
594
+ selected: {
595
+ type: Array,
596
+ default: () => []
597
+ }
598
+ },
599
+ emits: ["fetchList", "update:selected"],
600
+ setup(props, { emit }) {
601
+ const state = reactive({
602
+ searchVal: "",
603
+ selectAll: false,
604
+ indeterminate: false,
605
+ emptyPic: Empty.PRESENTED_IMAGE_SIMPLE,
606
+ isFulfill: false
607
+ });
608
+ const methods = {
609
+ search() {
610
+ let data = state.searchVal ? { searchVal: state.searchVal } : { searchVal: "" };
611
+ emit("fetchList", data);
612
+ }
613
+ };
614
+ function changeTreeCheck(checkedKeys) {
615
+ let flatMap = selectState.dataMap;
616
+ let curlistKeys = selectState.curlistKeys;
617
+ let hadselected = new Set(selectState.multipDepartment);
618
+ let curselect = new Set(checkedKeys);
619
+ console.log(hadselected, curselect);
620
+ for (let key of hadselected) {
621
+ if (curlistKeys.has(key) && (!curselect.has(key) || curselect.has(key) && curselect.has(flatMap.get(key)["parent"]))) {
622
+ hadselected.delete(key);
623
+ }
624
+ }
625
+ for (let key of curselect) {
626
+ let obj = flatMap.get(key);
627
+ if (obj && !curselect.has(obj["parent"])) {
628
+ hadselected.add(key);
629
+ }
630
+ }
631
+ let arr = Array.from(hadselected) || [];
632
+ if (props.limit && props.limit > 0 && arr.length > props.limit) {
633
+ message.error("\u52FE\u9009\u540E\u5C06\u8D85\u8FC7\u4EBA\u5458\u9650\u5236");
634
+ return;
635
+ }
636
+ selectState.multipDepartment = Array.from(hadselected) || [];
637
+ console.log(selectState.multipDepartment);
638
+ }
639
+ return {
640
+ changeTreeCheck,
641
+ ...toRefs(state),
642
+ ...toRefs(selectState),
643
+ list,
644
+ ...methods
645
+ };
646
+ }
647
+ });
648
+ const _hoisted_1$1 = { class: "multiple-selector" };
649
+ const _hoisted_2$1 = { class: "__selector-modal-panel" };
650
+ const _hoisted_3$1 = { class: "__search-panel" };
651
+ const _hoisted_4$1 = { class: "__selector-modal-options" };
652
+ const _hoisted_5$1 = { class: "department-option-item" };
653
+ const _hoisted_6$1 = {
654
+ key: 0,
655
+ class: "department-desc"
656
+ };
657
+ const _hoisted_7 = {
658
+ key: 0,
659
+ class: "noData",
660
+ style: { "height": "280px" }
661
+ };
662
+ const _hoisted_8 = { style: { "color": "#9393a3", "font-size": "12px", "font-weight": "400" } };
663
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
664
+ const _component_search_outlined = resolveComponent("search-outlined");
665
+ const _component_AInput = resolveComponent("AInput");
666
+ const _component_ATree = resolveComponent("ATree");
667
+ const _component_Empty = resolveComponent("Empty");
668
+ return openBlock(), createElementBlock("div", _hoisted_1$1, [
669
+ createElementVNode("div", _hoisted_2$1, [
670
+ createElementVNode("div", _hoisted_3$1, [
671
+ createVNode(_component_AInput, {
672
+ value: _ctx.searchVal,
673
+ "onUpdate:value": _cache[0] || (_cache[0] = ($event) => _ctx.searchVal = $event),
674
+ placeholder: "\u8BF7\u8F93\u5165\u90E8\u95E8\u540D\u79F0",
675
+ onBlur: _ctx.search
676
+ }, {
677
+ suffix: withCtx(() => [
678
+ createVNode(_component_search_outlined, { style: { color: "#9393A3" } })
679
+ ]),
680
+ _: 1
681
+ }, 8, ["value", "onBlur"]),
682
+ createElementVNode("div", _hoisted_4$1, [
683
+ createVNode(_component_ATree, {
684
+ "checked-keys": _ctx.multipDepartment,
685
+ checkable: "",
686
+ "tree-data": _ctx.list,
687
+ onCheck: _ctx.changeTreeCheck
688
+ }, {
689
+ title: withCtx(({ title, key, description }) => [
690
+ createElementVNode("div", _hoisted_5$1, [
691
+ createElementVNode("span", null, toDisplayString(title) + toDisplayString(key ? `(${key})` : ""), 1),
692
+ description ? (openBlock(), createElementBlock("p", _hoisted_6$1, toDisplayString(description), 1)) : createCommentVNode("v-if", true)
693
+ ])
694
+ ]),
695
+ _: 1
696
+ }, 8, ["checked-keys", "tree-data", "onCheck"]),
697
+ _ctx.list && !_ctx.list.length ? (openBlock(), createElementBlock("div", _hoisted_7, [
698
+ createVNode(_component_Empty, { image: _ctx.emptyPic }, {
699
+ description: withCtx(() => [
700
+ createElementVNode("span", _hoisted_8, toDisplayString(!!_ctx.searchVal ? "\u6682\u65E0\u6570\u636E" : "\u8BF7\u5148\u641C\u7D22\u4EBA\u5458\u5173\u952E\u5B57"), 1)
701
+ ]),
702
+ _: 1
703
+ }, 8, ["image"])
704
+ ])) : createCommentVNode("v-if", true)
705
+ ])
706
+ ])
707
+ ])
708
+ ]);
709
+ }
710
+ var departmentCmp = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render], ["__file", "departmentCmp.vue"]]);
634
711
 
635
712
  const _hoisted_1 = { class: "selector-content" };
636
713
  const _hoisted_2 = {
637
- key: 3,
714
+ key: 4,
638
715
  class: "__selector-chosen-panel"
639
716
  };
640
717
  const _hoisted_3 = {
@@ -657,13 +734,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
657
734
  const computeSelected = computed(() => {
658
735
  let list2 = [];
659
736
  if (props.mode === MODE.MULTIPLE) {
660
- if (multipTree.value) {
661
- return [...selectState.multipDepartment];
662
- }
663
737
  for (let [key, value] of Object.entries(selectState.multipleChecked)) {
664
738
  value && list2.push(String(key));
665
739
  }
666
740
  return list2;
741
+ } else if (props.mode === MODE.DEPARTMENT) {
742
+ return [...selectState.multipDepartment];
667
743
  } else if (props.mode === MODE.VARIED) {
668
744
  list2 = list2.concat(selectState.departmentChecked);
669
745
  for (let [key, value] of Object.entries(selectState.staffsChecked)) {
@@ -699,50 +775,42 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
699
775
  activeKey = area === "shop" ? 3 : activeKey;
700
776
  return selectState.activeKey === activeKey;
701
777
  }
702
- function fetch(params) {
778
+ async function fetch(params) {
703
779
  list.value = [];
704
- if (typeof params !== "boolean") {
705
- let isDepartTree = params.area === "department" || props.mode === MODE.MULTIPLE && multipTree.value;
706
- if (isDepartTree && departNative.value.length) {
707
- if (props.mode === MODE.VARIED && !params.searchVal || params.searchVal === "") {
708
- list.value = isCurrentFetch(params.area || "") ? [...departNative.value] : [];
709
- return;
710
- } else {
711
- let result = [];
712
- let queues = [...departNative.value];
713
- while (queues.length) {
714
- let node = queues.shift();
715
- if (node["title"] && node["title"].includes(params?.searchVal || "")) {
716
- result.push({ ...node });
717
- }
718
- if (node.children)
719
- queues.push(...node.children);
720
- }
721
- list.value = isCurrentFetch(params?.area || "") ? result : [];
722
- return;
723
- }
780
+ let isDepartTree = params.area === "department" || props.mode === MODE.DEPARTMENT;
781
+ if (isDepartTree) {
782
+ if (!departNative.value.length) {
783
+ departNative.value = await props.load(params);
784
+ selectState.dataMap = flatListFunc([...departNative.value]);
724
785
  }
725
- props.load(params).then((data) => {
726
- if (data && data.length) {
727
- if (params.area && params.area === "department") {
728
- departNative.value = data;
729
- fetch(params);
730
- } else {
731
- let result = data.map((item) => {
732
- return item;
733
- });
734
- list.value = isCurrentFetch(params.area) ? result : [];
786
+ if (params.searchVal) {
787
+ let result = [];
788
+ let queues = [...departNative.value];
789
+ while (queues.length) {
790
+ let node = queues.shift();
791
+ if (node["title"] && node["title"].includes(params?.searchVal || "")) {
792
+ result.push({ ...node });
735
793
  }
736
- selectState.dataMap = flatListFunc(data);
737
- } else {
738
- list.value = [];
794
+ if (node.children)
795
+ queues.push(...node.children);
739
796
  }
740
- });
741
- } else {
742
- if (props.mode === MODE.MULTIPLE && multipTree.value) {
743
- list.value = [...departNative.value];
797
+ list.value = result;
798
+ } else {
799
+ list.value = departNative.value;
744
800
  }
801
+ return;
745
802
  }
803
+ await props.load(params).then((data) => {
804
+ if (data && data.length) {
805
+ let result = data.map((item) => {
806
+ return item;
807
+ });
808
+ list.value = isCurrentFetch(params.area) ? result : [];
809
+ selectState.dataMap = flatListFunc(data);
810
+ } else {
811
+ list.value = [];
812
+ }
813
+ });
746
814
  }
747
815
  function flatListFunc(list2) {
748
816
  let queue = [...list2];
@@ -781,7 +849,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
781
849
  let data = selectState.dataMap.get(String(selected.value));
782
850
  emit("update:select", [data]);
783
851
  emit("change", [data]);
784
- } else if (props.mode === MODE.MULTIPLE) {
852
+ } else if (props.mode === MODE.MULTIPLE || props.mode === MODE.DEPARTMENT) {
785
853
  let arr = computeSelected.value.map((key) => findDataByKey(key));
786
854
  emit("update:select", arr);
787
855
  emit("change", arr);
@@ -827,12 +895,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
827
895
  if (props.mode === MODE.MULTIPLE) {
828
896
  if (selectState.multipleChecked[String(key)]) {
829
897
  selectState.multipleChecked[String(key)] = false;
830
- } else {
831
- let index = selectState.multipDepartment.findIndex(
832
- (item) => String(item) === String(key)
833
- );
834
- index > -1 && selectState.multipDepartment.splice(index, 1);
835
898
  }
899
+ } else if (props.mode === MODE.DEPARTMENT) {
900
+ let index = selectState.multipDepartment.findIndex(
901
+ (item) => String(item) === String(key)
902
+ );
903
+ index > -1 && selectState.multipDepartment.splice(index, 1);
836
904
  } else if (props.mode === MODE.VARIED) {
837
905
  if (selectState.staffsChecked[String(key)]) {
838
906
  selectState.staffsChecked[String(key)] = false;
@@ -852,43 +920,42 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
852
920
  () => props.visible,
853
921
  (val) => {
854
922
  if (val) {
855
- if (props.mode === "radio") {
923
+ if (props.mode === MODE.RADIO) {
856
924
  selected.value = "";
925
+ } else if (props.mode === MODE.DEPARTMENT) {
926
+ let arr = props.select;
927
+ selected.value = arr.length ? arr.map((item) => String(item?.key)) : [];
928
+ const multipDepartment = [];
929
+ arr.forEach((item) => multipDepartment.push(String(item?.key)));
930
+ selectState.multipDepartment = multipDepartment;
931
+ fetch({});
932
+ } else if (props.mode === MODE.MULTIPLE) {
933
+ let arr = props.select;
934
+ selected.value = arr.length ? arr.map((item) => String(item?.key)) : [];
935
+ let multipleChecked = {};
936
+ arr.forEach((item) => multipleChecked[String(item?.key)] = true);
937
+ selectState.multipleChecked = multipleChecked;
857
938
  } else {
858
939
  let arr = props.select;
859
940
  selected.value = arr.length ? arr.map((item) => String(item?.key)) : [];
860
- if (props.mode === MODE.MULTIPLE) {
861
- if (props.immediateFetch) {
862
- const multipDepartment = [];
863
- arr.forEach((item) => multipDepartment.push(String(item?.key)));
864
- selectState.multipDepartment = multipDepartment;
865
- } else {
866
- let multipleChecked = {};
867
- arr.forEach(
868
- (item) => multipleChecked[String(item?.key)] = true
869
- );
870
- selectState.multipleChecked = multipleChecked;
871
- }
872
- } else if (props.mode === MODE.VARIED) {
873
- let department = [];
874
- let shop = {};
875
- let staff = {};
876
- let group = {};
877
- arr.forEach((item) => {
878
- if (item["area"] && item["area"] === "department")
879
- department.push(String(item?.key));
880
- else if (item["area"] && item["area"] === "shop")
881
- shop[String(item?.key)] = true;
882
- else if (item["area"] && item["area"] === "staff")
883
- staff[String(item?.key)] = true;
884
- else if (item["area"] && item["area"] === "group")
885
- group[String(item?.key)] = true;
886
- });
887
- selectState.departmentChecked = department;
888
- selectState.shopChecked = shop;
889
- selectState.staffsChecked = staff;
890
- selectState.groupChecked = group;
891
- }
941
+ let department = [];
942
+ let shop = {};
943
+ let staff = {};
944
+ let group = {};
945
+ arr.forEach((item) => {
946
+ if (item["area"] && item["area"] === "department")
947
+ department.push(String(item?.key));
948
+ else if (item["area"] && item["area"] === "shop")
949
+ shop[String(item?.key)] = true;
950
+ else if (item["area"] && item["area"] === "staff")
951
+ staff[String(item?.key)] = true;
952
+ else if (item["area"] && item["area"] === "group")
953
+ group[String(item?.key)] = true;
954
+ });
955
+ selectState.departmentChecked = department;
956
+ selectState.shopChecked = shop;
957
+ selectState.staffsChecked = staff;
958
+ selectState.groupChecked = group;
892
959
  }
893
960
  } else {
894
961
  selected.value = [];
@@ -899,9 +966,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
899
966
  selectState.groupChecked = {};
900
967
  selectState.activeKey = 0;
901
968
  }
902
- if (val && props.mode === MODE.MULTIPLE && props.immediateFetch) {
903
- fetch({});
904
- }
905
969
  },
906
970
  { immediate: true, deep: true }
907
971
  );
@@ -932,17 +996,23 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
932
996
  list: unref(list),
933
997
  "show-count": _ctx.showCount,
934
998
  onFetchList: fetch
935
- }, null, 8, ["selected", "list", "show-count"])) : (openBlock(), createBlock(multipleCmp, {
999
+ }, null, 8, ["selected", "list", "show-count"])) : _ctx.mode === "department" ? (openBlock(), createBlock(departmentCmp, {
936
1000
  key: 2,
937
1001
  selected: selected.value,
938
1002
  "onUpdate:selected": _cache[2] || (_cache[2] = ($event) => selected.value = $event),
939
1003
  limit: _ctx.limit,
1004
+ onFetchList: fetch
1005
+ }, null, 8, ["selected", "limit"])) : (openBlock(), createBlock(multipleCmp, {
1006
+ key: 3,
1007
+ selected: selected.value,
1008
+ "onUpdate:selected": _cache[3] || (_cache[3] = ($event) => selected.value = $event),
1009
+ limit: _ctx.limit,
940
1010
  list: unref(list),
941
1011
  "is-tree": multipTree.value,
942
1012
  onFetchList: fetch
943
1013
  }, null, 8, ["selected", "limit", "list", "is-tree"])),
944
- ["multiple", "varied"].includes(_ctx.mode) ? (openBlock(), createElementBlock("div", _hoisted_2, [
945
- _ctx.showCount ? (openBlock(), createElementBlock("div", _hoisted_3, [
1014
+ ["multiple", "varied", "department"].includes(_ctx.mode) ? (openBlock(), createElementBlock("div", _hoisted_2, [
1015
+ ["multiple", "varied"].includes(_ctx.mode) && _ctx.showCount ? (openBlock(), createElementBlock("div", _hoisted_3, [
946
1016
  createElementVNode("span", null, "\u5DF2\u9009\u62E9" + toDisplayString(unref(computeSelected) && unref(computeSelected).length || 0) + toDisplayString(_ctx.$props.unitStr), 1),
947
1017
  _ctx.limit ? (openBlock(), createElementBlock("span", _hoisted_4, "\u6700\u591A\u9009\u62E9" + toDisplayString(_ctx.limit) + toDisplayString(_ctx.$props.unitStr), 1)) : createCommentVNode("v-if", true)
948
1018
  ])) : createCommentVNode("v-if", true),