From 53531219512bd3085903ebb11cf1184b66b05461 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期一, 29 六月 2026 18:15:07 +0800
Subject: [PATCH] feat: 根据备件数量展示不同背景颜色
---
src/views/equipmentManagement/spareParts/index.vue | 25 ++++++++++++++++++++++---
src/components/PIMTable/PIMTable.vue | 5 +++++
2 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/src/components/PIMTable/PIMTable.vue b/src/components/PIMTable/PIMTable.vue
index 631d956..aad24fa 100644
--- a/src/components/PIMTable/PIMTable.vue
+++ b/src/components/PIMTable/PIMTable.vue
@@ -8,6 +8,7 @@
:highlight-current-row="highlightCurrentRow"
:row-class-name="rowClassName"
:row-style="rowStyle"
+ :cell-style="cellStyle"
:row-key="rowKey"
:style="tableStyle"
tooltip-effect="dark"
@@ -293,6 +294,10 @@
type: [Object, Function],
default: () => ({}),
},
+ cellStyle: {
+ type: [Object, Function],
+ default: () => ({}),
+ },
tableData: {
type: Array,
default: () => [],
diff --git a/src/views/equipmentManagement/spareParts/index.vue b/src/views/equipmentManagement/spareParts/index.vue
index 8abe35d..f3509e1 100644
--- a/src/views/equipmentManagement/spareParts/index.vue
+++ b/src/views/equipmentManagement/spareParts/index.vue
@@ -29,6 +29,7 @@
:tableLoading="loading"
:page="pagination"
:isShowPagination="true"
+ :row-class-name="rowClassName"
@pagination="handleSizeChange"
>
<template #status="{ row }">
@@ -521,9 +522,17 @@
onMounted(() => {
fetchListData();
});
+
+// 鏍规嵁鏁伴噺杩涜鍒ゆ柇鑳屾櫙棰滆壊
+const rowClassName = ({ row }) => {
+ const num = Number(row.quantity);
+ if (num <= 1) return 'row-qty-low';
+ if (num >= 8) return 'row-qty-high';
+ return 'row-qty-mid';
+};
</script>
-<style scoped>
+<style>
.spare-part-category {
padding: 20px;
}
@@ -547,8 +556,17 @@
font-weight: 600;
}
-.el-table__row:hover > td {
- background-color: #fafafa;
+.el-table .row-qty-low td.el-table__cell,
+.el-table .row-qty-low:hover > td.el-table__cell {
+ background-color: #fde8e8 !important;
+}
+.el-table .row-qty-mid td.el-table__cell,
+.el-table .row-qty-mid:hover > td.el-table__cell {
+ background-color: #f0f4f8 !important;
+}
+.el-table .row-qty-high td.el-table__cell,
+.el-table .row-qty-high:hover > td.el-table__cell {
+ background-color: #e8f5e9 !important;
}
/* 鎸夐挳缁勬牱寮� */
@@ -567,4 +585,5 @@
font-size: 12px;
margin-right: 4px;
}
+
</style>
\ No newline at end of file
--
Gitblit v1.9.3