bm-admin-ui 1.0.82-alpha → 1.0.84-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 (41) hide show
  1. package/es/components/attachment/index.js +273 -0
  2. package/es/components/breadcrumb/index.js +158 -0
  3. package/es/components/button/index.js +49 -0
  4. package/es/components/edit-form/index.js +1186 -0
  5. package/es/components/editor/index.js +12554 -0
  6. package/es/components/feedback/index.js +295 -0
  7. package/es/components/float-table/index.js +3511 -0
  8. package/es/components/flow-designer/index.js +1317 -0
  9. package/es/components/form-create/index.js +20978 -0
  10. package/es/components/form-designer/index.js +4514 -0
  11. package/es/components/index.js +19 -0
  12. package/es/components/input-tags-display/index.js +226 -0
  13. package/es/components/over-tooltips/index.js +133 -0
  14. package/es/components/search-filter/index.js +449 -0
  15. package/es/components/select-all/index.js +172 -0
  16. package/es/components/shops-filter/index.js +453 -0
  17. package/es/components/staffs-selector/index.js +728 -0
  18. package/es/components/timeline/index.js +168 -0
  19. package/es/components/upload/index.js +909 -0
  20. package/es/components/videoView/index.js +100 -0
  21. package/lib/components/attachment/index.js +278 -0
  22. package/lib/components/breadcrumb/index.js +168 -0
  23. package/lib/components/button/index.js +58 -0
  24. package/lib/components/edit-form/index.js +1195 -0
  25. package/lib/components/editor/index.js +12559 -0
  26. package/lib/components/feedback/index.js +309 -0
  27. package/lib/components/float-table/index.js +3516 -0
  28. package/lib/components/flow-designer/index.js +1329 -0
  29. package/lib/components/form-create/index.js +20990 -0
  30. package/lib/components/form-designer/index.js +4525 -0
  31. package/lib/components/index.js +140 -0
  32. package/lib/components/input-tags-display/index.js +237 -0
  33. package/lib/components/over-tooltips/index.js +138 -0
  34. package/lib/components/search-filter/index.js +459 -0
  35. package/lib/components/select-all/index.js +181 -0
  36. package/lib/components/shops-filter/index.js +465 -0
  37. package/lib/components/staffs-selector/index.js +733 -0
  38. package/lib/components/timeline/index.js +174 -0
  39. package/lib/components/upload/index.js +914 -0
  40. package/lib/components/videoView/index.js +105 -0
  41. package/package.json +1 -1
