From fe631515b71782a10a750874f6d4582fe027cd22 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 03 十一月 2025 09:32:49 +0800
Subject: [PATCH] 公司-所有的表格添加斑马纹
---
src/components/PIMTable/PIMTable.vue | 35 +++++++++++++++++++++++++----------
1 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/src/components/PIMTable/PIMTable.vue b/src/components/PIMTable/PIMTable.vue
index 3c9e756..a89aa96 100644
--- a/src/components/PIMTable/PIMTable.vue
+++ b/src/components/PIMTable/PIMTable.vue
@@ -5,18 +5,21 @@
:border="border"
:data="tableData"
:header-cell-style="{ background: '#F0F1F5', color: '#333333' }"
- height="calc(100vh - 18.5em)"
+ :height="height"
:highlight-current-row="highlightCurrentRow"
:row-class-name="rowClassName"
:row-style="rowStyle"
:row-key="rowKey"
style="width: 100%"
tooltip-effect="dark"
- @row-click="rowClick"
- @current-change="currentChange"
+ :expand-row-keys="expandRowKeys"
:show-summary="isShowSummary"
:summary-method="summaryMethod"
+ stripe
+ @row-click="rowClick"
+ @current-change="currentChange"
@selection-change="handleSelectionChange"
+ @expand-change="expandChange"
class="lims-table"
>
<el-table-column
@@ -205,8 +208,8 @@
</el-table-column>
</el-table>
<pagination
- v-show="total > 0"
- :total="total"
+ v-if="page.total > 0"
+ :total="page.total"
:layout="page.layout"
:page="page.current"
:limit="page.size"
@@ -224,7 +227,7 @@
const uploadHeader = proxy.uploadHeader;
const javaApi = proxy.javaApi;
-const emit = defineEmits(["pagination"]);
+const emit = defineEmits(["pagination", "expand-change", "selection-change"]);
// Filters
const typeFn = (val, row) => {
@@ -241,9 +244,13 @@
type: Boolean,
default: false,
},
- handleSelectionChange: {
- type: Function,
- default: () => {},
+ height: {
+ type: [Number, String],
+ default: "calc(100vh - 22em)",
+ },
+ expandRowKeys: {
+ type: Array,
+ default: () => [],
},
summaryMethod: {
type: Function,
@@ -295,7 +302,7 @@
},
rowKey: {
type: String,
- default: undefined,
+ default: 'id',
},
page: {
type: Object,
@@ -405,6 +412,14 @@
const paginationSearch = ({ page, limit }) => {
emit("pagination", { page: page, limit: limit });
};
+
+const expandChange = (row, expandedRows) => {
+ emit("expand-change", row, expandedRows);
+};
+
+const handleSelectionChange = (newSelection) => {
+ emit("selection-change", newSelection);
+};
</script>
<style scoped lang="scss">
--
Gitblit v1.9.3