From aeabb6a019fbb7e60bd3b6c8cf3e4081abdff80c Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期一, 18 五月 2026 20:39:10 +0800
Subject: [PATCH] feat: 设备巡检任务添加启用/停用
---
src/components/PIMTable/PIMTable.vue | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/components/PIMTable/PIMTable.vue b/src/components/PIMTable/PIMTable.vue
index eb0cf87..1cddb23 100644
--- a/src/components/PIMTable/PIMTable.vue
+++ b/src/components/PIMTable/PIMTable.vue
@@ -146,7 +146,7 @@
@click.stop="o.clickFun(scope.row)"
:key="key"
>
- {{ o.name }}
+ {{ typeof o.name === 'function' ? o.name(scope.row) : o.name }}
</el-button>
<el-upload
:action="
@@ -367,11 +367,11 @@
return format(val);
} else return val;
};
+const validTagTypes = ["primary", "success", "info", "warning", "danger"];
const formatType = (val, format) => {
- if (typeof format === "function") {
- return format(val);
- } else return "";
+ const type = typeof format === "function" ? format(val) : undefined;
+ return validTagTypes.includes(type) ? type : undefined;
};
const isOperationDisabled = (operation, row) => {
@@ -426,12 +426,13 @@
};
const getOperationColor = (operation, row) => {
+ const colorValue = typeof operation?.color === 'function' ? operation.color(row) : operation?.color;
const baseColor =
operation?.name === "鍒犻櫎" || operation?.name === "delete"
? "#D93025"
: operation?.name === "璇︽儏"
? "#67C23A"
- : operation?.color || "var(--el-color-primary)";
+ : colorValue || "var(--el-color-primary)";
if (isOperationDisabled(operation, row)) {
return fadeColor(baseColor, 0.35);
--
Gitblit v1.9.3