@fecp/designer 5.6.29 → 5.6.30
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.css +115 -115
- package/es/packages/vue/src/components/dialog/DialogRenderer.vue2.mjs +75 -8
- package/es/packages/vue/src/components/dialog/index.mjs +2 -1
- package/es/packages/vue/src/components/forms/form/Form.vue.mjs +6 -43
- package/es/packages/vue/src/components/forms/formItem/FormItem.vue.mjs +2 -12
- package/es/packages/vue/src/components/forms/roleSelect/RoleSelect.vue.mjs +9 -3
- package/es/packages/vue/src/components/forms/userSelect/UserSelect.vue.mjs +9 -3
- package/es/packages/vue/src/components/table/Table.vue.mjs +119 -11
- package/lib/designer/package.json.js +1 -1
- package/lib/designer.css +115 -115
- package/lib/packages/vue/src/components/dialog/DialogRenderer.vue2.js +75 -8
- package/lib/packages/vue/src/components/dialog/index.js +2 -1
- package/lib/packages/vue/src/components/forms/form/Form.vue.js +6 -43
- package/lib/packages/vue/src/components/forms/formItem/FormItem.vue.js +1 -11
- package/lib/packages/vue/src/components/forms/roleSelect/RoleSelect.vue.js +9 -3
- package/lib/packages/vue/src/components/forms/userSelect/UserSelect.vue.js +9 -3
- package/lib/packages/vue/src/components/table/Table.vue.js +118 -10
- package/package.json +1 -1
|
@@ -38,6 +38,7 @@ const _hoisted_3 = {
|
|
|
38
38
|
key: 3,
|
|
39
39
|
class: "empty-content"
|
|
40
40
|
};
|
|
41
|
+
const CONFIRMED_ROWS_CACHE = /* @__PURE__ */ new Map();
|
|
41
42
|
const _sfc_main = {
|
|
42
43
|
__name: "DialogRenderer",
|
|
43
44
|
props: {
|
|
@@ -63,6 +64,11 @@ const _sfc_main = {
|
|
|
63
64
|
type: String,
|
|
64
65
|
default: ""
|
|
65
66
|
},
|
|
67
|
+
// 调用方显式指定的「列表真实值字段 ↔ 表单字段」映射,优先于弹层配置的 fieldMapping
|
|
68
|
+
valueConfig: {
|
|
69
|
+
type: Object,
|
|
70
|
+
default: null
|
|
71
|
+
},
|
|
66
72
|
componentCtx: {
|
|
67
73
|
type: Object,
|
|
68
74
|
default: {}
|
|
@@ -157,17 +163,37 @@ const _sfc_main = {
|
|
|
157
163
|
dialogVisible.value = false;
|
|
158
164
|
};
|
|
159
165
|
const dialogTableRef = Vue.ref();
|
|
166
|
+
function getTableSelectionRows() {
|
|
167
|
+
var _a, _b, _c;
|
|
168
|
+
const fromTable = (_b = (_a = dialogTableRef.value) == null ? void 0 : _a.getSelection) == null ? void 0 : _b.call(_a);
|
|
169
|
+
const instanceRows = Array.isArray(fromTable) ? fromTable : [];
|
|
170
|
+
const cachedRows = tableSelectionRows.value || [];
|
|
171
|
+
const valueField = (_c = resolveValueField()) == null ? void 0 : _c.valueField;
|
|
172
|
+
if (!valueField) {
|
|
173
|
+
return instanceRows.length > 0 ? instanceRows : cachedRows;
|
|
174
|
+
}
|
|
175
|
+
const merged = [];
|
|
176
|
+
const seen = /* @__PURE__ */ new Set();
|
|
177
|
+
[...instanceRows, ...cachedRows].forEach((row) => {
|
|
178
|
+
const key = String((row == null ? void 0 : row[valueField]) ?? "");
|
|
179
|
+
if (!key || seen.has(key)) return;
|
|
180
|
+
seen.add(key);
|
|
181
|
+
merged.push(row);
|
|
182
|
+
});
|
|
183
|
+
return merged;
|
|
184
|
+
}
|
|
160
185
|
const handleConfirm = async () => {
|
|
161
186
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
162
187
|
const contentSource = (_a = currentDialogConfig.value) == null ? void 0 : _a.contentSource;
|
|
163
188
|
if (contentSource === "table") {
|
|
164
|
-
|
|
189
|
+
const selectedRows = getTableSelectionRows();
|
|
190
|
+
if (selectedRows.length == 0) {
|
|
165
191
|
index$2.ElMessage.error("数据未选择,请选择");
|
|
166
192
|
return;
|
|
167
193
|
}
|
|
168
194
|
const formData = {};
|
|
169
195
|
const displayFormat = currentDialogConfig.value.displayFormat;
|
|
170
|
-
const displayValues =
|
|
196
|
+
const displayValues = selectedRows.map((row) => {
|
|
171
197
|
const calcResult = calculate.calculate({
|
|
172
198
|
text: displayFormat == null ? void 0 : displayFormat.text,
|
|
173
199
|
marks: [],
|
|
@@ -183,14 +209,14 @@ const _sfc_main = {
|
|
|
183
209
|
}
|
|
184
210
|
const isRowDataAssignToForm = currentDialogConfig.value.isRowDataAssignToForm;
|
|
185
211
|
if (isRowDataAssignToForm) {
|
|
186
|
-
Object.assign(formData,
|
|
212
|
+
Object.assign(formData, selectedRows[0]);
|
|
187
213
|
}
|
|
188
214
|
const fieldMapping = currentDialogConfig.value.fieldMapping;
|
|
189
215
|
if ((fieldMapping == null ? void 0 : fieldMapping.length) > 0) {
|
|
190
216
|
fieldMapping.forEach((item) => {
|
|
191
217
|
const field = props.fieldsList.find((field2) => field2.id === item.field);
|
|
192
218
|
if (field) {
|
|
193
|
-
const values =
|
|
219
|
+
const values = selectedRows.map((row) => row[item.value]);
|
|
194
220
|
formData[field.fieldName] = values.join(",");
|
|
195
221
|
}
|
|
196
222
|
});
|
|
@@ -218,7 +244,11 @@ const _sfc_main = {
|
|
|
218
244
|
item: {}
|
|
219
245
|
});
|
|
220
246
|
}
|
|
221
|
-
|
|
247
|
+
const valueConfig = resolveValueField();
|
|
248
|
+
if (valueConfig == null ? void 0 : valueConfig.formField) {
|
|
249
|
+
CONFIRMED_ROWS_CACHE.set(rowsCacheKey(valueConfig), selectedRows);
|
|
250
|
+
}
|
|
251
|
+
emit("confirm", selectedRows);
|
|
222
252
|
} else {
|
|
223
253
|
emit("confirm");
|
|
224
254
|
}
|
|
@@ -228,6 +258,41 @@ const _sfc_main = {
|
|
|
228
258
|
emit("cancel");
|
|
229
259
|
dialogVisible.value = false;
|
|
230
260
|
};
|
|
261
|
+
function resolveValueField() {
|
|
262
|
+
var _a, _b, _c, _d;
|
|
263
|
+
if (((_a = props.valueConfig) == null ? void 0 : _a.valueField) && ((_b = props.valueConfig) == null ? void 0 : _b.formField)) {
|
|
264
|
+
return {
|
|
265
|
+
valueField: props.valueConfig.valueField,
|
|
266
|
+
formField: props.valueConfig.formField
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
const mapping = (_d = (_c = currentDialogConfig.value) == null ? void 0 : _c.fieldMapping) == null ? void 0 : _d[0];
|
|
270
|
+
if ((mapping == null ? void 0 : mapping.value) && (mapping == null ? void 0 : mapping.field)) {
|
|
271
|
+
const field = props.fieldsList.find((item) => item.id === mapping.field);
|
|
272
|
+
if (field == null ? void 0 : field.fieldName) {
|
|
273
|
+
return { valueField: mapping.value, formField: field.fieldName };
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return null;
|
|
277
|
+
}
|
|
278
|
+
function rowsCacheKey(config) {
|
|
279
|
+
return `${config == null ? void 0 : config.valueField}::${config == null ? void 0 : config.formField}`;
|
|
280
|
+
}
|
|
281
|
+
const initialSelected = Vue.computed(() => {
|
|
282
|
+
var _a;
|
|
283
|
+
const config = resolveValueField();
|
|
284
|
+
if (!config) return null;
|
|
285
|
+
const raw = (_a = props.formData) == null ? void 0 : _a[config.formField];
|
|
286
|
+
if (raw === void 0 || raw === null || raw === "") return null;
|
|
287
|
+
const values = String(raw).split(/[|,]/).map((v) => v.trim()).filter((v) => v !== "");
|
|
288
|
+
if (values.length === 0) return null;
|
|
289
|
+
return {
|
|
290
|
+
field: config.valueField,
|
|
291
|
+
values,
|
|
292
|
+
// 回显基线:上次确认的完整行集合(含未渲染页)
|
|
293
|
+
rows: CONFIRMED_ROWS_CACHE.get(rowsCacheKey(config)) || []
|
|
294
|
+
};
|
|
295
|
+
});
|
|
231
296
|
const initDialogParams = Vue.computed(() => {
|
|
232
297
|
var _a;
|
|
233
298
|
if (((_a = currentDialogConfig.value.dialogParams) == null ? void 0 : _a.length) > 0) {
|
|
@@ -406,10 +471,11 @@ const _sfc_main = {
|
|
|
406
471
|
initHiddenData: initDialogParams.value,
|
|
407
472
|
readonly: __props.dialogConfig.isSubTableReadOnly,
|
|
408
473
|
selectMode: __props.dialogConfig.selectionMode,
|
|
474
|
+
"initial-selected": initialSelected.value,
|
|
409
475
|
onSelectionChange: tableSelectionChange,
|
|
410
476
|
ref_key: "dialogTableRef",
|
|
411
477
|
ref: dialogTableRef
|
|
412
|
-
}, null, 8, ["templateKey", "mode", "hasPagination", "initHiddenData", "readonly", "selectMode"])) : __props.dialogConfig.tableContent === "custom" ? (Vue.openBlock(), Vue.createBlock(_component_fec_table, {
|
|
478
|
+
}, null, 8, ["templateKey", "mode", "hasPagination", "initHiddenData", "readonly", "selectMode", "initial-selected"])) : __props.dialogConfig.tableContent === "custom" ? (Vue.openBlock(), Vue.createBlock(_component_fec_table, {
|
|
413
479
|
key: 1,
|
|
414
480
|
initOption: __props.dialogConfig.customTableConfig,
|
|
415
481
|
isDialog: "",
|
|
@@ -417,10 +483,11 @@ const _sfc_main = {
|
|
|
417
483
|
initHiddenData: initDialogParams.value,
|
|
418
484
|
readonly: __props.dialogConfig.isSubTableReadOnly,
|
|
419
485
|
selectMode: __props.dialogConfig.selectionMode,
|
|
486
|
+
"initial-selected": initialSelected.value,
|
|
420
487
|
onSelectionChange: tableSelectionChange,
|
|
421
488
|
ref_key: "dialogTableRef",
|
|
422
489
|
ref: dialogTableRef
|
|
423
|
-
}, null, 8, ["initOption", "hasPagination", "initHiddenData", "readonly", "selectMode"])) : Vue.createCommentVNode("", true)
|
|
490
|
+
}, null, 8, ["initOption", "hasPagination", "initHiddenData", "readonly", "selectMode", "initial-selected"])) : Vue.createCommentVNode("", true)
|
|
424
491
|
], 64)) : ((_c = __props.dialogConfig) == null ? void 0 : _c.contentSource) === "form" ? (Vue.openBlock(), Vue.createBlock(_component_fec_form, {
|
|
425
492
|
key: 1,
|
|
426
493
|
templateKey: __props.dialogConfig.subFormKey,
|
|
@@ -442,5 +509,5 @@ const _sfc_main = {
|
|
|
442
509
|
};
|
|
443
510
|
}
|
|
444
511
|
};
|
|
445
|
-
const DialogRenderer = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-
|
|
512
|
+
const DialogRenderer = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-10fbeb22"]]);
|
|
446
513
|
exports.default = DialogRenderer;
|
|
@@ -24,7 +24,7 @@ const cleanupDialog = () => {
|
|
|
24
24
|
}
|
|
25
25
|
}, 300);
|
|
26
26
|
};
|
|
27
|
-
function openDialog(displayField, dialogConfig, instance, componentCtx, fieldsList, formData) {
|
|
27
|
+
function openDialog(displayField, dialogConfig, instance, componentCtx, fieldsList, formData, valueConfig) {
|
|
28
28
|
return new Promise((resolve, reject) => {
|
|
29
29
|
if (currentDialogInstance) {
|
|
30
30
|
closeDialog();
|
|
@@ -37,6 +37,7 @@ function openDialog(displayField, dialogConfig, instance, componentCtx, fieldsLi
|
|
|
37
37
|
fieldsList,
|
|
38
38
|
formData,
|
|
39
39
|
displayField,
|
|
40
|
+
valueConfig,
|
|
40
41
|
componentCtx,
|
|
41
42
|
instance,
|
|
42
43
|
"onUpdate:modelValue": (val) => {
|
|
@@ -231,12 +231,6 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
231
231
|
}
|
|
232
232
|
};
|
|
233
233
|
function layoutUpdated(layoutData) {
|
|
234
|
-
if (window.__FEC_FORM_PERF && window.__PERF_T0) {
|
|
235
|
-
console.log(
|
|
236
|
-
`[联动性能] GridLayout.layoutUpdated +${(performance.now() - window.__PERF_T0).toFixed(1)}ms`
|
|
237
|
-
);
|
|
238
|
-
window.__PERF_T0 = 0;
|
|
239
|
-
}
|
|
240
234
|
emit("layoutUpdated", layoutData);
|
|
241
235
|
}
|
|
242
236
|
const loadFormData = (state) => {
|
|
@@ -1009,7 +1003,6 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
1009
1003
|
var _a;
|
|
1010
1004
|
if (isApplyingLinkage) return;
|
|
1011
1005
|
isApplyingLinkage = true;
|
|
1012
|
-
const __ptf0 = performance.now();
|
|
1013
1006
|
const linkedConfig = localConfig.value.linkedConfig || {};
|
|
1014
1007
|
const fields = [...fieldsData.value, ...hiddenFields.value];
|
|
1015
1008
|
const relevantConfigs = filterRelevantLinkageConfigs(
|
|
@@ -1039,9 +1032,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
1039
1032
|
});
|
|
1040
1033
|
}
|
|
1041
1034
|
});
|
|
1042
|
-
const __pt0 = performance.now();
|
|
1043
1035
|
const updatedLayoutData = oriGridLayoutData.value;
|
|
1044
|
-
const __pt1 = performance.now();
|
|
1045
1036
|
relevantConfigs.options.forEach((item) => {
|
|
1046
1037
|
if (parseFilterConfig.checkFilterMatch(item.filterConfig, formData.value, fields)) {
|
|
1047
1038
|
const fieldAssignments = item.fieldAssignments || [];
|
|
@@ -1097,8 +1088,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
1097
1088
|
});
|
|
1098
1089
|
}
|
|
1099
1090
|
});
|
|
1100
|
-
|
|
1101
|
-
if ((((_a = relevantConfigs.required) == null ? void 0 : _a.length) || 0) > 0) {
|
|
1091
|
+
if (((_a = relevantConfigs.required) == null ? void 0 : _a.length) > 0) {
|
|
1102
1092
|
const rules = {};
|
|
1103
1093
|
updatedLayoutData.forEach(({ component }) => {
|
|
1104
1094
|
if (component.fieldName) {
|
|
@@ -1119,7 +1109,6 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
1119
1109
|
formRules.value = rules;
|
|
1120
1110
|
}
|
|
1121
1111
|
}
|
|
1122
|
-
const __ptr1 = performance.now();
|
|
1123
1112
|
if (formMode.value != "query") {
|
|
1124
1113
|
relevantConfigs.readonly.forEach((item) => {
|
|
1125
1114
|
const dataLinkFieldList = item.dataLinkFieldList || [];
|
|
@@ -1160,10 +1149,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
1160
1149
|
}
|
|
1161
1150
|
});
|
|
1162
1151
|
}
|
|
1163
|
-
const __pt2 = performance.now();
|
|
1164
1152
|
const oldVisibleKey = gridLayoutFieldsData.value.map((i) => i.id).sort().join(",");
|
|
1165
1153
|
const newVisibleKey = updatedLayoutData.filter((item) => !item.hidden).map((i) => i.id).sort().join(",");
|
|
1166
|
-
const __pt3 = performance.now();
|
|
1167
1154
|
const rebuild = oldVisibleKey !== newVisibleKey;
|
|
1168
1155
|
if (rebuild) {
|
|
1169
1156
|
updatedLayoutData.forEach((item) => {
|
|
@@ -1176,28 +1163,6 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
1176
1163
|
localConfig.value.columns
|
|
1177
1164
|
);
|
|
1178
1165
|
}
|
|
1179
|
-
const __pt4 = performance.now();
|
|
1180
|
-
if (window.__FEC_FORM_PERF) {
|
|
1181
|
-
window.__PERF_T0 = __pt4;
|
|
1182
|
-
console.log(
|
|
1183
|
-
`[联动性能] 字段总数 ${oriGridLayoutData.value.length} | 联动触发字段 ${linkageTriggerFields.value.size || "全量"} | 筛选配置 ${(__pt0 - __ptf0).toFixed(1)}ms | 浅拷贝 ${(__pt1 - __pt0).toFixed(1)}ms | 规则生成 ${(__ptr1 - __ptr0).toFixed(
|
|
1184
|
-
1
|
|
1185
|
-
)}ms | 联动处理 ${(__pt2 - __pt1).toFixed(1)}ms | 显隐比对 ${(__pt3 - __pt2).toFixed(1)}ms | 重建=${rebuild} ${(__pt4 - __pt3).toFixed(1)}ms`
|
|
1186
|
-
);
|
|
1187
|
-
Vue.nextTick(() => {
|
|
1188
|
-
const __pt5 = performance.now();
|
|
1189
|
-
const __fiN = window.__FI_UPDATED || 0;
|
|
1190
|
-
const __fiT = window.__FI_TIME || 0;
|
|
1191
|
-
window.__FI_UPDATED = 0;
|
|
1192
|
-
window.__FI_TIME = 0;
|
|
1193
|
-
requestAnimationFrame(() => {
|
|
1194
|
-
const __pt6 = performance.now();
|
|
1195
|
-
console.log(
|
|
1196
|
-
`[联动性能] JS补丁 ${(__pt5 - __pt4).toFixed(1)}ms | 浏览器 ${(__pt6 - __pt5).toFixed(1)}ms | FormItem重渲染 ${__fiN}次 ${__fiN ? `${__fiT.toFixed(1)}ms` : ""}`
|
|
1197
|
-
);
|
|
1198
|
-
});
|
|
1199
|
-
});
|
|
1200
|
-
}
|
|
1201
1166
|
isApplyingLinkage = false;
|
|
1202
1167
|
};
|
|
1203
1168
|
function compactLayoutVertical(arr, cols) {
|
|
@@ -1287,13 +1252,11 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
1287
1252
|
return;
|
|
1288
1253
|
}
|
|
1289
1254
|
const lastValue = { ...prevFormData.value };
|
|
1290
|
-
const changedFields = isApplyingLinkage ? [] : (
|
|
1291
|
-
// [性能优化] 去掉全量 isEqual 深比较,改由 findChangedFields 的结果判定;
|
|
1292
|
-
// 只比较参与联动的字段(initLinkage 初始化时仍走全量,保证所有联动被应用)
|
|
1293
|
-
findChangedFields(newVal, lastValue, linkageTriggerFields.value)
|
|
1294
|
-
);
|
|
1255
|
+
const changedFields = isApplyingLinkage ? [] : findChangedFields(newVal, lastValue, linkageTriggerFields.value);
|
|
1295
1256
|
if (changedFields.length > 0) {
|
|
1296
|
-
__pendingLinkageFields = [
|
|
1257
|
+
__pendingLinkageFields = [
|
|
1258
|
+
.../* @__PURE__ */ new Set([...__pendingLinkageFields || [], ...changedFields])
|
|
1259
|
+
];
|
|
1297
1260
|
if (__pendingLinkageTimer) clearTimeout(__pendingLinkageTimer);
|
|
1298
1261
|
__pendingLinkageTimer = setTimeout(() => {
|
|
1299
1262
|
__pendingLinkageTimer = null;
|
|
@@ -1476,5 +1439,5 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
1476
1439
|
};
|
|
1477
1440
|
}
|
|
1478
1441
|
});
|
|
1479
|
-
const _Form = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-
|
|
1442
|
+
const _Form = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-46bcf105"]]);
|
|
1480
1443
|
exports.default = _Form;
|
|
@@ -89,16 +89,6 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
89
89
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
90
90
|
const props = __props;
|
|
91
91
|
const emit = __emit;
|
|
92
|
-
if (typeof window !== "undefined" && window.__FEC_FORM_PERF) {
|
|
93
|
-
let __uStart = 0;
|
|
94
|
-
Vue.onBeforeUpdate(() => {
|
|
95
|
-
__uStart = performance.now();
|
|
96
|
-
});
|
|
97
|
-
Vue.onUpdated(() => {
|
|
98
|
-
window.__FI_UPDATED = (window.__FI_UPDATED || 0) + 1;
|
|
99
|
-
window.__FI_TIME = (window.__FI_TIME || 0) + (performance.now() - __uStart);
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
92
|
function handleChange(config, val) {
|
|
103
93
|
emit("change", config, val);
|
|
104
94
|
}
|
|
@@ -326,5 +316,5 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
326
316
|
};
|
|
327
317
|
}
|
|
328
318
|
});
|
|
329
|
-
const _FormItem = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-
|
|
319
|
+
const _FormItem = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-4bbb491d"]]);
|
|
330
320
|
exports.default = _FormItem;
|
|
@@ -10,6 +10,7 @@ const index$2 = require("../../dialog/index.js");
|
|
|
10
10
|
const _pluginVue_exportHelper = require("../../../../../../_virtual/_plugin-vue_export-helper.js");
|
|
11
11
|
const index = require("../../../../../../node_modules/element-plus/es/components/input/index.js");
|
|
12
12
|
const index$1 = require("../../../../../../node_modules/element-plus/es/components/button/index.js");
|
|
13
|
+
const VALUE_FIELD = "roleNo";
|
|
13
14
|
const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
14
15
|
inheritAttrs: false
|
|
15
16
|
}, {
|
|
@@ -82,9 +83,14 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
82
83
|
instance,
|
|
83
84
|
formCtx,
|
|
84
85
|
fieldsList,
|
|
85
|
-
formData.value
|
|
86
|
+
formData.value,
|
|
87
|
+
{
|
|
88
|
+
// 真实值字段与表单字段的映射,用于打开弹层时反向勾选已选项
|
|
89
|
+
valueField: VALUE_FIELD,
|
|
90
|
+
formField: props.config.fieldName
|
|
91
|
+
}
|
|
86
92
|
).then((result) => {
|
|
87
|
-
const values = result.map((row) => row
|
|
93
|
+
const values = result.map((row) => row[VALUE_FIELD]);
|
|
88
94
|
formData.value[props.config.fieldName] = values.join("|");
|
|
89
95
|
console.log("确定", result);
|
|
90
96
|
}).catch(() => {
|
|
@@ -123,5 +129,5 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
123
129
|
};
|
|
124
130
|
}
|
|
125
131
|
});
|
|
126
|
-
const _RoleSelect = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-
|
|
132
|
+
const _RoleSelect = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-5ebf9681"]]);
|
|
127
133
|
exports.default = _RoleSelect;
|
|
@@ -10,6 +10,7 @@ const index$2 = require("../../dialog/index.js");
|
|
|
10
10
|
const _pluginVue_exportHelper = require("../../../../../../_virtual/_plugin-vue_export-helper.js");
|
|
11
11
|
const index = require("../../../../../../node_modules/element-plus/es/components/input/index.js");
|
|
12
12
|
const index$1 = require("../../../../../../node_modules/element-plus/es/components/button/index.js");
|
|
13
|
+
const VALUE_FIELD = "opNo";
|
|
13
14
|
const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
14
15
|
inheritAttrs: false
|
|
15
16
|
}, {
|
|
@@ -82,9 +83,14 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
82
83
|
instance,
|
|
83
84
|
formCtx,
|
|
84
85
|
fieldsList,
|
|
85
|
-
formData.value
|
|
86
|
+
formData.value,
|
|
87
|
+
{
|
|
88
|
+
// 真实值字段与表单字段的映射,用于打开弹层时反向勾选已选项
|
|
89
|
+
valueField: VALUE_FIELD,
|
|
90
|
+
formField: props.config.fieldName
|
|
91
|
+
}
|
|
86
92
|
).then((result) => {
|
|
87
|
-
const values = result.map((row) => row
|
|
93
|
+
const values = result.map((row) => row[VALUE_FIELD]);
|
|
88
94
|
formData.value[props.config.fieldName] = values.join("|");
|
|
89
95
|
console.log("确定", result);
|
|
90
96
|
}).catch(() => {
|
|
@@ -123,5 +129,5 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
123
129
|
};
|
|
124
130
|
}
|
|
125
131
|
});
|
|
126
|
-
const _UserSelect = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-
|
|
132
|
+
const _UserSelect = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-661d709f"]]);
|
|
127
133
|
exports.default = _UserSelect;
|
|
@@ -118,6 +118,12 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
118
118
|
default: "",
|
|
119
119
|
validator: (value) => ["", "none", "single", "multiple"].includes(value)
|
|
120
120
|
},
|
|
121
|
+
// 打开时回显已选项:{ field: 列表字段名, values: [真实值...] }
|
|
122
|
+
// 仅在弹层等"打开即勾中已保存项"的场景传入;为 null 时不回显
|
|
123
|
+
initialSelected: {
|
|
124
|
+
type: Object,
|
|
125
|
+
default: null
|
|
126
|
+
},
|
|
121
127
|
initHiddenData: {
|
|
122
128
|
type: Object,
|
|
123
129
|
default: {}
|
|
@@ -549,20 +555,97 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
549
555
|
emit("page-change", { pageNo, pageSize });
|
|
550
556
|
};
|
|
551
557
|
const selectedRows = Vue.ref([]);
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
558
|
+
let userInteracted = false;
|
|
559
|
+
const handleCheckboxChange = () => {
|
|
560
|
+
userInteracted = true;
|
|
561
|
+
selectedRows.value = collectSelectionWithBaseline();
|
|
562
|
+
emit("selection-change", selectedRows.value);
|
|
555
563
|
};
|
|
556
|
-
const handleCheckboxAll = (
|
|
557
|
-
|
|
558
|
-
|
|
564
|
+
const handleCheckboxAll = () => {
|
|
565
|
+
userInteracted = true;
|
|
566
|
+
selectedRows.value = collectSelectionWithBaseline();
|
|
567
|
+
emit("selection-change", selectedRows.value);
|
|
559
568
|
};
|
|
560
569
|
const handleRadioChange = (checked) => {
|
|
570
|
+
userInteracted = true;
|
|
561
571
|
emit("selection-change", [checked.row]);
|
|
562
572
|
};
|
|
573
|
+
const appliedInitialValues = /* @__PURE__ */ new Set();
|
|
574
|
+
const renderedKeys = /* @__PURE__ */ new Set();
|
|
575
|
+
function mergeRowsByKey(primary, extra, keyOf) {
|
|
576
|
+
const merged = [];
|
|
577
|
+
const seen = /* @__PURE__ */ new Set();
|
|
578
|
+
primary.forEach((row) => {
|
|
579
|
+
const key = keyOf(row);
|
|
580
|
+
if (seen.has(key)) return;
|
|
581
|
+
seen.add(key);
|
|
582
|
+
merged.push(row);
|
|
583
|
+
});
|
|
584
|
+
extra.forEach((row) => {
|
|
585
|
+
const key = keyOf(row);
|
|
586
|
+
if (seen.has(key)) return;
|
|
587
|
+
seen.add(key);
|
|
588
|
+
merged.push(row);
|
|
589
|
+
});
|
|
590
|
+
return merged;
|
|
591
|
+
}
|
|
592
|
+
function collectSelectionWithBaseline() {
|
|
593
|
+
const checked = collectCheckboxSelection();
|
|
594
|
+
const cfg = props.initialSelected;
|
|
595
|
+
if (!(cfg == null ? void 0 : cfg.field) || !Array.isArray(cfg.rows) || cfg.rows.length === 0) {
|
|
596
|
+
return checked;
|
|
597
|
+
}
|
|
598
|
+
const keyOf = (row) => String((row == null ? void 0 : row[cfg.field]) ?? "");
|
|
599
|
+
const allowed = new Set((cfg.values || []).map((v) => String(v)));
|
|
600
|
+
const unseen = cfg.rows.filter(
|
|
601
|
+
(row) => allowed.has(keyOf(row)) && !renderedKeys.has(keyOf(row))
|
|
602
|
+
);
|
|
603
|
+
return mergeRowsByKey(checked, unseen, keyOf);
|
|
604
|
+
}
|
|
605
|
+
function applyInitialSelected() {
|
|
606
|
+
var _a;
|
|
607
|
+
const cfg = props.initialSelected;
|
|
608
|
+
const $table = tableRef.value;
|
|
609
|
+
if (!$table || userInteracted) return;
|
|
610
|
+
if (!(cfg == null ? void 0 : cfg.field) || !Array.isArray(cfg.values) || cfg.values.length === 0)
|
|
611
|
+
return;
|
|
612
|
+
const mode = props.selectMode || ((_a = localConfig.value) == null ? void 0 : _a.selectMode);
|
|
613
|
+
if (mode !== "single" && mode !== "multiple") return;
|
|
614
|
+
const keyOf = (row) => String((row == null ? void 0 : row[cfg.field]) ?? "");
|
|
615
|
+
displayData.value.forEach((row) => {
|
|
616
|
+
const key = keyOf(row);
|
|
617
|
+
if (key) renderedKeys.add(key);
|
|
618
|
+
});
|
|
619
|
+
const pendingValues = cfg.values.map((v) => String(v)).filter((v) => !appliedInitialValues.has(v));
|
|
620
|
+
const rows = pendingValues.length ? displayData.value.filter((row) => pendingValues.includes(keyOf(row))) : [];
|
|
621
|
+
if (rows.length > 0) {
|
|
622
|
+
rows.forEach((row) => appliedInitialValues.add(keyOf(row)));
|
|
623
|
+
}
|
|
624
|
+
if (mode === "single") {
|
|
625
|
+
if (rows.length === 0) return;
|
|
626
|
+
$table.setRadioRow(rows[0]);
|
|
627
|
+
selectedRows.value = [rows[0]];
|
|
628
|
+
} else {
|
|
629
|
+
if (rows.length > 0) $table.setCheckboxRow(rows, true);
|
|
630
|
+
selectedRows.value = collectSelectionWithBaseline();
|
|
631
|
+
}
|
|
632
|
+
if (selectedRows.value.length > 0) {
|
|
633
|
+
emit("selection-change", selectedRows.value);
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
Vue.watch(
|
|
637
|
+
() => props.initialSelected,
|
|
638
|
+
() => {
|
|
639
|
+
appliedInitialValues.clear();
|
|
640
|
+
renderedKeys.clear();
|
|
641
|
+
userInteracted = false;
|
|
642
|
+
},
|
|
643
|
+
{ deep: true }
|
|
644
|
+
);
|
|
563
645
|
const handleInitRendered = ({ visibleColumn, visibleData, $event }) => {
|
|
564
646
|
const offsetHeight = fecTableContainerRef.value.$el.offsetHeight;
|
|
565
647
|
emit("height-loaded", localConfig.value, offsetHeight);
|
|
648
|
+
applyInitialSelected();
|
|
566
649
|
if ((visibleData == null ? void 0 : visibleData.length) > 0) {
|
|
567
650
|
eventBus.default.emit("onSubTableDataLoaded", {
|
|
568
651
|
subTableConfig: props.subTableConfig,
|
|
@@ -578,6 +661,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
578
661
|
}) => {
|
|
579
662
|
const offsetHeight = fecTableContainerRef.value.$el.offsetHeight;
|
|
580
663
|
emit("height-loaded", localConfig.value, offsetHeight);
|
|
664
|
+
applyInitialSelected();
|
|
581
665
|
if ((visibleData == null ? void 0 : visibleData.length) > 0) {
|
|
582
666
|
eventBus.default.emit("onSubTableDataLoaded", {
|
|
583
667
|
subTableConfig: props.subTableConfig,
|
|
@@ -743,9 +827,26 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
743
827
|
isHover: true
|
|
744
828
|
};
|
|
745
829
|
});
|
|
830
|
+
function collectCheckboxSelection() {
|
|
831
|
+
var _a, _b;
|
|
832
|
+
const $table = tableRef.value;
|
|
833
|
+
if (!$table) return [];
|
|
834
|
+
const current = ((_a = $table.getCheckboxRecords) == null ? void 0 : _a.call($table)) || [];
|
|
835
|
+
const reserve = ((_b = $table.getCheckboxReserveRecords) == null ? void 0 : _b.call($table)) || [];
|
|
836
|
+
const keyField = rowConfig.value.keyField;
|
|
837
|
+
if (!keyField) return [...current, ...reserve];
|
|
838
|
+
const seen = /* @__PURE__ */ new Set();
|
|
839
|
+
return [...current, ...reserve].filter((row) => {
|
|
840
|
+
const key = String((row == null ? void 0 : row[keyField]) ?? "");
|
|
841
|
+
if (seen.has(key)) return false;
|
|
842
|
+
seen.add(key);
|
|
843
|
+
return true;
|
|
844
|
+
});
|
|
845
|
+
}
|
|
746
846
|
const radioConfig = Vue.ref({
|
|
747
847
|
trigger: "row",
|
|
748
|
-
highlight: true
|
|
848
|
+
highlight: true,
|
|
849
|
+
reserve: true
|
|
749
850
|
});
|
|
750
851
|
const checkboxConfig = Vue.ref({
|
|
751
852
|
showHeader: true,
|
|
@@ -770,8 +871,15 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
770
871
|
currentMode.value = modeKey;
|
|
771
872
|
};
|
|
772
873
|
const getSelection = () => {
|
|
773
|
-
|
|
774
|
-
|
|
874
|
+
var _a, _b, _c;
|
|
875
|
+
const $table = tableRef.value;
|
|
876
|
+
if (!$table) return [];
|
|
877
|
+
const mode = props.selectMode || ((_a = localConfig.value) == null ? void 0 : _a.selectMode);
|
|
878
|
+
if (mode === "single") {
|
|
879
|
+
const row = ((_b = $table.getRadioRecord) == null ? void 0 : _b.call($table)) || ((_c = $table.getRadioReserveRecord) == null ? void 0 : _c.call($table));
|
|
880
|
+
return row ? [row] : [];
|
|
881
|
+
}
|
|
882
|
+
return collectSelectionWithBaseline();
|
|
775
883
|
};
|
|
776
884
|
const clearSelection = () => {
|
|
777
885
|
if (tableRef.value) {
|
|
@@ -1032,5 +1140,5 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
|
1032
1140
|
};
|
|
1033
1141
|
}
|
|
1034
1142
|
});
|
|
1035
|
-
const _Table = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-
|
|
1143
|
+
const _Table = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-63047ad0"]]);
|
|
1036
1144
|
exports.default = _Table;
|