diff --git a/public/images/cars/new.jpg b/public/images/cars/new.jpg deleted file mode 100644 index dc89497..0000000 Binary files a/public/images/cars/new.jpg and /dev/null differ diff --git a/public/images/cars/new.png b/public/images/cars/new.png new file mode 100644 index 0000000..f5f28af Binary files /dev/null and b/public/images/cars/new.png differ diff --git a/src/assets/images/cars/new.jpg b/src/assets/images/cars/new.jpg deleted file mode 100644 index dc89497..0000000 Binary files a/src/assets/images/cars/new.jpg and /dev/null differ diff --git a/src/assets/images/cars/new.png b/src/assets/images/cars/new.png new file mode 100644 index 0000000..f5f28af Binary files /dev/null and b/src/assets/images/cars/new.png differ diff --git a/src/data/step2MockData.js b/src/data/step2MockData.js index c81910c..945f4b1 100644 --- a/src/data/step2MockData.js +++ b/src/data/step2MockData.js @@ -1,12 +1,12 @@ // 需要对比的参数列表 export const paramsToCompare = [ - "品名/物料名称", - "品号", "品号-规格型号", + "品号申请时间", "图号", "技术规范编号", "技术规范版本", "技术规范名称", + "技术要求签订时间", "CBC编号", "CBC版本", "车型", @@ -19,8 +19,6 @@ export const paramsToCompare = [ // 字段映射关系 export const fieldMap = { - "品名/物料名称": "name", - 品号: "productNumber", "品号-规格型号": "specificationModel", 图号: "drawingNumber", 技术规范编号: "technicalSpecCode", diff --git a/src/views/order/intention/search.vue b/src/views/order/intention/search.vue index 019d9db..c59ed74 100644 --- a/src/views/order/intention/search.vue +++ b/src/views/order/intention/search.vue @@ -284,7 +284,7 @@ fixed="left" /> - {{ column.label }} - {{ - selectedCompareList.find( - (i) => i.productNumber === column.label - ).name - }} + + 最新品号 + +
+ + {{ column.label }} + + {{ + sortedCompareList.find( + (i) => i.productNumber === column.label + ).name + }} +
@@ -432,9 +450,36 @@ const parameterDifferences = ref({}); // 确认弹窗 const confirmDialogVisible = ref(false); +// 计算排序后的对比列表(最新品号在前) +const sortedCompareList = computed(() => { + // 复制数组以避免修改原始数据 + const list = [...selectedCompareList.value]; + + // 排序:根据品号结尾的五位数从大到小排序 + list.sort((a, b) => { + // 提取品号结尾的五位数 + const aMatch = a.productNumber.match(/-(\d{5})$/); + const bMatch = b.productNumber.match(/-(\d{5})$/); + + const aNum = aMatch ? parseInt(aMatch[1], 10) : 0; + const bNum = bMatch ? parseInt(bMatch[1], 10) : 0; + + return bNum - aNum; + }); + + // 标记最新的品号(排序后的第一个) + if (list.length > 0) { + list.forEach((item, index) => { + item.isLatest = index === 0; + }); + } + + return list; +}); + // 生成对比表格数据并分析差异 const compareTableData = computed(() => { - if (selectedCompareList.value.length === 0) { + if (sortedCompareList.value.length === 0) { parameterDifferences.value = {}; return []; } @@ -442,21 +487,60 @@ const compareTableData = computed(() => { // 重置差异映射 const differences = {}; - // 构建对比数据 - const result = paramsToCompare.map((param) => { - const row = { param }; - const values = []; + // 获取当前时间和昨天的日期 + const today = new Date(); + const yesterday = new Date(today); + yesterday.setDate(yesterday.getDate() - 1); - // 收集所有产品的参数值 - selectedCompareList.value.forEach((item) => { - const value = item[fieldMap[param]] || "-"; - row[item.productNumber] = value; - values.push(value); + // 格式化日期为 yyyy-MM-dd + const formatDate = (date) => { + return date.toISOString().split("T")[0]; + }; + + const formattedToday = formatDate(today); + const formattedYesterday = formatDate(yesterday); + + // 构建对比数据,添加新参数 + const result = [ + // 原有参数 + { param: "品号-规格型号" }, + // 新增参数:品号申请时间 + { param: "品号申请时间" }, + { param: "图号" }, + { param: "技术规范编号" }, + { param: "技术规范版本" }, + { param: "技术规范名称" }, + // 新增参数:技术要求签订时间 + { param: "技术要求签订时间" }, + { param: "CBC编号" }, + { param: "CBC版本" }, + { param: "车型" }, + { param: "型号" }, + { param: "材质" }, + { param: "采购属性" }, + { param: "车轮踏面形式" }, + { param: "油漆制造商" }, + ].map((item) => { + const row = { param: item.param }; + + // 为每个产品填充参数值 + sortedCompareList.value.forEach((product) => { + // 处理新增的两个参数 + if (item.param === "品号申请时间") { + row[product.productNumber] = formattedToday; + } else if (item.param === "技术要求签订时间") { + row[product.productNumber] = formattedYesterday; + } else { + // 处理原有参数 + const fieldKey = fieldMap[item.param]; + row[product.productNumber] = fieldKey ? product[fieldKey] ?? "-" : "-"; + } }); - // 判断参数值是否全部相同 + // 收集所有产品的参数值用于判断差异 + const values = sortedCompareList.value.map((p) => row[p.productNumber]); const allSame = values.every((v) => v === values[0]); - differences[param] = !allSame; + differences[item.param] = !allSame; return row; }); @@ -2084,18 +2168,24 @@ function handleConfirm() { padding: 20px 0; } -/* 新增:不同参数值的样式 */ +/* 不同参数值的样式 */ .different-value { color: #ff4d4f; /* 红色 */ font-weight: 500; } -/* 新增:对比筛选选项样式 */ +/* 对比筛选选项样式 */ .compare-filter-options { text-align: right; padding-right: 10px; } +.new-tag-img { + width: 35px; + height: 35px; + vertical-align: middle; +} + @media (max-width: 768px) { .search-box { flex-direction: column;