This commit is contained in:
hayu 2026-01-03 17:18:07 +08:00
parent ac5b880220
commit 754df57e0f
1 changed files with 82 additions and 12 deletions

View File

@ -134,6 +134,33 @@
:prop="column.prop" :prop="column.prop"
align="center" align="center"
> >
<!-- 表格列插槽单独处理装备总数工具总数 -->
<template #default="scope">
<!-- 装备总数非0/非空变色 + 跳转 -->
<div
v-if="column.prop === 'maNum'"
:class="{ 'table-active-color': isEffectiveValue(scope.row.maNum) }"
@click="handleTableJump('equip', scope.row)"
style="cursor: pointer; user-select: none;"
>
{{ scope.row.maNum }}
</div>
<!-- 工具总数非0/非空变色 + 跳转 -->
<div
v-else-if="column.prop === 'toolNum'"
:class="{ 'table-active-color': isEffectiveValue(scope.row.toolNum) }"
@click="handleTableJump('tool', scope.row)"
style="cursor: pointer; user-select: none;"
>
{{ scope.row.toolNum }}
</div>
<!-- 其他列保持原样 -->
<div v-else>
{{ scope.row[column.prop] }}
</div>
</template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- 柱状图 --> <!-- 柱状图 -->
@ -195,6 +222,37 @@ export default {
}, },
methods: { methods: {
// 1. 0/null/undefined/
isEffectiveValue(val) {
if (val === null || val === undefined || val === '') return false;
const numVal = Number(val);
return !isNaN(numVal) && numVal !== 0;
},
// 2.
handleTableJump(type, rowData) {
//
const targetVal = type === 'equip' ? rowData.maNum : rowData.toolNum;
if (!this.isEffectiveValue(targetVal)) {
return; //
}
if (type === 'equip') {
console.log('跳转至装备详情页', {
equipTotal: rowData.maNum
});
this.$router.push({
path: '/equipment/equipment-ledger',
query: { company: rowData.companyName, total: rowData.maNum }
});
} else if (type === 'tool') {
console.log('跳转至工具详情页', {
toolTotal: rowData.toolNum
});
this.$router.push({
path: '/toolsManage/toolsLedger',
query: { company: rowData.companyName, total: rowData.toolNum }
});
}
},
async getDataAll() { async getDataAll() {
try { try {
const res = await getDeviceNumAll() const res = await getDeviceNumAll()
@ -607,4 +665,16 @@ export default {
.scroll-list li.odd { .scroll-list li.odd {
background-color: #ebf8f3; background-color: #ebf8f3;
} }
// 0/
.table-active-color {
color: #1890ff !important; //
font-weight: 700 !important; //
}
//
.table-active-color:hover {
color: #096dd9 !important;
transition: color 0.2s ease;
}
</style> </style>