From 8ba79292b0a1b6a8f93ca00432c6f2db827b1a93 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期四, 19 三月 2026 17:32:29 +0800
Subject: [PATCH] 。
---
src/components/PIMTable/PIMTable.vue | 28 ++++++++++++++++++----------
1 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/src/components/PIMTable/PIMTable.vue b/src/components/PIMTable/PIMTable.vue
index 976086b..6fee5d6 100644
--- a/src/components/PIMTable/PIMTable.vue
+++ b/src/components/PIMTable/PIMTable.vue
@@ -22,7 +22,8 @@
<el-table-column align="center"
type="selection"
width="55"
- v-if="isSelection" />
+ v-if="isSelection"
+ :selectable="selectable" />
<el-table-column align="center"
label="搴忓彿"
type="index"
@@ -41,7 +42,8 @@
:align="item.align"
:sortable="!!item.sortable"
:type="item.type"
- :width="item.width">
+ :width="item.width"
+ :class-name="item.className || ''">
<template #header="scope">
<div class="pim-table-header-cell">
<div class="pim-table-header-title">
@@ -85,9 +87,9 @@
typeof dataTypeFn(scope.row[item.prop], item.formatData) ===
'string'
"
- :title="formatters(scope.row[item.prop], item.formatData)"
+ :title="formatters(scope.row[item.prop], item.formatData, scope.row)"
:type="formatType(scope.row[item.prop], item.formatType)">
- {{ formatters(scope.row[item.prop], item.formatData) }}
+ {{ formatters(scope.row[item.prop], item.formatData, scope.row) }}
</el-tag>
<el-tag v-for="(tag, index) in dataTypeFn(
scope.row[item.prop],
@@ -98,14 +100,14 @@
'object'
"
:key="index"
- :title="formatters(scope.row[item.prop], item.formatData)"
+ :title="formatters(scope.row[item.prop], item.formatData, scope.row)"
:type="formatType(tag, item.formatType)">
{{ item.tagGroup ? tag[item.tagGroup.label] ?? tag : tag }}
</el-tag>
<el-tag v-else
- :title="formatters(scope.row[item.prop], item.formatData)"
+ :title="formatters(scope.row[item.prop], item.formatData, scope.row)"
:type="formatType(scope.row[item.prop], item.formatType)">
- {{ formatters(scope.row[item.prop], item.formatData) }}
+ {{ formatters(scope.row[item.prop], item.formatData, scope.row) }}
</el-tag>
</div>
<!-- 鎸夐挳 -->
@@ -171,6 +173,7 @@
<!-- 鍙偣鍑荤殑鏂囧瓧 -->
<div v-else-if="item.dataType == 'link'"
class="cell link"
+ :class="item.className || ''"
style="width: 100%"
@click="goLink(scope.row, item.linkMethod)">
<span v-if="!item.formatData">{{ scope.row[item.prop] }}</span>
@@ -178,10 +181,11 @@
<!-- 榛樿绾睍绀烘暟鎹� -->
<div v-else
class="cell"
+ :class="item.className || ''"
style="width: 100%">
<span v-if="!item.formatData">{{ scope.row[item.prop] }}</span>
<span v-else>{{
- formatters(scope.row[item.prop], item.formatData)
+ formatters(scope.row[item.prop], item.formatData, scope.row)
}}</span>
</div>
</template>
@@ -217,8 +221,8 @@
return typeof val === "function" ? val(row) : val;
};
- const formatters = (val, format) => {
- return typeof format === "function" ? format(val) : val;
+ const formatters = (val, format, row) => {
+ return typeof format === "function" ? format(val, row) : val;
};
// Props锛堜娇鐢� defineProps 鐨勯潪 TS 褰㈠紡锛�
@@ -308,6 +312,10 @@
type: [String, Object],
default: () => ({ width: "100%" }),
},
+ selectable: {
+ type: Function,
+ default: () => true,
+ },
});
// Data
--
Gitblit v1.9.3