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