@fecp/designer 5.5.78 → 5.5.80

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.
@@ -33,6 +33,7 @@ require("../../../../node_modules/element-plus/theme-chalk/el-date-picker.css.js
33
33
  ;/* empty css */
34
34
  const _pluginVue_exportHelper = require("../../../../_virtual/_plugin-vue_export-helper.js");
35
35
  ;/* empty css */
36
+ const index$8 = require("../../api/index.js");
36
37
  ;/* empty css */
37
38
  ;/* empty css */
38
39
  ;/* empty css */
@@ -71,20 +72,35 @@ const _hoisted_14 = { class: "field-name" };
71
72
  const _hoisted_15 = { class: "field-value-display" };
72
73
  const _hoisted_16 = {
73
74
  key: 1,
75
+ class: "field-assignments-display"
76
+ };
77
+ const _hoisted_17 = { class: "field-name" };
78
+ const _hoisted_18 = { class: "field-value-display" };
79
+ const _hoisted_19 = {
80
+ key: 2,
74
81
  class: "field-value-item"
75
82
  };
76
- const _hoisted_17 = {
83
+ const _hoisted_20 = {
77
84
  key: 1,
78
85
  class: "tab-empty-state"
79
86
  };
80
- const _hoisted_18 = { class: "advanced-title" };
81
- const _hoisted_19 = { key: 0 };
82
- const _hoisted_20 = {
87
+ const _hoisted_21 = { class: "advanced-title" };
88
+ const _hoisted_22 = { key: 0 };
89
+ const _hoisted_23 = {
83
90
  key: 1,
84
91
  class: "field-assignment-area"
85
92
  };
86
- const _hoisted_21 = { class: "field-assignment-list" };
87
- const _hoisted_22 = {
93
+ const _hoisted_24 = { class: "field-assignment-list" };
94
+ const _hoisted_25 = {
95
+ key: 0,
96
+ class: "field-value-input"
97
+ };
98
+ const _hoisted_26 = {
99
+ key: 2,
100
+ class: "field-assignment-area"
101
+ };
102
+ const _hoisted_27 = { class: "field-assignment-list" };
103
+ const _hoisted_28 = {
88
104
  key: 0,
89
105
  class: "field-value-input"
90
106
  };
@@ -99,10 +115,24 @@ const _sfc_main = {
99
115
  emits: ["update:linkedConfig"],
100
116
  setup(__props, { emit: __emit }) {
101
117
  const props = __props;
118
+ const currentInstance = Vue.getCurrentInstance();
119
+ const ctx = currentInstance.proxy;
102
120
  const emit = __emit;
103
121
  const fieldsData = Vue.computed(() => {
104
122
  return common.getEditConfigDataFields();
105
123
  });
124
+ const optionsFieldsData = Vue.computed(() => {
125
+ const list = ["select", "multipleSelection", "radio", "checkbox"];
126
+ const fieldList = common.getEditConfigDataFields().filter(
127
+ (item) => list.includes(item.fieldType)
128
+ );
129
+ return fieldList.filter(
130
+ (item) => {
131
+ var _a;
132
+ return ((_a = item.optionConfig) == null ? void 0 : _a.optionSource) != "dataSource";
133
+ }
134
+ );
135
+ });
106
136
  const hiddenFields = Vue.computed(() => {
107
137
  const editConfigData = common.getEditConfigData();
108
138
  const fields = (editConfigData == null ? void 0 : editConfigData.hiddenFields) || [];
@@ -130,7 +160,7 @@ const _sfc_main = {
130
160
  desc: "让字段在特定条件成立时变为不可编辑"
131
161
  },
132
162
  // { label: "禁用", name: "disabled", desc: "让字段在特定条件成立时变为禁用" },
133
- { label: "属性", name: "property", desc: "让字段的其他属性根据条件动态变化" }
163
+ { label: "可选项", name: "options", desc: "让字段的选择项根据条件动态变化" }
134
164
  ]);
135
165
  const activeTab = Vue.ref("dataLink");
136
166
  const currentTab = Vue.computed(() => {
@@ -140,6 +170,38 @@ const _sfc_main = {
140
170
  const filterConfig = Vue.ref();
141
171
  const editingRuleIndex = Vue.ref(-1);
142
172
  const fieldAssignments = Vue.ref([]);
173
+ const optionsFieldsOptionsCache = Vue.ref({});
174
+ async function loadOptionsFieldsOptions(fieldId) {
175
+ if (!fieldId) return [];
176
+ if (optionsFieldsOptionsCache.value[fieldId]) {
177
+ return optionsFieldsOptionsCache.value[fieldId];
178
+ }
179
+ const options = await getOptionsFieldsOptions(
180
+ optionsFieldsData.value,
181
+ fieldId
182
+ );
183
+ optionsFieldsOptionsCache.value[fieldId] = options;
184
+ return options;
185
+ }
186
+ Vue.watch(
187
+ () => fieldAssignments.value.map((a) => a.fieldId).filter(Boolean).join(","),
188
+ async () => {
189
+ if (currentTab.value.name == "options") {
190
+ for (const assignment of fieldAssignments.value) {
191
+ if (assignment.fieldId && !optionsFieldsOptionsCache.value[assignment.fieldId]) {
192
+ await loadOptionsFieldsOptions(assignment.fieldId);
193
+ }
194
+ }
195
+ }
196
+ },
197
+ { immediate: true }
198
+ );
199
+ function getOptionsFieldsOptionsByCache(fieldId) {
200
+ return optionsFieldsOptionsCache.value[fieldId] || [];
201
+ }
202
+ function onFieldIdChange(index2) {
203
+ fieldAssignments.value[index2].optionsOpt = null;
204
+ }
143
205
  const filterTitle = Vue.ref("");
144
206
  const filterSuccessDesc = Vue.ref("条件满足时或不设置条件,数据联动赋值以下字段");
145
207
  function handleAddRule(tab) {
@@ -161,6 +223,9 @@ const _sfc_main = {
161
223
  case "property":
162
224
  filterSuccessDesc.value = `条件满足时,${tab.label}以下字段的属性`;
163
225
  break;
226
+ case "options":
227
+ filterSuccessDesc.value = `条件满足时,可显示以下字段的可选项`;
228
+ break;
164
229
  }
165
230
  filterConfig.value = {
166
231
  operator: "and",
@@ -190,7 +255,7 @@ const _sfc_main = {
190
255
  dataLinkFieldList: dataLinkFieldList.value,
191
256
  filterConfig: data
192
257
  };
193
- if (currentTab.value.name == "dataLink") {
258
+ if (currentTab.value.name == "dataLink" || currentTab.value.name == "options") {
194
259
  newRule.fieldAssignments = common.cloneDeep(fieldAssignments.value);
195
260
  }
196
261
  if (editingRuleIndex.value == -1) {
@@ -216,7 +281,7 @@ const _sfc_main = {
216
281
  required: "必填字段",
217
282
  readonly: "只读字段",
218
283
  disabled: "禁用字段",
219
- property: "属性字段"
284
+ options: "字段显示可选项"
220
285
  };
221
286
  return titleMap[tabName] || "联动字段";
222
287
  };
@@ -231,6 +296,8 @@ const _sfc_main = {
231
296
  fieldAssignments.value.push({
232
297
  fieldId: null,
233
298
  value: null,
299
+ optionsOpt: null,
300
+ optionsLabel: "",
234
301
  isField: false,
235
302
  operator: "eq",
236
303
  formula: {
@@ -242,6 +309,19 @@ const _sfc_main = {
242
309
  }
243
310
  });
244
311
  };
312
+ function onOptionsOptChange(index2) {
313
+ const assignment = fieldAssignments.value[index2];
314
+ if (!assignment.optionsOpt || !assignment.optionsOpt.length) {
315
+ assignment.optionsLabel = "";
316
+ return;
317
+ }
318
+ const options = optionsFieldsOptionsCache.value[assignment.fieldId] || [];
319
+ const labels = assignment.optionsOpt.map((val) => {
320
+ const opt = options.find((o) => o.value === val);
321
+ return opt ? opt.label : val;
322
+ });
323
+ assignment.optionsLabel = labels.join(", ");
324
+ }
245
325
  const removeFieldAssignment = (index2) => {
246
326
  fieldAssignments.value.splice(index2, 1);
247
327
  };
@@ -249,9 +329,9 @@ const _sfc_main = {
249
329
  filterTitle.value = `${tab.label}联动规则`;
250
330
  filterConfig.value = common.cloneDeep(item.filterConfig);
251
331
  dataLinkFieldList.value = [...item.dataLinkFieldList.map(String)];
252
- if (tab.name == "dataLink" && item.fieldAssignments) {
332
+ if ((tab.name == "dataLink" || tab.name == "options") && item.fieldAssignments) {
253
333
  fieldAssignments.value = common.cloneDeep(item.fieldAssignments);
254
- } else if (tab.name == "dataLink") {
334
+ } else if (tab.name == "dataLink" || tab.name == "options") {
255
335
  fieldAssignments.value = [];
256
336
  }
257
337
  editingRuleIndex.value = index2;
@@ -267,6 +347,26 @@ const _sfc_main = {
267
347
  };
268
348
  emit("update:linkedConfig", newLinkedConfig);
269
349
  };
350
+ async function getOptionsFieldsOptions(optionsFieldsData2, fieldId) {
351
+ var _a;
352
+ const optionConfig = (_a = optionsFieldsData2.find(
353
+ (item) => item.id == fieldId
354
+ )) == null ? void 0 : _a.optionConfig;
355
+ if (!(optionConfig == null ? void 0 : optionConfig.optionSource)) return [];
356
+ if (optionConfig.optionSource == "custom") {
357
+ return optionConfig.options.map((item) => ({
358
+ label: item.label,
359
+ value: item.value
360
+ }));
361
+ } else if (optionConfig.optionSource == "dictionary") {
362
+ const data = await index$8.default.getDicDataByKey(
363
+ ctx.$http,
364
+ optionConfig.dictionaryValue
365
+ );
366
+ return Object.entries(data).map(([value, label]) => ({ label, value }));
367
+ }
368
+ return [];
369
+ }
270
370
  return (_ctx, _cache) => {
271
371
  const _component_el_button = index$2.ElButton;
272
372
  const _component_el_card = index$5.ElCard;
@@ -383,7 +483,18 @@ const _sfc_main = {
383
483
  ])
384
484
  ]);
385
485
  }), 128))
386
- ])) : (Vue.openBlock(), Vue.createElementBlock("span", _hoisted_16, Vue.toDisplayString(item.dataLinkFieldList.map((fieldId) => `${getFieldLabel(fieldId)}`).join(", ")), 1))
486
+ ])) : tab.name == "options" && item.fieldAssignments && item.fieldAssignments.length > 0 ? (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_16, [
487
+ (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(item.fieldAssignments, (assignment, index2) => {
488
+ return Vue.openBlock(), Vue.createElementBlock("div", {
489
+ key: index2,
490
+ class: "field-assignment-display-item"
491
+ }, [
492
+ Vue.createElementVNode("span", _hoisted_17, "「" + Vue.toDisplayString(getFieldLabel(assignment.fieldId)) + "」", 1),
493
+ _cache[7] || (_cache[7] = Vue.createElementVNode("span", { class: "field-operator" }, "→", -1)),
494
+ Vue.createElementVNode("span", _hoisted_18, Vue.toDisplayString(assignment.optionsLabel), 1)
495
+ ]);
496
+ }), 128))
497
+ ])) : (Vue.openBlock(), Vue.createElementBlock("span", _hoisted_19, Vue.toDisplayString(item.dataLinkFieldList.map((fieldId) => `${getFieldLabel(fieldId)}`).join(", ")), 1))
387
498
  ])
