Commit 379356de by chenwq

fix(表格): 修复表格高度和样式问题

调整StickyTable组件高度逻辑,当数据少于5条时自动适应高度
修复表头和单元格的padding样式问题
为空数据项显示默认'-'字符
1 parent 6617e135
<template> <template>
<div class="sticky-table-container" :style="{ height: height }"> <div class="sticky-table-container" :style="{ height: height }">
<div class="sticky-table-wrapper"> <div class="sticky-table-wrapper" :style="{ height: data.length > 5 ? '100%' : '' }">
<table class="sticky-table"> <table class="sticky-table">
<thead> <thead>
<tr> <tr>
...@@ -78,7 +78,7 @@ export default { ...@@ -78,7 +78,7 @@ export default {
.sticky-table-wrapper { .sticky-table-wrapper {
overflow: auto; overflow: auto;
height: 100%; // height: 100%;
.sticky-table { .sticky-table {
border-collapse: separate; // sticky需要separate或collapse配合特定处理,separate较安全 border-collapse: separate; // sticky需要separate或collapse配合特定处理,separate较安全
...@@ -125,7 +125,7 @@ export default { ...@@ -125,7 +125,7 @@ export default {
// } // }
th:first-child, th:first-child,
td:first-child { td:first-child {
padding: 2px 8px 14px 0; padding: 4px 8px 4px 0;
} }
th { th {
...@@ -134,6 +134,7 @@ export default { ...@@ -134,6 +134,7 @@ export default {
z-index: 10; z-index: 10;
color: #999999; color: #999999;
font-size: 12px; font-size: 12px;
padding-top: 0;
} }
// 固定第一列样式 // 固定第一列样式
...@@ -160,7 +161,7 @@ export default { ...@@ -160,7 +161,7 @@ export default {
// 表头和第一列交叉的单元格 // 表头和第一列交叉的单元格
th.fixed-col { th.fixed-col {
padding: 2px 8px 14px 0; padding: 4px 8px 4px 0;
z-index: 15; // 最高层级 z-index: 15; // 最高层级
background: #fff; background: #fff;
} }
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<div class="label"> <div class="label">
{{ item.label }} {{ item.label }}
</div> </div>
<div>{{ item.formatter ? item.formatter(infoData) : infoData[item.prop] }}</div> <div>{{ item.formatter ? item.formatter(infoData) : (infoData[item.prop] || '-') }}</div>
</div> </div>
</div> </div>
</h-dialog> </h-dialog>
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
<div class="title"> <div class="title">
商品信息<span class="title-tip">点击商品名称可查看商品全部信息</span> 商品信息<span class="title-tip">点击商品名称可查看商品全部信息</span>
</div> </div>
<StickyTable :columns="tableColumns" :data="purchaseOrderInfo.goodsList" height="216px"> <StickyTable :columns="tableColumns" :data="purchaseOrderInfo.goodsList" :height="purchaseOrderInfo?.goodsList?.length > 5 ? '216px' : 'auto'">
<template #upgradeGoodsName="{ row }"> <template #upgradeGoodsName="{ row }">
<span style="color: #347bff; cursor: pointer;" @click="handleProductClick(row)">{{ row.upgradeGoodsName }}</span> <span style="color: #347bff; cursor: pointer;" @click="handleProductClick(row)">{{ row.upgradeGoodsName }}</span>
</template> </template>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!