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