|
|
@ -1,6 +1,8 @@ |
|
|
|
<template> |
|
|
|
<div class="table-container"> |
|
|
|
|
|
|
|
<el-table ref="guiptable" v-bind="$attrs" :data="tableData" v-on="$listeners" :border="border" @selection-change="handleSelectionChange" |
|
|
|
:style="{ width: width ? width : '100%', height: height ? height : '100%' }" v-loading="loading"> |
|
|
|
:style="{ width: width ? width : '100%', height: height ? height : '100%' }" v-loading="loading" empty-text=" "> |
|
|
|
<!-- 多选 --> |
|
|
|
<template v-if="multiple"> |
|
|
|
<el-table-column type="selection" width="55"> |
|
|
@ -36,10 +38,13 @@ |
|
|
|
|
|
|
|
</el-table-column> |
|
|
|
</template> |
|
|
|
<template #empty> |
|
|
|
<el-empty :image="emptyImg"></el-empty> |
|
|
|
</template> |
|
|
|
</el-table> |
|
|
|
<div v-if="tableData.length === 0" class="custom-empty"> |
|
|
|
<img :src="emptyImg" alt="无数据" /> |
|
|
|
<p>暂无数据</p> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
@ -82,12 +87,41 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
<style scoped> |
|
|
|
<style scoped lang="scss"> |
|
|
|
|
|
|
|
/* 外层容器需设为 relative,以便空状态定位 */ |
|
|
|
.table-container { |
|
|
|
position: relative; |
|
|
|
width: 100%; |
|
|
|
} |
|
|
|
|
|
|
|
/* 空状态固定定位(不随滚动移动) */ |
|
|
|
.custom-empty { |
|
|
|
position: absolute; |
|
|
|
left: 50%; |
|
|
|
top: 50%; |
|
|
|
transform: translate(-50%, -35%); |
|
|
|
width: 200px; |
|
|
|
text-align: center; |
|
|
|
display: flex; |
|
|
|
flex-direction: column; |
|
|
|
align-items: center; |
|
|
|
background-color: #fff; /* 避免透明背景被表格线干扰 */ |
|
|
|
// padding: 20px; |
|
|
|
z-index: 10; /* 确保显示在表格上方 */ |
|
|
|
img{ |
|
|
|
width: 80px; |
|
|
|
height: 80px; |
|
|
|
} |
|
|
|
p{ |
|
|
|
font-size: 12px; |
|
|
|
font-weight: normal; |
|
|
|
line-height: 13px; |
|
|
|
letter-spacing: 0.08em; |
|
|
|
color: #626573; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/* 确保表格有最小高度(避免高度塌陷) */ |
|
|
|
.el-table ::v-deep .el-table__body-wrapper { |
|
|
|
min-height: 150px !important; |
|
|
|
} |
|
|
|
|
|
|
|
.empty-image { |
|
|
|