Commit a0283c5d by 张立顺

feat 联调修改

1 parent 47d8cb25
......@@ -266,16 +266,18 @@ export default {
label: "旧值",
prop: "oldValue",
minWidth: 120,
formatter: row => this.formatNameValue(row.oldValue),
html: true,
formatter: row => this.formatNameValueHtml(row.oldValue),
},
{
label: "新值",
prop: "newValue",
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: "ID", prop: "baseGoodsId", minWidth: 100, formatter: row => row.baseGoodsId ?? row.baseGoodsId ?? "-" },
{ label: "商品编码", prop: "type", minWidth: 100, formatter: row => row.type ?? "-" },
{ label: "ID", prop: "commodityCode", minWidth: 100, formatter: row => row.commodityCode ?? "-" },
{ label: "操作人", prop: "updatedBy", minWidth: 100 },
{
label: "操作日期",
......@@ -434,12 +436,39 @@ export default {
.filter(item => item && (item.name != null || item.value != null))
.map(item => `${item.name ?? ""}: ${item.value ?? ""}`.trim())
.filter(s => s && s !== ":")
.join(";");
.join("\n");
return str || "-";
} catch {
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>
......
......@@ -137,28 +137,28 @@
min-width="120"
prop="oldValue">
<template #default="scope">
{{ formatNameValue(scope.row.oldValue) }}
<span v-html="formatNameValueHtml(scope.row.oldValue)"></span>
</template>
</el-table-column>
<el-table-column label="新值"
min-width="120"
prop="newValue">
<template #default="scope">
{{ formatNameValue(scope.row.newValue) }}
<span v-html="formatNameValueHtml(scope.row.newValue)"></span>
</template>
</el-table-column>
<el-table-column label="商品编码"
min-width="100"
prop="commodityCode">
prop="type">
<template #default="scope">
{{ scope.row.commodityCode || "-" }}
{{ scope.row.type || "-" }}
</template>
</el-table-column>
<el-table-column label="ID"
min-width="100"
prop="baseGoodsId">
prop="commodityCode">
<template #default="scope">
{{ scope.row.baseGoodsId || scope.row.id || "-" }}
{{ scope.row.commodityCode || "-" }}
</template>
</el-table-column>
<el-table-column label="操作人"
......@@ -301,12 +301,38 @@ export default {
.filter(item => item && (item.name != null || item.value != null))
.map(item => `${item.name ?? ""}: ${item.value ?? ""}`.trim())
.filter(s => s && s !== ":")
.join(";");
.join("\n");
return str || "-";
} catch {
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() {
if (!this.commodityInfoId)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!