xytSk-App/pages/water/skWater/table.vue

122 lines
3.5 KiB
Vue

<template>
<div class="table_div">
<div class="table_cur">
<table>
<tr>
<th style="width: 40px;">
序号
</th>
<th style="width: 90px">
站名
<th style="width: 80px;">
监测时间
</th>
<th style="width: 100px;" >
实时水位(m)
</th>
<th style="width: 90px;" >
超汛限(m)
</th>
</tr>
<div style="max-height: 500px; overflow-y: auto">
<tr v-for="(item, index) in newList" :key="index">
<td style="width: 40px">{{ index + 1 }}</td>
<td style="width: 90px;color: #3399ef;" @click="jumpDetail(item)">{{ item.stnm }}</td>
<td style="width: 80px">{{item.tm}}</td>
<td style="width: 100px; position: relative;" >
<text :class="{'active1':item.flState == 1,'active2':item.desState == 1,'active3':item.calState}">{{ item.rz.toFixed(2) }}</text>
<text v-if="item.state == 1"
style="position: absolute; top: 0px; right: 0; color: #FF7D7D;font-size:18px;">↑</text>
<text v-else-if="item.state == 2" style="position: absolute;
top:0px;right: 0; color: #32E48E; font-size: 18px;">↓</text>
</td>
<td style="width: 90px">{{item.afsltdz ? item.afsltdz.toFixed(2):'-'}}</td>
</tr>
</div>
</table>
</div>
</div>
</template>
<script>
import moment from "moment"
export default {
props:{
list:{
type:Array,
default:[],
}
},
computed:{
newList(){
if(this.list.length > 0){
let newData = this.list.map(item=>({...item,tm:moment(item.tm).format("MM-DD HH:mm")}))
return newData
}
}
},
methods:{
jumpDetail(params){
console.log(params);
uni.navigateTo({
url:`/pages/skDetail/skDetail?stcd=${params.stcd}&stnm=${params.stnm}&source=${params.source}&afsltdz=${params.afsltdz}&flLowLimLev=${params.flLowLimLev}&desFloodLev=${params.desFloodLev}&calFloodLev=${params.calFloodLev}&resCode=${params.resCode}`
})
}
}
}
</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;
}
.table_cur tr {
display: flex;
line-height: 56rpx;
}
.table_cur th {
height: 56rpx;
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;
}
.active2{
color: #f59a23;
}
.active1{
color: #c4c415;
}
.active3{
color: #d9001b;
}
/*table样式 end*/
</style>