@fecp/designer 5.6.37 → 5.6.39
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.
- package/es/designer/package.json.mjs +1 -1
- package/es/designer/src/components/DataSourceSelect.vue.mjs +10 -4
- package/es/designer/src/packages/dialog/index.vue.mjs +28 -11
- package/es/designer/src/packages/dialog/index.vue2.mjs +28 -11
- package/es/designer/src/packages/dialog/useDialogDialog.mjs +1 -1
- package/es/designer/src/packages/dialogGlobal/index.vue.mjs +28 -11
- package/es/designer/src/packages/dialogGlobal/index.vue2.mjs +28 -11
- package/es/designer/src/packages/dialogGlobal/useDialogGlobalDialog.mjs +1 -1
- package/es/designer/src/packages/form/property/widgets.vue.mjs +2 -2
- package/es/designer/src/packages/utils/common.mjs +17 -0
- package/es/designer.css +122 -121
- package/es/packages/vue/src/components/forms/formItem/FormItem.vue.mjs +1 -1
- package/lib/designer/package.json.js +1 -1
- package/lib/designer/src/components/DataSourceSelect.vue.js +9 -3
- package/lib/designer/src/packages/dialog/index.vue.js +26 -9
- package/lib/designer/src/packages/dialog/index.vue2.js +351 -334
- package/lib/designer/src/packages/dialog/useDialogDialog.js +1 -1
- package/lib/designer/src/packages/dialogGlobal/index.vue.js +26 -9
- package/lib/designer/src/packages/dialogGlobal/index.vue2.js +321 -304
- package/lib/designer/src/packages/dialogGlobal/useDialogGlobalDialog.js +1 -1
- package/lib/designer/src/packages/form/property/widgets.vue.js +2 -2
- package/lib/designer/src/packages/utils/common.js +17 -0
- package/lib/designer.css +122 -121
- package/lib/packages/vue/src/components/forms/formItem/FormItem.vue.js +1 -1
- package/package.json +23 -23
|
@@ -9,7 +9,7 @@ import "../../../node_modules/element-plus/es/index.mjs";
|
|
|
9
9
|
/* empty css */
|
|
10
10
|
import { computed, ref, createElementBlock, openBlock, Fragment, createVNode, unref, isRef, withCtx, renderList, createBlock, createTextVNode } from "vue";
|
|
11
11
|
import { Plus as plus_default } from "../../../node_modules/@element-plus/icons-vue/dist/index.mjs";
|
|
12
|
-
import { getEditConfigDataSources } from "../packages/utils/common.mjs";
|
|
12
|
+
import { mergeDataSources, getEditConfigDataSources } from "../packages/utils/common.mjs";
|
|
13
13
|
import { useDataSourceDialog } from "../packages/dataSource/useDataSourceDialog.mjs";
|
|
14
14
|
import { ElSelect, ElOption } from "../../../node_modules/element-plus/es/components/select/index.mjs";
|
|
15
15
|
import { ElButton } from "../../../node_modules/element-plus/es/components/button/index.mjs";
|
|
@@ -23,6 +23,12 @@ const _sfc_main = {
|
|
|
23
23
|
teleported: {
|
|
24
24
|
type: Boolean,
|
|
25
25
|
default: false
|
|
26
|
+
},
|
|
27
|
+
// 可选的局部数据源(如弹层自定义列表自己的 dataSources)。
|
|
28
|
+
// 传入后与页面头部数据源合并展示,避免 dataSourceId 找不到选项时回显原始值。
|
|
29
|
+
dataSources: {
|
|
30
|
+
type: Array,
|
|
31
|
+
default: null
|
|
26
32
|
}
|
|
27
33
|
},
|
|
28
34
|
emits: ["update:modelValue"],
|
|
@@ -34,8 +40,8 @@ const _sfc_main = {
|
|
|
34
40
|
set: (val) => emit("update:modelValue", val)
|
|
35
41
|
});
|
|
36
42
|
const { dataSourceDialogVisible, openDataSourceDialog, DataSourceDialog } = useDataSourceDialog();
|
|
37
|
-
const
|
|
38
|
-
return getEditConfigDataSources();
|
|
43
|
+
const dataSourceOptions = computed(() => {
|
|
44
|
+
return mergeDataSources(getEditConfigDataSources(), props.dataSources);
|
|
39
45
|
});
|
|
40
46
|
const selectRef = ref(null);
|
|
41
47
|
const handleAddDataSource = () => {
|
|
@@ -73,7 +79,7 @@ const _sfc_main = {
|
|
|
73
79
|
}, 8, ["icon"])
|
|
74
80
|
]),
|
|
75
81
|
default: withCtx(() => [
|
|
76
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(
|
|
82
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(dataSourceOptions), (dataSource) => {
|
|
77
83
|
return openBlock(), createBlock(_component_el_option, {
|
|
78
84
|
key: dataSource.id,
|
|
79
85
|
label: dataSource.name,
|
|
@@ -24,10 +24,10 @@ import "../../../../node_modules/element-plus/es/index.mjs";
|
|
|
24
24
|
/* empty css */
|
|
25
25
|
/* empty css */
|
|
26
26
|
/* empty css */
|
|
27
|
-
import { getCurrentInstance,
|
|
27
|
+
import { getCurrentInstance, useModel, ref, watch, computed, createBlock, openBlock, withCtx, createVNode, unref, createTextVNode, createElementBlock, createCommentVNode, createElementVNode, withKeys, isRef, Fragment, renderList, normalizeClass, withDirectives, vShow, withModifiers, toDisplayString } from "vue";
|
|
28
28
|
import { VueDraggable as lo } from "../../../../node_modules/vue-draggable-plus/dist/vue-draggable-plus.mjs";
|
|
29
29
|
import { Plus as plus_default, Close as close_default, Check as check_default, Delete as delete_default, Rank as rank_default, Edit as edit_default } from "../../../../node_modules/@element-plus/icons-vue/dist/index.mjs";
|
|
30
|
-
import {
|
|
30
|
+
import { cloneDeep, getEditConfigDialogs, getEditConfigDataSources, mergeDataSources, setEditConfigDialogs } from "../utils/common.mjs";
|
|
31
31
|
import TemplateSelector from "../../components/TemplateSelector.vue2.mjs";
|
|
32
32
|
import api from "../../api/index.mjs";
|
|
33
33
|
import ParamsConfig from "../../components/ParamsConfig.vue2.mjs";
|
|
@@ -94,17 +94,31 @@ const _sfc_main = {
|
|
|
94
94
|
setup(__props) {
|
|
95
95
|
const currentInstance = getCurrentInstance();
|
|
96
96
|
const ctx = currentInstance.proxy;
|
|
97
|
-
const editConfigData = computed(() => {
|
|
98
|
-
return getEditConfigData();
|
|
99
|
-
});
|
|
100
97
|
const dialogVisible = useModel(__props, "modelValue");
|
|
101
98
|
const selectedDialogs = ref([]);
|
|
102
99
|
const activeDialogIndex = ref(-1);
|
|
100
|
+
function normalizeDataSourceConfigs(dialogs) {
|
|
101
|
+
const globalDataSources = getEditConfigDataSources() || [];
|
|
102
|
+
(dialogs || []).forEach((dialog) => {
|
|
103
|
+
if (dialog.contentSource !== "table" || dialog.tableContent !== "custom") {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (!dialog.customTableConfig) {
|
|
107
|
+
dialog.customTableConfig = cloneDeep(defaultTableConfig);
|
|
108
|
+
dialog.customTableConfig.fieldsData = [];
|
|
109
|
+
}
|
|
110
|
+
dialog.customTableConfig.dataSources = mergeDataSources(
|
|
111
|
+
globalDataSources,
|
|
112
|
+
dialog.customTableConfig.dataSources
|
|
113
|
+
);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
103
116
|
watch(dialogVisible, (val) => {
|
|
104
117
|
if (val) {
|
|
105
118
|
isEditingNew.value = false;
|
|
106
119
|
editingDialogIndex.value = -1;
|
|
107
120
|
selectedDialogs.value = cloneDeep(getEditConfigDialogs());
|
|
121
|
+
normalizeDataSourceConfigs(selectedDialogs.value);
|
|
108
122
|
if (selectedDialogs.value.length > 0 && activeDialogIndex.value === -1) {
|
|
109
123
|
activeDialogIndex.value = 0;
|
|
110
124
|
}
|
|
@@ -176,6 +190,7 @@ const _sfc_main = {
|
|
|
176
190
|
}
|
|
177
191
|
};
|
|
178
192
|
const onConfirm = () => {
|
|
193
|
+
normalizeDataSourceConfigs(selectedDialogs.value);
|
|
179
194
|
setEditConfigDialogs(selectedDialogs.value);
|
|
180
195
|
dialogVisible.value = false;
|
|
181
196
|
};
|
|
@@ -189,10 +204,11 @@ const _sfc_main = {
|
|
|
189
204
|
if (!data.customTableConfig) {
|
|
190
205
|
data.customTableConfig = cloneDeep(defaultTableConfig);
|
|
191
206
|
data.customTableConfig.fieldsData = [];
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
data.customTableConfig.dataSources = editConfigData.value.dataSources;
|
|
207
|
+
}
|
|
208
|
+
if (data.customTableConfig.queryConfig) {
|
|
195
209
|
data.customTableConfig.queryConfig.enabled = false;
|
|
210
|
+
} else {
|
|
211
|
+
data.customTableConfig.queryConfig = { enabled: false };
|
|
196
212
|
}
|
|
197
213
|
if ((data == null ? void 0 : data.contentSource) == "table") {
|
|
198
214
|
const pkId = data == null ? void 0 : data.subTableId;
|
|
@@ -759,8 +775,9 @@ const _sfc_main = {
|
|
|
759
775
|
default: withCtx(() => [
|
|
760
776
|
createVNode(_sfc_main$1, {
|
|
761
777
|
modelValue: unref(currentDialog).customTableConfig.dataSourceId,
|
|
762
|
-
"onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => unref(currentDialog).customTableConfig.dataSourceId = $event)
|
|
763
|
-
|
|
778
|
+
"onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => unref(currentDialog).customTableConfig.dataSourceId = $event),
|
|
779
|
+
"data-sources": unref(currentDialog).customTableConfig.dataSources
|
|
780
|
+
}, null, 8, ["modelValue", "data-sources"])
|
|
764
781
|
]),
|
|
765
782
|
_: 1
|
|
766
783
|
})
|
|
@@ -984,7 +1001,7 @@ const _sfc_main = {
|
|
|
984
1001
|
};
|
|
985
1002
|
}
|
|
986
1003
|
};
|
|
987
|
-
const DialogDialog = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
1004
|
+
const DialogDialog = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-1c16c4fd"]]);
|
|
988
1005
|
export {
|
|
989
1006
|
DialogDialog as default
|
|
990
1007
|
};
|
|
@@ -24,10 +24,10 @@ import "../../../../node_modules/element-plus/es/index.mjs";
|
|
|
24
24
|
/* empty css */
|
|
25
25
|
/* empty css */
|
|
26
26
|
/* empty css */
|
|
27
|
-
import { getCurrentInstance,
|
|
27
|
+
import { getCurrentInstance, useModel, ref, watch, computed, createBlock, openBlock, withCtx, createVNode, unref, createTextVNode, createElementBlock, createCommentVNode, createElementVNode, withKeys, isRef, Fragment, renderList, normalizeClass, withDirectives, vShow, withModifiers, toDisplayString } from "vue";
|
|
28
28
|
import { VueDraggable as lo } from "../../../../node_modules/vue-draggable-plus/dist/vue-draggable-plus.mjs";
|
|
29
29
|
import { Plus as plus_default, Close as close_default, Check as check_default, Delete as delete_default, Rank as rank_default, Edit as edit_default } from "../../../../node_modules/@element-plus/icons-vue/dist/index.mjs";
|
|
30
|
-
import {
|
|
30
|
+
import { cloneDeep, getEditConfigDialogs, getEditConfigDataSources, mergeDataSources, setEditConfigDialogs } from "../utils/common.mjs";
|
|
31
31
|
import TemplateSelector from "../../components/TemplateSelector.vue2.mjs";
|
|
32
32
|
import api from "../../api/index.mjs";
|
|
33
33
|
import ParamsConfig from "../../components/ParamsConfig.vue2.mjs";
|
|
@@ -94,17 +94,31 @@ const _sfc_main = {
|
|
|
94
94
|
setup(__props) {
|
|
95
95
|
const currentInstance = getCurrentInstance();
|
|
96
96
|
const ctx = currentInstance.proxy;
|
|
97
|
-
const editConfigData = computed(() => {
|
|
98
|
-
return getEditConfigData();
|
|
99
|
-
});
|
|
100
97
|
const dialogVisible = useModel(__props, "modelValue");
|
|
101
98
|
const selectedDialogs = ref([]);
|
|
102
99
|
const activeDialogIndex = ref(-1);
|
|
100
|
+
function normalizeDataSourceConfigs(dialogs) {
|
|
101
|
+
const globalDataSources = getEditConfigDataSources() || [];
|
|
102
|
+
(dialogs || []).forEach((dialog) => {
|
|
103
|
+
if (dialog.contentSource !== "table" || dialog.tableContent !== "custom") {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (!dialog.customTableConfig) {
|
|
107
|
+
dialog.customTableConfig = cloneDeep(defaultTableConfig);
|
|
108
|
+
dialog.customTableConfig.fieldsData = [];
|
|
109
|
+
}
|
|
110
|
+
dialog.customTableConfig.dataSources = mergeDataSources(
|
|
111
|
+
globalDataSources,
|
|
112
|
+
dialog.customTableConfig.dataSources
|
|
113
|
+
);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
103
116
|
watch(dialogVisible, (val) => {
|
|
104
117
|
if (val) {
|
|
105
118
|
isEditingNew.value = false;
|
|
106
119
|
editingDialogIndex.value = -1;
|
|
107
120
|
selectedDialogs.value = cloneDeep(getEditConfigDialogs());
|
|
121
|
+
normalizeDataSourceConfigs(selectedDialogs.value);
|
|
108
122
|
if (selectedDialogs.value.length > 0 && activeDialogIndex.value === -1) {
|
|
109
123
|
activeDialogIndex.value = 0;
|
|
110
124
|
}
|
|
@@ -176,6 +190,7 @@ const _sfc_main = {
|
|
|
176
190
|
}
|
|
177
191
|
};
|
|
178
192
|
const onConfirm = () => {
|
|
193
|
+
normalizeDataSourceConfigs(selectedDialogs.value);
|
|
179
194
|
setEditConfigDialogs(selectedDialogs.value);
|
|
180
195
|
dialogVisible.value = false;
|
|
181
196
|
};
|
|
@@ -189,10 +204,11 @@ const _sfc_main = {
|
|
|
189
204
|
if (!data.customTableConfig) {
|
|
190
205
|
data.customTableConfig = cloneDeep(defaultTableConfig);
|
|
191
206
|
data.customTableConfig.fieldsData = [];
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
data.customTableConfig.dataSources = editConfigData.value.dataSources;
|
|
207
|
+
}
|
|
208
|
+
if (data.customTableConfig.queryConfig) {
|
|
195
209
|
data.customTableConfig.queryConfig.enabled = false;
|
|
210
|
+
} else {
|
|
211
|
+
data.customTableConfig.queryConfig = { enabled: false };
|
|
196
212
|
}
|
|
197
213
|
if ((data == null ? void 0 : data.contentSource) == "table") {
|
|
198
214
|
const pkId = data == null ? void 0 : data.subTableId;
|
|
@@ -759,8 +775,9 @@ const _sfc_main = {
|
|
|
759
775
|
default: withCtx(() => [
|
|
760
776
|
createVNode(_sfc_main$1, {
|
|
761
777
|
modelValue: unref(currentDialog).customTableConfig.dataSourceId,
|
|
762
|
-
"onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => unref(currentDialog).customTableConfig.dataSourceId = $event)
|
|
763
|
-
|
|
778
|
+
"onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => unref(currentDialog).customTableConfig.dataSourceId = $event),
|
|
779
|
+
"data-sources": unref(currentDialog).customTableConfig.dataSources
|
|
780
|
+
}, null, 8, ["modelValue", "data-sources"])
|
|
764
781
|
]),
|
|
765
782
|
_: 1
|
|
766
783
|
})
|
|
@@ -984,7 +1001,7 @@ const _sfc_main = {
|
|
|
984
1001
|
};
|
|
985
1002
|
}
|
|
986
1003
|
};
|
|
987
|
-
const DialogDialog = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
1004
|
+
const DialogDialog = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-1c16c4fd"]]);
|
|
988
1005
|
export {
|
|
989
1006
|
DialogDialog as default
|
|
990
1007
|
};
|
|
@@ -24,10 +24,10 @@ import "../../../../node_modules/element-plus/es/index.mjs";
|
|
|
24
24
|
/* empty css */
|
|
25
25
|
/* empty css */
|
|
26
26
|
/* empty css */
|
|
27
|
-
import { getCurrentInstance,
|
|
27
|
+
import { getCurrentInstance, useModel, ref, watch, computed, createBlock, openBlock, unref, withCtx, createVNode, createElementBlock, createCommentVNode, createElementVNode, toDisplayString, createTextVNode, withKeys, isRef, Fragment, renderList, normalizeClass, withDirectives, vShow, withModifiers } from "vue";
|
|
28
28
|
import { VueDraggable as lo } from "../../../../node_modules/vue-draggable-plus/dist/vue-draggable-plus.mjs";
|
|
29
29
|
import { Loading as loading_default, Plus as plus_default, Close as close_default, Check as check_default, Delete as delete_default, Rank as rank_default, Edit as edit_default } from "../../../../node_modules/@element-plus/icons-vue/dist/index.mjs";
|
|
30
|
-
import {
|
|
30
|
+
import { cloneDeep, getEditConfigDataSources, mergeDataSources } from "../utils/common.mjs";
|
|
31
31
|
import TemplateSelector from "../../components/TemplateSelector.vue2.mjs";
|
|
32
32
|
import api from "../../api/index.mjs";
|
|
33
33
|
import ParamsConfig from "../../components/ParamsConfig.vue2.mjs";
|
|
@@ -159,14 +159,27 @@ const _sfc_main = {
|
|
|
159
159
|
setup(__props) {
|
|
160
160
|
const currentInstance = getCurrentInstance();
|
|
161
161
|
const ctx = currentInstance.proxy;
|
|
162
|
-
const editConfigData = computed(() => {
|
|
163
|
-
return getEditConfigData();
|
|
164
|
-
});
|
|
165
162
|
const dialogVisible = useModel(__props, "modelValue");
|
|
166
163
|
const loading = ref(false);
|
|
167
164
|
const saving = ref(false);
|
|
168
165
|
const selectedDialogs = ref([]);
|
|
169
166
|
const activeDialogIndex = ref(-1);
|
|
167
|
+
function normalizeDataSourceConfigs(dialogs) {
|
|
168
|
+
const globalDataSources = getEditConfigDataSources() || [];
|
|
169
|
+
(dialogs || []).forEach((dialog) => {
|
|
170
|
+
if (dialog.contentSource !== "table" || dialog.tableContent !== "custom") {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
if (!dialog.customTableConfig) {
|
|
174
|
+
dialog.customTableConfig = cloneDeep(defaultTableConfig);
|
|
175
|
+
dialog.customTableConfig.fieldsData = [];
|
|
176
|
+
}
|
|
177
|
+
dialog.customTableConfig.dataSources = mergeDataSources(
|
|
178
|
+
globalDataSources,
|
|
179
|
+
dialog.customTableConfig.dataSources
|
|
180
|
+
);
|
|
181
|
+
});
|
|
182
|
+
}
|
|
170
183
|
watch(dialogVisible, async (val) => {
|
|
171
184
|
if (val) {
|
|
172
185
|
isEditingNew.value = false;
|
|
@@ -182,6 +195,7 @@ const _sfc_main = {
|
|
|
182
195
|
...JSON.parse(dialog.config)
|
|
183
196
|
});
|
|
184
197
|
}
|
|
198
|
+
normalizeDataSourceConfigs(selectedDialogs.value);
|
|
185
199
|
if (selectedDialogs.value.length > 0 && activeDialogIndex.value === -1) {
|
|
186
200
|
activeDialogIndex.value = 0;
|
|
187
201
|
}
|
|
@@ -274,6 +288,7 @@ const _sfc_main = {
|
|
|
274
288
|
const onConfirm = async () => {
|
|
275
289
|
saving.value = true;
|
|
276
290
|
try {
|
|
291
|
+
normalizeDataSourceConfigs(selectedDialogs.value);
|
|
277
292
|
const dialogArr = selectedDialogs.value.map((dialog) => {
|
|
278
293
|
const data = cloneDeep(dialog);
|
|
279
294
|
const id = data.id;
|
|
@@ -306,10 +321,11 @@ const _sfc_main = {
|
|
|
306
321
|
if (!data.customTableConfig) {
|
|
307
322
|
data.customTableConfig = cloneDeep(defaultTableConfig);
|
|
308
323
|
data.customTableConfig.fieldsData = [];
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
data.customTableConfig.dataSources = editConfigData.value.dataSources;
|
|
324
|
+
}
|
|
325
|
+
if (data.customTableConfig.queryConfig) {
|
|
312
326
|
data.customTableConfig.queryConfig.enabled = false;
|
|
327
|
+
} else {
|
|
328
|
+
data.customTableConfig.queryConfig = { enabled: false };
|
|
313
329
|
}
|
|
314
330
|
if ((data == null ? void 0 : data.contentSource) == "table") {
|
|
315
331
|
const pkId = data == null ? void 0 : data.subTableId;
|
|
@@ -888,8 +904,9 @@ const _sfc_main = {
|
|
|
888
904
|
default: withCtx(() => [
|
|
889
905
|
createVNode(_sfc_main$1, {
|
|
890
906
|
modelValue: unref(currentDialog).customTableConfig.dataSourceId,
|
|
891
|
-
"onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => unref(currentDialog).customTableConfig.dataSourceId = $event)
|
|
892
|
-
|
|
907
|
+
"onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => unref(currentDialog).customTableConfig.dataSourceId = $event),
|
|
908
|
+
"data-sources": unref(currentDialog).customTableConfig.dataSources
|
|
909
|
+
}, null, 8, ["modelValue", "data-sources"])
|
|
893
910
|
]),
|
|
894
911
|
_: 1
|
|
895
912
|
})
|
|
@@ -1031,7 +1048,7 @@ const _sfc_main = {
|
|
|
1031
1048
|
};
|
|
1032
1049
|
}
|
|
1033
1050
|
};
|
|
1034
|
-
const DialogGlobalDialog = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
1051
|
+
const DialogGlobalDialog = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-be95917a"]]);
|
|
1035
1052
|
export {
|
|
1036
1053
|
DialogGlobalDialog as default
|
|
1037
1054
|
};
|
|
@@ -24,10 +24,10 @@ import "../../../../node_modules/element-plus/es/index.mjs";
|
|
|
24
24
|
/* empty css */
|
|
25
25
|
/* empty css */
|
|
26
26
|
/* empty css */
|
|
27
|
-
import { getCurrentInstance,
|
|
27
|
+
import { getCurrentInstance, useModel, ref, watch, computed, createBlock, openBlock, unref, withCtx, createVNode, createElementBlock, createCommentVNode, createElementVNode, toDisplayString, createTextVNode, withKeys, isRef, Fragment, renderList, normalizeClass, withDirectives, vShow, withModifiers } from "vue";
|
|
28
28
|
import { VueDraggable as lo } from "../../../../node_modules/vue-draggable-plus/dist/vue-draggable-plus.mjs";
|
|
29
29
|
import { Loading as loading_default, Plus as plus_default, Close as close_default, Check as check_default, Delete as delete_default, Rank as rank_default, Edit as edit_default } from "../../../../node_modules/@element-plus/icons-vue/dist/index.mjs";
|
|
30
|
-
import {
|
|
30
|
+
import { cloneDeep, getEditConfigDataSources, mergeDataSources } from "../utils/common.mjs";
|
|
31
31
|
import TemplateSelector from "../../components/TemplateSelector.vue2.mjs";
|
|
32
32
|
import api from "../../api/index.mjs";
|
|
33
33
|
import ParamsConfig from "../../components/ParamsConfig.vue2.mjs";
|
|
@@ -159,14 +159,27 @@ const _sfc_main = {
|
|
|
159
159
|
setup(__props) {
|
|
160
160
|
const currentInstance = getCurrentInstance();
|
|
161
161
|
const ctx = currentInstance.proxy;
|
|
162
|
-
const editConfigData = computed(() => {
|
|
163
|
-
return getEditConfigData();
|
|
164
|
-
});
|
|
165
162
|
const dialogVisible = useModel(__props, "modelValue");
|
|
166
163
|
const loading = ref(false);
|
|
167
164
|
const saving = ref(false);
|
|
168
165
|
const selectedDialogs = ref([]);
|
|
169
166
|
const activeDialogIndex = ref(-1);
|
|
167
|
+
function normalizeDataSourceConfigs(dialogs) {
|
|
168
|
+
const globalDataSources = getEditConfigDataSources() || [];
|
|
169
|
+
(dialogs || []).forEach((dialog) => {
|
|
170
|
+
if (dialog.contentSource !== "table" || dialog.tableContent !== "custom") {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
if (!dialog.customTableConfig) {
|
|
174
|
+
dialog.customTableConfig = cloneDeep(defaultTableConfig);
|
|
175
|
+
dialog.customTableConfig.fieldsData = [];
|
|
176
|
+
}
|
|
177
|
+
dialog.customTableConfig.dataSources = mergeDataSources(
|
|
178
|
+
globalDataSources,
|
|
179
|
+
dialog.customTableConfig.dataSources
|
|
180
|
+
);
|
|
181
|
+
});
|
|
182
|
+
}
|
|
170
183
|
watch(dialogVisible, async (val) => {
|
|
171
184
|
if (val) {
|
|
172
185
|
isEditingNew.value = false;
|
|
@@ -182,6 +195,7 @@ const _sfc_main = {
|
|
|
182
195
|
...JSON.parse(dialog.config)
|
|
183
196
|
});
|
|
184
197
|
}
|
|
198
|
+
normalizeDataSourceConfigs(selectedDialogs.value);
|
|
185
199
|
if (selectedDialogs.value.length > 0 && activeDialogIndex.value === -1) {
|
|
186
200
|
activeDialogIndex.value = 0;
|
|
187
201
|
}
|
|
@@ -274,6 +288,7 @@ const _sfc_main = {
|
|
|
274
288
|
const onConfirm = async () => {
|
|
275
289
|
saving.value = true;
|
|
276
290
|
try {
|
|
291
|
+
normalizeDataSourceConfigs(selectedDialogs.value);
|
|
277
292
|
const dialogArr = selectedDialogs.value.map((dialog) => {
|
|
278
293
|
const data = cloneDeep(dialog);
|
|
279
294
|
const id = data.id;
|
|
@@ -306,10 +321,11 @@ const _sfc_main = {
|
|
|
306
321
|
if (!data.customTableConfig) {
|
|
307
322
|
data.customTableConfig = cloneDeep(defaultTableConfig);
|
|
308
323
|
data.customTableConfig.fieldsData = [];
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
data.customTableConfig.dataSources = editConfigData.value.dataSources;
|
|
324
|
+
}
|
|
325
|
+
if (data.customTableConfig.queryConfig) {
|
|
312
326
|
data.customTableConfig.queryConfig.enabled = false;
|
|
327
|
+
} else {
|
|
328
|
+
data.customTableConfig.queryConfig = { enabled: false };
|
|
313
329
|
}
|
|
314
330
|
if ((data == null ? void 0 : data.contentSource) == "table") {
|
|
315
331
|
const pkId = data == null ? void 0 : data.subTableId;
|
|
@@ -888,8 +904,9 @@ const _sfc_main = {
|
|
|
888
904
|
default: withCtx(() => [
|
|
889
905
|
createVNode(_sfc_main$1, {
|
|
890
906
|
modelValue: unref(currentDialog).customTableConfig.dataSourceId,
|
|
891
|
-
"onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => unref(currentDialog).customTableConfig.dataSourceId = $event)
|
|
892
|
-
|
|
907
|
+
"onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => unref(currentDialog).customTableConfig.dataSourceId = $event),
|
|
908
|
+
"data-sources": unref(currentDialog).customTableConfig.dataSources
|
|
909
|
+
}, null, 8, ["modelValue", "data-sources"])
|
|
893
910
|
]),
|
|
894
911
|
_: 1
|
|
895
912
|
})
|
|
@@ -1031,7 +1048,7 @@ const _sfc_main = {
|
|
|
1031
1048
|
};
|
|
1032
1049
|
}
|
|
1033
1050
|
};
|
|
1034
|
-
const DialogGlobalDialog = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
1051
|
+
const DialogGlobalDialog = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-be95917a"]]);
|
|
1035
1052
|
export {
|
|
1036
1053
|
DialogGlobalDialog as default
|
|
1037
1054
|
};
|
|
@@ -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";
|
|
@@ -48,6 +48,22 @@ function setEditConfigDialogs(dialogs) {
|
|
|
48
48
|
function getEditConfigDataSources() {
|
|
49
49
|
return store.getters.editConfigData.dataSources;
|
|
50
50
|
}
|
|
51
|
+
function mergeDataSources(...groups) {
|
|
52
|
+
const merged = [];
|
|
53
|
+
const seen = /* @__PURE__ */ new Set();
|
|
54
|
+
groups.forEach((group) => {
|
|
55
|
+
(group || []).forEach((dataSource) => {
|
|
56
|
+
if (!dataSource || dataSource.id === void 0 || dataSource.id === null || dataSource.id === "") {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const key = String(dataSource.id);
|
|
60
|
+
if (seen.has(key)) return;
|
|
61
|
+
seen.add(key);
|
|
62
|
+
merged.push(dataSource);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
return merged;
|
|
66
|
+
}
|
|
51
67
|
function getEditConfigDataFields() {
|
|
52
68
|
const editingType = store.getters.editingType;
|
|
53
69
|
const fieldsData = store.getters.editConfigData.fieldsData;
|
|
@@ -73,6 +89,7 @@ export {
|
|
|
73
89
|
getEditingType,
|
|
74
90
|
isHoverItem,
|
|
75
91
|
isSelectedItem,
|
|
92
|
+
mergeDataSources,
|
|
76
93
|
setEditConfigData,
|
|
77
94
|
setEditConfigDataSources,
|
|
78
95
|
setEditConfigDialogs,
|