From 94798a7210af091ba71a27cad7c53e5cd021b314 Mon Sep 17 00:00:00 2001
From: 张诺 <zhang_12370@163.com>
Date: 星期六, 25 四月 2026 10:48:26 +0800
Subject: [PATCH] 阳光印刷web 销售台账从销售报价导入
---
src/components/PIMTable/PIMTable.vue | 54 ++++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 48 insertions(+), 6 deletions(-)
diff --git a/src/components/PIMTable/PIMTable.vue b/src/components/PIMTable/PIMTable.vue
index 1fa1695..bfb3c4e 100644
--- a/src/components/PIMTable/PIMTable.vue
+++ b/src/components/PIMTable/PIMTable.vue
@@ -30,7 +30,7 @@
<el-table-column align="center" label="搴忓彿" type="index" width="60" />
<el-table-column
- v-for="(item, index) in column"
+ v-for="(item, index) in visibleColumns"
:key="index"
:column-key="item.columnKey"
:filter-method="item.filterHandler"
@@ -40,12 +40,23 @@
:fixed="item.fixed"
:label="item.label"
:prop="item.prop"
- show-overflow-tooltip
+ :show-overflow-tooltip="item.dataType !== 'action' && item.dataType !== 'slot'"
:align="item.align"
:sortable="!!item.sortable"
:type="item.type"
:width="item.width"
+ :minWidth="item.minWidth"
>
+ <template #header="scope">
+ <div class="pim-table-header-cell">
+ <div class="pim-table-header-title">
+ {{ item.label }}
+ </div>
+ <div v-if="item.headerSlot" class="pim-table-header-extra">
+ <slot :name="item.headerSlot" :column="scope.column" />
+ </div>
+ </div>
+ </template>
<template
v-if="item.hasOwnProperty('colunmTemplate')"
#[item.colunmTemplate]="scope"
@@ -120,7 +131,7 @@
</div>
<!-- 鎸夐挳 -->
- <div v-else-if="item.dataType == 'action'">
+ <div v-else-if="item.dataType == 'action'" @click.stop>
<template v-for="(o, key) in item.operation" :key="key">
<el-button
v-show="o.type != 'upload'"
@@ -135,7 +146,7 @@
: o.color,
}"
link
- @click="o.clickFun(scope.row)"
+ @click.stop="o.clickFun(scope.row)"
:key="key"
>
{{ o.name }}
@@ -204,6 +215,7 @@
</el-table-column>
</el-table>
<pagination
+ v-if="isShowPagination"
:total="page.total"
:layout="page.layout"
:page="page.current"
@@ -214,7 +226,7 @@
<script setup>
import pagination from "./Pagination.vue";
-import { ref, inject, getCurrentInstance } from "vue";
+import { ref, inject, getCurrentInstance, computed, unref } from "vue";
import { ElMessage } from "element-plus";
// 鑾峰彇鍏ㄥ眬鐨� uploadHeader
@@ -222,7 +234,7 @@
const uploadHeader = proxy.uploadHeader;
const javaApi = proxy.javaApi;
-const emit = defineEmits(["pagination", "expand-change", "selection-change"]);
+const emit = defineEmits(["pagination", "expand-change", "selection-change", "row-click"]);
// Filters
const typeFn = (val, row) => {
@@ -266,6 +278,10 @@
isSelection: {
type: Boolean,
default: false,
+ },
+ isShowPagination: {
+ type: Boolean,
+ default: true,
},
isShowSummary: {
type: Boolean,
@@ -316,6 +332,23 @@
type: [String, Object],
default: () => ({ width: "100%" }),
},
+});
+
+const resolveColumnVisible = (visible) => {
+ if (visible === undefined) return true;
+ if (typeof visible === "function") {
+ try {
+ return !!visible();
+ } catch (error) {
+ console.warn("PIMTable column visible function error:", error);
+ return true;
+ }
+ }
+ return !!unref(visible);
+};
+
+const visibleColumns = computed(() => {
+ return (props.column || []).filter((item) => resolveColumnVisible(item?.visible));
});
// Data
@@ -412,6 +445,10 @@
emit("pagination", { page: page, limit: limit });
};
+const rowClick = (row) => {
+ emit("row-click", row);
+};
+
const expandChange = (row, expandedRows) => {
emit("expand-change", row, expandedRows);
};
@@ -429,4 +466,9 @@
padding-right: 0 !important;
padding-left: 0 !important;
}
+
+.pim-table-header-extra :deep(.el-input),
+.pim-table-header-extra :deep(.el-select) {
+ width: 100%;
+}
</style>
--
Gitblit v1.9.3