Commit a0283c5d by 张立顺

feat 联调修改

1 parent 47d8cb25
...@@ -266,16 +266,18 @@ export default { ...@@ -266,16 +266,18 @@ export default {
label: "旧值", label: "旧值",
prop: "oldValue", prop: "oldValue",
minWidth: 120, minWidth: 120,
formatter: row => this.formatNameValue(row.oldValue), html: true,
formatter: row => this.formatNameValueHtml(row.oldValue),
}, },
{ {
label: "新值", label: "新值",
prop: "newValue", prop: "newValue",
minWidth: 120, minWidth: 120,
formatter: row => this.formatNameValue(row.newValue), html: true,
formatter: row => this.formatNameValueHtml(row.newValue),
}, },
{ label: "商品编码", prop: "commodityCode", minWidth: 100, formatter: row => row.commodityCode ?? "-" }, { label: "商品编码", prop: "type", minWidth: 100, formatter: row => row.type ?? "-" },
{ label: "ID", prop: "baseGoodsId", minWidth: 100, formatter: row => row.baseGoodsId ?? row.baseGoodsId ?? "-" }, { label: "ID", prop: "commodityCode", minWidth: 100, formatter: row => row.commodityCode ?? "-" },
{ label: "操作人", prop: "updatedBy", minWidth: 100 }, { label: "操作人", prop: "updatedBy", minWidth: 100 },
{ {
label: "操作日期", label: "操作日期",
...@@ -434,12 +436,39 @@ export default { ...@@ -434,12 +436,39 @@ export default {
.filter(item => item && (item.name != null || item.value != null)) .filter(item => item && (item.name != null || item.value != null))
.map(item => `${item.name ?? ""}: ${item.value ?? ""}`.trim()) .map(item => `${item.name ?? ""}: ${item.value ?? ""}`.trim())
.filter(s => s && s !== ":") .filter(s => s && s !== ":")
.join(";"); .join("\n");
return str || "-"; return str || "-";
} catch { } catch {
return val; return val;
} }
}, },
// 解析 JSON 格式的 name/value,返回 HTML 用于换行显示
formatNameValueHtml(val) {
if (val == null || val === "")
return "-";
try {
const data = typeof val === "string" ? JSON.parse(val) : val;
const arr = Array.isArray(data) ? data : [data];
const str = arr
.filter(item => item && (item.name != null || item.value != null))
.map(item => `${this.escapeHtml(item.name ?? "")}: ${this.escapeHtml(item.value ?? "")}`.trim())
.filter(s => s && s !== ":")
.join("<br>");
return str || "-";
} catch {
return this.escapeHtml(String(val));
}
},
escapeHtml(str) {
if (str == null)
return "";
const s = String(str);
return s
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;");
},
}, },
}; };
</script> </script>
......
...@@ -137,28 +137,28 @@ ...@@ -137,28 +137,28 @@
min-width="120" min-width="120"
prop="oldValue"> prop="oldValue">
<template #default="scope"> <template #default="scope">
{{ formatNameValue(scope.row.oldValue) }} <span v-html="formatNameValueHtml(scope.row.oldValue)"></span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="新值" <el-table-column label="新值"
min-width="120" min-width="120"
prop="newValue"> prop="newValue">
<template #default="scope"> <template #default="scope">
{{ formatNameValue(scope.row.newValue) }} <span v-html="formatNameValueHtml(scope.row.newValue)"></span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="商品编码" <el-table-column label="商品编码"
min-width="100" min-width="100"
prop="commodityCode"> prop="type">
<template #default="scope"> <template #default="scope">
{{ scope.row.commodityCode || "-" }} {{ scope.row.type || "-" }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="ID" <el-table-column label="ID"
min-width="100" min-width="100"
prop="baseGoodsId"> prop="commodityCode">
<template #default="scope"> <template #default="scope">
{{ scope.row.baseGoodsId || scope.row.id || "-" }} {{ scope.row.commodityCode || "-" }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作人" <el-table-column label="操作人"
...@@ -301,12 +301,38 @@ export default { ...@@ -301,12 +301,38 @@ export default {
.filter(item => item && (item.name != null || item.value != null)) .filter(item => item && (item.name != null || item.value != null))
.map(item => `${item.name ?? ""}: ${item.value ?? ""}`.trim()) .map(item => `${item.name ?? ""}: ${item.value ?? ""}`.trim())
.filter(s => s && s !== ":") .filter(s => s && s !== ":")
.join(";"); .join("\n");
return str || "-"; return str || "-";
} catch { } catch {
return val; return val;
} }
}, },
formatNameValueHtml(val) {
if (val == null || val === "")
return "-";
try {
const data = typeof val === "string" ? JSON.parse(val) : val;
const arr = Array.isArray(data) ? data : [data];
const str = arr
.filter(item => item && (item.name != null || item.value != null))
.map(item => `${this.escapeHtml(item.name ?? "")}: ${this.escapeHtml(item.value ?? "")}`.trim())
.filter(s => s && s !== ":")
.join("<br>");
return str || "-";
} catch {
return this.escapeHtml(String(val));
}
},
escapeHtml(str) {
if (str == null)
return "";
const s = String(str);
return s
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;");
},
loadSkuData() { loadSkuData() {
if (!this.commodityInfoId) if (!this.commodityInfoId)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!