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