兼容格式问题

This commit is contained in:
2025-06-16 08:53:05 +08:00
parent 78833fe7d7
commit cb982796a7
+40 -23
View File
@@ -36,7 +36,9 @@
</el-form-item> </el-form-item>
</template> </template>
</template> </template>
<el-button type="primary" @click="saveData" :disabled="isSubmit">确认</el-button> <el-button type="primary" @click="saveData" :disabled="isSubmit"
>确认</el-button
>
<el-button type="primary" @click="handleDownload(loaderData)" <el-button type="primary" @click="handleDownload(loaderData)"
>下载全部文件</el-button >下载全部文件</el-button
> >
@@ -156,27 +158,39 @@ async function getData() {
FormJson: json_info, FormJson: json_info,
}; };
} }
let fromdata = true;
CeErpOrderFormData.value.content = CeErpOrderFormData.value.content.replace(/\n/g, ' ')
if (CeErpOrderFormData.value && CeErpOrderFormData.value.content) { if (CeErpOrderFormData.value && CeErpOrderFormData.value.content) {
console.log( console.log(
"🚀 ~ getData ~ CeErpOrderFormData.value.content:", "🚀 ~ getData ~ CeErpOrderFormData.value.content:",
CeErpOrderFormData.value.content CeErpOrderFormData.value.content
); );
CeErpOrderFormData.value = { try {
content: JSON.parse(CeErpOrderFormData.value.content), CeErpOrderFormData.value = {
id: CeErpOrderFormData.value.ID, content: JSON.parse(CeErpOrderFormData.value.content),
tid: CeErpOrderFormData.value.tid, id: CeErpOrderFormData.value.ID,
}; tid: CeErpOrderFormData.value.tid,
CeErpOrderFormData.value?.content.map((item) => { };
if (
item.type == "upload" && CeErpOrderFormData.value?.content.map((item) => {
item.content && if (
typeof item.content == "string" item.type == "upload" &&
) { item.content &&
item.content?.split(",")?.map((e) => { typeof item.content == "string"
loaderData.value.push(baseUrl + e); ) {
}); item.content?.split(",")?.map((e) => {
} loaderData.value.push(baseUrl + e);
}); });
}
});
} catch (error) {
console.error("getData ~ error:", error);
fromdata = false;
ElMessage({
message: "数据解析错误",
type: "error",
});
}
} }
product.FormJson = json_info; product.FormJson = json_info;
if (product && product.FormJson != "") { if (product && product.FormJson != "") {
@@ -188,13 +202,16 @@ async function getData() {
} else { } else {
item.content = ""; item.content = "";
} }
if (CeErpOrderFormData.value && CeErpOrderFormData.value.content) { if (fromdata) {
CeErpOrderFormData.value.content.map((e) => { if (CeErpOrderFormData.value && CeErpOrderFormData.value.content) {
if (e.title === item.title && e.type === item.type) { CeErpOrderFormData.value.content.map((e) => {
item.content = e.content; if (e.title === item.title && e.type === item.type) {
} item.content = e.content;
}); }
});
}
} }
if (item.title == "手机号") { if (item.title == "手机号") {
need = false; need = false;
} }