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