参数对比

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