This commit is contained in:
lcw
2025-08-28 17:03:45 +08:00
parent 3421e90ba5
commit d68ae2ef3c
5 changed files with 32 additions and 77 deletions

View File

@ -40,28 +40,7 @@ const data = {
40: "特征识别分析",
}
const model = ref()
function simpleExtractJSON(text) {
// 找到第一个 [
const startIndex = text.indexOf('[');
if (startIndex === -1) return null;
// 找到最后一个完整的 }
let lastBraceIndex = text.lastIndexOf('}');
if (lastBraceIndex === -1) return null;
// 确保 } 后面没有其他字符(除了空格和换行)
let endIndex = lastBraceIndex + 1;
// 截取从 [ 到最后一个 } 的内容,然后加上 ]
let jsonString = text.substring(startIndex, endIndex) + ']';
try {
return JSON.parse(jsonString);
} catch (error) {
console.error("修改JSON格式复失败:", error);
return null;
}
}
onMounted(() => {
const json =props.listData ;
const jsonString = JSON.parse(json);
@ -85,7 +64,6 @@ const jsonString = JSON.parse(json);
acc[prefix].inputs.push({ label: cur[key].name, prop: key, type: "input", width: "33%" });
acc[prefix].model[key] = cur[key].content=='-'||cur[key].content==''||cur[key].content=='无'? '/':cur[key].content ;
}
return acc;
}, {});
} else {