You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

179 lines
4.4 KiB

2 years ago
<template>
<view>
<uni-nav-bar left-icon="left" fixed="true" title="电站列表" @clickLeft="handleClickLeft"></uni-nav-bar>
2 years ago
<scroll-view :scroll-y="modalName==null" class="page" :class="modalName!=null?'show':''">
<view class="station-box">
<view class="card-box">
<uni-section title="电站列表" type="line" padding="0 0 5px 0">
<view class="station-box-list">
<uni-card title=""
class="arrow animation-slide-right"
:style="[{animationDelay: '0.'+ index +'s'}]"
v-for="(item, index) in stationData" :key="item.id">
<template v-slot:title>
<uni-list>
<uni-list-item showArrow clickable :title="item.stationName" @click="goNext(item.id)" />
</uni-list>
</template>
<!-- <image style="width: 100%;" :src="cover"></image> -->
<view class="station-info">
<view class="flex station-info-item">
<text class="left">装机容量(MW)</text>
<text class="right">{{ item.capacity }}</text>
</view>
<view class="flex station-info-item">
<text class="left">当日发电(kWh)</text>
<text class="right">{{ item.dayElectricity }}</text>
</view>
<view class="flex station-info-item">
<text class="left">当日功率(kW)</text>
<text >{{ item.dayPower }}</text>
</view>
<view class="flex station-info-item">
<text class="left">累计发电(kWh)</text>
<text>{{ item.totalElectricity }}</text>
</view>
<!-- <view class="flex station-info-item">
<text class="left">光照强度(W/m^2)</text>
<text>{{ station.irradiationLevel }}</text>
</view> -->
</view>
</uni-card>
</view>
2 years ago
</uni-section>
</view>
</view>
</scroll-view>
</view>
</template>
<script>
2 years ago
import { getStationList } from '@/api/modules/station.js'
import _mixin from './mixin.js'
import { STATION_LIST } from './config'
2 years ago
export default {
data() {
return {
modalName: null,
index: 0,
station: {}
2 years ago
}
},
mixins: [_mixin],
created() {
this.getStationList()
},
methods: {
getStationList() {
const userInfo = uni.getStorageSync('login_user_info')
const username = userInfo.username
const filterStation = [
{
username: 'hailun',
stationId: ['1052758024'],
stationName: '海伦'
},
{
username: 'hanzhong',
stationId: ['1052758028', '1052758029'],
stationName: '汉钟'
},
]
const filterStationItem = filterStation.some(v => v.username === username) && filterStation.filter(v => v.username === username)[0]
2 years ago
getStationList({
pageSize:20
}).then(res => {
this.stationData = res.data.result.records.filter(v => {
return !v.stationName.includes('户用光伏电站')
}).map(v => {
v.children = STATION_LIST[v.id]
2 years ago
return v
}).filter(v => {
if (filterStationItem) {
return v.stationName.includes(filterStationItem.stationName)
}
return v
})
2 years ago
this.station = this.stationData[this.index]
uni.setStorageSync('_pro_stations', this.stationData)
})
},
handleClickLeft() {
this.$router.replace('/')
},
handlerChangeStation(e) {
this.index = e.detail.value
this.station = this.stationData[this.index]
},
goNext(id) {
2 years ago
this.$router.push({
name: 'stationListItem1',
query: {
id
2 years ago
}
})
}
}
}
</script>
<style lang="scss">
.station-box {
position: relative;
padding: 10px 0;
2 years ago
color: #333;
}
.station-box-list {
position: relative;
width: 100%;
max-height: 85vh;
overflow-x: hidden;
overflow-y: scroll;
}
2 years ago
.card-box {
// margin-top: 50px;
// max-height: 90vh;
// overflow-y: scroll;
2 years ago
}
/deep/ .uni-card {
padding: 0 !important;
}
2 years ago
.station-info {
// margin-top: 20px;
display: flex;
// flex-direction:column;
flex-wrap: wrap;
color: #888;
2 years ago
.station-info-item {
font-size: 12px;
width: 50%;
vertical-align: middle;
line-height: 2.5;
// &:not(:first-child) {
// // margin-top: 10px;
// border-top: 1px dashed #cedefb;
// vertical-align: middle;
// line-height: 2.5;
// }
&:nth-child(3), &:nth-child(4) {
width: 100%;
2 years ago
border-top: 1px dashed #cedefb;
}
2 years ago
.left {
// width: 130px;
2 years ago
text-align: justify;
}
.right {
color: #4aaf0b;
// letter-spacing: 2upx;
}
2 years ago
}
}
</style>