388
499
  ])
389
500
  ])
@@ -397,7 +508,7 @@ const _sfc_main = {
397
508
  _: 2
398
509
  }, 1024)
399
510
  ])) : Vue.createCommentVNode("", true),
400
- !((_d = (_c = props.linkedConfig) == null ? void 0 : _c[tab.name]) == null ? void 0 : _d.length) ? (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_17, [
511
+ !((_d = (_c = props.linkedConfig) == null ? void 0 : _c[tab.name]) == null ? void 0 : _d.length) ? (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_20, [
401
512
  Vue.createVNode(_component_el_empty, {
402
513
  description: tab.desc
403
514
  }, {
@@ -441,8 +552,8 @@ const _sfc_main = {
441
552
  default: Vue.withCtx(({ filterConfigData }) => {
442
553
  var _a, _b;
443
554
  return [
444
- Vue.createElementVNode("span", _hoisted_18, Vue.toDisplayString(Vue.unref(filterSuccessDesc)), 1),
445
- Vue.unref(currentTab).name !== "dataLink" ? (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_19, [
555
+ Vue.createElementVNode("span", _hoisted_21, Vue.toDisplayString(Vue.unref(filterSuccessDesc)), 1),
556
+ Vue.unref(currentTab).name !== "dataLink" && Vue.unref(currentTab).name !== "options" ? (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_22, [
446
557
  Vue.createVNode(_component_el_select, {
447
558
  modelValue: Vue.unref(dataLinkFieldList),
448
559
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => Vue.isRef(dataLinkFieldList) ? dataLinkFieldList.value = $event : null),
@@ -462,8 +573,80 @@ const _sfc_main = {
462
573
  ]),
463
574
  _: 2
464
575
  }, 1032, ["modelValue", "placeholder", "disabled"])
465
- ])) : (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_20, [
466
- Vue.createElementVNode("div", _hoisted_21, [
576
+ ])) : Vue.unref(currentTab).name == "options" ? (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_23, [
577
+ Vue.createElementVNode("div", _hoisted_24, [
578
+ (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(Vue.unref(fieldAssignments), (assignment, index2) => {
579
+ return Vue.openBlock(), Vue.createElementBlock("div", {
580
+ key: index2,
581
+ class: "field-assignment-item"
582
+ }, [
583
+ Vue.createVNode(_component_el_select, {
584
+ modelValue: assignment.fieldId,
585
+ "onUpdate:modelValue": ($event) => assignment.fieldId = $event,
586
+ filterable: "",
587
+ placeholder: "请选择字段",
588
+ style: { "width": "200px", "margin-right": "12px" },
589
+ onChange: ($event) => onFieldIdChange(index2)
590
+ }, {
591
+ default: Vue.withCtx(() => [
592
+ (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(Vue.unref(optionsFieldsData), (item) => {
593
+ return Vue.openBlock(), Vue.createBlock(_component_el_option, {
594
+ key: item.id,
595
+ label: item.label,
596
+ value: item.id
597
+ }, null, 8, ["label", "value"]);
598
+ }), 128))
599
+ ]),
600
+ _: 2
601
+ }, 1032, ["modelValue", "onUpdate:modelValue", "onChange"]),
602
+ assignment.fieldId ? (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_25, [
603
+ Vue.createVNode(_component_el_select, {
604
+ modelValue: assignment.optionsOpt,
605
+ "onUpdate:modelValue": ($event) => assignment.optionsOpt = $event,
606
+ multiple: "",
607
+ placeholder: "请选择可选项",
608
+ style: { "width": "100%", "margin-right": "12px" },
609
+ loading: !Vue.unref(optionsFieldsOptionsCache)[assignment.fieldId],
610
+ onChange: ($event) => onOptionsOptChange(index2)
611
+ }, {
612
+ default: Vue.withCtx(() => [
613
+ (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(getOptionsFieldsOptionsByCache(
614
+ assignment.fieldId
615
+ ), (item) => {
616
+ return Vue.openBlock(), Vue.createBlock(_component_el_option, {
617
+ key: item.value,
618
+ label: item.label,
619
+ value: item.value
620
+ }, null, 8, ["label", "value"]);
621
+ }), 128))
622
+ ]),
623
+ _: 2
624
+ }, 1032, ["modelValue", "onUpdate:modelValue", "loading", "onChange"])
625
+ ])) : Vue.createCommentVNode("", true),
626
+ Vue.createVNode(_component_el_button, {
627
+ type: "danger",
628
+ link: "",
629
+ icon: "Delete",
630
+ onClick: ($event) => removeFieldAssignment(index2),
631
+ style: { "margin-left": "8px" }
632
+ }, null, 8, ["onClick"])
633
+ ]);
634
+ }), 128))
635
+ ]),
636
+ Vue.createVNode(_component_el_button, {
637
+ type: "primary",
638
+ link: "",
639
+ icon: "CirclePlus",
640
+ onClick: addFieldAssignment,
641
+ class: "add-assignment-btn"
642
+ }, {
643
+ default: Vue.withCtx(() => _cache[8] || (_cache[8] = [
644
+ Vue.createTextVNode(" 添加可选项字段 ")
645
+ ])),
646
+ _: 1
647
+ })
648
+ ])) : (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_26, [
649
+ Vue.createElementVNode("div", _hoisted_27, [
467
650
  (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(Vue.unref(fieldAssignments), (assignment, index2) => {
468
651
  return Vue.openBlock(), Vue.createElementBlock("div", {
469
652
  key: index2,
@@ -510,7 +693,7 @@ const _sfc_main = {
510
693
  ]),
511
694
  _: 2
512
695
  }, 1032, ["modelValue", "onUpdate:modelValue"]),
513
- assignment.fieldId ? (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_22, [
696
+ assignment.fieldId ? (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_28, [
514
697
  Vue.createVNode(Vue.unref(FormulaEditorInput.default), {
515
698
  title: "公式配置",
516
699
  formulaConf: assignment.formula.value,
@@ -536,7 +719,7 @@ const _sfc_main = {
536
719
  onClick: addFieldAssignment,
537
720
  class: "add-assignment-btn"
538
721
  }, {
539
- default: Vue.withCtx(() => _cache[7] || (_cache[7] = [
722
+ default: Vue.withCtx(() => _cache[9] || (_cache[9] = [
540
723
  Vue.createTextVNode(" 添加字段赋值 ")
541
724
  ])),
542
725
  _: 1
@@ -550,5 +733,5 @@ const _sfc_main = {
550
733
  };
551
734
  }
552
735
  };
553
- const DataLinkage = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-889ebf8b"]]);
736
+ const DataLinkage = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-35097e4f"]]);
554
737
  exports.default = DataLinkage;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index.vue2.js");
3
+ const index = require("./index.vue.js");
4
4
  const Vue = require("vue");
5
5
  function useDialogDialog() {
6
6
  const dialogDialogVisible = Vue.ref(false);
@@ -86,7 +86,7 @@ const widgets = require("../table/property/widgets.vue.js");
86
86
  require("../../../../node_modules/element-plus/theme-chalk/el-tab-pane.css.js");
87
87
  ;/* empty css */
88
88
  ;/* empty css */
89
- ;/* empty css */
89
+ ;/* empty css */
90
90
  ;/* empty css */
91
91
  ;/* empty css */
92
92
  ;/* empty css */
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index.vue2.js");
3
+ const index = require("./index.vue.js");
4
4
  const Vue = require("vue");
5
5
  function useDialogGlobalDialog() {
6
6
  const dialogGlobalDialogVisible = Vue.ref(false);
@@ -54,8 +54,8 @@ const _pluginVue_exportHelper = require("../../../../../_virtual/_plugin-vue_exp
54
54
  require("../../../components/TemplateSelector.vue.js");
55
55
  require("../../table/default.js");
56
56
  ;/* empty css */
57
- ;/* empty css */
58
- ;/* empty css */
57
+ ;/* empty css */
58
+ ;/* empty css */
59
59
  require("../../../store/index.js");
60
60
  ;/* empty css */
61
61
  const index$2 = require("../../../../../node_modules/element-plus/es/components/collapse/index.js");