From 7427fcc7d9fa212404889a3fd41f985ead94c062 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期二, 28 七月 2026 17:04:29 +0800
Subject: [PATCH] fix: 安全培训考核调整
---
src/components/PIMTable/PIMTable.vue | 25 +++++++++++++++++++++----
1 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/src/components/PIMTable/PIMTable.vue b/src/components/PIMTable/PIMTable.vue
index f99b1eb..5c317e0 100644
--- a/src/components/PIMTable/PIMTable.vue
+++ b/src/components/PIMTable/PIMTable.vue
@@ -11,6 +11,7 @@
:row-key="rowKey"
:style="tableStyle"
tooltip-effect="dark"
+ :tooltip-options="{ appendTo: 'body' }"
:expand-row-keys="expandRowKeys"
:show-summary="isShowSummary"
:summary-method="summaryMethod"
@@ -117,8 +118,9 @@
<template v-for="(o, key) in item.operation"
:key="key">
<el-button v-show="o.type != 'upload'"
- v-if="o.showHide ? o.showHide(scope.row) : true"
+ v-if="isOperationVisible(o, scope.row)"
:disabled="isOperationDisabled(o, scope.row)"
+ :loading="isOperationLoading(o, scope.row)"
:plain="o.plain"
type="primary"
:style="{
@@ -147,7 +149,7 @@
"
v-if="o.type == 'upload'"
style="display: inline-block; width: 50px"
- v-show="o.showHide ? o.showHide(scope.row) : true"
+ v-show="isOperationVisible(o, scope.row)"
:headers="uploadHeader"
:before-upload="(file) => beforeUpload(file, scope.$index)"
:on-change="
@@ -222,7 +224,9 @@
};
const formatters = (val, format) => {
- return typeof format === "function" ? format(val) : val;
+ if (typeof format === "function") return format(val);
+ if (format && typeof format === "object") return format[val] ?? val;
+ return val;
};
// Props锛堜娇鐢� defineProps 鐨勯潪 TS 褰㈠紡锛�
@@ -372,6 +376,19 @@
: !!operation.disabled;
};
+ const isOperationVisible = (operation, row) => {
+ const visibleHandler = operation?.showHide ?? operation?.show;
+ if (visibleHandler === undefined) return true;
+ return typeof visibleHandler === "function" ? !!visibleHandler(row) : !!visibleHandler;
+ };
+
+ const isOperationLoading = (operation, row) => {
+ if (!operation?.loading) return false;
+ return typeof operation.loading === "function"
+ ? !!operation.loading(row)
+ : !!operation.loading;
+ };
+
const parseHexToRgb = hex => {
const normalized = String(hex || "")
.trim()
@@ -446,7 +463,7 @@
// 鏂囦欢涓婁紶鍓嶆牎楠�
const beforeUpload = (rawFile, index) => {
currentFiles.value[index] = {};
- if (rawfile.size > 1024 * 1024 * 10 * 10) {
+ if (rawFile.size > 1024 * 1024 * 10 * 10) {
ElMessage.error("涓婁紶鏂囦欢涓嶈秴杩�10M");
return false;
}
--
Gitblit v1.9.3