Bläddra i källkod

feat(equipLedger): add row background color based on colorType

为设备台账表格根据colorType字段添加不同的行背景色,区分展示不同状态的设备数据
huoyi 1 månad sedan
förälder
incheckning
9661a35bde
1 ändrade filer med 24 tillägg och 1 borttagningar
  1. 24 1
      src/views/equipManage/equipLedger/index.vue

+ 24 - 1
src/views/equipManage/equipLedger/index.vue

@@ -33,7 +33,7 @@
33 33
     </div>
34 34
 
35 35
     <!-- 数据表格 -->
36
-    <el-table v-loading="loading" :data="tableData" border @selection-change="handleSelectionChange">
36
+    <el-table v-loading="loading" :data="tableData" border @selection-change="handleSelectionChange" :row-class-name="tableRowClassName">
37 37
       <el-table-column type="selection" width="55" align="center" />
38 38
       <el-table-column label="序号" prop="rowIndex" width="70" align="center">
39 39
         <template #default="scope">
@@ -420,6 +420,17 @@ function handleBatchDelete() {
420 420
   }).catch(() => { })
421 421
 }
422 422
 
423
+function tableRowClassName({ row }) {
424
+  if (row.colorType === 'RED') {
425
+    return 'row-red'
426
+  } else if (row.colorType === 'ORANGE') {
427
+    return 'row-orange'
428
+  } else if (row.colorType === 'YELLOW') {
429
+    return 'row-yellow'
430
+  }
431
+  return ''
432
+}
433
+
423 434
 function handleExport() {
424 435
   proxy.download('equipment/ledger/export', {
425 436
     ...queryParams
@@ -588,4 +599,16 @@ onMounted(() => {
588 599
   flex-wrap: wrap;
589 600
   gap: 10px;
590 601
 }
602
+
603
+:deep(.row-red) {
604
+  background-color: rgba(245, 108, 108, 0.3) !important;
605
+}
606
+
607
+:deep(.row-orange) {
608
+  background-color: rgba(230, 162, 60, 0.3) !important;
609
+}
610
+
611
+:deep(.row-yellow) {
612
+  background-color: rgba(255, 206, 86, 0.3) !important;
613
+}
591 614
 </style>