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,4514 +0,0 @@
1
- import { withInstall } from 'bm-admin-ui/es/utils/with-install';
2
- import { defineComponent, openBlock, createElementBlock, normalizeStyle, toDisplayString, computed, resolveComponent, normalizeClass, unref, createBlock, createCommentVNode, withDirectives, createVNode, withCtx, createTextVNode, withModifiers, vShow, ref, watch, createElementVNode, nextTick, Fragment, isRef, renderList, renderSlot, createStaticVNode, reactive, resolveDynamicComponent } from 'vue';
3
- import uniqueId from 'bm-admin-ui/es/utils/uniqueId';
4
- import Draggable from 'vuedraggable';
5
- import { Tooltip, FormItemRest, Input, Button, RadioGroup, Radio, DatePicker, Checkbox, Tabs, TabPane, Row, Col, Dropdown, Menu, CheckboxGroup, MenuItem, Divider, Switch, Select, Layout, LayoutSider, LayoutContent, message } from 'ant-design-vue';
6
- import { HolderOutlined, EditOutlined, PlusOutlined, QuestionCircleOutlined, InfoCircleFilled, ExclamationCircleFilled } from '@ant-design/icons-vue';
7
- import { BmUpload } from 'bm-admin-ui/es/components';
8
- import { cloneDeep } from 'lodash-es';
9
- import FC from '@form-create/ant-design-vue';
10
-
11
- var WidgetType;
12
- (function (WidgetType) {
13
- WidgetType["RowWidget"] = "RowWidget";
14
- WidgetType["TableWidget"] = "TableWidget";
15
- WidgetType["UploadFile"] = "UploadFile";
16
- })(WidgetType || (WidgetType = {}));
17
- function getFieldRatioRule(rule, parentRule) {
18
- let defaultValue = rule.config.fieldRatio;
19
- const propRule = {
20
- type: 'radio',
21
- title: '字段占比',
22
- options: [],
23
- props: {
24
- optionType: 'button',
25
- buttonStyle: 'solid',
26
- },
27
- };
28
- switch (parentRule === null || parentRule === void 0 ? void 0 : parentRule.type) {
29
- case WidgetType.RowWidget:
30
- defaultValue = defaultValue || 12;
31
- propRule.options = [
32
- { value: 6, label: '25%' },
33
- { value: 12, label: '50%' },
34
- { value: 18, label: '75%' },
35
- { value: 24, label: '100%' },
36
- ];
37
- propRule.value = defaultValue;
38
- break;
39
- case WidgetType.TableWidget:
40
- defaultValue = defaultValue || '140px';
41
- propRule.title = '子字段宽度';
42
- propRule.options = [
43
- { value: '140px', label: '小' },
44
- { value: '212px', label: '中' },
45
- { value: '392px', label: '大' },
46
- { value: '572px', label: '超大 ' },
47
- ];
48
- propRule.value = defaultValue;
49
- break;
50
- default:
51
- defaultValue = defaultValue || '100%';
52
- propRule.options = [
53
- { value: '25%', label: '25%' },
54
- { value: '50%', label: '50%' },
55
- { value: '75%', label: '75%' },
56
- { value: '100%', label: '100%' },
57
- ];
58
- propRule.value = defaultValue;
59
- }
60
- return propRule;
61
- }
62
-
63
- var _export_sfc = (sfc, props) => {
64
- const target = sfc.__vccOpts || sfc;
65
- for (const [key, val] of props) {
66
- target[key] = val;
67
- }
68
- return target;
69
- };
70
-
71
- const _sfc_main$i = /* @__PURE__ */ defineComponent({
72
- __name: "widget-instruction",
73
- props: ["rule"],
74
- setup(__props) {
75
- return (_ctx, _cache) => {
76
- return openBlock(), createElementBlock("div", {
77
- style: normalizeStyle({ minHeight: "22px", color: __props.rule.style.color })
78
- }, toDisplayString(__props.rule.value), 5);
79
- };
80
- }
81
- });
82
- var WidgetInstruction = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__file", "widget-instruction.vue"]]);
83
-
84
- const _hoisted_1$f = {
85
- key: 2,
86
- class: "bm-drag-tool-mask"
87
- };
88
- const _sfc_main$h = /* @__PURE__ */ defineComponent({
89
- __name: "drag-tool",
90
- props: ["rule", "activeRuleField", "parentRule"],
91
- emits: [
92
- "copy",
93
- "delete",
94
- "mouseenter",
95
- "mouseleave",
96
- "setActiveRule",
97
- "widgetAdd"
98
- ],
99
- setup(__props, { emit: emits }) {
100
- const props = __props;
101
- const isActive = computed(() => props.rule.field === props.activeRuleField);
102
- const option = computed(() => ({
103
- form: {
104
- layout: "vertical"
105
- },
106
- submitBtn: {
107
- show: false
108
- },
109
- global: {
110
- "*": {
111
- props: {
112
- activeRuleField: props.activeRuleField
113
- }
114
- }
115
- },
116
- parentType: props.parentRule?.type
117
- }));
118
- function emitCopyEvt(rule, parentRule = void 0) {
119
- emits("copy", rule, parentRule);
120
- }
121
- function emitDeleteEvt(rule, parentRule = void 0) {
122
- emits("delete", rule, parentRule);
123
- }
124
- function handleCopy() {
125
- emitCopyEvt(props.rule);
126
- }
127
- function handleDelete() {
128
- emitDeleteEvt(props.rule);
129
- }
130
- function handleMouseenter() {
131
- props.rule.config.isHover = true;
132
- emits("mouseenter");
133
- }
134
- function handleMouseleave() {
135
- props.rule.config.isHover = false;
136
- emits("mouseleave");
137
- }
138
- function handleRowWidgetMouseenter() {
139
- props.rule.config.isHover = false;
140
- }
141
- function handleRowWidgetMouseleave() {
142
- props.rule.config.isHover = true;
143
- }
144
- function handleNestSetActiveRule(element, parentRule) {
145
- emits("setActiveRule", element, parentRule);
146
- }
147
- function handleNestCopy(rule, parentRule) {
148
- emitCopyEvt(rule, parentRule);
149
- }
150
- function handleNestDelete(rule, parentRule) {
151
- emitDeleteEvt(rule, parentRule);
152
- }
153
- function handleNestAdd(rule, parentRule) {
154
- emits("widgetAdd", rule, parentRule);
155
- }
156
- return (_ctx, _cache) => {
157
- const _component_FormCreate = resolveComponent("FormCreate");
158
- const _component_Copy = resolveComponent("Copy");
159
- const _component_ACol = resolveComponent("ACol");
160
- const _component_Delete = resolveComponent("Delete");
161
- const _component_ARow = resolveComponent("ARow");
162
- return openBlock(), createElementBlock("div", {
163
- class: normalizeClass([
164
- "bm-drag-tool",
165
- __props.rule.type === unref(WidgetType).RowWidget ? "is-row" : "",
166
- unref(isActive) ? "is-active" : "",
167
- __props.rule?.config?.putDisabled ? "is-put-disabled" : ""
168
- ]),
169
- onMouseenter: handleMouseenter,
170
- onMouseleave: handleMouseleave
171
- }, [
172
- __props.rule.type ? (openBlock(), createBlock(_component_FormCreate, {
173
- key: 0,
174
- option: unref(option),
175
- rule: [__props.rule],
176
- onNestMouseenter: handleRowWidgetMouseenter,
177
- onNestMouseleave: handleRowWidgetMouseleave,
178
- onNestSetActiveRule: handleNestSetActiveRule,
179
- onNestCopy: handleNestCopy,
180
- onNestDelete: handleNestDelete,
181
- onNestAdd: handleNestAdd
182
- }, null, 8, ["option", "rule"])) : (openBlock(), createBlock(WidgetInstruction, {
183
- key: 1,
184
- rule: __props.rule
185
- }, null, 8, ["rule"])),
186
- __props.rule.type !== unref(WidgetType).RowWidget && __props.rule.type !== unref(WidgetType).TableWidget ? (openBlock(), createElementBlock("div", _hoisted_1$f)) : createCommentVNode("v-if", true),
187
- withDirectives(createVNode(_component_ARow, {
188
- class: "bm-drag-tool-btn",
189
- gutter: [16, 0]
190
- }, {
191
- default: withCtx(() => [
192
- createVNode(_component_ACol, { class: "bm-drag-tool-btn-col" }, {
193
- default: withCtx(() => [
194
- createVNode(unref(Tooltip), { placement: "top" }, {
195
- title: withCtx(() => [
196
- createTextVNode("\u590D\u5236")
197
- ]),
198
- default: withCtx(() => [
199
- createVNode(_component_Copy, {
200
- class: "bm-drag-tool-btn-icon is-copy",
201
- onClick: withModifiers(handleCopy, ["stop"])
202
- }, null, 8, ["onClick"])
203
- ]),
204
- _: 1
205
- })
206
- ]),
207
- _: 1
208
- }),
209
- createVNode(_component_ACol, { class: "bm-drag-tool-btn-col" }, {
210
- default: withCtx(() => [
211
- createVNode(unref(Tooltip), { placement: "top" }, {
212
- title: withCtx(() => [
213
- createTextVNode("\u5220\u9664")
214
- ]),
215
- default: withCtx(() => [
216
- createVNode(_component_Delete, {
217
- class: "bm-drag-tool-btn-icon is-delete",
218
- onClick: withModifiers(handleDelete, ["stop"])
219
- }, null, 8, ["onClick"])
220
- ]),
221
- _: 1
222
- })
223
- ]),
224
- _: 1
225
- })
226
- ]),
227
- _: 1
228
- }, 512), [
229
- [vShow, __props.rule.config.isHover || unref(isActive)]
230
- ])
231
- ], 34);
232
- };
233
- }
234
- });
235
- var DragTool = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__file", "drag-tool.vue"]]);
236
-
237
- const _hoisted_1$e = { class: "bm-drag-placeholder" };
238
- const _sfc_main$g = /* @__PURE__ */ defineComponent({
239
- __name: "drag-placeholder",
240
- props: {},
241
- setup(__props) {
242
- return (_ctx, _cache) => {
243
- return openBlock(), createElementBlock("div", _hoisted_1$e);
244
- };
245
- }
246
- });
247
- var DragPlaceholder = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__file", "drag-placeholder.vue"]]);
248
-
249
- const _hoisted_1$d = { class: "bm-widget-row-wrap" };
250
- const _hoisted_2$a = {
251
- key: 0,
252
- class: "bm-widget-row-tip"
253
- };
254
- const _sfc_main$f = /* @__PURE__ */ defineComponent({
255
- __name: "widget-row",
256
- props: ["activeRuleField", "formCreateInject"],
257
- emits: [
258
- "mouseenter",
259
- "mouseleave",
260
- "set-active-rule",
261
- "copy",
262
- "delete",
263
- "add"
264
- ],
265
- setup(__props, { emit: emits }) {
266
- const props = __props;
267
- const rowRule = computed(() => props.formCreateInject.rule);
268
- const childRules = computed(() => rowRule.value.config.childRules);
269
- function handleMouseenter() {
270
- emits("mouseenter");
271
- }
272
- function handleMouseleave() {
273
- emits("mouseleave");
274
- }
275
- function emitSetActiveRuleEvt(rule, parentRule) {
276
- emits("set-active-rule", rule, parentRule);
277
- }
278
- function handleClick(element) {
279
- emitSetActiveRuleEvt(element, rowRule.value);
280
- }
281
- function emitAdd(rule, parentRule) {
282
- emits("add", rule, parentRule);
283
- }
284
- function handleRowWidgetAdd({ newIndex }) {
285
- emitAdd(childRules.value[newIndex], rowRule.value);
286
- }
287
- function handleRowWidgetUpdate({ newIndex }) {
288
- const rule = childRules.value[newIndex];
289
- if (rule)
290
- emitSetActiveRuleEvt(rule, rowRule.value);
291
- }
292
- function handleCopy(rule, parentRule) {
293
- parentRule = parentRule || rowRule.value;
294
- emits("copy", rule, parentRule);
295
- }
296
- function handleDelete(rule, parentRule) {
297
- parentRule = parentRule || rowRule.value;
298
- emits("delete", rule, parentRule);
299
- }
300
- function handleWidgetInTableActive(rule, parentRule) {
301
- emitSetActiveRuleEvt(rule, parentRule);
302
- }
303
- function handleWidgetAdd(rule, parentRule) {
304
- emitAdd(rule, parentRule);
305
- }
306
- return (_ctx, _cache) => {
307
- const _component_ACol = resolveComponent("ACol");
308
- return openBlock(), createElementBlock("div", _hoisted_1$d, [
309
- !unref(childRules).length ? (openBlock(), createElementBlock("div", _hoisted_2$a, " \u53EF\u62D6\u5165\u591A\u4E2A\u63A7\u4EF6 ")) : createCommentVNode("v-if", true),
310
- createVNode(unref(Draggable), {
311
- "component-data": {
312
- field: __props.formCreateInject.rule.field,
313
- type: unref(WidgetType).RowWidget
314
- },
315
- class: "bm-widget-row",
316
- tag: "ARow",
317
- group: {
318
- name: "rowWidget",
319
- pull: true,
320
- put: ["widget", "rowWidget", "formWidget"]
321
- },
322
- "ghost-class": unref(childRules).length ? "row-drag-ghost" : "row-drag-ghost__is-empty",
323
- list: unref(childRules),
324
- "force-fallback": true,
325
- delay: 50,
326
- "item-key": "field",
327
- direction: "vertical",
328
- onAdd: handleRowWidgetAdd,
329
- onUpdate: handleRowWidgetUpdate
330
- }, {
331
- item: withCtx(({ element }) => [
332
- createVNode(_component_ACol, {
333
- span: element.config.fieldRatio
334
- }, {
335
- default: withCtx(() => [
336
- createVNode(DragTool, {
337
- rule: element,
338
- "active-rule-field": __props.activeRuleField,
339
- "parent-rule": __props.formCreateInject.rule,
340
- onMouseenter: handleMouseenter,
341
- onMouseleave: handleMouseleave,
342
- onClick: withModifiers(($event) => handleClick(element), ["stop"]),
343
- onCopy: handleCopy,
344
- onDelete: handleDelete,
345
- onSetActiveRule: handleWidgetInTableActive,
346
- onWidgetAdd: handleWidgetAdd
347
- }, null, 8, ["rule", "active-rule-field", "parent-rule", "onClick"]),
348
- createVNode(DragPlaceholder)
349
- ]),
350
- _: 2
351
- }, 1032, ["span"])
352
- ]),
353
- _: 1
354
- }, 8, ["component-data", "ghost-class", "list"])
355
- ]);
356
- };
357
- }
358
- });
359
- var WidgetRow = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__file", "widget-row.vue"]]);
360
-
361
- const label$h = '分栏';
362
- const fieldsMap$h = {
363
- 'title.title': 'title.title',
364
- 'config.title': 'config.title',
365
- 'config.showTitle': 'config.showTitle',
366
- };
367
- function handleTitle(title) {
368
- return title + '(该标题不会显示在表单)';
369
- }
370
- const name$h = 'row';
371
- var row = {
372
- icon: 'RowIcon',
373
- name: name$h,
374
- label: label$h,
375
- rule() {
376
- return {
377
- type: WidgetType.RowWidget,
378
- component: WidgetRow,
379
- title: {
380
- title: label$h,
381
- },
382
- field: uniqueId(),
383
- props: {
384
- field: '',
385
- list: [],
386
- activeRule: {},
387
- },
388
- emit: [
389
- 'mouseenter',
390
- 'mouseleave',
391
- 'set-active-rule',
392
- 'copy',
393
- 'delete',
394
- 'add',
395
- ],
396
- emitPrefix: 'nest',
397
- config: {
398
- title: label$h,
399
- showTitle: true,
400
- childRules: [],
401
- propsFields: Object.values(fieldsMap$h),
402
- },
403
- };
404
- },
405
- props(rule) {
406
- return [
407
- {
408
- type: 'input',
409
- title: '标题',
410
- field: fieldsMap$h['config.title'],
411
- value: rule.config.title,
412
- effect: {
413
- required: '请输入标题',
414
- },
415
- props: {
416
- placeholder: '请输入',
417
- maxlength: 10,
418
- },
419
- inject: true,
420
- on: {
421
- change({ api, self }, $event) {
422
- const showTitle = rule.config.showTitle;
423
- let title = $event.target.value;
424
- if (!showTitle) {
425
- title = handleTitle(title);
426
- }
427
- api.emit('change', 'title.title', title, self, api, true);
428
- },
429
- },
430
- },
431
- {
432
- type: 'switch',
433
- title: '是否显示标题',
434
- field: fieldsMap$h['config.showTitle'],
435
- value: rule.config.showTitle,
436
- inject: true,
437
- on: {
438
- change({ api, self }, value) {
439
- let title = rule.config.title;
440
- if (!value) {
441
- title = handleTitle(title);
442
- }
443
- api.emit('change', 'title.title', title, self, api, true);
444
- },
445
- },
446
- },
447
- ];
448
- },
449
- parse(rule) {
450
- return {
451
- name: name$h,
452
- field: rule.field,
453
- title: {
454
- title: rule.title.title,
455
- },
456
- config: {
457
- title: rule.config.title,
458
- showTitle: rule.config.showTitle,
459
- },
460
- };
461
- },
462
- };
463
-
464
- const label$g = '单行输入框';
465
- const fieldsMap$g = {
466
- 'title.title': 'title.title',
467
- 'props.placeholder': 'props.placeholder',
468
- value: 'value',
469
- 'config.fieldRatio': 'config.fieldRatio',
470
- 'effect.required': 'effect.required',
471
- };
472
- const name$g = 'input';
473
- var input = {
474
- icon: 'InputIcon',
475
- name: name$g,
476
- label: label$g,
477
- rule() {
478
- return {
479
- type: 'input',
480
- field: uniqueId(),
481
- title: {
482
- title: label$g,
483
- style: {
484
- overflow: 'hidden',
485
- textOverflow: 'ellipsis',
486
- whiteSpace: 'nowrap',
487
- },
488
- },
489
- effect: {
490
- required: false,
491
- formRule: 'formRule',
492
- },
493
- props: {
494
- maxlength: 200,
495
- placeholder: '请输入',
496
- },
497
- config: {
498
- propsFields: Object.values(fieldsMap$g),
499
- },
500
- };
501
- },
502
- props(rule, parentRule) {
503
- return [
504
- {
505
- type: 'input',
506
- title: '标题',
507
- field: fieldsMap$g['title.title'],
508
- value: rule.title.title,
509
- effect: {
510
- required: '请输入标题',
511
- },
512
- props: {
513
- placeholder: '请输入',
514
- maxlength: 10,
515
- },
516
- },
517
- {
518
- type: 'input',
519
- title: '提示文字',
520
- field: fieldsMap$g['props.placeholder'],
521
- props: {
522
- placeholder: '请输入',
523
- maxlength: 30,
524
- },
525
- value: rule.props.placeholder,
526
- },
527
- {
528
- type: 'input',
529
- title: '默认值',
530
- field: fieldsMap$g['value'],
531
- props: {
532
- placeholder: '请输入',
533
- maxlength: 200,
534
- },
535
- value: rule.value,
536
- },
537
- Object.assign({ field: fieldsMap$g['config.fieldRatio'] }, getFieldRatioRule(rule, parentRule)),
538
- {
539
- type: 'switch',
540
- title: '是否必填',
541
- field: fieldsMap$g['effect.required'],
542
- value: rule.effect.required,
543
- },
544
- ];
545
- },
546
- parse(rule) {
547
- return {
548
- name: name$g,
549
- field: rule.field,
550
- title: {
551
- title: rule.title.title,
552
- },
553
- props: {
554
- placeholder: rule.props.placeholder,
555
- },
556
- value: rule.value,
557
- config: {
558
- fieldRatio: rule.config.fieldRatio,
559
- },
560
- effect: {
561
- required: rule.effect.required,
562
- },
563
- };
564
- },
565
- };
566
-
567
- const label$f = '多行输入框';
568
- const fieldsMap$f = {
569
- 'title.title': 'title.title',
570
- 'props.placeholder': 'props.placeholder',
571
- value: 'value',
572
- 'config.fieldRatio': 'config.fieldRatio',
573
- 'effect.required': 'effect.required',
574
- };
575
- const name$f = 'textarea';
576
- var textarea = {
577
- icon: 'TextareaIcon',
578
- name: name$f,
579
- label: label$f,
580
- rule() {
581
- return {
582
- type: 'input',
583
- field: uniqueId(),
584
- title: {
585
- title: label$f,
586
- style: {
587
- overflow: 'hidden',
588
- textOverflow: 'ellipsis',
589
- whiteSpace: 'nowrap',
590
- },
591
- },
592
- effect: {
593
- required: false,
594
- formRule: 'formRule',
595
- },
596
- props: {
597
- type: 'textarea',
598
- placeholder: '请输入',
599
- maxlength: 5000,
600
- },
601
- config: {
602
- propsFields: Object.values(fieldsMap$f),
603
- },
604
- };
605
- },
606
- props(rule, parentRule) {
607
- return [
608
- {
609
- type: 'input',
610
- title: '标题',
611
- field: fieldsMap$f['title.title'],
612
- value: rule.title.title,
613
- effect: {
614
- required: '请输入标题',
615
- },
616
- props: {
617
- placeholder: '请输入',
618
- maxlength: 10,
619
- },
620
- },
621
- {
622
- type: 'input',
623
- title: '提示文字',
624
- field: fieldsMap$f['props.placeholder'],
625
- props: {
626
- placeholder: '请输入',
627
- maxlength: 30,
628
- },
629
- value: rule.props.placeholder,
630
- },
631
- {
632
- type: 'input',
633
- title: '默认值',
634
- field: fieldsMap$f['value'],
635
- props: {
636
- placeholder: '请输入',
637
- maxlength: 5000,
638
- },
639
- value: rule.value,
640
- },
641
- Object.assign({ field: fieldsMap$f['config.fieldRatio'] }, getFieldRatioRule(rule, parentRule)),
642
- {
643
- type: 'switch',
644
- title: '是否必填',
645
- field: fieldsMap$f['effect.required'],
646
- value: rule.effect.required,
647
- },
648
- ];
649
- },
650
- parse(rule) {
651
- return {
652
- name: name$f,
653
- field: rule.field,
654
- title: {
655
- title: rule.title.title,
656
- },
657
- props: {
658
- placeholder: rule.props.placeholder,
659
- },
660
- value: rule.value,
661
- config: {
662
- fieldRatio: rule.config.fieldRatio,
663
- },
664
- effect: {
665
- required: rule.effect.required,
666
- },
667
- };
668
- },
669
- };
670
-
671
- const label$e = '数字输入框';
672
- const fieldsMap$e = {
673
- 'title.title': 'title.title',
674
- 'props.placeholder': 'props.placeholder',
675
- value: 'value',
676
- 'config.fieldRatio': 'config.fieldRatio',
677
- 'config.count': 'config.count',
678
- 'effect.required': 'effect.required',
679
- };
680
- const name$e = 'numInput';
681
- var numInput = {
682
- icon: 'NumInput',
683
- name: name$e,
684
- label: label$e,
685
- rule() {
686
- return {
687
- type: 'inputNumber',
688
- field: uniqueId(),
689
- title: {
690
- title: label$e,
691
- style: {
692
- overflow: 'hidden',
693
- textOverflow: 'ellipsis',
694
- whiteSpace: 'nowrap',
695
- },
696
- },
697
- effect: {
698
- required: false,
699
- formRule: 'formRule',
700
- },
701
- props: {
702
- placeholder: '请输入',
703
- },
704
- config: {
705
- propsFields: Object.values(fieldsMap$e),
706
- },
707
- style: {
708
- width: '100%',
709
- },
710
- };
711
- },
712
- props(rule, parentRule) {
713
- return [
714
- {
715
- type: 'input',
716
- title: '标题',
717
- field: fieldsMap$e['title.title'],
718
- value: rule.title.title,
719
- effect: {
720
- required: '请输入标题',
721
- },
722
- props: {
723
- placeholder: '请输入',
724
- maxlength: 10,
725
- },
726
- },
727
- {
728
- type: 'input',
729
- title: '提示文字',
730
- field: fieldsMap$e['props.placeholder'],
731
- props: {
732
- placeholder: '请输入',
733
- maxlength: 30,
734
- },
735
- value: rule.props.placeholder,
736
- },
737
- {
738
- type: 'inputNumber',
739
- title: '默认值',
740
- field: fieldsMap$e['value'],
741
- props: {
742
- placeholder: '请输入',
743
- type: 'number',
744
- },
745
- value: rule.value,
746
- style: {
747
- width: '100%',
748
- },
749
- },
750
- Object.assign({ field: fieldsMap$e['config.fieldRatio'] }, getFieldRatioRule(rule, parentRule)),
751
- {
752
- type: 'switch',
753
- title: '统计总数',
754
- info: '仅当该控件结合“表格”控件使用时应用',
755
- field: fieldsMap$e['config.count'],
756
- value: rule.config.count,
757
- props: {
758
- disabled: (parentRule === null || parentRule === void 0 ? void 0 : parentRule.type) !== WidgetType.TableWidget,
759
- },
760
- },
761
- {
762
- type: 'switch',
763
- title: '是否必填',
764
- field: fieldsMap$e['effect.required'],
765
- value: rule.effect.required,
766
- info: '勾选后可作为流程条件',
767
- },
768
- ];
769
- },
770
- parse(rule) {
771
- return {
772
- name: name$e,
773
- field: rule.field,
774
- title: {
775
- title: rule.title.title,
776
- },
777
- props: {
778
- placeholder: rule.props.placeholder,
779
- },
780
- value: rule.value,
781
- config: {
782
- count: rule.config.count,
783
- fieldRatio: rule.config.fieldRatio,
784
- },
785
- effect: {
786
- required: rule.effect.required,
787
- },
788
- };
789
- },
790
- };
791
-
792
- const _hoisted_1$c = { class: "bm-handle-options" };
793
- const _hoisted_2$9 = {
794
- key: 0,
795
- class: "bm-handle-options__error-tip"
796
- };
797
- const _sfc_main$e = /* @__PURE__ */ defineComponent({
798
- __name: "handle-options",
799
- props: ["options", "disabled"],
800
- emits: ["setValue"],
801
- setup(__props, { emit: emits }) {
802
- const props = __props;
803
- const handleClass = "bm-handle-options__drag-icon";
804
- const visible = ref(false);
805
- const text = ref("");
806
- const repeatOption = ref([]);
807
- const maxlength = 500;
808
- function edit() {
809
- visible.value = true;
810
- text.value = makeText(props.options);
811
- }
812
- function add() {
813
- const index = props.options.length;
814
- const value = `\u9009\u9879${index + 1}`;
815
- props.options.push({ value, label: value });
816
- }
817
- function makeText(options) {
818
- return options.reduce((pre, cur) => {
819
- if (!pre) {
820
- return cur.label;
821
- } else {
822
- return pre + "\n" + cur.label;
823
- }
824
- }, "");
825
- }
826
- function handleOk() {
827
- const options = text.value.split("\n").reduce((pre, cur) => {
828
- if (cur) {
829
- cur = cur.substring(0, maxlength - 1);
830
- pre.push({ value: cur, label: cur });
831
- }
832
- return pre;
833
- }, []);
834
- props.options.splice(0, props.options.length);
835
- props.options.push(...options);
836
- visible.value = false;
837
- }
838
- function handleBlur(element) {
839
- element.value = element.label;
840
- }
841
- function handleRepeatOption(val) {
842
- repeatOption.value = [];
843
- const cache = {};
844
- val.forEach(({ value }) => {
845
- if (!cache[value]) {
846
- cache[value] = 1;
847
- } else {
848
- cache[value]++;
849
- if (cache[value] === 2) {
850
- repeatOption.value.push(value);
851
- }
852
- }
853
- });
854
- }
855
- function emitSetValue(val) {
856
- emits("setValue", val);
857
- }
858
- watch(
859
- props.options,
860
- (val) => {
861
- handleRepeatOption(val);
862
- emitSetValue(val);
863
- },
864
- { deep: true }
865
- );
866
- return (_ctx, _cache) => {
867
- const _component_Delete = resolveComponent("Delete");
868
- const _component_ARow = resolveComponent("ARow");
869
- const _component_a_textarea = resolveComponent("a-textarea");
870
- const _component_a_modal = resolveComponent("a-modal");
871
- return openBlock(), createElementBlock("div", null, [
872
- createVNode(unref(Draggable), {
873
- tag: "transition-group",
874
- "component-data": {
875
- name: "flip-list"
876
- },
877
- animation: 200,
878
- list: __props.options,
879
- handle: `.${handleClass}`,
880
- "force-fallback": true,
881
- disabled: __props.disabled
882
- }, {
883
- item: withCtx(({ element, index }) => [
884
- createElementVNode("div", _hoisted_1$c, [
885
- createVNode(_component_ARow, { align: "middle" }, {
886
- default: withCtx(() => [
887
- !__props.disabled ? (openBlock(), createBlock(unref(HolderOutlined), {
888
- key: 0,
889
- class: normalizeClass([handleClass])
890
- }, null, 8, ["class"])) : createCommentVNode("v-if", true),
891
- createVNode(unref(FormItemRest), null, {
892
- default: withCtx(() => [
893
- createVNode(unref(Input), {
894
- value: element.label,
895
- "onUpdate:value": ($event) => element.label = $event,
896
- class: normalizeClass([
897
- "bm-handle-options__input",
898
- repeatOption.value.length && repeatOption.value.includes(element.value) ? "is-error" : ""
899
- ]),
900
- maxlength,
901
- disabled: __props.disabled,
902
- onBlur: ($event) => handleBlur(element)
903
- }, null, 8, ["value", "onUpdate:value", "class", "disabled", "onBlur"])
904
- ]),
905
- _: 2
906
- }, 1024),
907
- !__props.disabled ? (openBlock(), createBlock(_component_Delete, {
908
- key: 1,
909
- class: "bm-handle-options__del-icon",
910
- onClick: ($event) => __props.options.splice(index, 1)
911
- }, null, 8, ["onClick"])) : createCommentVNode("v-if", true)
912
- ]),
913
- _: 2
914
- }, 1024),
915
- repeatOption.value.length && repeatOption.value.includes(element.value) ? (openBlock(), createElementBlock("div", _hoisted_2$9, " \u8BF7\u66F4\u6539\u91CD\u590D\u9009\u9879 ")) : createCommentVNode("v-if", true)
916
- ])
917
- ]),
918
- _: 1
919
- }, 8, ["list", "handle", "disabled"]),
920
- !__props.disabled ? (openBlock(), createBlock(unref(Button), {
921
- key: 0,
922
- style: { "margin-left": "24px", "margin-top": "8px" },
923
- onClick: edit
924
- }, {
925
- icon: withCtx(() => [
926
- createVNode(unref(EditOutlined))
927
- ]),
928
- default: withCtx(() => [
929
- createTextVNode(" \u6279\u91CF\u7F16\u8F91 ")
930
- ]),
931
- _: 1
932
- })) : createCommentVNode("v-if", true),
933
- !__props.disabled ? (openBlock(), createBlock(unref(Button), {
934
- key: 1,
935
- style: { "margin-left": "8px", "margin-top": "8px" },
936
- onClick: add
937
- }, {
938
- icon: withCtx(() => [
939
- createVNode(unref(PlusOutlined))
940
- ]),
941
- default: withCtx(() => [
942
- createTextVNode(" \u6DFB\u52A0\u9009\u9879 ")
943
- ]),
944
- _: 1
945
- })) : createCommentVNode("v-if", true),
946
- createVNode(_component_a_modal, {
947
- visible: visible.value,
948
- "onUpdate:visible": _cache[1] || (_cache[1] = ($event) => visible.value = $event),
949
- title: "\u9009\u9879\u6279\u91CF\u7F16\u8F91",
950
- onOk: handleOk
951
- }, {
952
- default: withCtx(() => [
953
- createTextVNode(" \u6BCF\u884C\u5BF9\u5E94\u4E00\u4E2A\u9009\u9879 "),
954
- createVNode(_component_a_textarea, {
955
- value: text.value,
956
- "onUpdate:value": _cache[0] || (_cache[0] = ($event) => text.value = $event),
957
- style: { "margin-top": "8px" },
958
- placeholder: "\u8BF7\u8F93\u5165",
959
- "auto-size": { minRows: 8 }
960
- }, null, 8, ["value"])
961
- ]),
962
- _: 1
963
- }, 8, ["visible"])
964
- ]);
965
- };
966
- }
967
- });
968
- var HandleOptionsCom = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__file", "handle-options.vue"]]);
969
-
970
- const label$d = '单选框';
971
- const ruleType$1 = {
972
- checkedValue: 'radio',
973
- unCheckedValue: 'select',
974
- };
975
- const fieldsMap$d = {
976
- 'title.title': 'title.title',
977
- 'props.placeholder': 'props.placeholder',
978
- options: 'options',
979
- type: 'type',
980
- 'config.fieldRatio': 'config.fieldRatio',
981
- 'effect.required': 'effect.required',
982
- };
983
- const name$d = 'radio';
984
- var radio = {
985
- icon: 'RadioIcon',
986
- name: name$d,
987
- label: label$d,
988
- rule() {
989
- return {
990
- type: ruleType$1.unCheckedValue,
991
- field: uniqueId(),
992
- title: {
993
- title: label$d,
994
- style: {
995
- overflow: 'hidden',
996
- textOverflow: 'ellipsis',
997
- whiteSpace: 'nowrap',
998
- },
999
- },
1000
- effect: {
1001
- required: false,
1002
- formRule: 'formRule',
1003
- },
1004
- options: [
1005
- {
1006
- value: '选项1',
1007
- label: '选项1',
1008
- },
1009
- {
1010
- value: '选项2',
1011
- label: '选项2',
1012
- },
1013
- {
1014
- value: '选项3',
1015
- label: '选项3',
1016
- },
1017
- ],
1018
- props: {
1019
- placeholder: '请选择',
1020
- },
1021
- config: {
1022
- propsFields: Object.values(fieldsMap$d),
1023
- },
1024
- };
1025
- },
1026
- props(rule, parentRule) {
1027
- return [
1028
- {
1029
- type: 'input',
1030
- title: '标题',
1031
- field: fieldsMap$d['title.title'],
1032
- value: rule.title.title,
1033
- effect: {
1034
- required: '请输入标题',
1035
- },
1036
- props: {
1037
- placeholder: '请输入',
1038
- maxlength: 10,
1039
- },
1040
- },
1041
- {
1042
- type: 'input',
1043
- title: '提示文字',
1044
- field: fieldsMap$d['props.placeholder'],
1045
- props: {
1046
- placeholder: '请输入',
1047
- maxlength: 30,
1048
- },
1049
- value: rule.props.placeholder,
1050
- },
1051
- {
1052
- type: 'HandleOptions',
1053
- component: HandleOptionsCom,
1054
- title: '选项',
1055
- field: fieldsMap$d['options'],
1056
- props: {
1057
- options: rule.options,
1058
- },
1059
- value: rule.options,
1060
- inject: true,
1061
- on: {
1062
- setValue(inject, options) {
1063
- const rule = inject.self;
1064
- const api = inject.api;
1065
- api.changeValue(rule.field, options);
1066
- api.emit('change', rule.field, rule.value, rule, api, true);
1067
- },
1068
- },
1069
- },
1070
- {
1071
- hidden: (parentRule === null || parentRule === void 0 ? void 0 : parentRule.type) === WidgetType.TableWidget,
1072
- type: 'switch',
1073
- title: '选项平铺',
1074
- field: fieldsMap$d['type'],
1075
- value: rule.type,
1076
- props: Object.assign({}, ruleType$1),
1077
- },
1078
- Object.assign({ field: fieldsMap$d['config.fieldRatio'] }, getFieldRatioRule(rule, parentRule)),
1079
- {
1080
- type: 'switch',
1081
- title: '是否必填',
1082
- field: fieldsMap$d['effect.required'],
1083
- value: rule.effect.required,
1084
- },
1085
- ];
1086
- },
1087
- parse(rule) {
1088
- return {
1089
- name: name$d,
1090
- field: rule.field,
1091
- type: rule.type,
1092
- title: {
1093
- title: rule.title.title,
1094
- },
1095
- props: {
1096
- placeholder: rule.props.placeholder,
1097
- },
1098
- options: rule.options,
1099
- config: {
1100
- fieldRatio: rule.config.fieldRatio,
1101
- },
1102
- effect: {
1103
- required: rule.effect.required,
1104
- },
1105
- };
1106
- },
1107
- };
1108
-
1109
- const label$c = '多选框';
1110
- const ruleType = {
1111
- checkedValue: 'checkbox',
1112
- unCheckedValue: 'select',
1113
- };
1114
- const fieldsMap$c = {
1115
- 'title.title': 'title.title',
1116
- 'props.placeholder': 'props.placeholder',
1117
- options: 'options',
1118
- type: 'type',
1119
- 'config.fieldRatio': 'config.fieldRatio',
1120
- 'effect.required': 'effect.required',
1121
- };
1122
- const name$c = 'checkbox';
1123
- var checkbox = {
1124
- icon: 'CheckboxIcon',
1125
- name: name$c,
1126
- label: label$c,
1127
- rule() {
1128
- return {
1129
- type: ruleType.unCheckedValue,
1130
- field: uniqueId(),
1131
- title: {
1132
- title: label$c,
1133
- style: {
1134
- overflow: 'hidden',
1135
- textOverflow: 'ellipsis',
1136
- whiteSpace: 'nowrap',
1137
- },
1138
- },
1139
- effect: {
1140
- required: false,
1141
- formRule: 'formRule',
1142
- },
1143
- options: [
1144
- {
1145
- value: '选项1',
1146
- label: '选项1',
1147
- },
1148
- {
1149
- value: '选项2',
1150
- label: '选项2',
1151
- },
1152
- {
1153
- value: '选项3',
1154
- label: '选项3',
1155
- },
1156
- ],
1157
- props: {
1158
- placeholder: '请选择',
1159
- },
1160
- config: {
1161
- propsFields: Object.values(fieldsMap$c),
1162
- },
1163
- };
1164
- },
1165
- props(rule, parentRule) {
1166
- return [
1167
- {
1168
- type: 'input',
1169
- title: '标题',
1170
- field: fieldsMap$c['title.title'],
1171
- value: rule.title.title,
1172
- effect: {
1173
- required: '请输入标题',
1174
- },
1175
- props: {
1176
- placeholder: '请输入',
1177
- maxlength: 10,
1178
- },
1179
- },
1180
- {
1181
- type: 'input',
1182
- title: '提示文字',
1183
- field: fieldsMap$c['props.placeholder'],
1184
- props: {
1185
- placeholder: '请输入',
1186
- maxlength: 30,
1187
- },
1188
- value: rule.props.placeholder,
1189
- },
1190
- {
1191
- type: 'HandleOptions',
1192
- component: HandleOptionsCom,
1193
- title: '选项',
1194
- field: fieldsMap$c['options'],
1195
- props: {
1196
- options: rule.options,
1197
- },
1198
- value: rule.options,
1199
- inject: true,
1200
- on: {
1201
- setValue(inject, options) {
1202
- const rule = inject.self;
1203
- const api = inject.api;
1204
- api.changeValue(rule.field, options);
1205
- api.emit('change', rule.field, rule.value, rule, api, true);
1206
- },
1207
- },
1208
- },
1209
- {
1210
- hidden: (parentRule === null || parentRule === void 0 ? void 0 : parentRule.type) === WidgetType.TableWidget,
1211
- type: 'switch',
1212
- title: '选项平铺',
1213
- field: fieldsMap$c['type'],
1214
- value: rule.type,
1215
- props: Object.assign({}, ruleType),
1216
- },
1217
- Object.assign({ field: fieldsMap$c['config.fieldRatio'] }, getFieldRatioRule(rule, parentRule)),
1218
- {
1219
- type: 'switch',
1220
- title: '是否必填',
1221
- field: fieldsMap$c['effect.required'],
1222
- value: rule.effect.required,
1223
- },
1224
- ];
1225
- },
1226
- parse(rule) {
1227
- return {
1228
- name: name$c,
1229
- field: rule.field,
1230
- type: rule.type,
1231
- title: {
1232
- title: rule.title.title,
1233
- },
1234
- props: {
1235
- placeholder: rule.props.placeholder,
1236
- },
1237
- options: rule.options,
1238
- config: {
1239
- fieldRatio: rule.config.fieldRatio,
1240
- },
1241
- effect: {
1242
- required: rule.effect.required,
1243
- },
1244
- };
1245
- },
1246
- };
1247
-
1248
- const _hoisted_1$b = { class: "bm-default-date" };
1249
- const _sfc_main$d = /* @__PURE__ */ defineComponent({
1250
- __name: "default-date",
1251
- props: [
1252
- "defaultRadioValue",
1253
- "defalueDateValue",
1254
- "formCreateInject"
1255
- ],
1256
- emits: ["change"],
1257
- setup(__props, { emit: emits }) {
1258
- const props = __props;
1259
- const format = computed(
1260
- () => props.formCreateInject.api.getRule("props.format").value
1261
- );
1262
- const extraProps = computed(() => ({
1263
- picker: format.value === "YYYY-MM" ? "month" : "",
1264
- showTime: format.value === "YYYY-MM-DD HH:mm"
1265
- }));
1266
- const radioValue = ref(props.defaultRadioValue);
1267
- const dateValue = ref(props.defalueDateValue);
1268
- function emitChange(dateValue2) {
1269
- emits("change", radioValue.value, dateValue2);
1270
- }
1271
- function handleRadioChange(evt) {
1272
- radioValue.value = evt.target.value;
1273
- dateValue.value = "";
1274
- emitChange("");
1275
- }
1276
- function handleDateChange(date) {
1277
- dateValue.value = date;
1278
- emitChange(date);
1279
- }
1280
- function getPopupContainer() {
1281
- return document.body;
1282
- }
1283
- watch(format, () => {
1284
- handleDateChange("");
1285
- });
1286
- return (_ctx, _cache) => {
1287
- return openBlock(), createElementBlock("div", _hoisted_1$b, [
1288
- createVNode(unref(FormItemRest), null, {
1289
- default: withCtx(() => [
1290
- createVNode(unref(RadioGroup), {
1291
- value: radioValue.value,
1292
- onChange: handleRadioChange
1293
- }, {
1294
- default: withCtx(() => [
1295
- createVNode(unref(Radio), { value: 0 }, {
1296
- default: withCtx(() => [
1297
- createTextVNode(" \u5F53\u524D\u65F6\u95F4(\u5E74/\u6708/\u65E5) "),
1298
- createVNode(unref(Tooltip), null, {
1299
- title: withCtx(() => [
1300
- createTextVNode(" \u83B7\u53D6\u7528\u6237\u5B9E\u9645\u586B\u5199\u65F6\u7684\u65F6\u95F4 ")
1301
- ]),
1302
- default: withCtx(() => [
1303
- createVNode(unref(QuestionCircleOutlined), { style: { "color": "#babac1" } })
1304
- ]),
1305
- _: 1
1306
- })
1307
- ]),
1308
- _: 1
1309
- }),
1310
- createVNode(unref(Radio), { value: 1 }, {
1311
- default: withCtx(() => [
1312
- createTextVNode("\u81EA\u5B9A\u4E49")
1313
- ]),
1314
- _: 1
1315
- })
1316
- ]),
1317
- _: 1
1318
- }, 8, ["value"]),
1319
- radioValue.value === 1 ? (openBlock(), createBlock(unref(DatePicker), {
1320
- key: 0,
1321
- style: { width: "100%", marginTop: "8px" },
1322
- value: dateValue.value,
1323
- format: unref(format),
1324
- "value-format": unref(format),
1325
- picker: unref(extraProps).picker,
1326
- "show-time": unref(extraProps).showTime,
1327
- placeholder: "\u8BF7\u9009\u62E9",
1328
- "get-popup-container": getPopupContainer,
1329
- onChange: handleDateChange
1330
- }, null, 8, ["value", "format", "value-format", "picker", "show-time"])) : createCommentVNode("v-if", true)
1331
- ]),
1332
- _: 1
1333
- })
1334
- ]);
1335
- };
1336
- }
1337
- });
1338
- var DefaultDate = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__file", "default-date.vue"]]);
1339
-
1340
- const label$b = '日期';
1341
- const fieldsMap$b = {
1342
- 'title.title': 'title.title',
1343
- 'props.format': 'props.format',
1344
- 'props.placeholder': 'props.placeholder',
1345
- value: 'value',
1346
- 'config.defaultValue': 'config.defaultValue',
1347
- 'config.fieldRatio': 'config.fieldRatio',
1348
- 'effect.required': 'effect.required',
1349
- };
1350
- const name$b = 'date';
1351
- var date = {
1352
- icon: 'Date',
1353
- name: name$b,
1354
- label: label$b,
1355
- rule() {
1356
- return {
1357
- type: 'datePicker',
1358
- field: uniqueId(),
1359
- title: {
1360
- title: label$b,
1361
- style: {
1362
- overflow: 'hidden',
1363
- textOverflow: 'ellipsis',
1364
- whiteSpace: 'nowrap',
1365
- },
1366
- },
1367
- effect: {
1368
- required: false,
1369
- formRule: 'formRule',
1370
- },
1371
- props: {
1372
- placeholder: '请选择',
1373
- format: 'YYYY-MM',
1374
- valueFormat: 'YYYY-MM',
1375
- },
1376
- config: {
1377
- propsFields: Object.values(fieldsMap$b),
1378
- defaultValue: 1,
1379
- },
1380
- style: {
1381
- width: '100%',
1382
- },
1383
- };
1384
- },
1385
- props(rule, parentRule) {
1386
- return [
1387
- {
1388
- type: 'input',
1389
- title: '标题',
1390
- field: fieldsMap$b['title.title'],
1391
- value: rule.title.title,
1392
- effect: {
1393
- required: '请输入标题',
1394
- },
1395
- props: {
1396
- placeholder: '请输入',
1397
- maxlength: 10,
1398
- },
1399
- },
1400
- {
1401
- type: 'select',
1402
- title: '日期类型',
1403
- field: fieldsMap$b['props.format'],
1404
- effect: {
1405
- required: '请选择日期类型',
1406
- },
1407
- props: {
1408
- placeholder: '请选择',
1409
- },
1410
- options: [
1411
- {
1412
- value: 'YYYY-MM',
1413
- label: '年-月',
1414
- },
1415
- {
1416
- value: 'YYYY-MM-DD',
1417
- label: '年-月-日',
1418
- },
1419
- {
1420
- value: 'YYYY-MM-DD HH:mm',
1421
- label: '年-月-日 时:分',
1422
- },
1423
- ],
1424
- value: rule.props.format,
1425
- inject: true,
1426
- on: {
1427
- change({ api, self }, format) {
1428
- api.emit('props.valueFormat', format.value);
1429
- },
1430
- },
1431
- },
1432
- {
1433
- type: 'input',
1434
- title: '提示文字',
1435
- field: fieldsMap$b['props.placeholder'],
1436
- props: {
1437
- placeholder: '请输入',
1438
- maxlength: 30,
1439
- },
1440
- value: rule.props.placeholder,
1441
- },
1442
- {
1443
- type: 'DefaultDate',
1444
- component: DefaultDate,
1445
- title: '默认值',
1446
- field: fieldsMap$b['config.defaultValue'],
1447
- props: {
1448
- defaultRadioValue: rule.config.defaultValue,
1449
- defalueDateValue: rule.value,
1450
- },
1451
- inject: true,
1452
- on: {
1453
- change({ api, self }, radioValue, dateValue) {
1454
- self.props.defaultRadioValue = radioValue;
1455
- self.props.defalueDateValue = dateValue;
1456
- api.emit('change', 'config.defaultValue', radioValue, self, api, true);
1457
- api.emit('change', 'value', dateValue, self, api, true);
1458
- },
1459
- },
1460
- },
1461
- Object.assign({ field: fieldsMap$b['config.fieldRatio'] }, getFieldRatioRule(rule, parentRule)),
1462
- {
1463
- type: 'switch',
1464
- title: '是否必填',
1465
- field: fieldsMap$b['effect.required'],
1466
- value: rule.effect.required,
1467
- },
1468
- ];
1469
- },
1470
- parse(rule) {
1471
- return {
1472
- name: name$b,
1473
- field: rule.field,
1474
- title: {
1475
- title: rule.title.title,
1476
- },
1477
- props: {
1478
- format: rule.props.format,
1479
- placeholder: rule.props.placeholder,
1480
- },
1481
- value: rule.value,
1482
- config: {
1483
- defaultValue: rule.config.defaultValue,
1484
- fieldRatio: rule.config.fieldRatio,
1485
- },
1486
- effect: {
1487
- required: rule.effect.required,
1488
- },
1489
- };
1490
- },
1491
- };
1492
-
1493
- const label$a = '日期区间';
1494
- const fieldsMap$a = {
1495
- 'title.title': 'title.title',
1496
- 'props.format': 'props.format',
1497
- 'props.placeholder.0': 'props.placeholder.0',
1498
- 'props.placeholder.1': 'props.placeholder.1',
1499
- 'config.fieldRatio': 'config.fieldRatio',
1500
- 'effect.required': 'effect.required',
1501
- };
1502
- const name$a = 'dateRange';
1503
- var dateRange = {
1504
- icon: 'DateRange',
1505
- name: name$a,
1506
- label: label$a,
1507
- rule() {
1508
- return {
1509
- type: 'datePicker',
1510
- field: uniqueId(),
1511
- title: {
1512
- title: label$a,
1513
- style: {
1514
- overflow: 'hidden',
1515
- textOverflow: 'ellipsis',
1516
- whiteSpace: 'nowrap',
1517
- },
1518
- },
1519
- effect: {
1520
- required: false,
1521
- formRule: 'formRule',
1522
- },
1523
- props: {
1524
- range: true,
1525
- placeholder: ['开始日期', '结束日期'],
1526
- format: 'YYYY-MM',
1527
- separator: '~',
1528
- },
1529
- config: {
1530
- propsFields: Object.values(fieldsMap$a),
1531
- defaultValue: 1,
1532
- },
1533
- style: {
1534
- width: '100%',
1535
- },
1536
- };
1537
- },
1538
- props(rule, parentRule) {
1539
- return [
1540
- {
1541
- type: 'input',
1542
- title: '标题',
1543
- field: fieldsMap$a['title.title'],
1544
- value: rule.title.title,
1545
- effect: {
1546
- required: '请输入标题',
1547
- },
1548
- props: {
1549
- placeholder: '请输入',
1550
- maxlength: 10,
1551
- },
1552
- },
1553
- {
1554
- type: 'select',
1555
- title: '日期类型',
1556
- field: fieldsMap$a['props.format'],
1557
- effect: {
1558
- required: '请选择日期类型',
1559
- },
1560
- props: {
1561
- placeholder: '请选择',
1562
- },
1563
- options: [
1564
- {
1565
- value: 'YYYY-MM',
1566
- label: '年-月',
1567
- },
1568
- {
1569
- value: 'YYYY-MM-DD',
1570
- label: '年-月-日',
1571
- },
1572
- {
1573
- value: 'YYYY-MM-DD HH:mm',
1574
- label: '年-月-日 时:分',
1575
- },
1576
- ],
1577
- value: rule.props.format,
1578
- },
1579
- {
1580
- type: 'input',
1581
- title: '提示文字1',
1582
- field: fieldsMap$a['props.placeholder.0'],
1583
- props: {
1584
- placeholder: '请输入',
1585
- maxlength: 30,
1586
- },
1587
- value: rule.props.placeholder[0],
1588
- },
1589
- {
1590
- type: 'input',
1591
- title: '提示文字2',
1592
- field: fieldsMap$a['props.placeholder.1'],
1593
- props: {
1594
- placeholder: '请输入',
1595
- maxlength: 30,
1596
- },
1597
- value: rule.props.placeholder[1],
1598
- },
1599
- Object.assign({ field: fieldsMap$a['config.fieldRatio'] }, getFieldRatioRule(rule, parentRule)),
1600
- {
1601
- type: 'switch',
1602
- title: '是否必填',
1603
- field: fieldsMap$a['effect.required'],
1604
- value: rule.effect.required,
1605
- },
1606
- ];
1607
- },
1608
- parse(rule) {
1609
- return {
1610
- name: name$a,
1611
- field: rule.field,
1612
- title: {
1613
- title: rule.title.title,
1614
- },
1615
- props: {
1616
- format: rule.props.format,
1617
- placeholder: rule.props.placeholder,
1618
- },
1619
- config: {
1620
- fieldRatio: rule.config.fieldRatio,
1621
- },
1622
- effect: {
1623
- required: rule.effect.required,
1624
- },
1625
- };
1626
- },
1627
- };
1628
-
1629
- const label$9 = '说明文字';
1630
- const fieldsMap$9 = {
1631
- value: 'value',
1632
- 'style.color': 'style.color',
1633
- };
1634
- const name$9 = 'instruction';
1635
- var Colors;
1636
- (function (Colors) {
1637
- Colors["Black"] = "#242633";
1638
- Colors["Blue"] = "#2F4EED";
1639
- })(Colors || (Colors = {}));
1640
- var instruction = {
1641
- icon: 'Instruction',
1642
- name: name$9,
1643
- label: label$9,
1644
- rule() {
1645
- return {
1646
- field: uniqueId(),
1647
- config: {
1648
- propsFields: Object.values(fieldsMap$9),
1649
- },
1650
- style: {
1651
- color: Colors.Black,
1652
- },
1653
- value: '请输入说明文字',
1654
- };
1655
- },
1656
- props(rule, parentRule) {
1657
- return [
1658
- {
1659
- type: 'input',
1660
- props: {
1661
- type: 'textarea',
1662
- autoSize: {
1663
- minRows: 5,
1664
- },
1665
- },
1666
- effect: {
1667
- required: '请输入说明文字',
1668
- },
1669
- title: label$9,
1670
- field: fieldsMap$9.value,
1671
- value: rule.value,
1672
- inject: true,
1673
- prefix: {
1674
- type: 'TextColor',
1675
- on: {
1676
- change({ api, self }, color) {
1677
- api.emit('change', 'style.color', color, self, api, true);
1678
- },
1679
- },
1680
- props: {
1681
- color: rule.style.color,
1682
- },
1683
- },
1684
- on: {
1685
- change({ api, self }, list) {
1686
- nextTick(() => {
1687
- api.refresh();
1688
- });
1689
- },
1690
- },
1691
- },
1692
- ];
1693
- },
1694
- parse(rule) {
1695
- return {
1696
- name: name$9,
1697
- field: rule.field,
1698
- value: rule.value,
1699
- style: {
1700
- color: rule.style.color,
1701
- },
1702
- };
1703
- },
1704
- };
1705
-
1706
- const label$8 = '图片';
1707
- const fieldsMap$8 = {
1708
- 'title.title': 'title.title',
1709
- 'props.extraProps.maxCount': 'props.extraProps.maxCount',
1710
- 'effect.required': 'effect.required',
1711
- };
1712
- const name$8 = 'picture';
1713
- var picture = {
1714
- icon: 'Picture',
1715
- name: name$8,
1716
- label: label$8,
1717
- rule() {
1718
- return {
1719
- type: 'UploadPicture',
1720
- component: BmUpload,
1721
- field: uniqueId(),
1722
- title: {
1723
- title: label$8,
1724
- style: {
1725
- overflow: 'hidden',
1726
- textOverflow: 'ellipsis',
1727
- whiteSpace: 'nowrap',
1728
- },
1729
- },
1730
- effect: {
1731
- required: false,
1732
- formRule: 'formRule',
1733
- },
1734
- props: {
1735
- uploadProps: {
1736
- listType: 'picture-card',
1737
- text: '请选择',
1738
- },
1739
- extraProps: {
1740
- maxCount: 9,
1741
- },
1742
- },
1743
- config: {
1744
- propsFields: Object.values(fieldsMap$8),
1745
- },
1746
- };
1747
- },
1748
- props(rule, parentRule) {
1749
- return [
1750
- {
1751
- type: 'input',
1752
- title: '标题',
1753
- field: fieldsMap$8['title.title'],
1754
- value: rule.title.title,
1755
- effect: {
1756
- required: '请输入标题',
1757
- },
1758
- props: {
1759
- placeholder: '请输入',
1760
- maxlength: 10,
1761
- },
1762
- },
1763
- {
1764
- type: 'radio',
1765
- field: 'props.extraProps.maxCount',
1766
- title: '图片上传限制',
1767
- info: '单张图片的大小需在10M以内',
1768
- options: [
1769
- {
1770
- label: '最多可上传9张',
1771
- value: 9,
1772
- },
1773
- {
1774
- label: '仅允许上传1张图片',
1775
- value: 1,
1776
- },
1777
- ],
1778
- value: rule.props.extraProps.maxCount,
1779
- className: 'form-designer-props-radio-label',
1780
- inject: true,
1781
- on: {
1782
- change({ api, self }, { target }) {
1783
- const value = target.value;
1784
- self.value = value;
1785
- api.emit('change', self.field, value, self, api, true);
1786
- },
1787
- },
1788
- },
1789
- {
1790
- type: 'switch',
1791
- title: '是否必填',
1792
- field: fieldsMap$8['effect.required'],
1793
- value: rule.effect.required,
1794
- },
1795
- ];
1796
- },
1797
- parse(rule) {
1798
- return {
1799
- name: name$8,
1800
- field: rule.field,
1801
- title: {
1802
- title: rule.title.title,
1803
- },
1804
- props: {
1805
- extraProps: {
1806
- maxCount: rule.props.extraProps.maxCount,
1807
- },
1808
- },
1809
- effect: {
1810
- required: rule.effect.required,
1811
- },
1812
- };
1813
- },
1814
- };
1815
-
1816
- const _hoisted_1$a = { class: "bm-widget-table-wrap" };
1817
- const _hoisted_2$8 = { class: "bm-widget-table-top-bar" };
1818
- const _hoisted_3$5 = { class: "bm-widget-table-outer" };
1819
- const _hoisted_4$4 = { class: "bm-widget-table" };
1820
- const _hoisted_5$1 = {
1821
- key: 0,
1822
- class: "bm-widget-table__virtual"
1823
- };
1824
- const _hoisted_6$1 = /* @__PURE__ */ createElementVNode("div", { class: "bm-widget-table__virtual__head" }, null, -1);
1825
- const _hoisted_7$1 = /* @__PURE__ */ createElementVNode("div", { class: "bm-widget-table__virtual__content" }, null, -1);
1826
- const _hoisted_8 = [
1827
- _hoisted_6$1,
1828
- _hoisted_7$1
1829
- ];
1830
- const _hoisted_9 = {
1831
- key: 1,
1832
- class: "bm-widget-table__tip"
1833
- };
1834
- const _hoisted_10 = {
1835
- key: 0,
1836
- class: "bm-widget-table__checkbox"
1837
- };
1838
- const _hoisted_11 = { class: "bm-widget-table__checkbox__head" };
1839
- const _hoisted_12 = { class: "bm-widget-table__checkbox__content" };
1840
- const _hoisted_13 = { class: "bm-widget-table__operateColumn" };
1841
- const _hoisted_14 = /* @__PURE__ */ createElementVNode("div", { class: "bm-widget-table__operateColumn__head" }, "\u64CD\u4F5C", -1);
1842
- const _hoisted_15 = { class: "bm-widget-table__operateColumn__content" };
1843
- const _hoisted_16 = /* @__PURE__ */ createElementVNode("a", null, "\u590D\u5236", -1);
1844
- const _hoisted_17 = /* @__PURE__ */ createElementVNode("span", null, null, -1);
1845
- const _hoisted_18 = /* @__PURE__ */ createElementVNode("a", null, "\u5220\u9664", -1);
1846
- const _sfc_main$c = /* @__PURE__ */ defineComponent({
1847
- __name: "widget-table",
1848
- props: ["formCreateInject", "activeRuleField"],
1849
- emits: [
1850
- "add",
1851
- "mouseenter",
1852
- "mouseleave",
1853
- "set-active-rule",
1854
- "copy",
1855
- "delete"
1856
- ],
1857
- setup(__props, { emit: emits }) {
1858
- const props = __props;
1859
- const tableRule = computed(() => props.formCreateInject.rule);
1860
- const childRules = computed(() => tableRule.value.config.childRules);
1861
- const showDelete = computed(() => showFeature("delete"));
1862
- const showImport = computed(() => showFeature("import"));
1863
- const showCopy = computed(() => showFeature("copy"));
1864
- function showFeature(featureId) {
1865
- return tableRule.value.config.tableAdvancedFeatures.includes(featureId);
1866
- }
1867
- function handleAdd({ newIndex }) {
1868
- emits("add", childRules.value[newIndex], tableRule.value);
1869
- }
1870
- function handleMouseenter() {
1871
- emits("mouseenter");
1872
- }
1873
- function handleMouseleave() {
1874
- emits("mouseleave");
1875
- }
1876
- function emitSetActiveRuleEvt(rule) {
1877
- emits("set-active-rule", rule, tableRule.value);
1878
- }
1879
- function handleClick(element) {
1880
- emitSetActiveRuleEvt(element);
1881
- }
1882
- function handleUpdate({ newIndex }) {
1883
- emitSetActiveRuleEvt(childRules.value[newIndex]);
1884
- }
1885
- function handleCopy(rule) {
1886
- emits("copy", rule, tableRule.value);
1887
- }
1888
- function handleDelete(rule) {
1889
- emits("delete", rule, tableRule.value);
1890
- }
1891
- return (_ctx, _cache) => {
1892
- return openBlock(), createElementBlock("div", _hoisted_1$a, [
1893
- createElementVNode("div", _hoisted_2$8, [
1894
- createVNode(unref(Button), { type: "primary" }, {
1895
- icon: withCtx(() => [
1896
- createVNode(unref(PlusOutlined))
1897
- ]),
1898
- default: withCtx(() => [
1899
- createTextVNode(" \u65B0\u589E ")
1900
- ]),
1901
- _: 1
1902
- }),
1903
- unref(showDelete) ? (openBlock(), createBlock(unref(Button), { key: 0 }, {
1904
- default: withCtx(() => [
1905
- createTextVNode(" \u6279\u91CF\u5220\u9664 ")
1906
- ]),
1907
- _: 1
1908
- })) : createCommentVNode("v-if", true),
1909
- unref(showImport) ? (openBlock(), createBlock(unref(Button), { key: 1 }, {
1910
- default: withCtx(() => [
1911
- createTextVNode(" \u6279\u91CF\u5BFC\u5165 ")
1912
- ]),
1913
- _: 1
1914
- })) : createCommentVNode("v-if", true),
1915
- unref(showImport) ? (openBlock(), createBlock(unref(Button), { key: 2 }, {
1916
- default: withCtx(() => [
1917
- createTextVNode(" \u4E0B\u8F7D\u5BFC\u5165\u6A21\u677F ")
1918
- ]),
1919
- _: 1
1920
- })) : createCommentVNode("v-if", true)
1921
- ]),
1922
- createElementVNode("div", _hoisted_3$5, [
1923
- createElementVNode("div", {
1924
- class: "bm-widget-table-inner",
1925
- style: normalizeStyle({
1926
- paddingLeft: unref(showDelete) ? "32px" : 0,
1927
- paddingRight: unref(showCopy) ? "81px" : "60px"
1928
- })
1929
- }, [
1930
- createElementVNode("div", _hoisted_4$4, [
1931
- unref(childRules).length ? (openBlock(), createElementBlock("div", _hoisted_5$1, _hoisted_8)) : (openBlock(), createElementBlock("div", _hoisted_9, "\u53EF\u62D6\u5165\u591A\u4E2A\u63A7\u4EF6")),
1932
- createVNode(unref(Draggable), {
1933
- "component-data": {
1934
- field: unref(tableRule).field,
1935
- type: unref(WidgetType).TableWidget
1936
- },
1937
- class: "bm-widget-table__drag-content",
1938
- group: {
1939
- name: "tableWidget",
1940
- pull: true,
1941
- put: ["widget", "tableWidget"]
1942
- },
1943
- list: unref(childRules),
1944
- "ghost-class": unref(childRules).length ? "table-drag-ghost" : "table-drag-ghost__is-empty",
1945
- "item-key": "field",
1946
- direction: "vertical",
1947
- "force-fallback": true,
1948
- "scroll-sensitivity": 100,
1949
- delay: 50,
1950
- onAdd: handleAdd,
1951
- onUpdate: handleUpdate
1952
- }, {
1953
- item: withCtx(({ element }) => [
1954
- createElementVNode("div", {
1955
- class: normalizeClass(["bm-widget-table__drag-item", { "no-label": !element?.title?.title }]),
1956
- style: normalizeStyle({ width: element.config.fieldRatio })
1957
- }, [
1958
- createVNode(DragTool, {
1959
- rule: element,
1960
- "active-rule-field": __props.activeRuleField,
1961
- "parent-rule": __props.formCreateInject.rule,
1962
- onMouseenter: handleMouseenter,
1963
- onMouseleave: handleMouseleave,
1964
- onClick: withModifiers(($event) => handleClick(element), ["stop"]),
1965
- onCopy: handleCopy,
1966
- onDelete: handleDelete
1967
- }, null, 8, ["rule", "active-rule-field", "parent-rule", "onClick"]),
1968
- createVNode(DragPlaceholder)
1969
- ], 6)
1970
- ]),
1971
- _: 1
1972
- }, 8, ["component-data", "list", "ghost-class"])
1973
- ])
1974
- ], 4),
1975
- unref(showDelete) ? (openBlock(), createElementBlock("div", _hoisted_10, [
1976
- createElementVNode("div", _hoisted_11, [
1977
- createVNode(unref(FormItemRest), null, {
1978
- default: withCtx(() => [
1979
- createVNode(unref(Checkbox))
1980
- ]),
1981
- _: 1
1982
- })
1983
- ]),
1984
- createElementVNode("div", _hoisted_12, [
1985
- createVNode(unref(FormItemRest), null, {
1986
- default: withCtx(() => [
1987
- createVNode(unref(Checkbox))
1988
- ]),
1989
- _: 1
1990
- })
1991
- ])
1992
- ])) : createCommentVNode("v-if", true),
1993
- createElementVNode("div", _hoisted_13, [
1994
- _hoisted_14,
1995
- createElementVNode("div", _hoisted_15, [
1996
- unref(showCopy) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
1997
- _hoisted_16,
1998
- _hoisted_17
1999
- ], 64)) : createCommentVNode("v-if", true),
2000
- _hoisted_18
2001
- ])
2002
- ])
2003
- ])
2004
- ]);
2005
- };
2006
- }
2007
- });
2008
- var WidgetTable = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__file", "widget-table.vue"]]);
2009
-
2010
- const label$7 = '表格';
2011
- const fieldsMap$7 = {
2012
- 'title.title': 'title.title',
2013
- 'config.childRules': 'config.childRules',
2014
- 'config.tableAdvancedFeatures': 'config.tableAdvancedFeatures',
2015
- };
2016
- const name$7 = 'table';
2017
- var table = {
2018
- icon: 'Table',
2019
- name: name$7,
2020
- label: label$7,
2021
- rule() {
2022
- const childRules = [];
2023
- return {
2024
- type: WidgetType.TableWidget,
2025
- component: WidgetTable,
2026
- field: uniqueId(),
2027
- title: {
2028
- type: 'TableHeadCount',
2029
- title: label$7,
2030
- props: {
2031
- childRules,
2032
- },
2033
- style: {
2034
- overflow: 'hidden',
2035
- textOverflow: 'ellipsis',
2036
- whiteSpace: 'nowrap',
2037
- },
2038
- },
2039
- effect: {
2040
- formRule: 'formRule',
2041
- },
2042
- config: {
2043
- childRules,
2044
- tableAdvancedFeatures: ['copy', 'delete', 'import'],
2045
- propsFields: Object.values(fieldsMap$7),
2046
- },
2047
- emit: [
2048
- 'mouseenter',
2049
- 'mouseleave',
2050
- 'set-active-rule',
2051
- 'copy',
2052
- 'delete',
2053
- 'add',
2054
- ],
2055
- emitPrefix: 'nest',
2056
- };
2057
- },
2058
- props(rule) {
2059
- return [
2060
- {
2061
- type: 'input',
2062
- title: '标题',
2063
- field: fieldsMap$7['title.title'],
2064
- value: rule.title.title,
2065
- effect: {
2066
- required: '请输入标题',
2067
- },
2068
- props: {
2069
- placeholder: '请输入',
2070
- maxlength: 10,
2071
- },
2072
- },
2073
- {
2074
- type: 'TableColumn',
2075
- title: '子字段设置',
2076
- field: fieldsMap$7['config.childRules'],
2077
- effect: {
2078
- required: true,
2079
- },
2080
- inject: true,
2081
- value: rule.config.childRules,
2082
- on: {
2083
- change({ api, self }, list) {
2084
- nextTick(() => {
2085
- setTimeout(() => {
2086
- api.validate();
2087
- });
2088
- });
2089
- },
2090
- childRuleDelete({ api }, rule) {
2091
- api.emit('tableChildRuleDelete', rule);
2092
- },
2093
- },
2094
- },
2095
- {
2096
- type: 'checkbox',
2097
- title: '表格的高级操作',
2098
- field: fieldsMap$7['config.tableAdvancedFeatures'],
2099
- value: rule.config.tableAdvancedFeatures,
2100
- options: [
2101
- {
2102
- value: 'copy',
2103
- label: '复制行',
2104
- },
2105
- {
2106
- value: 'delete',
2107
- label: '批量删除',
2108
- },
2109
- {
2110
- value: 'import',
2111
- label: '批量导入',
2112
- },
2113
- ],
2114
- className: 'bfd-sider-right__form__table-checkbox',
2115
- },
2116
- ];
2117
- },
2118
- parse(rule) {
2119
- return {
2120
- name: name$7,
2121
- field: rule.field,
2122
- title: {
2123
- title: rule.title.title,
2124
- },
2125
- config: {
2126
- tableAdvancedFeatures: rule.config.tableAdvancedFeatures,
2127
- },
2128
- };
2129
- },
2130
- };
2131
-
2132
- const label$6 = '附件';
2133
- const fieldsMap$6 = {
2134
- 'title.title': 'title.title',
2135
- 'effect.required': 'effect.required',
2136
- };
2137
- const name$6 = 'file';
2138
- var file = {
2139
- icon: 'File',
2140
- name: name$6,
2141
- label: label$6,
2142
- rule() {
2143
- return {
2144
- type: WidgetType.UploadFile,
2145
- component: BmUpload,
2146
- field: uniqueId(),
2147
- title: {
2148
- title: label$6,
2149
- style: {
2150
- overflow: 'hidden',
2151
- textOverflow: 'ellipsis',
2152
- whiteSpace: 'nowrap',
2153
- },
2154
- },
2155
- effect: {
2156
- required: false,
2157
- formRule: 'formRule',
2158
- },
2159
- config: {
2160
- propsFields: Object.values(fieldsMap$6),
2161
- },
2162
- };
2163
- },
2164
- props(rule, parentRule) {
2165
- return [
2166
- {
2167
- type: 'input',
2168
- title: '标题',
2169
- field: fieldsMap$6['title.title'],
2170
- value: rule.title.title,
2171
- effect: {
2172
- required: '请输入标题',
2173
- },
2174
- props: {
2175
- placeholder: '请输入',
2176
- maxlength: 10,
2177
- },
2178
- },
2179
- {
2180
- type: 'switch',
2181
- title: '是否必填',
2182
- field: fieldsMap$6['effect.required'],
2183
- value: rule.effect.required,
2184
- },
2185
- ];
2186
- },
2187
- parse(rule) {
2188
- return {
2189
- name: name$6,
2190
- field: rule.field,
2191
- title: {
2192
- title: rule.title.title,
2193
- },
2194
- effect: {
2195
- required: rule.effect.required,
2196
- },
2197
- };
2198
- },
2199
- };
2200
-
2201
- const label$5 = '员工';
2202
- const fieldsMap$5 = {
2203
- 'title.title': 'title.title',
2204
- 'props.placeholder': 'props.placeholder',
2205
- 'props.limit': 'props.limit',
2206
- 'config.fieldRatio': 'config.fieldRatio',
2207
- 'effect.required': 'effect.required',
2208
- };
2209
- const name$5 = 'people';
2210
- var people = {
2211
- icon: 'People',
2212
- name: name$5,
2213
- label: label$5,
2214
- rule() {
2215
- return {
2216
- type: 'select',
2217
- field: uniqueId(),
2218
- title: {
2219
- title: label$5,
2220
- style: {
2221
- overflow: 'hidden',
2222
- textOverflow: 'ellipsis',
2223
- whiteSpace: 'nowrap',
2224
- },
2225
- },
2226
- effect: {
2227
- required: false,
2228
- formRule: 'formRule',
2229
- },
2230
- props: {
2231
- limit: 0,
2232
- placeholder: '请选择',
2233
- },
2234
- config: {
2235
- propsFields: Object.values(fieldsMap$5),
2236
- },
2237
- };
2238
- },
2239
- props(rule, parentRule) {
2240
- return [
2241
- {
2242
- type: 'input',
2243
- title: '标题',
2244
- field: fieldsMap$5['title.title'],
2245
- value: rule.title.title,
2246
- effect: {
2247
- required: '请输入标题',
2248
- },
2249
- props: {
2250
- placeholder: '请输入',
2251
- maxlength: 10,
2252
- },
2253
- },
2254
- {
2255
- type: 'input',
2256
- title: '提示文字',
2257
- field: fieldsMap$5['props.placeholder'],
2258
- props: {
2259
- placeholder: '请输入',
2260
- maxlength: 30,
2261
- },
2262
- value: rule.props.placeholder,
2263
- },
2264
- {
2265
- type: 'radio',
2266
- title: '选项',
2267
- field: fieldsMap$5['props.limit'],
2268
- options: [
2269
- {
2270
- value: 1,
2271
- label: '只能选择一人',
2272
- },
2273
- {
2274
- value: 0,
2275
- label: '可同时选择多人',
2276
- },
2277
- ],
2278
- value: rule.props.limit,
2279
- effect: {
2280
- required: true,
2281
- },
2282
- inject: true,
2283
- on: {
2284
- change({ api, self }, { target }) {
2285
- const value = target.value;
2286
- self.value = value;
2287
- api.emit('change', self.field, value, self, api, true);
2288
- },
2289
- },
2290
- className: 'form-designer-props-radio-label',
2291
- },
2292
- Object.assign({ field: fieldsMap$5['config.fieldRatio'] }, getFieldRatioRule(rule, parentRule)),
2293
- {
2294
- type: 'switch',
2295
- title: '是否必填',
2296
- info: '勾选后可作为流程条件',
2297
- field: fieldsMap$5['effect.required'],
2298
- value: rule.effect.required,
2299
- },
2300
- ];
2301
- },
2302
- parse(rule) {
2303
- return {
2304
- name: name$5,
2305
- field: rule.field,
2306
- title: {
2307
- title: rule.title.title,
2308
- },
2309
- props: {
2310
- placeholder: rule.props.placeholder,
2311
- limit: rule.props.limit,
2312
- },
2313
- config: {
2314
- fieldRatio: rule.config.fieldRatio,
2315
- },
2316
- effect: {
2317
- required: rule.effect.required,
2318
- },
2319
- };
2320
- },
2321
- };
2322
-
2323
- const label$4 = '部门';
2324
- const fieldsMap$4 = {
2325
- 'title.title': 'title.title',
2326
- 'props.placeholder': 'props.placeholder',
2327
- 'props.limit': 'props.limit',
2328
- 'config.fieldRatio': 'config.fieldRatio',
2329
- 'effect.required': 'effect.required',
2330
- };
2331
- const name$4 = 'department';
2332
- var department = {
2333
- icon: 'Department',
2334
- name: name$4,
2335
- label: label$4,
2336
- rule() {
2337
- return {
2338
- type: 'select',
2339
- field: uniqueId(),
2340
- title: {
2341
- title: label$4,
2342
- style: {
2343
- overflow: 'hidden',
2344
- textOverflow: 'ellipsis',
2345
- whiteSpace: 'nowrap',
2346
- },
2347
- },
2348
- effect: {
2349
- required: false,
2350
- formRule: 'formRule',
2351
- },
2352
- props: {
2353
- limit: 0,
2354
- placeholder: '请选择',
2355
- },
2356
- config: {
2357
- propsFields: Object.values(fieldsMap$4),
2358
- },
2359
- };
2360
- },
2361
- props(rule, parentRule) {
2362
- return [
2363
- {
2364
- type: 'input',
2365
- title: '标题',
2366
- field: fieldsMap$4['title.title'],
2367
- value: rule.title.title,
2368
- effect: {
2369
- required: '请输入标题',
2370
- },
2371
- props: {
2372
- placeholder: '请输入',
2373
- maxlength: 10,
2374
- },
2375
- },
2376
- {
2377
- type: 'input',
2378
- title: '提示文字',
2379
- field: fieldsMap$4['props.placeholder'],
2380
- props: {
2381
- placeholder: '请输入',
2382
- maxlength: 30,
2383
- },
2384
- value: rule.props.placeholder,
2385
- },
2386
- {
2387
- type: 'radio',
2388
- title: '选项',
2389
- field: fieldsMap$4['props.limit'],
2390
- options: [
2391
- {
2392
- value: 1,
2393
- label: '只能选择一部门',
2394
- },
2395
- {
2396
- value: 0,
2397
- label: '可同时选择多个部门',
2398
- },
2399
- ],
2400
- value: rule.props.limit,
2401
- effect: {
2402
- required: true,
2403
- },
2404
- inject: true,
2405
- on: {
2406
- change({ api, self }, { target }) {
2407
- const value = target.value;
2408
- self.value = value;
2409
- api.emit('change', self.field, value, self, api, true);
2410
- },
2411
- },
2412
- className: 'form-designer-props-radio-label',
2413
- },
2414
- Object.assign({ field: fieldsMap$4['config.fieldRatio'] }, getFieldRatioRule(rule, parentRule)),
2415
- {
2416
- type: 'switch',
2417
- title: '是否必填',
2418
- info: '勾选后可作为流程条件',
2419
- field: fieldsMap$4['effect.required'],
2420
- value: rule.effect.required,
2421
- },
2422
- ];
2423
- },
2424
- parse(rule) {
2425
- return {
2426
- name: name$4,
2427
- field: rule.field,
2428
- title: {
2429
- title: rule.title.title,
2430
- },
2431
- props: {
2432
- placeholder: rule.props.placeholder,
2433
- limit: rule.props.limit,
2434
- },
2435
- config: {
2436
- fieldRatio: rule.config.fieldRatio,
2437
- },
2438
- effect: {
2439
- required: rule.effect.required,
2440
- },
2441
- };
2442
- },
2443
- };
2444
-
2445
- const _hoisted_1$9 = { style: { "margin-top": "16px", "line-height": "32px" } };
2446
- const _hoisted_2$7 = { style: { "float": "right" } };
2447
- const _hoisted_3$4 = /* @__PURE__ */ createElementVNode("div", { class: "bm-material-temp__table-tip" }, "\u7CFB\u7EDF\u81EA\u52A8\u83B7\u53D6\u8868\u683C\u5B57\u6BB5", -1);
2448
- const _hoisted_4$3 = { class: "bm-material-temp__add" };
2449
- const _sfc_main$b = /* @__PURE__ */ defineComponent({
2450
- __name: "widget-material-temp",
2451
- props: ["formCreateInject"],
2452
- setup(__props) {
2453
- const props = __props;
2454
- const panes = [
2455
- {
2456
- key: "\u7D20\u67501",
2457
- title: "\u7D20\u67501"
2458
- }
2459
- ];
2460
- let activeKey = "\u7D20\u67501";
2461
- const option = {
2462
- form: {
2463
- layout: "vertical"
2464
- },
2465
- submitBtn: {
2466
- show: false
2467
- },
2468
- row: {
2469
- gutter: [24, 24]
2470
- },
2471
- col: {
2472
- span: 12
2473
- }
2474
- };
2475
- const uploadPicField = "uploadPicture";
2476
- const rules = ref([
2477
- {
2478
- type: "button",
2479
- field: "materialTemp",
2480
- title: "\u7D20\u6750\u6A21\u677F",
2481
- effect: {
2482
- required: true
2483
- },
2484
- children: [
2485
- {
2486
- type: "PlusOutlined",
2487
- component: PlusOutlined
2488
- },
2489
- "\u9009\u62E9\u6A21\u677F"
2490
- ]
2491
- },
2492
- {
2493
- type: "span",
2494
- field: "materialType",
2495
- title: "\u7D20\u6750\u7C7B\u578B",
2496
- children: ["\u7CFB\u7EDF\u81EA\u52A8\u83B7\u53D6"],
2497
- style: {
2498
- color: "#9393A3"
2499
- }
2500
- },
2501
- {
2502
- type: "span",
2503
- field: "size",
2504
- title: "\u5C3A\u5BF8",
2505
- children: ["\u7CFB\u7EDF\u81EA\u52A8\u83B7\u53D6"],
2506
- style: {
2507
- color: "#9393A3"
2508
- }
2509
- },
2510
- {
2511
- type: "span",
2512
- field: "coverPicture",
2513
- title: "\u5C01\u9762\u56FE",
2514
- children: ["\u7CFB\u7EDF\u81EA\u52A8\u83B7\u53D6"],
2515
- style: {
2516
- color: "#9393A3"
2517
- }
2518
- },
2519
- {
2520
- type: "span",
2521
- field: "templateStructureDiagram",
2522
- title: "\u6A21\u677F\u7ED3\u6784\u56FE",
2523
- children: ["\u7CFB\u7EDF\u81EA\u52A8\u83B7\u53D6"],
2524
- style: {
2525
- color: "#9393A3"
2526
- }
2527
- },
2528
- {
2529
- hidden: false,
2530
- type: "UploadPicture",
2531
- component: BmUpload,
2532
- field: uploadPicField,
2533
- title: "\u4E0A\u4F20\u53C2\u8003\u56FE",
2534
- effect: {
2535
- required: false
2536
- },
2537
- props: {
2538
- uploadProps: {
2539
- listType: "picture-card",
2540
- text: "\u4E0A\u4F20\u7167\u7247"
2541
- },
2542
- extraProps: {
2543
- maxSize: 9
2544
- }
2545
- }
2546
- }
2547
- ]);
2548
- function getUploadPicRule() {
2549
- return rules.value.find((rule) => rule.field === uploadPicField);
2550
- }
2551
- function handleUploadPicRule(uploadPictureRule) {
2552
- const uploadPicRule = getUploadPicRule();
2553
- uploadPicRule.effect.required = uploadPictureRule.required;
2554
- uploadPicRule.hidden = uploadPictureRule.hidden;
2555
- rules.value = [...rules.value];
2556
- }
2557
- watch(
2558
- () => props.formCreateInject.rule.config.uploadPictureRule,
2559
- handleUploadPicRule,
2560
- {
2561
- deep: true,
2562
- immediate: true
2563
- }
2564
- );
2565
- return (_ctx, _cache) => {
2566
- const _component_FormCreate = resolveComponent("FormCreate");
2567
- return openBlock(), createBlock(unref(Tabs), {
2568
- activeKey: unref(activeKey),
2569
- "onUpdate:activeKey": _cache[0] || (_cache[0] = ($event) => isRef(activeKey) ? activeKey.value = $event : activeKey = $event),
2570
- class: "bm-material-temp",
2571
- type: "editable-card",
2572
- "hide-add": "",
2573
- size: "small"
2574
- }, {
2575
- rightExtra: withCtx(() => [
2576
- createElementVNode("span", _hoisted_4$3, [
2577
- createVNode(unref(PlusOutlined))
2578
- ])
2579
- ]),
2580
- default: withCtx(() => [
2581
- (openBlock(), createElementBlock(Fragment, null, renderList(panes, (pane) => {
2582
- return createVNode(unref(TabPane), {
2583
- key: pane.key,
2584
- tab: pane.title
2585
- }, {
2586
- default: withCtx(() => [
2587
- createVNode(_component_FormCreate, {
2588
- option,
2589
- rule: rules.value
2590
- }, null, 8, ["rule"]),
2591
- createElementVNode("div", _hoisted_1$9, [
2592
- createTextVNode(" \u660E\u7EC6\u5217\u8868 "),
2593
- createElementVNode("div", _hoisted_2$7, [
2594
- createVNode(unref(Button), null, {
2595
- default: withCtx(() => [
2596
- createTextVNode(" \u4E0B\u8F7D\u5BFC\u5165\u6A21\u677F ")
2597
- ]),
2598
- _: 1
2599
- }),
2600
- createVNode(unref(Button), null, {
2601
- default: withCtx(() => [
2602
- createTextVNode(" \u5BFC\u5165\u660E\u7EC6 ")
2603
- ]),
2604
- _: 1
2605
- }),
2606
- createVNode(unref(Button), null, {
2607
- default: withCtx(() => [
2608
- createTextVNode(" \u6279\u91CF\u5220\u9664 ")
2609
- ]),
2610
- _: 1
2611
- }),
2612
- createVNode(unref(Button), { type: "primary" }, {
2613
- default: withCtx(() => [
2614
- createVNode(unref(PlusOutlined)),
2615
- createTextVNode(" \u65B0\u589E ")
2616
- ]),
2617
- _: 1
2618
- })
2619
- ])
2620
- ]),
2621
- _hoisted_3$4
2622
- ]),
2623
- _: 2
2624
- }, 1032, ["tab"]);
2625
- }), 64))
2626
- ]),
2627
- _: 1
2628
- }, 8, ["activeKey"]);
2629
- };
2630
- }
2631
- });
2632
- var WidgetMaterialTemp = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__file", "widget-material-temp.vue"]]);
2633
-
2634
- const _hoisted_1$8 = { class: "bm-use-instruction" };
2635
- const _hoisted_2$6 = { class: "bm-use-instruction__title" };
2636
- const _sfc_main$a = /* @__PURE__ */ defineComponent({
2637
- __name: "use-instruction",
2638
- setup(__props) {
2639
- return (_ctx, _cache) => {
2640
- return openBlock(), createElementBlock("div", _hoisted_1$8, [
2641
- createElementVNode("div", _hoisted_2$6, [
2642
- createVNode(unref(InfoCircleFilled), { class: "bm-use-instruction__title__icon" }),
2643
- createTextVNode(" \u4F7F\u7528\u8BF4\u660E ")
2644
- ]),
2645
- renderSlot(_ctx.$slots, "default")
2646
- ]);
2647
- };
2648
- }
2649
- });
2650
- var UseInstruction = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__file", "use-instruction.vue"]]);
2651
-
2652
- const label$3 = '素材模板';
2653
- const fieldsMap$3 = {
2654
- 'config.uploadPictureRule.required': 'config.uploadPictureRule.required',
2655
- 'config.uploadPictureRule.hidden': 'config.uploadPictureRule.hidden',
2656
- };
2657
- const name$3 = 'materialTemp';
2658
- var materialTemp = {
2659
- icon: 'MaterialTemp',
2660
- name: name$3,
2661
- label: label$3,
2662
- rule() {
2663
- return {
2664
- type: 'WidgetMaterialTemp',
2665
- component: WidgetMaterialTemp,
2666
- title: {
2667
- title: label$3,
2668
- },
2669
- field: uniqueId(),
2670
- config: {
2671
- propsFields: Object.values(fieldsMap$3),
2672
- uploadPictureRule: {
2673
- required: false,
2674
- hidden: false,
2675
- },
2676
- },
2677
- };
2678
- },
2679
- props(rule) {
2680
- return [
2681
- {
2682
- type: 'UseInstruction',
2683
- component: UseInstruction,
2684
- children: [
2685
- {
2686
- type: 'span',
2687
- children: [
2688
- '·该套件打通店铺与素材模板的数据关联,可根据店铺获取该店铺可用的素材模板。',
2689
- ],
2690
- },
2691
- {
2692
- type: 'span',
2693
- children: [
2694
- '·满足一个素材申请单可使用多个素材类型对应的素材模板申请素材。',
2695
- ],
2696
- style: {
2697
- display: 'inline-block',
2698
- marginTop: '8px',
2699
- },
2700
- },
2701
- ],
2702
- style: {
2703
- marginBottom: '24px',
2704
- },
2705
- },
2706
- {
2707
- type: 'span',
2708
- title: '素材模板',
2709
- field: 'materialTemp',
2710
- children: [
2711
- '用于选择对应可用的素材模板信息(编号、名称、尺寸、封面图、结构图)。此项必填并获取所选择的模板的编号及名称显示。',
2712
- ],
2713
- style: {
2714
- color: '#505259',
2715
- },
2716
- },
2717
- {
2718
- type: 'span',
2719
- title: '素材类型/尺寸/封面图/结构图',
2720
- field: 'systemGeneration',
2721
- children: ['通过所选模板,系统自动获取此模板对应的相关内容。'],
2722
- style: {
2723
- color: '#505259',
2724
- },
2725
- },
2726
- {
2727
- type: 'span',
2728
- title: '上传参考图',
2729
- field: 'uploadPicture',
2730
- prefix: {
2731
- type: 'CheckboxSwitch',
2732
- props: {
2733
- rule,
2734
- },
2735
- },
2736
- children: ['用于上传当次申请的素材参考的图片。可最多上传9张图。'],
2737
- style: {
2738
- color: '#505259',
2739
- },
2740
- },
2741
- {
2742
- type: 'span',
2743
- title: '明细列表',
2744
- field: 'detailList',
2745
- children: [
2746
- '根据所选的素材模板,系统自动获取该模板需填写的内容字段列表以及批量导入的模板。列表允许操作:下载所选素材模板的导入模板、批量导入明细、新增、编辑、删除。',
2747
- ],
2748
- style: {
2749
- color: '#505259',
2750
- },
2751
- },
2752
- ];
2753
- },
2754
- parse(rule) {
2755
- return {
2756
- name: name$3,
2757
- field: rule.field,
2758
- config: {
2759
- uploadPictureRule: {
2760
- hidden: rule.config.uploadPictureRule.hidden,
2761
- required: rule.config.uploadPictureRule.required,
2762
- },
2763
- },
2764
- };
2765
- },
2766
- };
2767
-
2768
- const _hoisted_1$7 = /* @__PURE__ */ createElementVNode("div", { class: "bm-product-info-item__title" }, "\u5546\u54C1\u7F16\u53F7", -1);
2769
- const _hoisted_2$5 = { class: "bm-product-info-item__content" };
2770
- const _hoisted_3$3 = { class: "bm-product-info-item__title" };
2771
- const _hoisted_4$2 = /* @__PURE__ */ createElementVNode("div", { class: "bm-product-info-item__content" }, "\u7CFB\u7EDF\u81EA\u52A8\u5E26\u51FA", -1);
2772
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
2773
- __name: "product-info",
2774
- props: ["formCreateInject"],
2775
- setup(__props) {
2776
- const props = __props;
2777
- const isInTable = computed(
2778
- () => props.formCreateInject.api.config.parentType === "TableWidget"
2779
- );
2780
- return (_ctx, _cache) => {
2781
- return unref(isInTable) ? (openBlock(), createBlock(unref(Input), {
2782
- key: 0,
2783
- placeholder: "\u8BF7\u8F93\u5165"
2784
- })) : (openBlock(), createBlock(unref(Row), { key: 1 }, {
2785
- default: withCtx(() => [
2786
- createVNode(unref(Col), {
2787
- class: "bm-product-info-item",
2788
- span: 12
2789
- }, {
2790
- default: withCtx(() => [
2791
- _hoisted_1$7,
2792
- createElementVNode("div", _hoisted_2$5, [
2793
- createVNode(unref(Input), { placeholder: "\u8BF7\u8F93\u5165\u5546\u54C1\u7F16\u53F7" })
2794
- ])
2795
- ]),
2796
- _: 1
2797
- }),
2798
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.formCreateInject.rule.config.associatedFields, (item) => {
2799
- return openBlock(), createBlock(unref(Col), {
2800
- key: item.value,
2801
- class: "bm-product-info-item",
2802
- span: 12
2803
- }, {
2804
- default: withCtx(() => [
2805
- createElementVNode("div", _hoisted_3$3, toDisplayString(item.label), 1),
2806
- _hoisted_4$2
2807
- ]),
2808
- _: 2
2809
- }, 1024);
2810
- }), 128))
2811
- ]),
2812
- _: 1
2813
- }));
2814
- };
2815
- }
2816
- });
2817
- var ProductInfo = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__file", "product-info.vue"]]);
2818
-
2819
- const _hoisted_1$6 = /* @__PURE__ */ createElementVNode("div", { class: "bm-associated-fields-item" }, [
2820
- /* @__PURE__ */ createElementVNode("span", { class: "bm-associated-fields-item__content" }, "\u5546\u54C1\u7F16\u53F7")
2821
- ], -1);
2822
- const _hoisted_2$4 = { class: "bm-associated-fields-item__content" };
2823
- const _hoisted_3$2 = { style: { "text-align": "right", "margin": "6px 0 4px", "padding-right": "8px" } };
2824
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
2825
- __name: "associated-fields",
2826
- props: ["associatedFields"],
2827
- emits: ["change"],
2828
- setup(__props, { emit: emits }) {
2829
- const props = __props;
2830
- const visible = ref(false);
2831
- const checkList = ref([]);
2832
- const options = [
2833
- {
2834
- value: "\u5546\u54C1\u540D\u79F0",
2835
- label: "\u5546\u54C1\u540D\u79F0"
2836
- },
2837
- {
2838
- value: "\u5546\u54C1\u7B80\u79F0",
2839
- label: "\u5546\u54C1\u7B80\u79F0"
2840
- },
2841
- {
2842
- value: "\u5546\u54C1\u56FE\u7247",
2843
- label: "\u5546\u54C1\u56FE\u7247"
2844
- },
2845
- {
2846
- value: "\u5EFA\u8BAE\u96F6\u552E\u4EF7",
2847
- label: "\u5EFA\u8BAE\u96F6\u552E\u4EF7"
2848
- },
2849
- {
2850
- value: "\u5546\u54C1\u7BB1\u89C4",
2851
- label: "\u5546\u54C1\u7BB1\u89C4"
2852
- },
2853
- {
2854
- value: "\u5546\u54C1\u5355\u4F4D",
2855
- label: "\u5546\u54C1\u5355\u4F4D"
2856
- }
2857
- ];
2858
- function emitChangeEvt() {
2859
- emits(
2860
- "change",
2861
- options.filter((op) => checkList.value.includes(op.value))
2862
- );
2863
- }
2864
- function handOk() {
2865
- visible.value = false;
2866
- emitChangeEvt();
2867
- }
2868
- function init() {
2869
- checkList.value = props.associatedFields.map((item) => item.value);
2870
- }
2871
- function visibleChange(visible2) {
2872
- if (visible2) {
2873
- init();
2874
- }
2875
- }
2876
- function handleDel(value) {
2877
- checkList.value = checkList.value.filter((cl) => cl !== value);
2878
- emitChangeEvt();
2879
- }
2880
- init();
2881
- watch(visible, (val) => {
2882
- visibleChange(val);
2883
- });
2884
- return (_ctx, _cache) => {
2885
- const _component_Delete = resolveComponent("Delete");
2886
- return openBlock(), createElementBlock("div", null, [
2887
- _hoisted_1$6,
2888
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.associatedFields, (item) => {
2889
- return openBlock(), createElementBlock("div", {
2890
- key: item.value,
2891
- class: "bm-associated-fields-item"
2892
- }, [
2893
- createElementVNode("span", _hoisted_2$4, toDisplayString(item.label), 1),
2894
- createVNode(_component_Delete, {
2895
- class: "bm-associated-fields-item__icon",
2896
- onClick: ($event) => handleDel(item.value)
2897
- }, null, 8, ["onClick"])
2898
- ]);
2899
- }), 128)),
2900
- createVNode(unref(Dropdown), {
2901
- visible: visible.value,
2902
- "onUpdate:visible": _cache[2] || (_cache[2] = ($event) => visible.value = $event),
2903
- trigger: ["click"]
2904
- }, {
2905
- overlay: withCtx(() => [
2906
- createVNode(unref(Menu), null, {
2907
- default: withCtx(() => [
2908
- createVNode(unref(FormItemRest), null, {
2909
- default: withCtx(() => [
2910
- createVNode(unref(CheckboxGroup), {
2911
- value: checkList.value,
2912
- "onUpdate:value": _cache[0] || (_cache[0] = ($event) => checkList.value = $event),
2913
- style: { "width": "100%" }
2914
- }, {
2915
- default: withCtx(() => [
2916
- (openBlock(), createElementBlock(Fragment, null, renderList(options, (item) => {
2917
- return createVNode(unref(MenuItem), {
2918
- key: item.value
2919
- }, {
2920
- default: withCtx(() => [
2921
- createVNode(unref(Checkbox), {
2922
- value: item.value,
2923
- style: { "width": "100%" }
2924
- }, {
2925
- default: withCtx(() => [
2926
- createTextVNode(toDisplayString(item.label), 1)
2927
- ]),
2928
- _: 2
2929
- }, 1032, ["value"])
2930
- ]),
2931
- _: 2
2932
- }, 1024);
2933
- }), 64))
2934
- ]),
2935
- _: 1
2936
- }, 8, ["value"])
2937
- ]),
2938
- _: 1
2939
- }),
2940
- createVNode(unref(Divider), { style: { "margin": "0" } }),
2941
- createElementVNode("div", _hoisted_3$2, [
2942
- createVNode(unref(Button), {
2943
- onClick: _cache[1] || (_cache[1] = ($event) => visible.value = false)
2944
- }, {
2945
- default: withCtx(() => [
2946
- createTextVNode("\u53D6\u6D88")
2947
- ]),
2948
- _: 1
2949
- }),
2950
- createVNode(unref(Button), {
2951
- type: "primary",
2952
- style: { "margin-left": "8px" },
2953
- onClick: handOk
2954
- }, {
2955
- default: withCtx(() => [
2956
- createTextVNode("\u786E\u5B9A")
2957
- ]),
2958
- _: 1
2959
- })
2960
- ])
2961
- ]),
2962
- _: 1
2963
- })
2964
- ]),
2965
- default: withCtx(() => [
2966
- createVNode(unref(Button), {
2967
- style: { "margin-top": "8px" },
2968
- block: ""
2969
- }, {
2970
- default: withCtx(() => [
2971
- createVNode(unref(PlusOutlined)),
2972
- createTextVNode(" \u6DFB\u52A0\u5B50\u5B57\u6BB5 ")
2973
- ]),
2974
- _: 1
2975
- })
2976
- ]),
2977
- _: 1
2978
- }, 8, ["visible"])
2979
- ]);
2980
- };
2981
- }
2982
- });
2983
- var AssociatedFields = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__file", "associated-fields.vue"]]);
2984
-
2985
- const _hoisted_1$5 = /* @__PURE__ */ createElementVNode("div", { style: { "margin": "18px 0 6px" } }, "\u4EC5\u83B7\u53D6", -1);
2986
- const _hoisted_2$3 = /* @__PURE__ */ createElementVNode("div", { style: { "margin-top": "7px" } }, "\u4E2D\u53EF\u5206\u9500\u7684\u5546\u54C1\u6570\u636E", -1);
2987
- const _sfc_main$7 = /* @__PURE__ */ defineComponent({
2988
- __name: "shop-data-filter",
2989
- props: ["widgetFormRules", "defaultSelectValue"],
2990
- emits: ["change"],
2991
- setup(__props, { emit: emits }) {
2992
- const props = __props;
2993
- const checkedValue = ref(!!props.defaultSelectValue);
2994
- const selectValue = ref(props.defaultSelectValue);
2995
- const shopRules = computed(
2996
- () => props.widgetFormRules.reduce((pre, cur) => {
2997
- const name = cur.config.config.name;
2998
- if (name === "row") {
2999
- cur.config.childRules.forEach((rule) => {
3000
- getShop(rule, pre);
3001
- });
3002
- } else {
3003
- getShop(cur, pre);
3004
- }
3005
- return pre;
3006
- }, [])
3007
- );
3008
- const shops = computed(() => {
3009
- return shopRules.value.map((shopRule) => ({
3010
- value: shopRule.field,
3011
- label: shopRule.title.title
3012
- }));
3013
- });
3014
- function getShop(rule, target) {
3015
- if (rule.config.config.name === "shop")
3016
- target.push(rule);
3017
- }
3018
- function checkedValueChange(val) {
3019
- if (val) {
3020
- if (shops.value.length === 1) {
3021
- selectValue.value = shops.value[0].value;
3022
- }
3023
- }
3024
- if (!val)
3025
- selectValue.value = void 0;
3026
- }
3027
- function selectValueChange(val) {
3028
- if (val) {
3029
- checkedValue.value = true;
3030
- }
3031
- }
3032
- function handleChange(val) {
3033
- emits("change", val);
3034
- }
3035
- watch(checkedValue, (checkedValue2) => {
3036
- checkedValueChange(checkedValue2);
3037
- });
3038
- watch(selectValue, (selectValue2) => {
3039
- selectValueChange(selectValue2);
3040
- handleChange(selectValue2);
3041
- });
3042
- return (_ctx, _cache) => {
3043
- const _component_a_tooltip = resolveComponent("a-tooltip");
3044
- return openBlock(), createBlock(unref(FormItemRest), null, {
3045
- default: withCtx(() => [
3046
- unref(shops).length ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
3047
- createVNode(unref(Switch), {
3048
- checked: checkedValue.value,
3049
- "onUpdate:checked": _cache[0] || (_cache[0] = ($event) => checkedValue.value = $event)
3050
- }, null, 8, ["checked"]),
3051
- checkedValue.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
3052
- _hoisted_1$5,
3053
- createVNode(unref(Select), {
3054
- value: selectValue.value,
3055
- "onUpdate:value": _cache[1] || (_cache[1] = ($event) => selectValue.value = $event),
3056
- options: unref(shops),
3057
- disabled: unref(shops).length === 1,
3058
- "show-arrow": unref(shops).length > 1,
3059
- placeholder: "\u8BF7\u9009\u62E9"
3060
- }, null, 8, ["value", "options", "disabled", "show-arrow"]),
3061
- _hoisted_2$3
3062
- ], 64)) : createCommentVNode("v-if", true)
3063
- ], 64)) : (openBlock(), createBlock(_component_a_tooltip, {
3064
- key: 1,
3065
- placement: "bottomLeft"
3066
- }, {
3067
- title: withCtx(() => [
3068
- createTextVNode("\u8BF7\u5148\u6DFB\u52A0\u5173\u8054\u8868\u5355\u4E2D\u7684\u5E97\u94FA\u7EC4\u4EF6")
3069
- ]),
3070
- default: withCtx(() => [
3071
- createVNode(unref(Switch), { disabled: "" })
3072
- ]),
3073
- _: 1
3074
- }))
3075
- ]),
3076
- _: 1
3077
- });
3078
- };
3079
- }
3080
- });
3081
- var ShopDataFilter = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__file", "shop-data-filter.vue"]]);
3082
-
3083
- const label$2 = '商品';
3084
- const fieldsMap$2 = {
3085
- 'effect.required': 'effect.required',
3086
- 'config.associatedFields': 'config.associatedFields',
3087
- 'config.dataFiltering': 'config.dataFiltering',
3088
- };
3089
- const name$2 = 'product';
3090
- var product = {
3091
- icon: 'Product',
3092
- name: name$2,
3093
- label: label$2,
3094
- rule() {
3095
- return {
3096
- type: 'ProductInfo',
3097
- component: ProductInfo,
3098
- field: uniqueId(),
3099
- title: {
3100
- title: label$2,
3101
- style: {
3102
- overflow: 'hidden',
3103
- textOverflow: 'ellipsis',
3104
- whiteSpace: 'nowrap',
3105
- },
3106
- },
3107
- effect: {
3108
- required: true,
3109
- formRule: 'formRule',
3110
- },
3111
- config: {
3112
- propsFields: Object.values(fieldsMap$2),
3113
- associatedFields: [],
3114
- },
3115
- };
3116
- },
3117
- props(rule, parentRule, widgetFormRules) {
3118
- return [
3119
- {
3120
- type: 'AssociatedFields',
3121
- component: AssociatedFields,
3122
- title: '关联字段',
3123
- field: fieldsMap$2['config.associatedFields'],
3124
- props: {
3125
- associatedFields: rule.config.associatedFields,
3126
- },
3127
- effect: {
3128
- required: true,
3129
- },
3130
- inject: true,
3131
- on: {
3132
- change({ api, self }, list) {
3133
- api.emit('change', self.field, list, self, api, true);
3134
- self.props.associatedFields = list;
3135
- nextTick(() => {
3136
- api.refresh();
3137
- });
3138
- },
3139
- },
3140
- },
3141
- {
3142
- type: 'ShopDataFilter',
3143
- component: ShopDataFilter,
3144
- title: '数据过滤',
3145
- field: fieldsMap$2['config.dataFiltering'],
3146
- info: '1.开启后,可以与当前表单的“店铺”控件关联进行商品数据过滤,在填写表单时满足仅可选择所选店铺下的可分销商品。' +
3147
- '2.若不启用数据过滤,则不进行店铺限制,用户填写表单时可选择所有未冻结的商品数据。' +
3148
- '3.开启前,请确认当前表单中已存在“店铺”控件。',
3149
- props: {
3150
- widgetFormRules,
3151
- defaultSelectValue: rule.config.dataFiltering,
3152
- },
3153
- inject: true,
3154
- on: {
3155
- change({ api, self }, value) {
3156
- api.emit('change', self.field, value, self, api, true);
3157
- self.props.defaultSelectValue = value;
3158
- nextTick(() => {
3159
- api.refresh();
3160
- });
3161
- },
3162
- },
3163
- },
3164
- {
3165
- type: 'switch',
3166
- title: '是否必填',
3167
- field: fieldsMap$2['effect.required'],
3168
- value: rule.effect.required,
3169
- },
3170
- ];
3171
- },
3172
- parse(rule) {
3173
- return {
3174
- name: name$2,
3175
- field: rule.field,
3176
- effect: {
3177
- required: rule.effect.required,
3178
- },
3179
- config: {
3180
- associatedFields: rule.config.associatedFields,
3181
- dataFiltering: rule.config.dataFiltering,
3182
- },
3183
- };
3184
- },
3185
- };
3186
-
3187
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
3188
- __name: "shop-associated-fields",
3189
- setup(__props) {
3190
- const associatedFields = [
3191
- {
3192
- value: "\u5E97\u94FA\u7F16\u53F7",
3193
- label: "\u5E97\u94FA\u7F16\u53F7"
3194
- },
3195
- {
3196
- value: "\u5E97\u94FA\u540D\u79F0",
3197
- label: "\u5E97\u94FA\u540D\u79F0"
3198
- }
3199
- ];
3200
- return (_ctx, _cache) => {
3201
- return openBlock(), createElementBlock("div", null, [
3202
- (openBlock(), createElementBlock(Fragment, null, renderList(associatedFields, (item) => {
3203
- return createElementVNode("span", {
3204
- key: item.value,
3205
- class: "bm-shop-associated-fields-item"
3206
- }, toDisplayString(item.label), 1);
3207
- }), 64))
3208
- ]);
3209
- };
3210
- }
3211
- });
3212
- var ShopAssociatedFields = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__file", "shop-associated-fields.vue"]]);
3213
-
3214
- let i = 0;
3215
- const label$1 = '店铺';
3216
- const fieldsMap$1 = {
3217
- 'effect.required': 'effect.required',
3218
- 'config.dataFiltering': 'config.dataFiltering',
3219
- 'config.isMain': 'config.isMain',
3220
- };
3221
- const name$1 = 'shop';
3222
- var shop = {
3223
- icon: 'Shop',
3224
- name: name$1,
3225
- label: label$1,
3226
- rule() {
3227
- return {
3228
- type: 'Select',
3229
- field: uniqueId(),
3230
- title: {
3231
- title: label$1 + ++i,
3232
- style: {
3233
- overflow: 'hidden',
3234
- textOverflow: 'ellipsis',
3235
- whiteSpace: 'nowrap',
3236
- },
3237
- },
3238
- effect: {
3239
- required: true,
3240
- formRule: 'formRule',
3241
- },
3242
- props: {
3243
- placeholder: '请选择',
3244
- },
3245
- config: {
3246
- propsFields: Object.values(fieldsMap$1),
3247
- },
3248
- };
3249
- },
3250
- props(rule, parentRule) {
3251
- return [
3252
- {
3253
- type: 'ShopAssociatedFields',
3254
- component: ShopAssociatedFields,
3255
- title: '关联字段',
3256
- field: 'config.associatedFields',
3257
- effect: {
3258
- required: true,
3259
- },
3260
- },
3261
- {
3262
- type: 'checkbox',
3263
- title: '数据过滤',
3264
- field: fieldsMap$1['config.dataFiltering'],
3265
- options: [
3266
- {
3267
- value: true,
3268
- label: '当前节点操作人所负责的店铺',
3269
- },
3270
- ],
3271
- value: [rule.config.dataFiltering],
3272
- inject: true,
3273
- on: {
3274
- change({ api, self }, value) {
3275
- api.emit('change', self.field, value[0], self, api, true);
3276
- },
3277
- },
3278
- },
3279
- {
3280
- type: 'switch',
3281
- title: '设为主控件',
3282
- info: '店铺控件在流程流转过程中涉及数据权限的控制,当表单中设置了多个店铺控件时,需设置其中1个店铺控件作为主控件。被设为主控件的店铺控件,流程流转过程中将以此店铺控件输入的数据作为数据权限判断依据。',
3283
- field: fieldsMap$1['config.isMain'],
3284
- value: rule.config.isMain,
3285
- hidden: (parentRule === null || parentRule === void 0 ? void 0 : parentRule.type) === WidgetType.RowWidget ||
3286
- (parentRule === null || parentRule === void 0 ? void 0 : parentRule.type) === WidgetType.TableWidget,
3287
- inject: true,
3288
- },
3289
- {
3290
- type: 'switch',
3291
- title: '是否必填',
3292
- field: fieldsMap$1['effect.required'],
3293
- value: rule.effect.required,
3294
- },
3295
- ];
3296
- },
3297
- parse(rule) {
3298
- return {
3299
- name: name$1,
3300
- field: rule.field,
3301
- title: {
3302
- title: rule.title.title,
3303
- },
3304
- effect: {
3305
- required: rule.effect.required,
3306
- },
3307
- config: {
3308
- dataFiltering: rule.config.dataFiltering,
3309
- isMain: rule.config.isMain,
3310
- },
3311
- };
3312
- },
3313
- };
3314
- function setShopIndex(index) {
3315
- i = index;
3316
- }
3317
-
3318
- const label = '素材类型';
3319
- const fieldsMap = {
3320
- 'effect.required': 'effect.required',
3321
- 'config.format': 'config.format',
3322
- 'props.multiple': 'props.multiple',
3323
- };
3324
- const name = 'materialType';
3325
- var materialType = {
3326
- icon: 'MaterialType',
3327
- name,
3328
- label,
3329
- rule() {
3330
- return {
3331
- type: 'Select',
3332
- field: uniqueId(),
3333
- title: {
3334
- title: label,
3335
- style: {
3336
- overflow: 'hidden',
3337
- textOverflow: 'ellipsis',
3338
- whiteSpace: 'nowrap',
3339
- },
3340
- },
3341
- effect: {
3342
- required: true,
3343
- formRule: 'formRule',
3344
- },
3345
- props: {
3346
- placeholder: '请选择',
3347
- multiple: false,
3348
- },
3349
- config: {
3350
- propsFields: Object.values(fieldsMap),
3351
- format: 1,
3352
- },
3353
- };
3354
- },
3355
- props(rule, parentRule) {
3356
- return [
3357
- {
3358
- type: 'radio',
3359
- title: '格式',
3360
- field: fieldsMap['config.format'],
3361
- effect: {
3362
- required: true,
3363
- },
3364
- options: [
3365
- {
3366
- value: 1,
3367
- label: '一级分类',
3368
- },
3369
- {
3370
- value: 2,
3371
- label: '一级分类-二级分类',
3372
- },
3373
- {
3374
- value: 3,
3375
- label: '一级分类-二级分类-三级分类',
3376
- },
3377
- ],
3378
- value: rule.config.format,
3379
- className: 'form-designer-props-radio-label',
3380
- },
3381
- {
3382
- type: 'radio',
3383
- title: '选项',
3384
- field: fieldsMap['props.multiple'],
3385
- effect: {
3386
- required: true,
3387
- },
3388
- options: [
3389
- {
3390
- value: false,
3391
- label: '只能选择一种类型',
3392
- },
3393
- {
3394
- value: true,
3395
- label: '可同时选择多种类型',
3396
- },
3397
- ],
3398
- value: rule.props.multiple,
3399
- className: 'form-designer-props-radio-label',
3400
- },
3401
- {
3402
- type: 'switch',
3403
- title: '是否必填',
3404
- info: '勾选后可作为流程条件',
3405
- field: fieldsMap['effect.required'],
3406
- value: rule.effect.required,
3407
- },
3408
- ];
3409
- },
3410
- parse(rule) {
3411
- return {
3412
- name,
3413
- field: rule.field,
3414
- props: {
3415
- multiple: rule.props.multiple,
3416
- },
3417
- config: {
3418
- format: rule.config.format,
3419
- },
3420
- effect: {
3421
- required: rule.effect.required,
3422
- },
3423
- };
3424
- },
3425
- };
3426
-
3427
- function createTab() {
3428
- return [
3429
- {
3430
- key: 'controlLibrary',
3431
- tab: '控件库',
3432
- menuList: [
3433
- {
3434
- name: 'layout',
3435
- title: '布局控件',
3436
- list: [row],
3437
- },
3438
- {
3439
- name: 'basic',
3440
- title: '基础控件',
3441
- list: [
3442
- input,
3443
- textarea,
3444
- numInput,
3445
- radio,
3446
- checkbox,
3447
- date,
3448
- dateRange,
3449
- instruction,
3450
- ],
3451
- },
3452
- {
3453
- name: 'enhance',
3454
- title: '增强控件',
3455
- list: [picture, table, file, people, department],
3456
- },
3457
- ],
3458
- },
3459
- {
3460
- key: 'kit',
3461
- tab: '套件',
3462
- menuList: [
3463
- {
3464
- name: 'materialKit',
3465
- title: '素材套件',
3466
- list: [materialTemp],
3467
- },
3468
- ],
3469
- },
3470
- {
3471
- key: 'associatedForm',
3472
- tab: '关联表单',
3473
- menuList: [
3474
- {
3475
- name: 'dataForm',
3476
- title: '数据表单',
3477
- list: [product, shop, materialType],
3478
- },
3479
- ],
3480
- },
3481
- ];
3482
- }
3483
-
3484
- const _hoisted_1$4 = {
3485
- style: { "vertical-align": "middle" },
3486
- width: "199px",
3487
- height: "107px",
3488
- viewBox: "0 0 199 107",
3489
- xmlns: "http://www.w3.org/2000/svg"
3490
- };
3491
- const _hoisted_2$2 = /* @__PURE__ */ createStaticVNode('<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g transform="translate(-826.000000, -249.000000)"><g transform="translate(667.000000, 71.000000)"><g transform="translate(159.000000, 178.000000)"><path d="M2,0 L197,0 C198.104569,-6.46995335e-16 199,0.8954305 199,2 L199,105 C199,106.104569 198.104569,107 197,107 L2,107 C0.8954305,107 1.3527075e-16,106.104569 0,105 L0,2 C-1.3527075e-16,0.8954305 0.8954305,2.02906125e-16 2,0 Z" fill="#F9FBFF"></path><path d="M41,6 C41.5522847,6 42,6.44771525 42,7 L42,100 C42,100.552285 41.5522847,101 41,101 L7,101 C6.44771525,101 6,100.552285 6,100 L6,7 C6,6.44771525 6.44771525,6 7,6 L41,6 Z M192,6 C192.552285,6 193,6.44771525 193,7 L193,100 C193,100.552285 192.552285,101 192,101 L159,101 C158.447715,101 158,100.552285 158,100 L158,7 C158,6.44771525 158.447715,6 159,6 L192,6 Z M151,35 C151.552285,35 152,35.4477153 152,36 L152,100 C152,100.552285 151.552285,101 151,101 L49,101 C48.4477153,101 48,100.552285 48,100 L48,36 C48,35.4477153 48.4477153,35 49,35 L151,35 Z M151,6 C151.552285,6 152,6.44771525 152,7 L152,30 C152,30.5522847 151.552285,31 151,31 L49,31 C48.4477153,31 48,30.5522847 48,30 L48,7 C48,6.44771525 48.4477153,6 49,6 L151,6 Z" fill="#EFF3FF"></path><rect stroke="#8FAAFF" fill="#D0DCFF" x="12.5" y="17.5" width="23" height="13" rx="0.5"></rect><rect fill="#E4E8F7" x="12" y="47" width="24" height="14" rx="0.5"></rect><rect fill="#E4E8F7" x="12" y="75" width="24" height="14" rx="0.5"></rect><use stroke="#AEC2FF" mask="url(#mask-2)" stroke-width="2" fill-opacity="0.26" fill="#AFC3FF" stroke-dasharray="2" xlink:href="#path-1"></use><path d="M33.5,20 C35.9852814,20 38,22.0147186 38,24.5 C38,26.9852814 35.9852814,29 33.5,29 C31.0147186,29 29,26.9852814 29,24.5 C29,22.0147186 31.0147186,20 33.5,20 Z M33.5,22 C32.1192881,22 31,23.1192881 31,24.5 C31,25.8807119 32.1192881,27 33.5,27 C34.8807119,27 36,25.8807119 36,24.5 C36,23.1192881 34.8807119,22 33.5,22 Z" fill="#2F4EED"></path><circle fill="#F9FBFF" cx="33.5" cy="24.5" r="2.5"></circle><path d="M42.5,22 C65.8354499,22 85.7454723,36.6659986 93.5155164,57.2834451 L93.7801465,55.3991118 C93.8570096,54.8522019 94.3626777,54.4711537 94.9095876,54.5480169 C95.4564976,54.6248801 95.8375458,55.1305481 95.7606826,55.677458 L94.925644,61.6190665 C94.8487808,62.1659764 94.3431128,62.5470246 93.7962028,62.4701614 L93.7673315,62.4658857 C93.5875459,62.4468789 93.4107192,62.3789077 93.2577621,62.2594045 L88.5296976,58.5654356 C88.0944913,58.2254152 88.0173279,57.5969697 88.3573483,57.1617634 C88.6973688,56.7265571 89.3258142,56.6493937 89.7610205,56.9894141 L91.887337,58.6494477 C84.582156,38.4419045 65.2276218,24 42.5,24 C40.4254117,24 38.3789284,24.1203318 36.367149,24.3543965 L36.022518,22.3809268 C38.1466458,22.1293826 40.3082134,22 42.5,22 Z" fill="#2F4EED"></path></g></g></g></g>', 1);
3492
- const _hoisted_3$1 = [
3493
- _hoisted_2$2
3494
- ];
3495
- const _hoisted_4$1 = /* @__PURE__ */ createElementVNode("div", { style: { "line-height": "20px", "margin-top": "12px", "color": "#505259" } }, " \u8BF7\u62D6\u62FD\u6216\u70B9\u51FB\u5DE6\u4FA7\u5B57\u6BB5\u521B\u5EFA\u8868\u5355 ", -1);
3496
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3497
- __name: "no-data-tip",
3498
- props: {},
3499
- setup(__props) {
3500
- return (_ctx, _cache) => {
3501
- return openBlock(), createElementBlock("div", null, [
3502
- (openBlock(), createElementBlock("svg", _hoisted_1$4, _hoisted_3$1)),
3503
- _hoisted_4$1
3504
- ]);
3505
- };
3506
- }
3507
- });
3508
- var NoDataTip = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__file", "no-data-tip.vue"]]);
3509
-
3510
- const formDesignerProps = {
3511
- formRules: {
3512
- type: Array,
3513
- default() {
3514
- return [];
3515
- },
3516
- },
3517
- flowCondition: {
3518
- type: Object,
3519
- default() {
3520
- return {};
3521
- },
3522
- },
3523
- showDragTip: {
3524
- type: Boolean,
3525
- default: false,
3526
- },
3527
- };
3528
-
3529
- const _hoisted_1$3 = {
3530
- key: 0,
3531
- style: { "font-weight": "normal" }
3532
- };
3533
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
3534
- __name: "table-head-count",
3535
- props: ["childRules"],
3536
- setup(__props) {
3537
- const props = __props;
3538
- const text = computed(
3539
- () => props.childRules.filter((rule) => rule.type === "inputNumber" && rule.config.count).reduce((pre, item, index) => {
3540
- if (index > 0)
3541
- pre += "\u3001";
3542
- return pre + `${item.title.title}: 0`;
3543
- }, "")
3544
- );
3545
- return (_ctx, _cache) => {
3546
- return openBlock(), createElementBlock("div", null, [
3547
- renderSlot(_ctx.$slots, "default"),
3548
- unref(text) ? (openBlock(), createElementBlock("span", _hoisted_1$3, "\uFF08" + toDisplayString(unref(text)) + "\uFF09", 1)) : createCommentVNode("v-if", true)
3549
- ]);
3550
- };
3551
- }
3552
- });
3553
- var TableHeadCount = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__file", "table-head-count.vue"]]);
3554
-
3555
- const _hoisted_1$2 = { style: { "position": "absolute", "right": "0", "top": "-30px", "display": "flex", "align-items": "center" } };
3556
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
3557
- __name: "checkbox-switch",
3558
- props: ["rule"],
3559
- setup(__props) {
3560
- const props = __props;
3561
- function handleChange() {
3562
- props.rule.config.uploadPictureRule.required = false;
3563
- }
3564
- return (_ctx, _cache) => {
3565
- return openBlock(), createElementBlock("span", _hoisted_1$2, [
3566
- createVNode(unref(FormItemRest), null, {
3567
- default: withCtx(() => [
3568
- !__props.rule.config.uploadPictureRule.hidden ? (openBlock(), createBlock(unref(Checkbox), {
3569
- key: 0,
3570
- checked: __props.rule.config.uploadPictureRule.required,
3571
- "onUpdate:checked": _cache[0] || (_cache[0] = ($event) => __props.rule.config.uploadPictureRule.required = $event)
3572
- }, {
3573
- default: withCtx(() => [
3574
- createTextVNode("\u5FC5\u586B")
3575
- ]),
3576
- _: 1
3577
- }, 8, ["checked"])) : createCommentVNode("v-if", true),
3578
- createVNode(unref(Switch), {
3579
- checked: __props.rule.config.uploadPictureRule.hidden,
3580
- "onUpdate:checked": _cache[1] || (_cache[1] = ($event) => __props.rule.config.uploadPictureRule.hidden = $event),
3581
- style: { "margin-left": "8px" },
3582
- "checked-children": "\u5F00",
3583
- "un-checked-children": "\u5173",
3584
- "checked-value": false,
3585
- "un-checked-value": true,
3586
- onChange: handleChange
3587
- }, null, 8, ["checked"])
3588
- ]),
3589
- _: 1
3590
- })
3591
- ]);
3592
- };
3593
- }
3594
- });
3595
- var CheckboxSwitch = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "checkbox-switch.vue"]]);
3596
-
3597
- const widgetsTableAccept = {
3598
- [input.name]: input,
3599
- [textarea.name]: textarea,
3600
- [numInput.name]: numInput,
3601
- [radio.name]: radio,
3602
- [checkbox.name]: checkbox,
3603
- [date.name]: date,
3604
- [dateRange.name]: dateRange,
3605
- [people.name]: people,
3606
- [department.name]: department,
3607
- [product.name]: product,
3608
- [shop.name]: shop,
3609
- [materialType.name]: materialType,
3610
- };
3611
- const widgetNamesRowAccept = [
3612
- input.name,
3613
- textarea.name,
3614
- numInput.name,
3615
- radio.name,
3616
- checkbox.name,
3617
- date.name,
3618
- dateRange.name,
3619
- picture.name,
3620
- table.name,
3621
- file.name,
3622
- people.name,
3623
- department.name,
3624
- product.name,
3625
- shop.name,
3626
- materialType.name,
3627
- ];
3628
- var ruleList = {
3629
- [row.name]: row,
3630
- [input.name]: input,
3631
- [textarea.name]: textarea,
3632
- [numInput.name]: numInput,
3633
- [radio.name]: radio,
3634
- [checkbox.name]: checkbox,
3635
- [date.name]: date,
3636
- [dateRange.name]: dateRange,
3637
- [instruction.name]: instruction,
3638
- [picture.name]: picture,
3639
- [table.name]: table,
3640
- [file.name]: file,
3641
- [people.name]: people,
3642
- [department.name]: department,
3643
- [materialTemp.name]: materialTemp,
3644
- [product.name]: product,
3645
- [shop.name]: shop,
3646
- [materialType.name]: materialType,
3647
- };
3648
-
3649
- const _hoisted_1$1 = { class: "bm-table-column__main" };
3650
- const _hoisted_2$1 = { class: "bm-table-column-btn-wrap" };
3651
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3652
- __name: "table-column",
3653
- props: ["formCreateInject"],
3654
- emits: ["change", "childRuleDelete"],
3655
- setup(__props, { emit: emits }) {
3656
- const props = __props;
3657
- const handleClass = "bm-table-column__drag-icon";
3658
- const btnCom = ref();
3659
- const open = ref(false);
3660
- const childRules = computed(() => props.formCreateInject.rule.value);
3661
- const api = computed(() => props.formCreateInject.api);
3662
- const options = computed(() => Object.values(widgetsTableAccept));
3663
- function handleEdit(rule) {
3664
- api.value.emit("setActive", rule);
3665
- }
3666
- function show() {
3667
- open.value = true;
3668
- }
3669
- function hide() {
3670
- open.value = false;
3671
- }
3672
- function handleSelect(value, config) {
3673
- api.value.emit("addChildRule", config);
3674
- open.value = false;
3675
- btnCom.value.$el.blur();
3676
- }
3677
- function getPopupContainer() {
3678
- return document.body;
3679
- }
3680
- function handleDelete(element, index) {
3681
- childRules.value.splice(index, 1);
3682
- emits("childRuleDelete", element);
3683
- }
3684
- watch(
3685
- childRules,
3686
- (val) => {
3687
- emits("change", val);
3688
- },
3689
- {
3690
- deep: true
3691
- }
3692
- );
3693
- return (_ctx, _cache) => {
3694
- const _component_Delete = resolveComponent("Delete");
3695
- const _component_ARow = resolveComponent("ARow");
3696
- return openBlock(), createElementBlock("div", null, [
3697
- createVNode(unref(Draggable), {
3698
- tag: "transition-group",
3699
- "component-data": {
3700
- name: "flip-list",
3701
- tag: "div"
3702
- },
3703
- animation: 200,
3704
- list: unref(childRules),
3705
- handle: `.${handleClass}`,
3706
- "force-fallback": true
3707
- }, {
3708
- item: withCtx(({ element, index }) => [
3709
- createVNode(_component_ARow, {
3710
- class: "bm-table-column",
3711
- align: "middle"
3712
- }, {
3713
- default: withCtx(() => [
3714
- createVNode(unref(HolderOutlined), {
3715
- class: normalizeClass([handleClass])
3716
- }, null, 8, ["class"]),
3717
- createElementVNode("div", _hoisted_1$1, toDisplayString(element.title.title), 1),
3718
- createVNode(unref(EditOutlined), {
3719
- class: "bm-table-column__icon is-edit",
3720
- onClick: ($event) => handleEdit(element)
3721
- }, null, 8, ["onClick"]),
3722
- createVNode(_component_Delete, {
3723
- class: "bm-table-column__icon is-del",
3724
- onClick: ($event) => handleDelete(element, index)
3725
- }, null, 8, ["onClick"])
3726
- ]),
3727
- _: 2
3728
- }, 1024)
3729
- ]),
3730
- _: 1
3731
- }, 8, ["list", "handle"]),
3732
- createElementVNode("div", _hoisted_2$1, [
3733
- createVNode(unref(FormItemRest), null, {
3734
- default: withCtx(() => [
3735
- createVNode(unref(Select), {
3736
- value: "",
3737
- class: "bm-table-column__select",
3738
- options: unref(options),
3739
- "field-names": { value: "name" },
3740
- open: open.value,
3741
- "get-popup-container": getPopupContainer,
3742
- placeholder: "\u8BF7\u9009\u62E9",
3743
- onSelect: handleSelect
3744
- }, null, 8, ["options", "open"])
3745
- ]),
3746
- _: 1
3747
- }),
3748
- createVNode(unref(Button), {
3749
- ref_key: "btnCom",
3750
- ref: btnCom,
3751
- class: "bm-table-column__btn",
3752
- block: "",
3753
- onFocus: show,
3754
- onBlur: hide
3755
- }, {
3756
- icon: withCtx(() => [
3757
- createVNode(unref(PlusOutlined))
3758
- ]),
3759
- default: withCtx(() => [
3760
- createTextVNode(" \u6DFB\u52A0\u5B50\u5B57\u6BB5 ")
3761
- ]),
3762
- _: 1
3763
- }, 512)
3764
- ])
3765
- ]);
3766
- };
3767
- }
3768
- });
3769
- var TableColumn = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "table-column.vue"]]);
3770
-
3771
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3772
- __name: "text-color",
3773
- props: ["color"],
3774
- emits: ["change"],
3775
- setup(__props, { emit: emits }) {
3776
- const props = __props;
3777
- const color = ref(props.color);
3778
- function getColor(curColor) {
3779
- return curColor === Colors.Black ? Colors.Blue : Colors.Black;
3780
- }
3781
- function handleClick() {
3782
- color.value = getColor(color.value);
3783
- emits("change", color.value);
3784
- }
3785
- return (_ctx, _cache) => {
3786
- const _component_ColorPanel = resolveComponent("ColorPanel");
3787
- return openBlock(), createBlock(_component_ColorPanel, {
3788
- style: normalizeStyle({
3789
- position: "absolute",
3790
- top: "-29px",
3791
- right: 0,
3792
- width: "1em",
3793
- height: "1em",
3794
- fontSize: "20px",
3795
- color: getColor(color.value),
3796
- cursor: "pointer"
3797
- }),
3798
- onClick: withModifiers(handleClick, ["prevent", "stop"])
3799
- }, null, 8, ["style", "onClick"]);
3800
- };
3801
- }
3802
- });
3803
- var TextColor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__file", "text-color.vue"]]);
3804
-
3805
- const _hoisted_1 = { class: "bm-menu-title" };
3806
- const _hoisted_2 = ["onClick"];
3807
- const _hoisted_3 = { class: "bfd-main__warp" };
3808
- const _hoisted_4 = { class: "bm-widget-form-item" };
3809
- const _hoisted_5 = {
3810
- key: 0,
3811
- class: "bfd-sider-right__title"
3812
- };
3813
- const _hoisted_6 = { class: "bfd-sider-right__form" };
3814
- const _hoisted_7 = {
3815
- key: 0,
3816
- class: "bfd-sider-right__form__flow-releated"
3817
- };
3818
- const __default__ = {
3819
- name: "BmFormDesigner"
3820
- };
3821
- const _sfc_main = /* @__PURE__ */ defineComponent({
3822
- ...__default__,
3823
- props: formDesignerProps,
3824
- emits: ["update:showDragTip"],
3825
- setup(__props, { expose, emit: emits }) {
3826
- const props = __props;
3827
- FC.component("TableHeadCount", TableHeadCount);
3828
- FC.component("TableColumn", TableColumn);
3829
- FC.component("TextColor", TextColor);
3830
- FC.component("CheckboxSwitch", CheckboxSwitch);
3831
- FC.register({
3832
- name: "formRule",
3833
- init(effect, rule, api) {
3834
- const config = api.config;
3835
- const parentType = config.parentType;
3836
- if (!rule.config.fieldRatio) {
3837
- resetFieldRatio(rule, parentType);
3838
- }
3839
- if (rule?.props?.type === "textarea" && parentType === WidgetType.TableWidget) {
3840
- rule.props.autoSize = true;
3841
- }
3842
- if (rule.config.config.name === "product" && parentType === WidgetType.TableWidget) {
3843
- rule.title.title = "\u5546\u54C1\u7F16\u53F7";
3844
- }
3845
- }
3846
- });
3847
- const flowConditionTipMap = {
3848
- numInput: "\u9664\u201C\u5FC5\u586B\u201D\u8BBE\u7F6E\u4E0D\u53EF\u4FEE\u6539\uFF0C\u5176\u4ED6\u4FE1\u606F\u53EF\u4FEE\u6539",
3849
- radio: "\u9664\u201C\u5FC5\u586B\u3001\u9009\u9879\u201D\u5185\u5BB9\u8BBE\u7F6E\u4E0D\u53EF\u4FEE\u6539\uFF0C\u5176\u4ED6\u4FE1\u606F\u53EF\u4FEE\u6539",
3850
- checkbox: "\u9664\u201C\u5FC5\u586B\u3001\u9009\u9879\u201D\u5185\u5BB9\u8BBE\u7F6E\u4E0D\u53EF\u4FEE\u6539\uFF0C\u5176\u4ED6\u4FE1\u606F\u53EF\u4FEE\u6539",
3851
- shop: "\u9664\u201C\u5FC5\u586B\u201D\u5185\u5BB9\u8BBE\u7F6E\u4E0D\u53EF\u4FEE\u6539\uFF0C\u5176\u4ED6\u4FE1\u606F\u53EF\u4FEE\u6539\u3002",
3852
- materialType: "\u8BBE\u7F6E\u4FE1\u606F\u4E0D\u53EF\u4FEE\u6539\u3002",
3853
- people: "\u9664\u201C\u5FC5\u586B\u3001\u9009\u9879\u201D\u5185\u5BB9\u8BBE\u7F6E\u4E0D\u53EF\u4FEE\u6539\uFF0C\u5176\u4ED6\u4FE1\u606F\u53EF\u4FEE\u6539",
3854
- department: "\u9664\u201C\u5FC5\u586B\u3001\u9009\u9879\u201D\u5185\u5BB9\u8BBE\u7F6E\u4E0D\u53EF\u4FEE\u6539\uFF0C\u5176\u4ED6\u4FE1\u606F\u53EF\u4FEE\u6539"
3855
- };
3856
- const tabData = createTab();
3857
- const activeKey = ref("controlLibrary");
3858
- const widgetFormRules = reactive([]);
3859
- const activeRule = ref({});
3860
- const cacheProps = reactive({});
3861
- const fApi = ref();
3862
- const activeParentRule = ref();
3863
- const menuList = computed(
3864
- () => tabData.find((tab) => tab.key === activeKey.value).menuList
3865
- );
3866
- const activeProps = computed(() => cacheProps[activeRule.value.field]);
3867
- const activeRuleInList = computed(
3868
- () => activeParentRule.value?.config?.childRules || widgetFormRules
3869
- );
3870
- function hideShowDragTip() {
3871
- emits("update:showDragTip", false);
3872
- }
3873
- function handleTabChange(key) {
3874
- activeKey.value = key;
3875
- }
3876
- function cloneMenuItem(original) {
3877
- return makeRule(original);
3878
- }
3879
- function checkDragMove(evt) {
3880
- const draggedData = evt.dragged._underlying_vm_ || {};
3881
- const toComponentData = evt.to.__draggable_component__.componentData || {};
3882
- const widgetNameDragged = draggedData?.config?.config?.name;
3883
- if (toComponentData.type === WidgetType.RowWidget && !widgetNamesRowAccept.includes(widgetNameDragged) || toComponentData.type === WidgetType.TableWidget && !Object.keys(widgetsTableAccept).includes(widgetNameDragged)) {
3884
- widgetFormRules.forEach((rule) => {
3885
- rule.config.putDisabled = rule.field === toComponentData.field;
3886
- });
3887
- return false;
3888
- } else {
3889
- widgetFormRules.forEach((rule) => {
3890
- rule.config.putDisabled = false;
3891
- });
3892
- }
3893
- }
3894
- function moveMenuItem(evt) {
3895
- return checkDragMove(evt);
3896
- }
3897
- function moveFormItem(evt) {
3898
- return checkDragMove(evt);
3899
- }
3900
- function handleMenuItemDragStart(evt) {
3901
- const item = evt.item.children[0];
3902
- const cloneItem = evt.clone.children[0];
3903
- item.style.opacity = 0.3;
3904
- cloneItem.style.opacity = 0.3;
3905
- item.style.color = "#2F4EED";
3906
- cloneItem.style.color = "#2F4EED";
3907
- }
3908
- function resetPutDisabled() {
3909
- widgetFormRules.forEach((rule) => {
3910
- rule.config.putDisabled = false;
3911
- });
3912
- }
3913
- function handleMenuItemDragEnd(evt) {
3914
- evt.item.children[0].style.opacity = "";
3915
- evt.item.children[0].style.color = "";
3916
- resetPutDisabled();
3917
- }
3918
- function handleMenuItemClick(config) {
3919
- const rule = makeRule(config);
3920
- const activeParentRuleName = activeParentRule.value?.config?.config?.name;
3921
- if (!widgetNamesRowAccept.includes(config.name) && activeParentRuleName === "row" || !Object.keys(widgetsTableAccept).includes(config.name) && activeParentRuleName === "table") {
3922
- disabledTip(activeParentRule.value.config.config.name);
3923
- } else {
3924
- const index = activeRuleInList.value.findIndex(
3925
- (item) => item.field === activeRule.value.field
3926
- );
3927
- activeRuleInList.value.splice(index + 1, 0, rule);
3928
- setActiveRule(rule, activeParentRule.value);
3929
- hideShowDragTip();
3930
- }
3931
- }
3932
- function makeRule(config) {
3933
- const rule = config.rule();
3934
- rule.config.config = config;
3935
- return rule;
3936
- }
3937
- function disabledTip(name) {
3938
- message.warning({
3939
- content: name === "table" ? "\u8BE5\u63A7\u4EF6\u6682\u4E0D\u652F\u6301\u62D6\u5165\u8868\u683C\u4E2D" : "\u8BE5\u63A7\u4EF6\u6682\u4E0D\u652F\u6301\u5206\u680F",
3940
- class: "bm-form-designer__message-warning"
3941
- });
3942
- }
3943
- function putDisabledTip() {
3944
- const targetRule = widgetFormRules.find((rule) => rule.config.putDisabled);
3945
- if (targetRule) {
3946
- disabledTip(targetRule.config.config.name);
3947
- }
3948
- }
3949
- function dragAdd(rule, parentRule = void 0) {
3950
- resetFieldRatio(rule, parentRule?.type);
3951
- if (cacheProps[rule.field])
3952
- delete cacheProps[rule.field];
3953
- setActiveRule(rule, parentRule);
3954
- putDisabledTip();
3955
- }
3956
- function handleFormItemAdd({ newIndex }) {
3957
- const rule = widgetFormRules[newIndex];
3958
- dragAdd(rule);
3959
- hideShowDragTip();
3960
- }
3961
- function handleFormItemUpdate({ newIndex }) {
3962
- const rule = widgetFormRules[newIndex];
3963
- if (rule)
3964
- setActiveRule(widgetFormRules[newIndex]);
3965
- }
3966
- function handleFormItemDragEnd() {
3967
- putDisabledTip();
3968
- resetPutDisabled();
3969
- }
3970
- function handleFormItemClick(rule) {
3971
- setActiveRule(rule);
3972
- }
3973
- function copyRule(rule, ruleConfig, ruleHost, isCopyChildRule = false, needCopyField = false) {
3974
- const newRule = makeRule(ruleConfig);
3975
- if (isCopyChildRule) {
3976
- ruleHost.push(newRule);
3977
- } else {
3978
- const index = ruleHost.findIndex(
3979
- (ruleItem) => ruleItem.field === rule.field
3980
- );
3981
- ruleHost.splice(index + 1, 0, newRule);
3982
- }
3983
- copyPropValue(rule, newRule, needCopyField);
3984
- if (rule?.config?.childRules?.length) {
3985
- rule.config.childRules.forEach((cRule) => {
3986
- const config = cRule?.config?.config || ruleList[cRule.name];
3987
- copyRule(cRule, config, newRule.config.childRules, true, needCopyField);
3988
- });
3989
- }
3990
- return newRule;
3991
- }
3992
- function handleFormItemCopy(rule, parentRule) {
3993
- const newRule = copyRule(
3994
- rule,
3995
- rule.config.config,
3996
- parentRule?.config?.childRules || widgetFormRules
3997
- );
3998
- setActiveRule(newRule, parentRule);
3999
- }
4000
- function handleFormItemDelete(targetRule, parentRule) {
4001
- if (targetRule.config.linkProductCount > 0) {
4002
- message.error("\u8BE5\u63A7\u4EF6\u5DF2\u88AB\u8BBE\u4E3A\u6570\u636E\u8FC7\u6EE4\u6761\u4EF6\uFF0C\u4E0D\u53EF\u5220\u9664\u3002");
4003
- return;
4004
- }
4005
- if (props.flowCondition?.[targetRule.field]) {
4006
- message.error(
4007
- `\u8BE5\u7EC4\u4EF6\u5728\u201C${props.flowCondition[targetRule.field]}\u201D\u5DF2\u88AB\u8BBE\u4E3A\u5BA1\u6279\u6761\u4EF6\uFF0C\u4E0D\u53EF\u5220\u9664\u3002`
4008
- );
4009
- return;
4010
- }
4011
- const parentList = parentRule?.config?.childRules || widgetFormRules;
4012
- const index = parentList.findIndex((rule) => rule.field === targetRule.field);
4013
- parentList.splice(index, 1);
4014
- delete cacheProps[targetRule.field];
4015
- if (targetRule.field === activeRule.value.field) {
4016
- const newIndex = Math.min(parentList.length - 1, index);
4017
- if (newIndex >= 0) {
4018
- setActiveRule(parentList[newIndex]);
4019
- } else if (parentRule) {
4020
- setActiveRule(parentRule);
4021
- } else {
4022
- activeRule.value = {};
4023
- }
4024
- } else if (targetRule?.config?.childRules?.some(
4025
- (rule) => rule.field === activeRule.value.field
4026
- )) {
4027
- const newIndex = Math.min(parentList.length - 1, index);
4028
- if (newIndex >= 0) {
4029
- setActiveRule(parentList[newIndex]);
4030
- } else {
4031
- resetActiveRule();
4032
- }
4033
- }
4034
- if (productLinkShop(targetRule)) {
4035
- setShopLinkProductCount();
4036
- }
4037
- }
4038
- function makePropRule(rule, parentRule) {
4039
- return rule.config.config.props(rule, parentRule, widgetFormRules);
4040
- }
4041
- function setActiveRule(rule, parentRule = void 0) {
4042
- activeRule.value = rule;
4043
- activeParentRule.value = parentRule;
4044
- if (!cacheProps[rule.field]) {
4045
- cacheProps[rule.field] = makePropRule(rule, parentRule);
4046
- }
4047
- flowConditionEffect(props.flowCondition);
4048
- setMainShopPropDisabled(rule.field);
4049
- }
4050
- function propChange(field, value) {
4051
- setRulePropValue(field, value, activeRule.value);
4052
- processShopProps(field, value);
4053
- if (activeRule.value.config.config.name === "product" && field === "config.dataFiltering") {
4054
- setShopLinkProductCount();
4055
- }
4056
- }
4057
- function processShopProps(field, value) {
4058
- if (activeRule.value?.config?.config.name === "shop") {
4059
- if (field === "config.isMain") {
4060
- const shopProps = cacheProps[activeRule.value.field];
4061
- const requiredRule = shopProps.find(
4062
- (rule) => rule.field === "effect.required"
4063
- );
4064
- if (value) {
4065
- requiredRule.value = true;
4066
- }
4067
- flowConditionEffect(props.flowCondition);
4068
- }
4069
- }
4070
- }
4071
- function setRulePropValue(field, value, rule) {
4072
- field.split(".").reduce((pre, cur, index, arr) => {
4073
- if (index === arr.length - 1) {
4074
- pre[cur] = value;
4075
- } else {
4076
- if (!pre[cur]) {
4077
- pre[cur] = {};
4078
- }
4079
- }
4080
- return pre[cur];
4081
- }, rule);
4082
- }
4083
- function copyPropValue(oldRule, newRule, needCopyField = false) {
4084
- if (needCopyField && oldRule.field) {
4085
- newRule.field = oldRule.field;
4086
- }
4087
- newRule.config.propsFields.forEach((field) => {
4088
- if (field !== "config.childRules")
4089
- setRulePropValue(field, cloneDeep(getValue(field, oldRule)), newRule);
4090
- });
4091
- }
4092
- function handleWidgetAdd(rule, parentRule) {
4093
- dragAdd(rule, parentRule);
4094
- }
4095
- function handlePropsSetActive(rule) {
4096
- setActiveRule(rule, activeRule.value);
4097
- }
4098
- function handleAddChildRule(config) {
4099
- const rule = makeRule(config);
4100
- activeRule.value.config.childRules.push(rule);
4101
- }
4102
- function getValue(field, oldRule) {
4103
- return field.split(".").reduce((pre, cur) => {
4104
- return pre?.[cur];
4105
- }, oldRule);
4106
- }
4107
- function resetFieldRatio(rule, parentRuleType) {
4108
- if (!parentRuleType) {
4109
- rule.config.fieldRatio = "100%";
4110
- } else if (parentRuleType === WidgetType.RowWidget) {
4111
- const ruleName = rule.config.config.name;
4112
- rule.config.fieldRatio = ruleName === "table" || ruleName === "product" ? 24 : 12;
4113
- } else if (parentRuleType === WidgetType.TableWidget) {
4114
- rule.config.fieldRatio = "140px";
4115
- }
4116
- }
4117
- function getFormRule() {
4118
- return widgetFormRules.map((rule) => parseRule(rule));
4119
- }
4120
- function parseRule(rule) {
4121
- const ruleParsed = rule.config.config.parse(rule);
4122
- const childRules = rule?.config?.childRules;
4123
- if (childRules?.length) {
4124
- const childRulesParsed = ruleParsed.config.childRules = [];
4125
- childRules.forEach((ruleItem) => {
4126
- childRulesParsed.push(parseRule(ruleItem));
4127
- });
4128
- }
4129
- return ruleParsed;
4130
- }
4131
- function edit(formRules) {
4132
- widgetFormRules.splice(0);
4133
- formRules.forEach(
4134
- (item) => copyRule(item, ruleList[item.name], widgetFormRules, true, true)
4135
- );
4136
- }
4137
- function getRule(name) {
4138
- return makeRule(ruleList[name]);
4139
- }
4140
- function validate(rules = widgetFormRules) {
4141
- let pass = true;
4142
- for (const rule of rules) {
4143
- const config = rule.config.config || {};
4144
- const childRules = rule.config.childRules || [];
4145
- if (!rule?.title?.title && config.name !== "instruction") {
4146
- pass = false;
4147
- }
4148
- if (!rule?.value && config.name === "instruction") {
4149
- pass = false;
4150
- }
4151
- if (config.name === "table" && !childRules.length) {
4152
- pass = false;
4153
- }
4154
- if (!pass && rule.field !== activeRule.value.field) {
4155
- setActiveRule(rule);
4156
- }
4157
- if (pass && childRules.length) {
4158
- for (const childRule of childRules) {
4159
- if (!validate(childRules)) {
4160
- pass = false;
4161
- break;
4162
- }
4163
- }
4164
- }
4165
- if (!pass) {
4166
- nextTick(() => {
4167
- fApi.value.validate();
4168
- });
4169
- break;
4170
- }
4171
- }
4172
- return pass;
4173
- }
4174
- function flowConditionEffect(flowCondition) {
4175
- if (activeRule.value.config) {
4176
- const activeProps2 = cacheProps[activeRule.value.field];
4177
- const ruleName = activeRule.value.config.config.name;
4178
- let disabled;
4179
- if (ruleName === "shop") {
4180
- const isMainValue = activeProps2.find(
4181
- (rule) => rule.field === "config.isMain"
4182
- )?.value;
4183
- disabled = !!flowCondition[activeRule.value.field] || isMainValue;
4184
- } else {
4185
- disabled = !!flowCondition[activeRule.value.field];
4186
- }
4187
- const requiredRule = activeProps2?.find(
4188
- (rule) => rule.field === "effect.required"
4189
- );
4190
- if (requiredRule) {
4191
- if (!requiredRule.props) {
4192
- requiredRule.props = {};
4193
- }
4194
- requiredRule.props.disabled = disabled;
4195
- }
4196
- if (["radio", "checkbox"].includes(ruleName)) {
4197
- const optionsRule = activeProps2?.find((rule) => rule.field === "options");
4198
- optionsRule.props.disabled = disabled;
4199
- }
4200
- if (ruleName === "materialType") {
4201
- const formatRule = activeProps2?.find(
4202
- (rule) => rule.field === "config.format"
4203
- );
4204
- const multipleRule = activeProps2?.find(
4205
- (rule) => rule.field === "props.multiple"
4206
- );
4207
- formatRule.props = {
4208
- disabled
4209
- };
4210
- multipleRule.props = {
4211
- disabled
4212
- };
4213
- }
4214
- if (["people", "department"].includes(ruleName)) {
4215
- const limitRule = activeProps2?.find(
4216
- (rule) => rule.field === "props.limit"
4217
- );
4218
- limitRule.props = {
4219
- disabled
4220
- };
4221
- }
4222
- }
4223
- }
4224
- function resetActiveRule() {
4225
- activeRule.value = {};
4226
- activeParentRule.value = {};
4227
- for (const key in cacheProps) {
4228
- cacheProps[key] = void 0;
4229
- }
4230
- }
4231
- function getPopupContainer() {
4232
- return document.body;
4233
- }
4234
- function getMainShop() {
4235
- return widgetFormRules.find(
4236
- (rule) => rule?.config?.config?.name === "shop" && rule?.config?.isMain
4237
- );
4238
- }
4239
- function setMainShopPropDisabled(field) {
4240
- const propsRules = cacheProps[field];
4241
- const mainShopPropRule = propsRules.find(
4242
- (rule) => rule.field === "config.isMain"
4243
- );
4244
- const mainShopRule = getMainShop();
4245
- if (mainShopPropRule) {
4246
- if (!mainShopPropRule.props) {
4247
- mainShopPropRule.props = {};
4248
- }
4249
- mainShopPropRule.props.disabled = !!mainShopRule && !mainShopPropRule.value;
4250
- }
4251
- }
4252
- function setShopLinkProductCount() {
4253
- widgetFormRules.forEach((rule) => filterShopRule(rule));
4254
- }
4255
- function filterShopRule(rule) {
4256
- if (rule.config.config.name === "shop") {
4257
- rule.config.linkProductCount = calculateLinkProductCount(rule.field);
4258
- }
4259
- if (rule.config.config.name === "row" && rule.config.childRules?.length) {
4260
- rule.config.childRules.forEach((cRule) => filterShopRule(cRule));
4261
- }
4262
- }
4263
- function calculateLinkProductCount(shopField) {
4264
- return widgetFormRules.reduce((count, rule) => {
4265
- return count += recursiveCalculateLinkProductCount(shopField, rule);
4266
- }, 0);
4267
- }
4268
- function recursiveCalculateLinkProductCount(shopField, rule, count = 0) {
4269
- if (rule.config.config.name === "product" && rule.config.dataFiltering === shopField) {
4270
- count++;
4271
- }
4272
- if (rule.config.childRules?.length) {
4273
- rule.config.childRules.forEach(
4274
- (cRule) => recursiveCalculateLinkProductCount(shopField, cRule, count)
4275
- );
4276
- }
4277
- return count;
4278
- }
4279
- function handleTableChildRuleDelete(rule) {
4280
- if (productLinkShop(rule))
4281
- setShopLinkProductCount();
4282
- }
4283
- function productLinkShop(rule) {
4284
- return rule.config.config.name === "product" && rule.config.dataFiltering;
4285
- }
4286
- function getShopIndex(formRules, initIndex) {
4287
- function shopIndex(rule, initIndex2) {
4288
- if (rule.name === "shop") {
4289
- initIndex2 = Math.max(
4290
- initIndex2,
4291
- rule.title ? rule.title.title.replace("\u5E97\u94FA", "") : 1
4292
- );
4293
- }
4294
- if (rule.config?.childRules?.length) {
4295
- rule.config.childRules.forEach((cRule) => {
4296
- initIndex2 = shopIndex(cRule, initIndex2);
4297
- });
4298
- }
4299
- return initIndex2;
4300
- }
4301
- formRules.forEach((rule) => {
4302
- initIndex = shopIndex(rule, initIndex);
4303
- });
4304
- return initIndex;
4305
- }
4306
- function initPage(formRules) {
4307
- if (formRules?.length) {
4308
- setShopIndex(0);
4309
- edit(formRules);
4310
- setShopLinkProductCount();
4311
- setShopIndex(getShopIndex(formRules, 0));
4312
- }
4313
- }
4314
- watch(
4315
- () => props.formRules,
4316
- (formRules) => {
4317
- initPage(formRules);
4318
- },
4319
- {
4320
- immediate: true
4321
- }
4322
- );
4323
- watch(
4324
- () => props.flowCondition,
4325
- (flowCondition) => {
4326
- flowConditionEffect(flowCondition);
4327
- },
4328
- {
4329
- deep: true
4330
- }
4331
- );
4332
- expose({
4333
- getFormRule,
4334
- getRule,
4335
- validate,
4336
- resetActiveRule
4337
- });
4338
- return (_ctx, _cache) => {
4339
- const _component_ACol = resolveComponent("ACol");
4340
- const _component_ARow = resolveComponent("ARow");
4341
- const _component_FormCreate = resolveComponent("FormCreate");
4342
- return openBlock(), createBlock(unref(Layout), { class: "bm-form-designer" }, {
4343
- default: withCtx(() => [
4344
- createVNode(unref(LayoutSider), {
4345
- class: "bfd-sider-left",
4346
- width: "260"
4347
- }, {
4348
- default: withCtx(() => [
4349
- createVNode(_component_ARow, { class: "bm-tabs" }, {
4350
- default: withCtx(() => [
4351
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(tabData), (item) => {
4352
- return openBlock(), createBlock(_component_ACol, {
4353
- key: item.key,
4354
- class: normalizeClass(["bm-tabs-item", activeKey.value === item.key ? "active" : ""]),
4355
- onClick: ($event) => handleTabChange(item.key)
4356
- }, {
4357
- default: withCtx(() => [
4358
- createTextVNode(toDisplayString(item.tab), 1)
4359
- ]),
4360
- _: 2
4361
- }, 1032, ["class", "onClick"]);
4362
- }), 128))
4363
- ]),
4364
- _: 1
4365
- }),
4366
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(menuList), (item, index) => {
4367
- return openBlock(), createElementBlock("div", { key: index }, [
4368
- createElementVNode("div", _hoisted_1, toDisplayString(item.title), 1),
4369
- createVNode(unref(Draggable), {
4370
- class: "bm-menu-wrap",
4371
- list: item.list,
4372
- group: { name: "widget", pull: "clone", put: false },
4373
- "item-key": "name",
4374
- sort: false,
4375
- clone: cloneMenuItem,
4376
- move: moveMenuItem,
4377
- "force-fallback": true,
4378
- "scroll-sensitivity": 100,
4379
- onStart: handleMenuItemDragStart,
4380
- onEnd: handleMenuItemDragEnd
4381
- }, {
4382
- item: withCtx(({ element }) => [
4383
- createElementVNode("div", {
4384
- style: normalizeStyle({ flexBasis: item.name === "dataForm" ? "100%" : "50%" }),
4385
- class: "bm-menu-item-wrap"
4386
- }, [
4387
- createElementVNode("div", {
4388
- class: "bm-menu-item",
4389
- onClick: ($event) => handleMenuItemClick(element)
4390
- }, [
4391
- (openBlock(), createBlock(resolveDynamicComponent(element.icon), { class: "bm-menu-icon" })),
4392
- createTextVNode(" " + toDisplayString(element.label), 1)
4393
- ], 8, _hoisted_2),
4394
- createVNode(DragPlaceholder)
4395
- ], 4)
4396
- ]),
4397
- _: 2
4398
- }, 1032, ["list"])
4399
- ]);
4400
- }), 128))
4401
- ]),
4402
- _: 1
4403
- }),
4404
- createVNode(unref(LayoutContent), { class: "bfd-main" }, {
4405
- default: withCtx(() => [
4406
- createElementVNode("div", _hoisted_3, [
4407
- createVNode(unref(Draggable), {
4408
- list: widgetFormRules,
4409
- class: "bm-widget-form",
4410
- group: {
4411
- name: "formWidget",
4412
- pull: true,
4413
- put: ["widget", "formWidget", "rowWidget"]
4414
- },
4415
- "item-key": "field",
4416
- "ghost-class": "form-item-drag-ghost",
4417
- move: moveFormItem,
4418
- "force-fallback": true,
4419
- delay: 50,
4420
- onAdd: handleFormItemAdd,
4421
- onUpdate: handleFormItemUpdate,
4422
- onEnd: handleFormItemDragEnd
4423
- }, {
4424
- item: withCtx(({ element }) => [
4425
- createElementVNode("div", _hoisted_4, [
4426
- createVNode(DragTool, {
4427
- rule: element,
4428
- "active-rule-field": activeRule.value.field,
4429
- style: normalizeStyle({
4430
- width: element.config.fieldRatio
4431
- }),
4432
- onCopy: handleFormItemCopy,
4433
- onDelete: handleFormItemDelete,
4434
- onClick: ($event) => handleFormItemClick(element),
4435
- onSetActiveRule: setActiveRule,
4436
- onWidgetAdd: handleWidgetAdd
4437
- }, null, 8, ["rule", "active-rule-field", "style", "onClick"]),
4438
- createVNode(DragPlaceholder)
4439
- ])
4440
- ]),
4441
- _: 1
4442
- }, 8, ["list"]),
4443
- _ctx.showDragTip ? (openBlock(), createBlock(NoDataTip, {
4444
- key: 0,
4445
- class: "bm-no-data-tip"
4446
- })) : createCommentVNode("v-if", true)
4447
- ])
4448
- ]),
4449
- _: 1
4450
- }),
4451
- createVNode(unref(LayoutSider), {
4452
- class: "bfd-sider-right",
4453
- width: "288"
4454
- }, {
4455
- default: withCtx(() => [
4456
- activeRule.value.field ? (openBlock(), createElementBlock("div", _hoisted_5, [
4457
- (openBlock(), createBlock(resolveDynamicComponent(activeRule.value.config?.config.icon))),
4458
- createTextVNode(" " + toDisplayString(activeRule.value.config?.config.label) + " ", 1),
4459
- activeRule.value.type === unref(WidgetType).UploadFile ? (openBlock(), createBlock(unref(Tooltip), { key: 0 }, {
4460
- title: withCtx(() => [
4461
- createTextVNode(" \u5355\u4E2A\u6587\u4EF6\u5927\u5C0F\u9700\u572820M\u4EE5\u5185 ")
4462
- ]),
4463
- default: withCtx(() => [
4464
- createVNode(unref(QuestionCircleOutlined), { style: { "color": "#babac1", "font-size": "14px", "margin-left": "5px" } })
4465
- ]),
4466
- _: 1
4467
- })) : createCommentVNode("v-if", true)
4468
- ])) : createCommentVNode("v-if", true),
4469
- createElementVNode("div", _hoisted_6, [
4470
- _ctx.flowCondition?.[activeRule.value.field] ? (openBlock(), createElementBlock("div", _hoisted_7, [
4471
- createVNode(unref(ExclamationCircleFilled), { style: { "color": "#2f4eed" } }),
4472
- createTextVNode(" \u8BE5\u7EC4\u4EF6\u5728\u201C" + toDisplayString(_ctx.flowCondition[activeRule.value.field]) + "\u201D\u5DF2\u88AB\u8BBE\u4E3A\u5BA1\u6279\u6761\u4EF6\uFF0C" + toDisplayString(flowConditionTipMap[activeRule.value?.config?.config?.name]), 1)
4473
- ])) : createCommentVNode("v-if", true),
4474
- createVNode(_component_FormCreate, {
4475
- api: fApi.value,
4476
- "onUpdate:api": _cache[0] || (_cache[0] = ($event) => fApi.value = $event),
4477
- option: {
4478
- form: {
4479
- layout: "vertical"
4480
- },
4481
- submitBtn: {
4482
- show: false
4483
- },
4484
- info: {
4485
- type: "tooltip",
4486
- align: "left",
4487
- arrowPointAtCenter: true,
4488
- overlayStyle: {
4489
- width: "184px"
4490
- },
4491
- getPopupContainer
4492
- }
4493
- },
4494
- rule: unref(activeProps),
4495
- onChange: propChange,
4496
- onSetActive: handlePropsSetActive,
4497
- onAddChildRule: handleAddChildRule,
4498
- onTableChildRuleDelete: handleTableChildRuleDelete
4499
- }, null, 8, ["api", "option", "rule"])
4500
- ])
4501
- ]),
4502
- _: 1
4503
- })
4504
- ]),
4505
- _: 1
4506
- });
4507
- };
4508
- }
4509
- });
4510
- var FormDesigner = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "form-designer.vue"]]);
4511
-
4512
- const BmFormDesigner = withInstall(FormDesigner);
4513
-
4514
- export { BmFormDesigner, BmFormDesigner as default };