tsg-app/pages/skDetail/jcsj/jcsjTable.vue

126 lines
2.8 KiB
Vue

<template>
<view>
<div class="table_div" v-if="tableData.length !=0">
<div class="table_cur">
<table style="width:100%;display:block">
<tr>
<th style="width: 40px;">
序号
</th>
<th style="width: 80px">时间</th>
<th style="width: 80px;">
雨量(mm)
</th>
<th style="width: 90px;">
水位(m)
</th>
<th style="width: 90px; position: relative;">
<view>
库容(万m³)
<!-- <text style="position: absolute; bottom:-10px; left: 20px;">(m³/s)</text> -->
</view>
</th>
</tr>
<!-- style="max-height: 480px; overflow-y: auto" -->
<div class="scroll-table">
<tr v-for="(item, index) in newList" :key="index">
<td style="width: 30px">{{ index + 1 }}</td>
<td style="width: 80px;">{{ item.tm }}</td>
<td style="width: 80px">{{ item.drp }}</td>
<td style="width: 100px">{{ item.rz ? item.rz.toFixed(2) : "-" }}</td>
<td style="width: 80px">{{ item.w ? item.w : "-" }}</td>
</tr>
<div style="height:180px"></div>
</div>
</table>
</div>
</div>
<view
style="display: flex;align-items: center;justify-content: center;background-color: #fff;"
v-else>
<image src="../../../static/empty.png" mode=""></image>
</view>
</view>
</template>
<script>
import moment from "moment"
export default {
props: {
tableData: {
type: Array,
default: [],
}
},
computed: {
newList() {
if (this.tableData.length) {
return this.tableData.map(item => ({
...item,
tm: moment(item.tm).format("MM-DD HH:mm")
}))
}
}
},
methods: {
}
}
</script>
<style lang="scss" scoped>
.table_div {
height: 100%;
max-width: calc(100% - 0px);
max-height: calc(100vh);
flex: 1;
padding-top: 0px;
overflow-x: scroll;
}
/*table样式*/
.table_cur {
width: 100%;
empty-cells: show;
border-collapse: collapse;
font-size: 14px;
}
.scroll-table {
height: calc(100vh - 180px);
overflow-y: auto;
width: '100%'
}
.table_cur tr {
display: flex;
line-height: 75rpx;
}
.table_cur th {
height: 85rpx;
color: #3399ef;
background: #e1f3ff;
font-size: 14px;
// font-weight: bold;
padding: 0px 10px;
box-sizing: border-box;
white-space: nowrap;
text-align: center !important;
}
.table_cur td {
height: 65rpx;
// border-bottom: 1px solid #d8ddeb;
font-size: 14px;
color: #2f4056;
padding: 0 10px;
box-sizing: border-box;
white-space: nowrap;
text-align: center !important;
}
/*table样式 end*/
</style>