From 8959959e59f5a95ca7e61aa60decba4364f36339 Mon Sep 17 00:00:00 2001
From: chenhj <1263187585@qq.com>
Date: 星期三, 04 六月 2025 17:57:30 +0800
Subject: [PATCH] 供应商省市区接口对接
---
src/components/Table/ETable.vue | 46 ++++++++++++++++++++++++----------------------
1 files changed, 24 insertions(+), 22 deletions(-)
diff --git a/src/components/Table/ETable.vue b/src/components/Table/ETable.vue
index 88c6f57..b6bc89e 100644
--- a/src/components/Table/ETable.vue
+++ b/src/components/Table/ETable.vue
@@ -2,26 +2,25 @@
<el-table
v-loading="loading"
:data="tableData"
- style="width: 100%"
:border="border"
:show-selection="showSelection"
:max-height="maxHeight"
+ :header-cell-style="{ background: '#EBEEF5', color: '#3D3D3D' }"
@selection-change="handleSelectionChange"
-<<<<<<< HEAD
-=======
@row-click="handleRowClick"
@row-dblclick="handleRowDblClick"
@cell-click="handleCellClick"
:max-width="maxWidth"
@export="handleExport"
->>>>>>> master
>
<el-table-column v-if="showSelection" type="selection" width="55" align="center" />
- <el-table-column v-if="showIndex" label="搴忓彿" type="index" width="60" align="center" />
+ <el-table-column v-if="showIndex" label="搴忓彿" type="index" width="60" align="center" />
<template v-for="col in columns" :key="col.prop">
<el-table-column
v-bind="col"
- :show-overflow-tooltip="col.showOverflowTooltip !== false"
+ :show-overflow-tooltip="shouldShowTooltip(col, tableData)"
+ :formatter="(row, column, cellValue) => cellValue == null || cellValue === '' ? '--' : cellValue"
+ align="center"
>
<template v-if="col.slot" #default>
<slot></slot>
@@ -29,7 +28,7 @@
</el-table-column>
</template>
<!-- 鎿嶄綔鍒� -->
- <el-table-column v-if="showOperations" :label="operationsLabel" :width="operationsWidth" fixed="right">
+ <el-table-column v-if="showOperations" :label="operationsLabel" :width="operationsWidth" fixed="right" align="center">
<template #default="scope">
<slot name="operations" :row="scope.row">
<el-button
@@ -39,13 +38,13 @@
size="small"
@click="handleEdit(scope.row)"
>缂栬緫</el-button>
- <el-button
- v-if="operations.includes('delete')"
- link
- type="danger"
- size="small"
- @click="handleDelete(scope.row)"
- >鍒犻櫎</el-button>
+<!-- <el-button-->
+<!-- v-if="operations.includes('delete')"-->
+<!-- link-->
+<!-- type="danger"-->
+<!-- size="small"-->
+<!-- @click="handleDelete(scope.row)"-->
+<!-- >鍒犻櫎</el-button>-->
</slot>
</template>
</el-table-column>
@@ -55,10 +54,7 @@
<script setup>
import { defineEmits } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
-
const props = defineProps({
-<<<<<<< HEAD
-=======
// 鏈�澶у搴�
maxWidth: {
type: [String, Number],
@@ -80,7 +76,6 @@
type: Function,
default: () => {}
},
->>>>>>> master
// 楂樺害
maxHeight: {
type: [String, Number],
@@ -129,7 +124,7 @@
// 鎿嶄綔鍒楀搴�
operationsWidth: {
type: [String, Number],
- default: 160
+ default: 100
},
// 鏄剧ず鍝簺鎿嶄綔鎸夐挳
operations: {
@@ -142,6 +137,14 @@
default: '纭鍒犻櫎璇ヨ褰曪紵'
}
})
+ // 妫�鏌ュ垪鏄惁闇�瑕佹樉绀簍ooltip
+ const shouldShowTooltip = (col, data) => {
+ // 濡傛灉娌℃湁prop锛岀洿鎺ヨ繑鍥瀎alse
+ if (!col.prop) return false;
+ // 妫�鏌ヨ鍒楀湪鎵�鏈夋暟鎹腑鏄惁鏈夐潪绌哄��
+ return data.some(row => row[col.prop] != null && row[col.prop] !== '');
+};
+// 澶勭悊閫夋嫨鍙樺寲銆佺紪杈戙�佸垹闄ゅ拰瀵煎嚭鎿嶄綔
const emit = defineEmits(['selection-change', 'edit', 'delete', 'export'])
const handleSelectionChange = (selection) => {
emit('selection-change', selection)
@@ -169,9 +172,8 @@
</script>
<style scoped>
- :deep(.el-table) {
- margin-bottom: 20px;
- overflow-x: auto;
+ .el-table {
+ margin: 20px 0 !important;
}
:deep(.el-table th) {
--
Gitblit v1.9.3