@fecp/designer 5.4.8 → 5.4.9

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.
@@ -2,7 +2,8 @@ import "../../../../../../node_modules/element-plus/es/index.mjs";
2
2
  /* empty css */
3
3
  /* empty css */
4
4
  /* empty css */
5
- import { computed, createBlock, openBlock, mergeProps, toHandlers, withCtx, createElementBlock, Fragment, renderList } from "vue";
5
+ import { inject, computed, createBlock, openBlock, mergeProps, toHandlers, withCtx, createElementBlock, Fragment, renderList } from "vue";
6
+ import { setFormDataByFieldMapping } from "../../../utils/common.mjs";
6
7
  import { ElCheckboxGroup, ElCheckbox } from "../../../../../../node_modules/element-plus/es/components/checkbox/index.mjs";
7
8
  const _sfc_main = /* @__PURE__ */ Object.assign({
8
9
  inheritAttrs: false
@@ -37,6 +38,9 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
37
38
  emits: ["update:modelValue", "change"],
38
39
  setup(__props, { emit: __emit }) {
39
40
  const props = __props;
41
+ const formData = inject("formData", null);
42
+ const fieldsData = inject("fieldsData", []);
43
+ const hiddenFields = inject("hiddenFields", []);
40
44
  const emit = __emit;
41
45
  const inputValue = computed({
42
46
  get: () => {
@@ -54,6 +58,16 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
54
58
  var _a;
55
59
  return ((_a = props.optionConfig) == null ? void 0 : _a.options) || [];
56
60
  });
61
+ function handlerChange(val) {
62
+ setFormDataByFieldMapping(
63
+ val,
64
+ true,
65
+ options.value,
66
+ props.optionConfig.fieldMapping,
67
+ formData,
68
+ [...fieldsData.value, ...hiddenFields.value]
69
+ );
70
+ }
57
71
  return (_ctx, _cache) => {
58
72
  const _component_el_checkbox = ElCheckbox;
59
73
  const _component_el_checkbox_group = ElCheckboxGroup;
@@ -64,7 +78,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
64
78
  disabled: __props.disabled,
65
79
  style: {
66
80
  pointerEvents: __props.readonly ? "none" : "auto"
67
- }
81
+ },
82
+ onChange: handlerChange
68
83
  }), {
69
84
  default: withCtx(() => [
70
85
  (openBlock(true), createElementBlock(Fragment, null, renderList(options.value, (option) => {
@@ -2,7 +2,8 @@ import "../../../../../../node_modules/element-plus/es/index.mjs";
2
2
  /* empty css */
3
3
  /* empty css */
4
4
  /* empty css */
5
- import { computed, createBlock, openBlock, mergeProps, toHandlers, withCtx, createElementBlock, Fragment, renderList } from "vue";
5
+ import { inject, computed, createBlock, openBlock, mergeProps, toHandlers, withCtx, createElementBlock, Fragment, renderList } from "vue";
6
+ import { setFormDataByFieldMapping } from "../../../utils/common.mjs";
6
7
  import { ElRadioGroup, ElRadio } from "../../../../../../node_modules/element-plus/es/components/radio/index.mjs";
7
8
  const _sfc_main = /* @__PURE__ */ Object.assign({
8
9
  inheritAttrs: false
@@ -37,6 +38,9 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
37
38
  emits: ["update:modelValue", "change"],
38
39
  setup(__props, { emit: __emit }) {
39
40
  const props = __props;
41
+ const formData = inject("formData", null);
42
+ const fieldsData = inject("fieldsData", []);
43
+ const hiddenFields = inject("hiddenFields", []);
40
44
  const emit = __emit;
41
45
  const inputValue = computed({
42
46
  get: () => props.modelValue,
@@ -49,6 +53,16 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
49
53
  var _a;
50
54
  return ((_a = props.optionConfig) == null ? void 0 : _a.options) || [];
51
55
  });
56
+ function handlerChange(val) {
57
+ setFormDataByFieldMapping(
58
+ val,
59
+ false,
60
+ options.value,
61
+ props.optionConfig.fieldMapping,
62
+ formData,
63
+ [...fieldsData.value, ...hiddenFields.value]
64
+ );
65
+ }
52
66
  return (_ctx, _cache) => {
53
67
  const _component_el_radio = ElRadio;
54
68
  const _component_el_radio_group = ElRadioGroup;
@@ -59,7 +73,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
59
73
  disabled: __props.disabled,
60
74
  style: {
61
75
  pointerEvents: __props.readonly ? "none" : "auto"
62
- }
76
+ },
77
+ onChange: handlerChange
63
78
  }), {
64
79
  default: withCtx(() => [
65
80
  (openBlock(true), createElementBlock(Fragment, null, renderList(options.value, (option) => {
@@ -6,7 +6,8 @@ import "../../../../../../node_modules/element-plus/es/index.mjs";
6
6
  /* empty css */
7
7
  /* empty css */
8
8
  /* empty css */
9
- import { computed, createBlock, openBlock, mergeProps, toHandlers, withCtx, createElementBlock, Fragment, renderList } from "vue";
9
+ import { inject, computed, createBlock, openBlock, mergeProps, toHandlers, withCtx, createElementBlock, Fragment, renderList } from "vue";
10
+ import { setFormDataByFieldMapping } from "../../../utils/common.mjs";
10
11
  import { ElSelect, ElOption } from "../../../../../../node_modules/element-plus/es/components/select/index.mjs";
11
12
  const _sfc_main = /* @__PURE__ */ Object.assign({
12
13
  inheritAttrs: false
@@ -53,6 +54,9 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
53
54
  emits: ["update:modelValue", "change"],
54
55
  setup(__props, { emit: __emit }) {
55
56
  const props = __props;
57
+ const formData = inject("formData", null);
58
+ const fieldsData = inject("fieldsData", []);
59
+ const hiddenFields = inject("hiddenFields", []);
56
60
  const emit = __emit;
57
61
  const inputValue = computed({
58
62
  get: () => props.modelValue,
@@ -65,6 +69,16 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
65
69
  if (!props.optionConfig) return [];
66
70
  return props.optionConfig.options || [];
67
71
  });
72
+ function handlerChange(val) {
73
+ setFormDataByFieldMapping(
74
+ val,
75
+ props.multiple,
76
+ options.value,
77
+ props.optionConfig.fieldMapping,
78
+ formData,
79
+ [...fieldsData.value, ...hiddenFields.value]
80
+ );
81
+ }
68
82
  return (_ctx, _cache) => {
69
83
  const _component_el_option = ElOption;
70
84
  const _component_el_select = ElSelect;
@@ -79,7 +93,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
79
93
  filterable: __props.filterable,
80
94
  style: [{ "width": "100%" }, {
81
95
  pointerEvents: __props.readonly ? "none" : "auto"
82
- }]
96
+ }],
97
+ onChange: handlerChange
83
98
  }), {
84
99
  default: withCtx(() => [
85
100
  (openBlock(true), createElementBlock(Fragment, null, renderList(options.value, (option) => {
@@ -31,9 +31,7 @@ const handleSearchData = (filterValues, completeFilterFields) => {
31
31
  Object.keys(filterValues).forEach((key) => {
32
32
  const value = filterValues[key];
33
33
  if (value !== "" && value !== null && value !== void 0) {
34
- const fieldConfig = completeFilterFields.find(
35
- (field) => field.id == key
36
- );
34
+ const fieldConfig = completeFilterFields.find((field) => field.id == key);
37
35
  const fieldName = (fieldConfig == null ? void 0 : fieldConfig.fieldName) || key;
38
36
  const maxKey = `${key}_max`;
39
37
  const maxValue = filterValues[maxKey];
@@ -52,9 +50,27 @@ const handleSearchData = (filterValues, completeFilterFields) => {
52
50
  });
53
51
  return filters;
54
52
  };
53
+ const setFormDataByFieldMapping = (value, multiple, options, fieldMapping, formData, fields) => {
54
+ let selectedOptions = [];
55
+ if (multiple) {
56
+ selectedOptions = options.filter((opt) => value.includes(opt.value));
57
+ } else {
58
+ selectedOptions = options.filter((opt) => opt.value == value);
59
+ }
60
+ if (fieldMapping && Array.isArray(fieldMapping)) {
61
+ fieldMapping.forEach((item) => {
62
+ const field = fields.find((field2) => field2.id === item.field);
63
+ if (field) {
64
+ const values = selectedOptions.map((row) => row[item.value]);
65
+ formData.value[field.fieldName] = values.join(",");
66
+ }
67
+ });
68
+ }
69
+ };
55
70
  export {
56
71
  cloneDeep,
57
72
  handleSearchData,
58
73
  isEqual,
59
- removeEmptyValues
74
+ removeEmptyValues,
75
+ setFormDataByFieldMapping
60
76
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const version = "5.4.8";
3
+ const version = "5.4.9";
4
4
  const packageJson = {
5
5
  version
6
6
  };
@@ -187,5 +187,5 @@ const _sfc_main = {
187
187
  };
188
188
  }
189
189
  };
190
- const FieldMapping = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-bd18993e"]]);
190
+ const FieldMapping = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-a09f49c9"]]);
191
191
  exports.default = FieldMapping;
@@ -407,5 +407,5 @@ const _sfc_main = {
407
407
  };
408
408
  }
409
409
  };
410
- const FieldSetMapping = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-ac24177e"]]);
410
+ const FieldSetMapping = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-87a3bc4a"]]);
411
411
  exports.default = FieldSetMapping;
@@ -14,6 +14,8 @@ const vue = require("vue");
14
14
  const index$3 = require("../../../node_modules/@element-plus/icons-vue/dist/index.js");
15
15
  const vueDraggablePlus = require("../../../node_modules/vue-draggable-plus/dist/vue-draggable-plus.js");
16
16
  const DataSourceSelect = require("./DataSourceSelect.vue.js");
17
+ const FieldMapping = require("./FieldMapping.vue2.js");
18
+ const common = require("../packages/utils/common.js");
17
19
  ;/* empty css */
18
20
  const _pluginVue_exportHelper = require("../../../_virtual/_plugin-vue_export-helper.js");
19
21
  const index = require("../../../node_modules/element-plus/es/components/form/index.js");
@@ -27,6 +29,10 @@ const _hoisted_4 = ["onClick"];
27
29
  const _hoisted_5 = { class: "data-source-fields" };
28
30
  const _hoisted_6 = { class: "field-item" };
29
31
  const _hoisted_7 = { class: "field-item" };
32
+ const _hoisted_8 = {
33
+ class: "field-item",
34
+ style: { "flex-direction": "column", "align-items": "start" }
35
+ };
30
36
  const _sfc_main = {
31
37
  __name: "OptionConfig",
32
38
  props: {
@@ -54,21 +60,29 @@ const _sfc_main = {
54
60
  dataSourceValue: "",
55
61
  displayField: "",
56
62
  valueField: "",
57
- dictionaryValue: ""
63
+ dictionaryValue: "",
64
+ fieldMapping: []
58
65
  })
59
66
  }
60
67
  },
61
68
  emits: ["update:modelValue"],
62
69
  setup(__props, { emit: __emit }) {
63
- var _a, _b, _c, _d, _e, _f;
70
+ var _a, _b, _c, _d, _e, _f, _g;
64
71
  const props = __props;
65
72
  const emit = __emit;
73
+ vue.computed(() => {
74
+ const displayFields = common.getEditConfigDataFields() || [];
75
+ const editConfigData = common.getEditConfigData();
76
+ const hiddenList = (editConfigData == null ? void 0 : editConfigData.hiddenFields) || [];
77
+ return [...displayFields, ...hiddenList];
78
+ });
66
79
  const optionSource = vue.ref(((_a = props.modelValue) == null ? void 0 : _a.optionSource) || "custom");
67
80
  const options = vue.ref(((_b = props.modelValue) == null ? void 0 : _b.options) || []);
68
81
  const dataSourceValue = vue.ref(((_c = props.modelValue) == null ? void 0 : _c.dataSourceValue) || "");
69
82
  const displayField = vue.ref(((_d = props.modelValue) == null ? void 0 : _d.displayField) || "");
70
83
  const valueField = vue.ref(((_e = props.modelValue) == null ? void 0 : _e.valueField) || "");
71
84
  const dictionaryValue = vue.ref(((_f = props.modelValue) == null ? void 0 : _f.dictionaryValue) || "");
85
+ const fieldMapping = vue.ref(((_g = props.modelValue) == null ? void 0 : _g.fieldMapping) || []);
72
86
  const isUpdatingFromProps = vue.ref(false);
73
87
  vue.watch(
74
88
  () => props.modelValue,
@@ -80,6 +94,7 @@ const _sfc_main = {
80
94
  displayField.value = newVal.displayField || "";
81
95
  valueField.value = newVal.valueField || "";
82
96
  dictionaryValue.value = newVal.dictionaryValue || "";
97
+ fieldMapping.value = newVal.fieldMapping || [];
83
98
  }
84
99
  },
85
100
  { deep: true }
@@ -92,7 +107,8 @@ const _sfc_main = {
92
107
  dataSourceValue: dataSourceValue.value,
93
108
  displayField: displayField.value,
94
109
  valueField: valueField.value,
95
- dictionaryValue: dictionaryValue.value
110
+ dictionaryValue: dictionaryValue.value,
111
+ fieldMapping: fieldMapping.value
96
112
  };
97
113
  emit("update:modelValue", data);
98
114
  vue.nextTick(() => {
@@ -106,7 +122,8 @@ const _sfc_main = {
106
122
  dataSourceValue,
107
123
  displayField,
108
124
  valueField,
109
- dictionaryValue
125
+ dictionaryValue,
126
+ fieldMapping
110
127
  ],
111
128
  updateParent,
112
129
  { deep: true, immediate: true }
@@ -162,9 +179,9 @@ const _sfc_main = {
162
179
  default: vue.withCtx(() => [
163
180
  vue.createElementVNode("div", _hoisted_1, [
164
181
  vue.createElementVNode("div", _hoisted_2, [
165
- _cache[6] || (_cache[6] = vue.createElementVNode("span", null, null, -1)),
166
- _cache[7] || (_cache[7] = vue.createElementVNode("span", { class: "header-label" }, "显示值", -1)),
167
- _cache[8] || (_cache[8] = vue.createElementVNode("span", { class: "header-label" }, "真实值", -1)),
182
+ _cache[7] || (_cache[7] = vue.createElementVNode("span", null, null, -1)),
183
+ _cache[8] || (_cache[8] = vue.createElementVNode("span", { class: "header-label" }, "显示值", -1)),
184
+ _cache[9] || (_cache[9] = vue.createElementVNode("span", { class: "header-label" }, "真实值", -1)),
168
185
  vue.createElementVNode("div", {
169
186
  class: "icon-btn add-btn",
170
187
  onClick: handleAddOption
@@ -238,7 +255,7 @@ const _sfc_main = {
238
255
  }),
239
256
  vue.createElementVNode("div", _hoisted_5, [
240
257
  vue.createElementVNode("div", _hoisted_6, [
241
- _cache[9] || (_cache[9] = vue.createElementVNode("span", { class: "field-label" }, "显示字段", -1)),
258
+ _cache[10] || (_cache[10] = vue.createElementVNode("span", { class: "field-label" }, "显示字段", -1)),
242
259
  vue.createVNode(_component_el_input, {
243
260
  modelValue: vue.unref(displayField),
244
261
  "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => vue.isRef(displayField) ? displayField.value = $event : null),
@@ -246,19 +263,29 @@ const _sfc_main = {
246
263
  }, null, 8, ["modelValue"])
247
264
  ]),
248
265
  vue.createElementVNode("div", _hoisted_7, [
249
- _cache[10] || (_cache[10] = vue.createElementVNode("span", { class: "field-label" }, "值字段", -1)),
266
+ _cache[11] || (_cache[11] = vue.createElementVNode("span", { class: "field-label" }, "值字段", -1)),
250
267
  vue.createVNode(_component_el_input, {
251
268
  modelValue: vue.unref(valueField),
252
269
  "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => vue.isRef(valueField) ? valueField.value = $event : null),
253
270
  placeholder: "如:optCode"
254
271
  }, null, 8, ["modelValue"])
272
+ ]),
273
+ vue.createElementVNode("div", _hoisted_8, [
274
+ _cache[12] || (_cache[12] = vue.createElementVNode("span", {
275
+ class: "field-label",
276
+ style: { "width": "auto" }
277
+ }, "选中数据映射表单字段", -1)),
278
+ vue.createVNode(FieldMapping.default, {
279
+ modelValue: vue.unref(fieldMapping),
280
+ "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => vue.isRef(fieldMapping) ? fieldMapping.value = $event : null)
281
+ }, null, 8, ["modelValue"])
255
282
  ])
256
283
  ])
257
284
  ], 64)) : vue.unref(optionSource) === "dictionary" ? (vue.openBlock(), vue.createBlock(_component_el_form_item, { key: 2 }, {
258
285
  default: vue.withCtx(() => [
259
286
  vue.createVNode(_component_el_input, {
260
287
  modelValue: vue.unref(dictionaryValue),
261
- "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => vue.isRef(dictionaryValue) ? dictionaryValue.value = $event : null),
288
+ "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => vue.isRef(dictionaryValue) ? dictionaryValue.value = $event : null),
262
289
  placeholder: "keyName"
263
290
  }, null, 8, ["modelValue"])
264
291
  ]),
@@ -268,5 +295,5 @@ const _sfc_main = {
268
295
  };
269
296
  }
270
297
  };
271
- const OptionConfig = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-96075352"]]);
298
+ const OptionConfig = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-fd4c229c"]]);
272
299
  exports.default = OptionConfig;