|
|
@@ -219,10 +219,11 @@ function adaptLevelConfig(cfg = {}) {
|
|
|
category: item.certificateType || "",
|
|
|
certificateId: item.certificateId,
|
|
|
})),
|
|
|
- // 推荐培训:字典项 value 作为课程标识,回写/回显统一走 trainingName 字段
|
|
|
+ // 推荐培训:接口按字典 id(trainingId)回显,与下拉选项 value 对齐
|
|
|
trainings: (cfg.trainings || [])
|
|
|
- .map((item) => item.trainingName)
|
|
|
- .filter(Boolean),
|
|
|
+ .map((item) => item?.trainingId ?? item?.id ?? null)
|
|
|
+ .filter((value) => value !== null && value !== undefined && value !== "")
|
|
|
+ .map((value) => String(value)),
|
|
|
promote: {
|
|
|
paths: paths.length ? paths : [{ up: "", down: "", lateral: "" }],
|
|
|
conditions,
|
|
|
@@ -345,9 +346,11 @@ export function adaptPosition(raw = {}) {
|
|
|
name: item.certificateName || "",
|
|
|
category: item.certificateType || "",
|
|
|
})),
|
|
|
+ // 推荐培训:接口按字典 id(trainingId)回显,字符串化以匹配下拉选项 value
|
|
|
trainings: (raw.trainings || [])
|
|
|
- .map((item) => item.trainingName)
|
|
|
- .filter(Boolean),
|
|
|
+ .map((item) => item?.trainingId ?? item?.id ?? null)
|
|
|
+ .filter((value) => value !== null && value !== undefined && value !== "")
|
|
|
+ .map((value) => String(value)),
|
|
|
promote: { paths: pathsForForm, up, down, lateral, conditions },
|
|
|
promotions,
|
|
|
employees: (raw.activeEmployees || []).map((item) => ({
|
|
|
@@ -480,16 +483,14 @@ function buildLevelConfig(level = {}, positionList = [], positionSequence = "")
|
|
|
sortNo: index + 1,
|
|
|
}),
|
|
|
);
|
|
|
- // 推荐培训:表单值是字典项 value(字符串),接口按 trainingName 回写;
|
|
|
- // 兼容对象形态(含 trainingName 的历史数据),否则重进编辑会丢失已选课程
|
|
|
+ // 推荐培训:提交字典 id(trainingId),不再提交名称
|
|
|
const trainings = (level.trainings || [])
|
|
|
.map((item) =>
|
|
|
- typeof item === "string"
|
|
|
- ? item.trim()
|
|
|
- : String(item?.trainingName ?? item?.name ?? "").trim(),
|
|
|
+ item && typeof item === "object" ? (item.trainingId ?? item.id) : item,
|
|
|
)
|
|
|
- .filter(Boolean)
|
|
|
- .map((trainingName) => ({ trainingName }));
|
|
|
+ .map((value) => keepBigIntId(value))
|
|
|
+ .filter((value) => value !== undefined && value !== null && value !== "")
|
|
|
+ .map((trainingId) => ({ trainingId }));
|
|
|
|
|
|
const sequenceText = String(
|
|
|
positionSequence || level.positionSequence || "",
|