Commit 91cd1d9e by 李伟康

fix(TemplateImport): 修复选择框占位符不显示的问题

当清除导入文件时,将org、scene字段重置为undefined而非空字符串,防止antd Select将空字符串识别为已选值而隐藏占位符,同时统一重置分类列表为空数组
1 parent b76008f4
Pipeline #340 for 91cd1d9e failed in 0 seconds
...@@ -45,12 +45,13 @@ export default function TemplateImport() { ...@@ -45,12 +45,13 @@ export default function TemplateImport() {
const handleFileChange = (f: File | null) => { const handleFileChange = (f: File | null) => {
setSelectedFile(f); setSelectedFile(f);
// 移除文件时,同步清空校验结果 + 导入信息里的 3 个回显字段(保留 remark) // 移除文件时,同步清空校验结果 + 导入信息里的 3 个回显字段(保留 remark)
// 注意:org/scene 用 undefined 而非 '',否则 antd Select 会把 '' 当成选中值,placeholder 不显示
if (f === null) { if (f === null) {
setCheckResult(null); setCheckResult(null);
setImportInfo((prev) => ({ setImportInfo((prev) => ({
org: prev?.org ?? '', org: undefined,
scene: prev?.scene ?? '', scene: undefined,
categories: prev?.categories ?? [], categories: [],
remark: prev?.remark, remark: prev?.remark,
})); }));
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!