@@ -0,0 +1,728 @@
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, 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';
4
+ import { SearchOutlined, CloseCircleFilled } from '@ant-design/icons-vue';
5
+
6
+ const MODE = {
7
+ RADIO: 'radio',
8
+ MULTIPLE: 'multiple',
9
+ VARIED: 'varied',
10
+ DEPARTMENT: 'department',
11
+ };
12
+ const selectProps = {
13
+ visible: {
14
+ type: Boolean,
15
+ default: false,
16
+ },
17
+ mode: {
18
+ type: String,
19
+ default: MODE.MULTIPLE,
20
+ },
21
+ limit: {
22
+ type: Number,
23
+ default: 0,
24
+ },
25
+ title: {
26
+ type: String,
27
+ default: '人员选择器',
28
+ },
29
+ load: {
30
+ type: Function,
31
+ default: () => {
32
+ return Promise.resolve([]);
33
+ },
34
+ },
35
+ select: {
36
+ type: Array || Object,
37
+ defualt: () => [],
38
+ },
39
+ forceStatic: {
40
+ type: Boolean,
41
+ default: false,
42
+ },
43
+ immediateFetch: {
44
+ type: Boolean,
45
+ default: false,
46
+ },
47
+ showCount: {
48
+ type: Boolean,
49
+ default: true,
50
+ },
51
+ unitStr: {
52
+ type: String,
53
+ default: '人',
54
+ },
55
+ };
56
+ readonly([
57
+ { title: '成员', key: 0, paramStr: 'staff' },
58
+ { title: '部门', key: 1, paramStr: 'department' },
59
+ { title: '工作组', key: 2, paramStr: 'group' },
60
+ { title: '店铺', key: 3, paramStr: 'shop' },
61
+ ]);
62
+ ref('');
63
+ const selectState = reactive({
64
+ multipleChecked: {},
65
+ multipDepartment: [],
66
+ dataMap: new Map(),
67
+ curlistKeys: new Set(),
68
+ fetchLoading: false,
69
+ searched: false,
70
+ });
71
+ reactive({
72
+ departmentChecked: [],
73
+ staffsChecked: {},
74
+ shopChecked: {},
75
+ groupChecked: {},
76
+ dataMap: new Map(),
77
+ activeKey: 0,
78
+ curlistKeys: new Set(),
79
+ searched: false,
80
+ });
81
+ const list = ref([]);
82
+ const departNative = ref([]);
83
+
84
+ var _export_sfc = (sfc, props) => {
85
+ const target = sfc.__vccOpts || sfc;
86
+ for (const [key, val] of props) {
87
+ target[key] = val;
88
+ }
89
+ return target;
90
+ };
91
+
92
+ const _sfc_main$3 = defineComponent({
93
+ components: { SearchOutlined, Checkbox, Empty },
94
+ props: {
95
+ limit: {
96
+ type: Number,
97
+ default: 0
98
+ },
99
+ selected: {
100
+ type: Array,
101
+ default: () => []
102
+ }
103
+ },
104
+ emits: ["fetchList", "update:selected"],
105
+ setup(props, { emit }) {
106
+ const state = reactive({
107
+ searchVal: "",
108
+ selectAll: false,
109
+ indeterminate: false,
110
+ emptyPic: Empty.PRESENTED_IMAGE_SIMPLE,
111
+ isFulfill: false
112
+ });
113
+ const methods = {
114
+ changeAllOption() {
115
+ let status = state.selectAll;
116
+ let length = props.selected.length;
117
+ list.value.forEach((item) => {
118
+ if (status && props.limit > 0 && length++ >= props.limit)
119
+ return;
120
+ selectState.multipleChecked[item.key] = status;
121
+ });
122
+ },
123
+ search() {
124
+ let data = { searchVal: state.searchVal || "" };
125
+ emit("fetchList", data);
126
+ },
127
+ setState() {
128
+ let indeterminate = false;
129
+ let selectAll = true;
130
+ list.value.forEach((item) => {
131
+ if (!selectState.multipleChecked[item.key]) {
132
+ selectAll = false;
133
+ } else {
134
+ indeterminate = true;
135
+ }
136
+ });
137
+ state.selectAll = selectAll;
138
+ state.indeterminate = selectAll ? false : indeterminate;
139
+ }
140
+ };
141
+ watch(
142
+ () => selectState.multipleChecked,
143
+ () => {
144
+ if (props.limit && props.limit > 0) {
145
+ let length = 0;
146
+ for (let key in selectState.multipleChecked) {
147
+ if (selectState.multipleChecked[key])
148
+ length++;
149
+ }
150
+ state.isFulfill = length >= props.limit;
151
+ }
152
+ methods.setState();
153
+ },
154
+ { deep: true }
155
+ );
156
+ watch(
157
+ () => list,
158
+ () => {
159
+ methods.setState();
160
+ },
161
+ { deep: true }
162
+ );
163
+ return {
164
+ ...toRefs(state),
165
+ ...toRefs(selectState),
166
+ list,
167
+ ...methods
168
+ };
169
+ }
170
+ });
171
+ const _hoisted_1$3 = { class: "multiple-selector" };
172
+ const _hoisted_2$3 = { class: "__selector-modal-panel" };
173
+ const _hoisted_3$3 = { class: "__search-panel" };
174
+ const _hoisted_4$3 = { class: "__selector-modal-options" };
175
+ const _hoisted_5$3 = { class: "__selector-modal-options-item fixed-option" };
176
+ const _hoisted_6$2 = {
177
+ key: 0,
178
+ class: "noData",
179
+ style: { "height": "280px" }
180
+ };
181
+ const _hoisted_7$1 = { style: { "color": "#9393a3", "font-size": "12px", "font-weight": "400" } };
182
+ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
183
+ const _component_search_outlined = resolveComponent("search-outlined");
184
+ const _component_AInput = resolveComponent("AInput");
185
+ const _component_Checkbox = resolveComponent("Checkbox");
186
+ const _component_Empty = resolveComponent("Empty");
187
+ return openBlock(), createElementBlock("div", _hoisted_1$3, [
188
+ createElementVNode("div", _hoisted_2$3, [
189
+ createElementVNode("div", _hoisted_3$3, [
190
+ createVNode(_component_AInput, {
191
+ value: _ctx.searchVal,
192
+ "onUpdate:value": _cache[0] || (_cache[0] = ($event) => _ctx.searchVal = $event),
193
+ placeholder: "\u8BF7\u8F93\u5165\u59D3\u540D\u6216\u7F16\u53F7",
194
+ onBlur: _ctx.search
195
+ }, {
196
+ suffix: withCtx(() => [
197
+ createVNode(_component_search_outlined, { style: { color: "#9393A3" } })
198
+ ]),
199
+ _: 1
200
+ }, 8, ["value", "onBlur"]),
201
+ createElementVNode("div", _hoisted_4$3, [
202
+ createElementVNode("div", _hoisted_5$3, [
203
+ withDirectives(createVNode(_component_Checkbox, {
204
+ checked: _ctx.selectAll,
205
+ "onUpdate:checked": _cache[1] || (_cache[1] = ($event) => _ctx.selectAll = $event),
206
+ indeterminate: _ctx.indeterminate,
207
+ onChange: _ctx.changeAllOption
208
+ }, {
209
+ default: withCtx(() => [
210
+ createTextVNode("\u5168\u9009")
211
+ ]),
212
+ _: 1
213
+ }, 8, ["checked", "indeterminate", "onChange"]), [
214
+ [vShow, _ctx.list.length]
215
+ ])
216
+ ]),
217
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.list, (item) => {
218
+ return openBlock(), createElementBlock("div", {
219
+ key: item.key,
220
+ class: "__selector-modal-options-item"
221
+ }, [
222
+ createVNode(_component_Checkbox, {
223
+ checked: _ctx.multipleChecked[item.key],
224
+ "onUpdate:checked": ($event) => _ctx.multipleChecked[item.key] = $event,
225
+ class: "__selector-modal-option-check",
226
+ disabled: _ctx.isFulfill
227
+ }, {
228
+ default: withCtx(() => [
229
+ createTextVNode(toDisplayString(item?.fullTitle || item.title), 1)
230
+ ]),
231
+ _: 2
232
+ }, 1032, ["checked", "onUpdate:checked", "disabled"])
233
+ ]);
234
+ }), 128)),
235
+ _ctx.list && !_ctx.list.length ? (openBlock(), createElementBlock("div", _hoisted_6$2, [
236
+ createVNode(_component_Empty, { image: _ctx.emptyPic }, {
237
+ description: withCtx(() => [
238
+ createElementVNode("span", _hoisted_7$1, toDisplayString(!!_ctx.searched ? "\u6682\u65E0\u6570\u636E" : "\u8BF7\u5148\u641C\u7D22\u4EBA\u5458\u5173\u952E\u5B57"), 1)
239
+ ]),
240
+ _: 1
241
+ }, 8, ["image"])
242
+ ])) : createCommentVNode("v-if", true)
243
+ ])
244
+ ])
245
+ ])
246
+ ]);
247
+ }
248
+ var multipleCmp = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$2], ["__file", "multipleCmp.vue"]]);
249
+
250
+ const _sfc_main$2 = defineComponent({
251
+ name: "RadioCmp",
252
+ components: { ARadio: Radio, AInput: Input, ARadioGroup: RadioGroup, Empty, SearchOutlined },
253
+ props: {
254
+ list: {
255
+ type: Array,
256
+ default: () => []
257
+ },
258
+ selected: {
259
+ type: String || Number || Object,
260
+ default: ""
261
+ }
262
+ },
263
+ emits: ["fetchList", "update:selected"],
264
+ setup(_, { emit }) {
265
+ const searchVal = ref("");
266
+ const emptyPic = Empty.PRESENTED_IMAGE_SIMPLE;
267
+ function search() {
268
+ let data = { searchVal: searchVal.value || "" };
269
+ emit("fetchList", data);
270
+ }
271
+ function radioChange(e) {
272
+ emit("update:selected", String(e.target.value));
273
+ }
274
+ const searched = computed(() => selectState.searched);
275
+ return {
276
+ searchVal,
277
+ emptyPic,
278
+ searched,
279
+ search,
280
+ radioChange
281
+ };
282
+ }
283
+ });
284
+ const _hoisted_1$2 = { class: "radio-selector-panel" };
285
+ const _hoisted_2$2 = { class: "__search-panel withoutpad" };
286
+ const _hoisted_3$2 = {
287
+ key: 0,
288
+ class: "__selector-modal-options __radio-panel"
289
+ };
290
+ const _hoisted_4$2 = {
291
+ key: 1,
292
+ class: "noData"
293
+ };
294
+ const _hoisted_5$2 = { style: { "color": "#9393a3", "font-size": "12px", "font-weight": "400" } };
295
+ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
296
+ const _component_search_outlined = resolveComponent("search-outlined");
297
+ const _component_a_input = resolveComponent("a-input");
298
+ const _component_ARadio = resolveComponent("ARadio");
299
+ const _component_ARadioGroup = resolveComponent("ARadioGroup");
300
+ const _component_Empty = resolveComponent("Empty");
301
+ return openBlock(), createElementBlock("div", _hoisted_1$2, [
302
+ createElementVNode("div", _hoisted_2$2, [
303
+ createVNode(_component_a_input, {
304
+ value: _ctx.searchVal,
305
+ "onUpdate:value": _cache[0] || (_cache[0] = ($event) => _ctx.searchVal = $event),
306
+ placeholder: "\u8BF7\u8F93\u5165\u59D3\u540D\u6216\u7F16\u53F7",
307
+ onBlur: _ctx.search
308
+ }, {
309
+ suffix: withCtx(() => [
310
+ createVNode(_component_search_outlined, { style: { color: "#9393A3" } })
311
+ ]),
312
+ _: 1
313
+ }, 8, ["value", "onBlur"]),
314
+ _ctx.list && _ctx.list.length ? (openBlock(), createElementBlock("div", _hoisted_3$2, [
315
+ createVNode(_component_ARadioGroup, {
316
+ value: _ctx.selected,
317
+ style: { width: "100%" },
318
+ onChange: _ctx.radioChange
319
+ }, {
320
+ default: withCtx(() => [
321
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.list, (item) => {
322
+ return openBlock(), createBlock(_component_ARadio, {
323
+ key: item.key,
324
+ class: "__radio-option",
325
+ value: item.key
326
+ }, {
327
+ default: withCtx(() => [
328
+ createTextVNode(toDisplayString(item.fullTitle || item.title), 1)
329
+ ]),
330
+ _: 2
331
+ }, 1032, ["value"]);
332
+ }), 128))
333
+ ]),
334
+ _: 1
335
+ }, 8, ["value", "onChange"])
336
+ ])) : createCommentVNode("v-if", true),
337
+ _ctx.list && !_ctx.list.length ? (openBlock(), createElementBlock("div", _hoisted_4$2, [
338
+ createVNode(_component_Empty, { image: _ctx.emptyPic }, {
339
+ description: withCtx(() => [
340
+ createElementVNode("span", _hoisted_5$2, toDisplayString(!!_ctx.searched ? "\u6682\u65E0\u6570\u636E" : "\u8BF7\u5148\u641C\u7D22\u4EBA\u5458\u5173\u952E\u5B57"), 1)
341
+ ]),
342
+ _: 1
343
+ }, 8, ["image"])
344
+ ])) : createCommentVNode("v-if", true)
345
+ ])
346
+ ]);
347
+ }
348
+ var radioCmp = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$1], ["__file", "radioCmp.vue"]]);
349
+
350
+ const _sfc_main$1 = defineComponent({
351
+ components: { SearchOutlined, Empty, ATree: Tree },
352
+ props: {
353
+ limit: {
354
+ type: Number,
355
+ default: 0
356
+ },
357
+ selected: {
358
+ type: Array,
359
+ default: () => []
360
+ }
361
+ },
362
+ emits: ["fetchList", "update:selected"],
363
+ setup(props, { emit }) {
364
+ const treeRef = ref();
365
+ const state = reactive({
366
+ searchVal: "",
367
+ selectAll: false,
368
+ indeterminate: false,
369
+ emptyPic: Empty.PRESENTED_IMAGE_SIMPLE,
370
+ isFulfill: false
371
+ });
372
+ const methods = {
373
+ search() {
374
+ let data = state.searchVal ? { searchVal: state.searchVal } : { searchVal: "" };
375
+ emit("fetchList", data);
376
+ }
377
+ };
378
+ function changeTreeCheck(checkedKeys) {
379
+ let flatMap = selectState.dataMap;
380
+ let curlistKeys = selectState.curlistKeys;
381
+ let hadselected = new Set(selectState.multipDepartment);
382
+ let curselect = new Set(checkedKeys);
383
+ console.log(hadselected, curselect);
384
+ for (let key of hadselected) {
385
+ if (curlistKeys.has(key) && (!curselect.has(key) || curselect.has(key) && curselect.has(flatMap.get(key)["parent"]))) {
386
+ hadselected.delete(key);
387
+ }
388
+ }
389
+ for (let key of curselect) {
390
+ let obj = flatMap.get(key);
391
+ if (obj && !curselect.has(obj["parent"])) {
392
+ hadselected.add(key);
393
+ }
394
+ }
395
+ let arr = Array.from(hadselected) || [];
396
+ if (props.limit && props.limit > 0 && arr.length > props.limit) {
397
+ message.error("\u52FE\u9009\u540E\u5C06\u8D85\u8FC7\u4EBA\u5458\u9650\u5236");
398
+ return;
399
+ }
400
+ selectState.multipDepartment = Array.from(hadselected) || [];
401
+ console.log(selectState.multipDepartment);
402
+ }
403
+ return {
404
+ changeTreeCheck,
405
+ ...toRefs(state),
406
+ ...toRefs(selectState),
407
+ treeRef,
408
+ list,
409
+ ...methods
410
+ };
411
+ }
412
+ });
413
+ const _hoisted_1$1 = { class: "multiple-selector" };
414
+ const _hoisted_2$1 = { class: "__selector-modal-panel" };
415
+ const _hoisted_3$1 = { class: "__search-panel" };
416
+ const _hoisted_4$1 = { class: "__selector-modal-options" };
417
+ const _hoisted_5$1 = { class: "department-option-item" };
418
+ const _hoisted_6$1 = {
419
+ key: 0,
420
+ class: "department-desc"
421
+ };
422
+ const _hoisted_7 = {
423
+ key: 0,
424
+ class: "noData",
425
+ style: { "height": "280px" }
426
+ };
427
+ const _hoisted_8 = { style: { "color": "#9393a3", "font-size": "12px", "font-weight": "400" } };
428
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
429
+ const _component_search_outlined = resolveComponent("search-outlined");
430
+ const _component_AInput = resolveComponent("AInput");
431
+ const _component_ATree = resolveComponent("ATree");
432
+ const _component_Empty = resolveComponent("Empty");
433
+ return openBlock(), createElementBlock("div", _hoisted_1$1, [
434
+ createElementVNode("div", _hoisted_2$1, [
435
+ createElementVNode("div", _hoisted_3$1, [
436
+ createVNode(_component_AInput, {
437
+ value: _ctx.searchVal,
438
+ "onUpdate:value": _cache[0] || (_cache[0] = ($event) => _ctx.searchVal = $event),
439
+ placeholder: "\u8BF7\u8F93\u5165\u90E8\u95E8\u540D\u79F0",
440
+ onBlur: _ctx.search
441
+ }, {
442
+ suffix: withCtx(() => [
443
+ createVNode(_component_search_outlined, { style: { color: "#9393A3" } })
444
+ ]),
445
+ _: 1
446
+ }, 8, ["value", "onBlur"]),
447
+ createElementVNode("div", _hoisted_4$1, [
448
+ createVNode(_component_ATree, {
449
+ ref: "treeRef",
450
+ "checked-keys": _ctx.multipDepartment,
451
+ checkable: "",
452
+ "tree-data": _ctx.list,
453
+ onCheck: _ctx.changeTreeCheck
454
+ }, {
455
+ title: withCtx(({ title, key, description }) => [
456
+ createElementVNode("div", _hoisted_5$1, [
457
+ createElementVNode("span", null, toDisplayString(title) + toDisplayString(key ? `(${key})` : ""), 1),
458
+ description ? (openBlock(), createElementBlock("p", _hoisted_6$1, toDisplayString(description), 1)) : createCommentVNode("v-if", true)
459
+ ])
460
+ ]),
461
+ _: 1
462
+ }, 8, ["checked-keys", "tree-data", "onCheck"]),
463
+ _ctx.list && !_ctx.list.length ? (openBlock(), createElementBlock("div", _hoisted_7, [
464
+ createVNode(_component_Empty, { image: _ctx.emptyPic }, {
465
+ description: withCtx(() => [
466
+ createElementVNode("span", _hoisted_8, toDisplayString(!!_ctx.searched ? "\u6682\u65E0\u6570\u636E" : "\u8BF7\u5148\u641C\u7D22\u4EBA\u5458\u5173\u952E\u5B57"), 1)
467
+ ]),
468
+ _: 1
469
+ }, 8, ["image"])
470
+ ])) : createCommentVNode("v-if", true)
471
+ ])
472
+ ])
473
+ ])
474
+ ]);
475
+ }
476
+ var departmentCmp = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render], ["__file", "departmentCmp.vue"]]);
477
+
478
+ const _hoisted_1 = { class: "selector-content" };
479
+ const _hoisted_2 = {
480
+ key: 3,
481
+ class: "__selector-chosen-panel"
482
+ };
483
+ const _hoisted_3 = {
484
+ key: 0,
485
+ class: "__chosen-panel-tip"
486
+ };
487
+ const _hoisted_4 = {
488
+ key: 0,
489
+ class: "__limit-tip"
490
+ };
491
+ const _hoisted_5 = { class: "__chosen-panel-list" };
492
+ const _hoisted_6 = { class: "__tiem-title" };
493
+ const _sfc_main = /* @__PURE__ */ defineComponent({
494
+ __name: "staffs-selector",
495
+ props: selectProps,
496
+ emits: ["update:visible", "update:select", "change"],
497
+ setup(__props, { emit }) {
498
+ const props = __props;
499
+ const selected = ref([]);
500
+ const computeSelected = computed(() => {
501
+ let list2 = [];
502
+ if (props.mode === MODE.MULTIPLE) {
503
+ for (let [key, value] of Object.entries(selectState.multipleChecked)) {
504
+ value && list2.push(String(key));
505
+ }
506
+ return list2;
507
+ } else if (props.mode === MODE.DEPARTMENT) {
508
+ return [...selectState.multipDepartment];
509
+ }
510
+ return [];
511
+ });
512
+ const multipTree = ref(false);
513
+ const width = computed(() => {
514
+ if (props.mode === MODE.MULTIPLE) {
515
+ return 648;
516
+ } else if (props.mode === MODE.RADIO) {
517
+ return 480;
518
+ }
519
+ return 648;
520
+ });
521
+ function modalCancel() {
522
+ emit("update:visible", !props.visible);
523
+ list.value = [];
524
+ }
525
+ async function fetch(params) {
526
+ list.value = [];
527
+ selectState.searched = !!params?.searchVal;
528
+ let isDepartTree = props.mode === MODE.DEPARTMENT;
529
+ if (isDepartTree) {
530
+ if (!departNative.value.length) {
531
+ departNative.value = await props.load(params);
532
+ selectState.dataMap = flatListFunc([...departNative.value]);
533
+ }
534
+ if (params.searchVal) {
535
+ let result = [];
536
+ let queues = [...departNative.value];
537
+ while (queues.length) {
538
+ let node = queues.shift();
539
+ if (node["title"] && node["title"].includes(params?.searchVal || "")) {
540
+ result.push({ ...node });
541
+ }
542
+ if (node.children)
543
+ queues.push(...node.children);
544
+ }
545
+ list.value = result;
546
+ } else {
547
+ list.value = departNative.value;
548
+ }
549
+ return;
550
+ }
551
+ if (params.searchVal) {
552
+ await props.load(params).then((data) => {
553
+ if (data && data.length) {
554
+ let result = data.map((item) => {
555
+ return item;
556
+ });
557
+ list.value = result;
558
+ selectState.dataMap = flatListFunc(data);
559
+ } else {
560
+ list.value = [];
561
+ }
562
+ });
563
+ } else {
564
+ list.value = [];
565
+ }
566
+ }
567
+ function flatListFunc(list2) {
568
+ let queue = [...list2];
569
+ let map = new Map(selectState.dataMap);
570
+ let Keys = /* @__PURE__ */ new Set();
571
+ let treedata = false;
572
+ while (queue.length) {
573
+ let curnode = queue.shift();
574
+ map.set(String(curnode.key), curnode);
575
+ Keys.add(String(curnode.key));
576
+ let children = curnode.children;
577
+ if (children) {
578
+ children = children.map((obj) => {
579
+ treedata = true;
580
+ obj["parent"] = curnode && curnode.key || null;
581
+ return obj;
582
+ });
583
+ }
584
+ queue = queue.concat(children || []);
585
+ }
586
+ multipTree.value = props.forceStatic ? false : treedata;
587
+ selectState.curlistKeys = Keys;
588
+ return map;
589
+ }
590
+ function findDataByKey(key) {
591
+ let data = selectState.dataMap.get(String(key));
592
+ if (!data) {
593
+ data = props.select.find(
594
+ (item) => String(item) === String(key) || String(item?.key) === String(key)
595
+ );
596
+ }
597
+ return data || "\u672A\u77E5\u6570\u636E";
598
+ }
599
+ function summitSelect() {
600
+ if (typeof selected.value === "string") {
601
+ let data = selectState.dataMap.get(String(selected.value));
602
+ emit("update:select", [data]);
603
+ emit("change", [data]);
604
+ } else if (props.mode === MODE.MULTIPLE || props.mode === MODE.DEPARTMENT) {
605
+ let arr = computeSelected.value.map((key) => findDataByKey(key));
606
+ emit("update:select", arr);
607
+ emit("change", arr);
608
+ }
609
+ list.value = [];
610
+ modalCancel();
611
+ }
612
+ function getOptionName(key) {
613
+ let data = selectState.dataMap.get(String(key));
614
+ if (data && data.title)
615
+ return `${data.title}${data.key ? `(${data.key})` : ""}${data.description ? `-(${data.description})` : ""}`;
616
+ let arr = props.select;
617
+ arr = arr.length ? arr : [];
618
+ let had = arr.find(
619
+ (item) => String(item) === String(key) || String(item?.key) === String(key)
620
+ );
621
+ return had?.title ? `${had.title}${had.key ? `(${had.key})` : ""}${had.description ? `-(${had.description})` : ""}` : had;
622
+ }
623
+ function deleteOptions(key) {
624
+ if (props.mode === MODE.MULTIPLE) {
625
+ if (selectState.multipleChecked[String(key)]) {
626
+ selectState.multipleChecked[String(key)] = false;
627
+ }
628
+ } else if (props.mode === MODE.DEPARTMENT) {
629
+ let index = selectState.multipDepartment.findIndex(
630
+ (item) => String(item) === String(key)
631
+ );
632
+ index > -1 && selectState.multipDepartment.splice(index, 1);
633
+ }
634
+ }
635
+ watch(
636
+ () => props.visible,
637
+ (val) => {
638
+ if (val) {
639
+ if (props.mode === MODE.RADIO) {
640
+ selected.value = "";
641
+ } else if (props.mode === MODE.DEPARTMENT) {
642
+ let arr = props.select;
643
+ selected.value = arr.length ? arr.map((item) => String(item?.key)) : [];
644
+ const multipDepartment = [];
645
+ arr.forEach((item) => multipDepartment.push(String(item?.key)));
646
+ selectState.multipDepartment = multipDepartment;
647
+ fetch({});
648
+ } else if (props.mode === MODE.MULTIPLE) {
649
+ let arr = props.select;
650
+ selected.value = arr.length ? arr.map((item) => String(item?.key)) : [];
651
+ let multipleChecked = {};
652
+ arr.forEach((item) => multipleChecked[String(item?.key)] = true);
653
+ selectState.multipleChecked = multipleChecked;
654
+ }
655
+ } else {
656
+ selected.value = [];
657
+ selectState.multipleChecked = {};
658
+ }
659
+ },
660
+ { immediate: true, deep: true }
661
+ );
662
+ return (_ctx, _cache) => {
663
+ return openBlock(), createBlock(unref(Modal), {
664
+ class: "staffs-selector-modal",
665
+ title: _ctx.title,
666
+ visible: _ctx.visible,
667
+ width: unref(width),
668
+ "ok-text": "\u786E\u5B9A",
669
+ "cancel-text": "\u53D6\u6D88",
670
+ "destroy-on-close": true,
671
+ onCancel: modalCancel,
672
+ onOk: summitSelect
673
+ }, {
674
+ default: withCtx(() => [
675
+ createElementVNode("div", _hoisted_1, [
676
+ _ctx.mode === "radio" ? (openBlock(), createBlock(radioCmp, {
677
+ key: 0,
678
+ selected: selected.value,
679
+ "onUpdate:selected": _cache[0] || (_cache[0] = ($event) => selected.value = $event),
680
+ list: unref(list),
681
+ onFetchList: fetch
682
+ }, null, 8, ["selected", "list"])) : _ctx.mode === "department" ? (openBlock(), createBlock(departmentCmp, {
683
+ key: 1,
684
+ selected: selected.value,
685
+ "onUpdate:selected": _cache[1] || (_cache[1] = ($event) => selected.value = $event),
686
+ limit: _ctx.limit,
687
+ onFetchList: fetch
688
+ }, null, 8, ["selected", "limit"])) : (openBlock(), createBlock(multipleCmp, {
689
+ key: 2,
690
+ selected: selected.value,
691
+ "onUpdate:selected": _cache[2] || (_cache[2] = ($event) => selected.value = $event),
692
+ limit: _ctx.limit,
693
+ list: unref(list),
694
+ "is-tree": multipTree.value,
695
+ onFetchList: fetch
696
+ }, null, 8, ["selected", "limit", "list", "is-tree"])),
697
+ ["multiple", "department"].includes(_ctx.mode) ? (openBlock(), createElementBlock("div", _hoisted_2, [
698
+ ["multiple", "varied"].includes(_ctx.mode) && _ctx.showCount ? (openBlock(), createElementBlock("div", _hoisted_3, [
699
+ createElementVNode("span", null, "\u5DF2\u9009\u62E9" + toDisplayString(unref(computeSelected) && unref(computeSelected).length || 0) + toDisplayString(_ctx.$props.unitStr), 1),
700
+ _ctx.limit ? (openBlock(), createElementBlock("span", _hoisted_4, "\u6700\u591A\u9009\u62E9" + toDisplayString(_ctx.limit) + toDisplayString(_ctx.$props.unitStr), 1)) : createCommentVNode("v-if", true)
701
+ ])) : createCommentVNode("v-if", true),
702
+ createElementVNode("div", _hoisted_5, [
703
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(computeSelected), (item) => {
704
+ return openBlock(), createElementBlock("div", {
705
+ key: item + "checked",
706
+ class: "__chosen-panel-list-item"
707
+ }, [
708
+ createElementVNode("span", _hoisted_6, toDisplayString(getOptionName(item)), 1),
709
+ createVNode(unref(CloseCircleFilled), {
710
+ style: { "color": "#ced1d9" },
711
+ onMousedown: withModifiers(($event) => deleteOptions(item), ["stop"])
712
+ }, null, 8, ["onMousedown"])
713
+ ]);
714
+ }), 128))
715
+ ])
716
+ ])) : createCommentVNode("v-if", true)
717
+ ])
718
+ ]),
719
+ _: 1
720
+ }, 8, ["title", "visible", "width"]);
721
+ };
722
+ }
723
+ });
724
+ var staffsSelector = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "staffs-selector.vue"]]);
725
+
726
+ const BmStaffsSelector = withInstall(staffsSelector);
727
+
728
+ export { BmStaffsSelector, BmStaffsSelector as default };