@fecp/designer 5.2.14 → 5.3.1
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.css +10 -10
- package/es/packages/designer/package.json.mjs +1 -1
- package/es/packages/vue/src/api/index.mjs +3 -0
- package/es/packages/vue/src/components/dialog/DialogRenderer.vue2.mjs +3 -2
- package/es/packages/vue/src/components/forms/form/Form.vue.mjs +164 -7
- package/es/packages/vue/src/components/forms/text/Text.vue.mjs +1 -1
- package/es/packages/vue/src/components/table/TableColumn.vue.mjs +1 -1
- package/es/packages/vue/src/composables/usePageEvents.mjs +1 -1
- package/es/packages/vue/src/utils/datasource.mjs +1 -1
- package/lib/designer.css +10 -10
- package/lib/packages/designer/package.json.js +1 -1
- package/lib/packages/vue/src/api/index.js +3 -0
- package/lib/packages/vue/src/components/dialog/DialogRenderer.vue2.js +3 -2
- package/lib/packages/vue/src/components/forms/form/Form.vue.js +164 -7
- package/lib/packages/vue/src/components/forms/text/Text.vue.js +1 -1
- package/lib/packages/vue/src/components/table/TableColumn.vue.js +1 -1
- package/lib/packages/vue/src/composables/usePageEvents.js +1 -1
- package/lib/packages/vue/src/utils/datasource.js +1 -1
- package/package.json +1 -1
package/es/designer.css
CHANGED
|
@@ -5348,18 +5348,18 @@ body,
|
|
|
5348
5348
|
}
|
|
5349
5349
|
.approval-history-content.flowChart[data-v-7be2a6d2] {
|
|
5350
5350
|
background-color: #f9fafc;
|
|
5351
|
-
}.dialog-header-content[data-v-
|
|
5351
|
+
}.dialog-header-content[data-v-7e9fd985] {
|
|
5352
5352
|
font-size: 16px;
|
|
5353
5353
|
font-weight: 600;
|
|
5354
5354
|
color: #303133;
|
|
5355
5355
|
}
|
|
5356
|
-
.dialog-content-wrapper[data-v-
|
|
5356
|
+
.dialog-content-wrapper[data-v-7e9fd985] {
|
|
5357
5357
|
min-height: 500px;
|
|
5358
5358
|
flex-grow: 1;
|
|
5359
5359
|
display: flex;
|
|
5360
5360
|
flex-direction: column;
|
|
5361
5361
|
}
|
|
5362
|
-
.empty-content[data-v-
|
|
5362
|
+
.empty-content[data-v-7e9fd985] {
|
|
5363
5363
|
display: flex;
|
|
5364
5364
|
align-items: center;
|
|
5365
5365
|
justify-content: center;
|
|
@@ -5367,13 +5367,13 @@ body,
|
|
|
5367
5367
|
color: #909399;
|
|
5368
5368
|
font-size: 14px;
|
|
5369
5369
|
}
|
|
5370
|
-
.component-error[data-v-
|
|
5370
|
+
.component-error[data-v-7e9fd985] {
|
|
5371
5371
|
padding: 40px 20px;
|
|
5372
5372
|
text-align: center;
|
|
5373
5373
|
color: #f56c6c;
|
|
5374
5374
|
font-size: 14px;
|
|
5375
5375
|
}
|
|
5376
|
-
.fec-dialog-table[data-v-
|
|
5376
|
+
.fec-dialog-table[data-v-7e9fd985] .table-pagination {
|
|
5377
5377
|
padding: 8px 0 0 0;
|
|
5378
5378
|
}.text-field-wrapper[data-v-b0c0d80f] {
|
|
5379
5379
|
width: 100%;
|
|
@@ -5544,24 +5544,24 @@ body,
|
|
|
5544
5544
|
width: 80px;
|
|
5545
5545
|
font-size: var(--el-font-size-extra-small);
|
|
5546
5546
|
}
|
|
5547
|
-
.fec-form[data-v-
|
|
5547
|
+
.fec-form[data-v-f1c90d7c] {
|
|
5548
5548
|
height: 100%;
|
|
5549
5549
|
}
|
|
5550
|
-
[data-v-
|
|
5550
|
+
[data-v-f1c90d7c] .vgl-item > .el-form-item {
|
|
5551
5551
|
width: 100%;
|
|
5552
5552
|
padding: 12px 8px 0 8px;
|
|
5553
5553
|
height: calc(100% - 15px);
|
|
5554
5554
|
display: flex;
|
|
5555
5555
|
}
|
|
5556
|
-
[data-v-
|
|
5556
|
+
[data-v-f1c90d7c] .vgl-item > .el-form-item.el-form-item--label-top {
|
|
5557
5557
|
flex-direction: column;
|
|
5558
5558
|
}
|
|
5559
|
-
[data-v-
|
|
5559
|
+
[data-v-f1c90d7c] .vgl-item > .el-form-item .el-form-item__label {
|
|
5560
5560
|
line-height: 20px;
|
|
5561
5561
|
display: flex;
|
|
5562
5562
|
align-items: center;
|
|
5563
5563
|
}
|
|
5564
|
-
[data-v-
|
|
5564
|
+
[data-v-f1c90d7c] .vgl-item > .el-container {
|
|
5565
5565
|
height: auto !important;
|
|
5566
5566
|
}.cell-content .cell-text[data-v-b57831f4] {
|
|
5567
5567
|
display: inline-block;
|
|
@@ -10,6 +10,9 @@ const api = {
|
|
|
10
10
|
},
|
|
11
11
|
getTemplateDialogById: ($http, id) => {
|
|
12
12
|
return $http.postForm(`${$servers.base}/template/sysTemplateDialog/getById`, { id });
|
|
13
|
+
},
|
|
14
|
+
getProductData: ($http, prodId) => {
|
|
15
|
+
return $http.postForm(`${$servers.base}/design/getProductData`, { prodId });
|
|
13
16
|
}
|
|
14
17
|
};
|
|
15
18
|
export {
|
|
@@ -8,9 +8,9 @@ import { Form } from "../forms/form/index.mjs";
|
|
|
8
8
|
import { parseRouteParams } from "../../utils/parseRouteParams.mjs";
|
|
9
9
|
import { calculate } from "../../utils/formulajs/calculate.mjs";
|
|
10
10
|
import { useEventFlow, executeEventFlow } from "../../utils/eventFlow/eventFlowHandler.mjs";
|
|
11
|
-
/* empty css */
|
|
12
11
|
/* empty css */
|
|
13
12
|
/* empty css */
|
|
13
|
+
/* empty css */
|
|
14
14
|
/* empty css */
|
|
15
15
|
import _export_sfc from "../../../../../_virtual/_plugin-vue_export-helper.mjs";
|
|
16
16
|
/* empty css */
|
|
@@ -193,6 +193,7 @@ const _sfc_main = {
|
|
|
193
193
|
// exposed: dialogTableRef.value,
|
|
194
194
|
// },
|
|
195
195
|
// },
|
|
196
|
+
form: props.componentCtx,
|
|
196
197
|
table: props.componentCtx
|
|
197
198
|
},
|
|
198
199
|
row: props.formData,
|
|
@@ -410,7 +411,7 @@ const _sfc_main = {
|
|
|
410
411
|
};
|
|
411
412
|
}
|
|
412
413
|
};
|
|
413
|
-
const DialogRenderer = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
414
|
+
const DialogRenderer = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-7e9fd985"]]);
|
|
414
415
|
export {
|
|
415
416
|
DialogRenderer as default
|
|
416
417
|
};
|
|
@@ -24,6 +24,7 @@ import { useEventFlow } from "../../../utils/eventFlow/eventFlowHandler.mjs";
|
|
|
24
24
|
/* empty css */
|
|
25
25
|
/* empty css */
|
|
26
26
|
import _export_sfc from "../../../../../../_virtual/_plugin-vue_export-helper.mjs";
|
|
27
|
+
import api from "../../../api/index.mjs";
|
|
27
28
|
/* empty css */
|
|
28
29
|
/* empty css */
|
|
29
30
|
import { usePageEvents } from "../../../composables/usePageEvents.mjs";
|
|
@@ -98,6 +99,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
98
99
|
const formRules = ref({});
|
|
99
100
|
const dataSourceOptions = ref({});
|
|
100
101
|
const dictionaryOptions = ref({});
|
|
102
|
+
const productData = ref({});
|
|
101
103
|
const fieldsData = ref({});
|
|
102
104
|
const hiddenFields = ref({});
|
|
103
105
|
const rowHeight = ref(1);
|
|
@@ -144,8 +146,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
144
146
|
return item.component;
|
|
145
147
|
});
|
|
146
148
|
hiddenFields.value = option.hiddenFields || [];
|
|
147
|
-
loadFormData();
|
|
148
149
|
await loadFieldDataSources();
|
|
150
|
+
loadFormData();
|
|
149
151
|
loadEventFlow();
|
|
150
152
|
if (pageEvents && localConfig.value.pageEventConfig) {
|
|
151
153
|
const onCreatedEvent = localConfig.value.pageEventConfig.find(
|
|
@@ -156,6 +158,9 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
156
158
|
await pageEvents.executeEvent("onCreated");
|
|
157
159
|
}
|
|
158
160
|
}
|
|
161
|
+
await loadProductData();
|
|
162
|
+
applyProductConfigToForm();
|
|
163
|
+
mergeOptionsToFields();
|
|
159
164
|
} catch (error) {
|
|
160
165
|
console.error("加载配置失败:", error);
|
|
161
166
|
ElMessage.error("加载配置失败");
|
|
@@ -164,12 +169,12 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
164
169
|
}
|
|
165
170
|
};
|
|
166
171
|
const loadFormData = () => {
|
|
167
|
-
const
|
|
172
|
+
const defaultData = {};
|
|
168
173
|
const rules = {};
|
|
169
174
|
if (fieldsData.value) {
|
|
170
175
|
fieldsData.value.forEach((component) => {
|
|
171
176
|
if (component.fieldName) {
|
|
172
|
-
|
|
177
|
+
defaultData[component.fieldName] = component.defaultValue ? component.defaultValue : null;
|
|
173
178
|
}
|
|
174
179
|
if (component.fieldName) {
|
|
175
180
|
const fieldRules = generateFieldRules(component);
|
|
@@ -182,11 +187,11 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
182
187
|
if (hiddenFields.value && hiddenFields.value.length > 0) {
|
|
183
188
|
hiddenFields.value.forEach((field) => {
|
|
184
189
|
if (field.fieldName) {
|
|
185
|
-
|
|
190
|
+
defaultData[field.fieldName] = field.value !== void 0 ? field.value : null;
|
|
186
191
|
}
|
|
187
192
|
});
|
|
188
193
|
}
|
|
189
|
-
formData.value = { ...
|
|
194
|
+
formData.value = { ...defaultData, ...props.modelValue };
|
|
190
195
|
formRules.value = rules;
|
|
191
196
|
};
|
|
192
197
|
const loadFieldDataSources = async () => {
|
|
@@ -251,7 +256,6 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
251
256
|
console.error("Failed to load dictionary data:", error);
|
|
252
257
|
}
|
|
253
258
|
}
|
|
254
|
-
mergeOptionsToFields();
|
|
255
259
|
};
|
|
256
260
|
const mergeOptionsToFields = () => {
|
|
257
261
|
if (fieldsData.value) {
|
|
@@ -288,7 +292,157 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
288
292
|
} else if (optionSource === "custom") {
|
|
289
293
|
component.optionConfig.options = component.optionConfig.options || [];
|
|
290
294
|
}
|
|
295
|
+
applyProductConfigFilter(component);
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
const loadProductData = async () => {
|
|
300
|
+
if (!localConfig.value || !localConfig.value.prodConfig) {
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
const { prodId } = localConfig.value.prodConfig;
|
|
304
|
+
if (!prodId) {
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
const field = [...fieldsData.value, ...hiddenFields.value].find(
|
|
308
|
+
(item) => item.id == prodId.value
|
|
309
|
+
);
|
|
310
|
+
if (!field) {
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
const prodIdValue = formData.value[field.fieldName];
|
|
314
|
+
if (!prodIdValue) {
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
try {
|
|
318
|
+
const response = await api.getProductData(ctx.$http, prodIdValue);
|
|
319
|
+
productData.value = response;
|
|
320
|
+
console.log("产品数据加载成功:", productData.value);
|
|
321
|
+
} catch (error) {
|
|
322
|
+
console.error("获取产品数据失败:", error);
|
|
323
|
+
productData.value = {};
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
const prodRules = ref({});
|
|
327
|
+
const applyProductConfigToForm = () => {
|
|
328
|
+
if (!localConfig.value || !localConfig.value.prodConfig || !productData.value) {
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
const { defaultValueConfigs, validationConfigs } = localConfig.value.prodConfig;
|
|
332
|
+
if (defaultValueConfigs && defaultValueConfigs.length > 0) {
|
|
333
|
+
defaultValueConfigs.forEach((config) => {
|
|
334
|
+
if (config.pageField && config.productConfigField) {
|
|
335
|
+
const defaultValue = productData.value[config.productConfigField];
|
|
336
|
+
if (defaultValue !== void 0) {
|
|
337
|
+
const formField = [...fieldsData.value, ...hiddenFields.value].find(
|
|
338
|
+
(item) => item.id == config.pageField
|
|
339
|
+
);
|
|
340
|
+
if (formField && !formData.value[formField.fieldName]) {
|
|
341
|
+
formData.value[formField.fieldName] = defaultValue;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
if (validationConfigs && validationConfigs.length > 0) {
|
|
348
|
+
validationConfigs.forEach((config) => {
|
|
349
|
+
if (config.pageField && (config.minProductField || config.maxProductField)) {
|
|
350
|
+
const minValue = productData.value[config.minProductField];
|
|
351
|
+
const maxValue = productData.value[config.maxProductField];
|
|
352
|
+
if (minValue !== void 0 || maxValue !== void 0) {
|
|
353
|
+
const formField = [...fieldsData.value, ...hiddenFields.value].find(
|
|
354
|
+
(item) => item.id == config.pageField
|
|
355
|
+
);
|
|
356
|
+
if (formField && !prodRules.value[formField.fieldName]) {
|
|
357
|
+
prodRules.value[formField.fieldName] = [];
|
|
358
|
+
}
|
|
359
|
+
const customValidator = (rule, value, callback) => {
|
|
360
|
+
console.log(
|
|
361
|
+
"🚀 ~ customValidator 被调用 ~ 字段:",
|
|
362
|
+
formField == null ? void 0 : formField.fieldName,
|
|
363
|
+
"值:",
|
|
364
|
+
value,
|
|
365
|
+
"minValue:",
|
|
366
|
+
minValue,
|
|
367
|
+
"maxValue:",
|
|
368
|
+
maxValue
|
|
369
|
+
);
|
|
370
|
+
if (value === null || value === void 0 || value === "") {
|
|
371
|
+
callback();
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
const numValue = Number(value);
|
|
375
|
+
if (isNaN(numValue)) {
|
|
376
|
+
callback(new Error("请输入有效的数字"));
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
let errorMessage = "";
|
|
380
|
+
if (minValue !== void 0 && numValue < Number(minValue)) {
|
|
381
|
+
errorMessage = `不能小于 ${minValue}`;
|
|
382
|
+
}
|
|
383
|
+
if (maxValue !== void 0 && numValue > Number(maxValue)) {
|
|
384
|
+
if (errorMessage) {
|
|
385
|
+
errorMessage = `${errorMessage} 且 不能大于 ${maxValue}`;
|
|
386
|
+
} else {
|
|
387
|
+
errorMessage = `不能大于 ${maxValue}`;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
if (errorMessage) {
|
|
391
|
+
callback(new Error(errorMessage));
|
|
392
|
+
} else {
|
|
393
|
+
callback();
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
const customRule = {
|
|
397
|
+
validator: customValidator,
|
|
398
|
+
trigger: "blur"
|
|
399
|
+
};
|
|
400
|
+
prodRules.value[formField.fieldName].push(customRule);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
291
403
|
});
|
|
404
|
+
for (let fieldName in prodRules.value) {
|
|
405
|
+
if (formRules.value[fieldName]) {
|
|
406
|
+
formRules.value[fieldName].push(...prodRules.value[fieldName]);
|
|
407
|
+
} else {
|
|
408
|
+
formRules.value[fieldName] = prodRules.value[fieldName];
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
const applyProductConfigFilter = (component) => {
|
|
414
|
+
if (!localConfig.value || !localConfig.value.prodConfig || !productData.value) {
|
|
415
|
+
return;
|
|
416
|
+
}
|
|
417
|
+
const { optionConfigs } = localConfig.value.prodConfig;
|
|
418
|
+
if (!optionConfigs || !component.optionConfig || !component.optionConfig.options) {
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
const componentConfig = optionConfigs.find(
|
|
422
|
+
(item) => item.pageField == component.id
|
|
423
|
+
);
|
|
424
|
+
if (!componentConfig || !componentConfig.productConfigField) {
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
const fieldValue = productData.value[componentConfig.productConfigField];
|
|
428
|
+
if (!fieldValue) {
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
const allowedValues = Array.isArray(fieldValue) ? fieldValue : fieldValue.split("|");
|
|
432
|
+
component.optionConfig.options = component.optionConfig.options.filter(
|
|
433
|
+
(option) => {
|
|
434
|
+
const optionValue = option.value !== void 0 ? option.value : option;
|
|
435
|
+
return allowedValues.includes(optionValue);
|
|
436
|
+
}
|
|
437
|
+
);
|
|
438
|
+
if (component.optionConfig.options.length === 0) {
|
|
439
|
+
component.optionConfig.options = [
|
|
440
|
+
{
|
|
441
|
+
label: `无可用选项(产品配置限制)`,
|
|
442
|
+
value: "",
|
|
443
|
+
disabled: true
|
|
444
|
+
}
|
|
445
|
+
];
|
|
292
446
|
}
|
|
293
447
|
};
|
|
294
448
|
const handleEvent = ref(null);
|
|
@@ -411,6 +565,9 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
411
565
|
}
|
|
412
566
|
}
|
|
413
567
|
});
|
|
568
|
+
for (let fieldName in prodRules.value) {
|
|
569
|
+
rules[fieldName] = prodRules.value[fieldName];
|
|
570
|
+
}
|
|
414
571
|
formRules.value = rules;
|
|
415
572
|
const readonlyArr = (linkedConfig == null ? void 0 : linkedConfig.readonly) || [];
|
|
416
573
|
readonlyArr.forEach((item) => {
|
|
@@ -693,7 +850,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
693
850
|
};
|
|
694
851
|
}
|
|
695
852
|
});
|
|
696
|
-
const _Form = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
853
|
+
const _Form = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-f1c90d7c"]]);
|
|
697
854
|
export {
|
|
698
855
|
_Form as default
|
|
699
856
|
};
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
/* empty css */
|
|
3
3
|
/* empty css */
|
|
4
4
|
import { computed, getCurrentInstance, inject, createElementBlock, openBlock, createVNode, createCommentVNode, mergeProps, toHandlers, createSlots, withCtx, createElementVNode, toDisplayString, createBlock, createTextVNode, unref } from "vue";
|
|
5
|
-
/* empty css */
|
|
6
5
|
/* empty css */
|
|
7
6
|
/* empty css */
|
|
7
|
+
/* empty css */
|
|
8
8
|
import { openDialog } from "../../dialog/index.mjs";
|
|
9
9
|
import api from "../../../api/index.mjs";
|
|
10
10
|
/* empty css */
|
|
@@ -5,9 +5,9 @@ import { getCurrentInstance, computed, createElementBlock, openBlock, createBloc
|
|
|
5
5
|
import "../../../../../node_modules/.pnpm/vxe-table@4.17.47_vue@3.5.13_typescript@5.7.3_/node_modules/vxe-table/es/components.mjs";
|
|
6
6
|
import { CopyDocument as copy_document_default } from "../../../../../node_modules/.pnpm/@element-plus_icons-vue@2.3.2_vue@3.5.13_typescript@5.7.3_/node_modules/@element-plus/icons-vue/dist/index.mjs";
|
|
7
7
|
import { checkFilterMatch } from "../../utils/parseFilterConfig.mjs";
|
|
8
|
-
/* empty css */
|
|
9
8
|
/* empty css */
|
|
10
9
|
/* empty css */
|
|
10
|
+
/* empty css */
|
|
11
11
|
/* empty css */
|
|
12
12
|
/* empty css */
|
|
13
13
|
import "./index.mjs";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { reactive } from "vue";
|
|
2
2
|
import { parseRouteParams } from "./parseRouteParams.mjs";
|
|
3
3
|
/* empty css */
|
|
4
|
-
/* empty css */
|
|
5
4
|
/* empty css */
|
|
6
5
|
/* empty css */
|
|
6
|
+
/* empty css */
|
|
7
7
|
import { ElLoading } from "../../../../node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/components/loading/index.mjs";
|
|
8
8
|
import { ElMessage } from "../../../../node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/components/message/index.mjs";
|
|
9
9
|
class DataSourceManager {
|
package/lib/designer.css
CHANGED
|
@@ -5348,18 +5348,18 @@ body,
|
|
|
5348
5348
|
}
|
|
5349
5349
|
.approval-history-content.flowChart[data-v-7be2a6d2] {
|
|
5350
5350
|
background-color: #f9fafc;
|
|
5351
|
-
}.dialog-header-content[data-v-
|
|
5351
|
+
}.dialog-header-content[data-v-7e9fd985] {
|
|
5352
5352
|
font-size: 16px;
|
|
5353
5353
|
font-weight: 600;
|
|
5354
5354
|
color: #303133;
|
|
5355
5355
|
}
|
|
5356
|
-
.dialog-content-wrapper[data-v-
|
|
5356
|
+
.dialog-content-wrapper[data-v-7e9fd985] {
|
|
5357
5357
|
min-height: 500px;
|
|
5358
5358
|
flex-grow: 1;
|
|
5359
5359
|
display: flex;
|
|
5360
5360
|
flex-direction: column;
|
|
5361
5361
|
}
|
|
5362
|
-
.empty-content[data-v-
|
|
5362
|
+
.empty-content[data-v-7e9fd985] {
|
|
5363
5363
|
display: flex;
|
|
5364
5364
|
align-items: center;
|
|
5365
5365
|
justify-content: center;
|
|
@@ -5367,13 +5367,13 @@ body,
|
|
|
5367
5367
|
color: #909399;
|
|
5368
5368
|
font-size: 14px;
|
|
5369
5369
|
}
|
|
5370
|
-
.component-error[data-v-
|
|
5370
|
+
.component-error[data-v-7e9fd985] {
|
|
5371
5371
|
padding: 40px 20px;
|
|
5372
5372
|
text-align: center;
|
|
5373
5373
|
color: #f56c6c;
|
|
5374
5374
|
font-size: 14px;
|
|
5375
5375
|
}
|
|
5376
|
-
.fec-dialog-table[data-v-
|
|
5376
|
+
.fec-dialog-table[data-v-7e9fd985] .table-pagination {
|
|
5377
5377
|
padding: 8px 0 0 0;
|
|
5378
5378
|
}.text-field-wrapper[data-v-b0c0d80f] {
|
|
5379
5379
|
width: 100%;
|
|
@@ -5544,24 +5544,24 @@ body,
|
|
|
5544
5544
|
width: 80px;
|
|
5545
5545
|
font-size: var(--el-font-size-extra-small);
|
|
5546
5546
|
}
|
|
5547
|
-
.fec-form[data-v-
|
|
5547
|
+
.fec-form[data-v-f1c90d7c] {
|
|
5548
5548
|
height: 100%;
|
|
5549
5549
|
}
|
|
5550
|
-
[data-v-
|
|
5550
|
+
[data-v-f1c90d7c] .vgl-item > .el-form-item {
|
|
5551
5551
|
width: 100%;
|
|
5552
5552
|
padding: 12px 8px 0 8px;
|
|
5553
5553
|
height: calc(100% - 15px);
|
|
5554
5554
|
display: flex;
|
|
5555
5555
|
}
|
|
5556
|
-
[data-v-
|
|
5556
|
+
[data-v-f1c90d7c] .vgl-item > .el-form-item.el-form-item--label-top {
|
|
5557
5557
|
flex-direction: column;
|
|
5558
5558
|
}
|
|
5559
|
-
[data-v-
|
|
5559
|
+
[data-v-f1c90d7c] .vgl-item > .el-form-item .el-form-item__label {
|
|
5560
5560
|
line-height: 20px;
|
|
5561
5561
|
display: flex;
|
|
5562
5562
|
align-items: center;
|
|
5563
5563
|
}
|
|
5564
|
-
[data-v-
|
|
5564
|
+
[data-v-f1c90d7c] .vgl-item > .el-container {
|
|
5565
5565
|
height: auto !important;
|
|
5566
5566
|
}.cell-content .cell-text[data-v-b57831f4] {
|
|
5567
5567
|
display: inline-block;
|
|
@@ -12,6 +12,9 @@ const api = {
|
|
|
12
12
|
},
|
|
13
13
|
getTemplateDialogById: ($http, id) => {
|
|
14
14
|
return $http.postForm(`${$servers.base}/template/sysTemplateDialog/getById`, { id });
|
|
15
|
+
},
|
|
16
|
+
getProductData: ($http, prodId) => {
|
|
17
|
+
return $http.postForm(`${$servers.base}/design/getProductData`, { prodId });
|
|
15
18
|
}
|
|
16
19
|
};
|
|
17
20
|
exports.default = api;
|
|
@@ -10,9 +10,9 @@ const index$2 = require("../forms/form/index.js");
|
|
|
10
10
|
const parseRouteParams = require("../../utils/parseRouteParams.js");
|
|
11
11
|
const calculate = require("../../utils/formulajs/calculate.js");
|
|
12
12
|
const eventFlowHandler = require("../../utils/eventFlow/eventFlowHandler.js");
|
|
13
|
-
;/* empty css */
|
|
14
13
|
;/* empty css */
|
|
15
14
|
;/* empty css */
|
|
15
|
+
;/* empty css */
|
|
16
16
|
;/* empty css */
|
|
17
17
|
const _pluginVue_exportHelper = require("../../../../../_virtual/_plugin-vue_export-helper.js");
|
|
18
18
|
;/* empty css */
|
|
@@ -195,6 +195,7 @@ const _sfc_main = {
|
|
|
195
195
|
// exposed: dialogTableRef.value,
|
|
196
196
|
// },
|
|
197
197
|
// },
|
|
198
|
+
form: props.componentCtx,
|
|
198
199
|
table: props.componentCtx
|
|
199
200
|
},
|
|
200
201
|
row: props.formData,
|
|
@@ -412,5 +413,5 @@ const _sfc_main = {
|
|
|
412
413
|
};
|
|
413
414
|
}
|
|
414
415
|
};
|
|
415
|
-
const DialogRenderer = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-
|
|
416
|
+
const DialogRenderer = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-7e9fd985"]]);
|
|
416
417
|
exports.default = DialogRenderer;
|
|
@@ -26,6 +26,7 @@ const eventFlowHandler = require("../../../utils/eventFlow/eventFlowHandler.js")
|
|
|
26
26
|
;/* empty css */
|
|
27
27
|
;/* empty css */
|
|
28
28
|
const _pluginVue_exportHelper = require("../../../../../../_virtual/_plugin-vue_export-helper.js");
|
|
29
|
+
const index$6 = require("../../../api/index.js");
|
|
29
30
|
;/* empty css */
|
|
30
31
|
;/* empty css */
|
|
31
32
|
const usePageEvents = require("../../../composables/usePageEvents.js");
|
|
@@ -100,6 +101,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
100
101
|
const formRules = vue.ref({});
|
|
101
102
|
const dataSourceOptions = vue.ref({});
|
|
102
103
|
const dictionaryOptions = vue.ref({});
|
|
104
|
+
const productData = vue.ref({});
|
|
103
105
|
const fieldsData = vue.ref({});
|
|
104
106
|
const hiddenFields = vue.ref({});
|
|
105
107
|
const rowHeight = vue.ref(1);
|
|
@@ -146,8 +148,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
146
148
|
return item.component;
|
|
147
149
|
});
|
|
148
150
|
hiddenFields.value = option.hiddenFields || [];
|
|
149
|
-
loadFormData();
|
|
150
151
|
await loadFieldDataSources();
|
|
152
|
+
loadFormData();
|
|
151
153
|
loadEventFlow();
|
|
152
154
|
if (pageEvents && localConfig.value.pageEventConfig) {
|
|
153
155
|
const onCreatedEvent = localConfig.value.pageEventConfig.find(
|
|
@@ -158,6 +160,9 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
158
160
|
await pageEvents.executeEvent("onCreated");
|
|
159
161
|
}
|
|
160
162
|
}
|
|
163
|
+
await loadProductData();
|
|
164
|
+
applyProductConfigToForm();
|
|
165
|
+
mergeOptionsToFields();
|
|
161
166
|
} catch (error) {
|
|
162
167
|
console.error("加载配置失败:", error);
|
|
163
168
|
index$5.ElMessage.error("加载配置失败");
|
|
@@ -166,12 +171,12 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
166
171
|
}
|
|
167
172
|
};
|
|
168
173
|
const loadFormData = () => {
|
|
169
|
-
const
|
|
174
|
+
const defaultData = {};
|
|
170
175
|
const rules = {};
|
|
171
176
|
if (fieldsData.value) {
|
|
172
177
|
fieldsData.value.forEach((component) => {
|
|
173
178
|
if (component.fieldName) {
|
|
174
|
-
|
|
179
|
+
defaultData[component.fieldName] = component.defaultValue ? component.defaultValue : null;
|
|
175
180
|
}
|
|
176
181
|
if (component.fieldName) {
|
|
177
182
|
const fieldRules = validation.generateFieldRules(component);
|
|
@@ -184,11 +189,11 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
184
189
|
if (hiddenFields.value && hiddenFields.value.length > 0) {
|
|
185
190
|
hiddenFields.value.forEach((field) => {
|
|
186
191
|
if (field.fieldName) {
|
|
187
|
-
|
|
192
|
+
defaultData[field.fieldName] = field.value !== void 0 ? field.value : null;
|
|
188
193
|
}
|
|
189
194
|
});
|
|
190
195
|
}
|
|
191
|
-
formData.value = { ...
|
|
196
|
+
formData.value = { ...defaultData, ...props.modelValue };
|
|
192
197
|
formRules.value = rules;
|
|
193
198
|
};
|
|
194
199
|
const loadFieldDataSources = async () => {
|
|
@@ -253,7 +258,6 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
253
258
|
console.error("Failed to load dictionary data:", error);
|
|
254
259
|
}
|
|
255
260
|
}
|
|
256
|
-
mergeOptionsToFields();
|
|
257
261
|
};
|
|
258
262
|
const mergeOptionsToFields = () => {
|
|
259
263
|
if (fieldsData.value) {
|
|
@@ -290,7 +294,157 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
290
294
|
} else if (optionSource === "custom") {
|
|
291
295
|
component.optionConfig.options = component.optionConfig.options || [];
|
|
292
296
|
}
|
|
297
|
+
applyProductConfigFilter(component);
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
const loadProductData = async () => {
|
|
302
|
+
if (!localConfig.value || !localConfig.value.prodConfig) {
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
const { prodId } = localConfig.value.prodConfig;
|
|
306
|
+
if (!prodId) {
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
const field = [...fieldsData.value, ...hiddenFields.value].find(
|
|
310
|
+
(item) => item.id == prodId.value
|
|
311
|
+
);
|
|
312
|
+
if (!field) {
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
const prodIdValue = formData.value[field.fieldName];
|
|
316
|
+
if (!prodIdValue) {
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
try {
|
|
320
|
+
const response = await index$6.default.getProductData(ctx.$http, prodIdValue);
|
|
321
|
+
productData.value = response;
|
|
322
|
+
console.log("产品数据加载成功:", productData.value);
|
|
323
|
+
} catch (error) {
|
|
324
|
+
console.error("获取产品数据失败:", error);
|
|
325
|
+
productData.value = {};
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
const prodRules = vue.ref({});
|
|
329
|
+
const applyProductConfigToForm = () => {
|
|
330
|
+
if (!localConfig.value || !localConfig.value.prodConfig || !productData.value) {
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
const { defaultValueConfigs, validationConfigs } = localConfig.value.prodConfig;
|
|
334
|
+
if (defaultValueConfigs && defaultValueConfigs.length > 0) {
|
|
335
|
+
defaultValueConfigs.forEach((config) => {
|
|
336
|
+
if (config.pageField && config.productConfigField) {
|
|
337
|
+
const defaultValue = productData.value[config.productConfigField];
|
|
338
|
+
if (defaultValue !== void 0) {
|
|
339
|
+
const formField = [...fieldsData.value, ...hiddenFields.value].find(
|
|
340
|
+
(item) => item.id == config.pageField
|
|
341
|
+
);
|
|
342
|
+
if (formField && !formData.value[formField.fieldName]) {
|
|
343
|
+
formData.value[formField.fieldName] = defaultValue;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
if (validationConfigs && validationConfigs.length > 0) {
|
|
350
|
+
validationConfigs.forEach((config) => {
|
|
351
|
+
if (config.pageField && (config.minProductField || config.maxProductField)) {
|
|
352
|
+
const minValue = productData.value[config.minProductField];
|
|
353
|
+
const maxValue = productData.value[config.maxProductField];
|
|
354
|
+
if (minValue !== void 0 || maxValue !== void 0) {
|
|
355
|
+
const formField = [...fieldsData.value, ...hiddenFields.value].find(
|
|
356
|
+
(item) => item.id == config.pageField
|
|
357
|
+
);
|
|
358
|
+
if (formField && !prodRules.value[formField.fieldName]) {
|
|
359
|
+
prodRules.value[formField.fieldName] = [];
|
|
360
|
+
}
|
|
361
|
+
const customValidator = (rule, value, callback) => {
|
|
362
|
+
console.log(
|
|
363
|
+
"🚀 ~ customValidator 被调用 ~ 字段:",
|
|
364
|
+
formField == null ? void 0 : formField.fieldName,
|
|
365
|
+
"值:",
|
|
366
|
+
value,
|
|
367
|
+
"minValue:",
|
|
368
|
+
minValue,
|
|
369
|
+
"maxValue:",
|
|
370
|
+
maxValue
|
|
371
|
+
);
|
|
372
|
+
if (value === null || value === void 0 || value === "") {
|
|
373
|
+
callback();
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
const numValue = Number(value);
|
|
377
|
+
if (isNaN(numValue)) {
|
|
378
|
+
callback(new Error("请输入有效的数字"));
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
let errorMessage = "";
|
|
382
|
+
if (minValue !== void 0 && numValue < Number(minValue)) {
|
|
383
|
+
errorMessage = `不能小于 ${minValue}`;
|
|
384
|
+
}
|
|
385
|
+
if (maxValue !== void 0 && numValue > Number(maxValue)) {
|
|
386
|
+
if (errorMessage) {
|
|
387
|
+
errorMessage = `${errorMessage} 且 不能大于 ${maxValue}`;
|
|
388
|
+
} else {
|
|
389
|
+
errorMessage = `不能大于 ${maxValue}`;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
if (errorMessage) {
|
|
393
|
+
callback(new Error(errorMessage));
|
|
394
|
+
} else {
|
|
395
|
+
callback();
|
|
396
|
+
}
|
|
397
|
+
};
|
|
398
|
+
const customRule = {
|
|
399
|
+
validator: customValidator,
|
|
400
|
+
trigger: "blur"
|
|
401
|
+
};
|
|
402
|
+
prodRules.value[formField.fieldName].push(customRule);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
293
405
|
});
|
|
406
|
+
for (let fieldName in prodRules.value) {
|
|
407
|
+
if (formRules.value[fieldName]) {
|
|
408
|
+
formRules.value[fieldName].push(...prodRules.value[fieldName]);
|
|
409
|
+
} else {
|
|
410
|
+
formRules.value[fieldName] = prodRules.value[fieldName];
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
const applyProductConfigFilter = (component) => {
|
|
416
|
+
if (!localConfig.value || !localConfig.value.prodConfig || !productData.value) {
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
const { optionConfigs } = localConfig.value.prodConfig;
|
|
420
|
+
if (!optionConfigs || !component.optionConfig || !component.optionConfig.options) {
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
const componentConfig = optionConfigs.find(
|
|
424
|
+
(item) => item.pageField == component.id
|
|
425
|
+
);
|
|
426
|
+
if (!componentConfig || !componentConfig.productConfigField) {
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
const fieldValue = productData.value[componentConfig.productConfigField];
|
|
430
|
+
if (!fieldValue) {
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
const allowedValues = Array.isArray(fieldValue) ? fieldValue : fieldValue.split("|");
|
|
434
|
+
component.optionConfig.options = component.optionConfig.options.filter(
|
|
435
|
+
(option) => {
|
|
436
|
+
const optionValue = option.value !== void 0 ? option.value : option;
|
|
437
|
+
return allowedValues.includes(optionValue);
|
|
438
|
+
}
|
|
439
|
+
);
|
|
440
|
+
if (component.optionConfig.options.length === 0) {
|
|
441
|
+
component.optionConfig.options = [
|
|
442
|
+
{
|
|
443
|
+
label: `无可用选项(产品配置限制)`,
|
|
444
|
+
value: "",
|
|
445
|
+
disabled: true
|
|
446
|
+
}
|
|
447
|
+
];
|
|
294
448
|
}
|
|
295
449
|
};
|
|
296
450
|
const handleEvent = vue.ref(null);
|
|
@@ -413,6 +567,9 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
413
567
|
}
|
|
414
568
|
}
|
|
415
569
|
});
|
|
570
|
+
for (let fieldName in prodRules.value) {
|
|
571
|
+
rules[fieldName] = prodRules.value[fieldName];
|
|
572
|
+
}
|
|
416
573
|
formRules.value = rules;
|
|
417
574
|
const readonlyArr = (linkedConfig == null ? void 0 : linkedConfig.readonly) || [];
|
|
418
575
|
readonlyArr.forEach((item) => {
|
|
@@ -695,5 +852,5 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
695
852
|
};
|
|
696
853
|
}
|
|
697
854
|
});
|
|
698
|
-
const _Form = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-
|
|
855
|
+
const _Form = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-f1c90d7c"]]);
|
|
699
856
|
exports.default = _Form;
|
|
@@ -4,9 +4,9 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
4
4
|
;/* empty css */
|
|
5
5
|
;/* empty css */
|
|
6
6
|
const vue = require("vue");
|
|
7
|
-
;/* empty css */
|
|
8
7
|
;/* empty css */
|
|
9
8
|
;/* empty css */
|
|
9
|
+
;/* empty css */
|
|
10
10
|
const index$3 = require("../../dialog/index.js");
|
|
11
11
|
const index$2 = require("../../../api/index.js");
|
|
12
12
|
;/* empty css */
|
|
@@ -7,9 +7,9 @@ const vue = require("vue");
|
|
|
7
7
|
require("../../../../../node_modules/.pnpm/vxe-table@4.17.47_vue@3.5.13_typescript@5.7.3_/node_modules/vxe-table/es/components.js");
|
|
8
8
|
const index$3 = require("../../../../../node_modules/.pnpm/@element-plus_icons-vue@2.3.2_vue@3.5.13_typescript@5.7.3_/node_modules/@element-plus/icons-vue/dist/index.js");
|
|
9
9
|
const parseFilterConfig = require("../../utils/parseFilterConfig.js");
|
|
10
|
-
;/* empty css */
|
|
11
10
|
;/* empty css */
|
|
12
11
|
;/* empty css */
|
|
12
|
+
;/* empty css */
|
|
13
13
|
;/* empty css */
|
|
14
14
|
;/* empty css */
|
|
15
15
|
require("./index.js");
|
|
@@ -3,9 +3,9 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
3
3
|
const vue = require("vue");
|
|
4
4
|
const parseRouteParams = require("./parseRouteParams.js");
|
|
5
5
|
;/* empty css */
|
|
6
|
-
;/* empty css */
|
|
7
6
|
;/* empty css */
|
|
8
7
|
;/* empty css */
|
|
8
|
+
;/* empty css */
|
|
9
9
|
const index = require("../../../../node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/components/loading/index.js");
|
|
10
10
|
const index$1 = require("../../../../node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/components/message/index.js");
|
|
11
11
|
class DataSourceManager {
|