Refine major department options
This commit is contained in:
6
患者首页处理/数据可视化网页端/app/static/app.js
Normal file → Executable file
6
患者首页处理/数据可视化网页端/app/static/app.js
Normal file → Executable file
@@ -705,8 +705,12 @@ function renderField(record, name, label, type, options, alerted = false, source
|
||||
const sourceClass = source === "ai" ? " is-ai-modified" : source === "manual" ? " is-manual-modified" : "";
|
||||
let control = "";
|
||||
if (type === "select") {
|
||||
const normalizedValue = String(value ?? "");
|
||||
const normalizedOptions = (options || []).map((option) => String(option));
|
||||
const optionItems = ["", ...normalizedOptions];
|
||||
if (normalizedValue && !normalizedOptions.includes(normalizedValue)) optionItems.push(normalizedValue);
|
||||
control = `<select data-field="${name}" data-type="${type}">
|
||||
${(options || []).map((option) => `<option value="${escapeHtml(option)}" ${option === value ? "selected" : ""}>${escapeHtml(option)}</option>`).join("")}
|
||||
${optionItems.map((option) => `<option value="${escapeHtml(option)}" ${option === normalizedValue ? "selected" : ""}>${escapeHtml(option || "请选择")}</option>`).join("")}
|
||||
</select>`;
|
||||
} else if (type === "json") {
|
||||
control = renderJsonEditor(name, value, sourceMap);
|
||||
|
||||
Reference in New Issue
Block a user