参数对比

This commit is contained in:
JenniferW 2025-08-20 15:39:24 +08:00
parent 6724caa51c
commit 9c54c07710
1 changed files with 28 additions and 27 deletions

View File

@ -257,12 +257,17 @@
top="40px"
:close-on-click-modal="false"
>
<!-- 仅看不同项选项 -->
<div class="compare-filter-options" style="margin-bottom: 16px">
<el-radio-group v-model="showOnlyDifferences">
<el-radio :label="false">显示所有项</el-radio>
<el-radio :label="true">仅看不同项</el-radio>
</el-radio-group>
<!-- 仅看不同项按钮 -->
<div
class="compare-filter-options"
style="margin: -45px 80px 16px; text-align: left"
>
<el-button
type="primary"
@click="showOnlyDifferences = !showOnlyDifferences"
>
{{ showOnlyDifferences ? "显示全部" : "仅看不同项" }}
</el-button>
</div>
<!-- 表格对比区添加横向滚动 -->
@ -270,7 +275,7 @@
<el-table
:data="filteredCompareTableData"
border
style="width: 100%; min-width: 900px"
style="width: 100%; min-width: 600px"
>
<el-table-column
prop="param"
@ -279,6 +284,7 @@
class-name="param-col"
align="center"
header-align="center"
fixed="left"
/>
<el-table-column
v-for="item in selectedCompareList"
@ -287,7 +293,7 @@
:prop="item.productNumber"
align="center"
header-align="center"
min-width="200"
min-width="300"
>
<template #header="{ column }">
<div
@ -309,10 +315,7 @@
<template #default="scope">
<span
:class="{
'different-value': isValueDifferent(
scope.row.param,
scope.row[scope.column.property]
),
'different-value': isValueDifferent(scope.row.param),
}"
>
{{ scope.row[scope.column.property] || "-" }}
@ -424,7 +427,7 @@ const compareDialogVisible = ref(false);
const selectedCompareList = computed(() =>
filteredData.value.filter((i) => i.selected)
);
//
//
const showOnlyDifferences = ref(false);
//
const parameterDifferences = ref({});
@ -478,18 +481,10 @@ const filteredCompareTableData = computed(() => {
);
});
//
const isValueDifferent = (param, value) => {
// false
if (!parameterDifferences.value[param]) return false;
//
const values = selectedCompareList.value.map(
(item) => item[fieldMap[param]] || "-"
);
//
return value !== values[0];
//
const isValueDifferent = (param) => {
//
return parameterDifferences.value[param];
};
//
@ -1798,8 +1793,8 @@ function handleConfirm() {
/* 参数对比按钮样式 - 随滚动条移动 */
.compare-btn-float {
position: fixed; /* 修改为fixed定位相对于视口固定 */
top: 20px;
right: 20px;
top: 260px;
right: 10px;
z-index: 100; /* 提高层级确保可见 */
width: 52px;
height: 52px;
@ -1835,6 +1830,12 @@ function handleConfirm() {
background: #f5f7fa !important;
}
//
:deep(.el-table__fixed-left) {
box-shadow: 2px 0 6px rgba(0, 0, 0, 0.05);
z-index: 2;
}
.search-box-container {
max-width: 1200px;
margin: 0 auto;