<template>
	<view class="skinfo">
		<view class="title">
			<view class="left">
				<u-icon name="file-text" color="#f59d29" size="20"></u-icon>
				
				<text style="margin-left:5px">{{dataform.resName}}</text>
			</view>
			<view class="right">
				{{tm}}
			</view>
		</view>
		<view class="content">
			<view class="" style="display: flex;">
				<!-- <image src="../../static/c1.png" mode="" style="width:30%;height: 120px;"></image> -->
				<image :src="showImg" style="width: 30%;height: 120px;margin: 5px;" @click="previewImage(showImg)"></image>
				<view class="listItem"  @click="toDetail()">
					<view class="item-text" v-for="(v,k) of list"  :key="k">
						<text>{{v}}</text>:
						<text>{{dataform[k]}}</text>
					</view>
				</view>
			</view>
			<view class="bottom">
				<view class="bottomItem">
					<view class="withd-2" @click="toWaterDetail('生活供水',shStcd)">
						<text>生活供水m³/s</text>:
						<text>{{shgs}}</text>
					</view>
					<view class="withd-2" @click="toWaterDetail('生态供水',stStcd)">
						<text>生态供水m³/s</text>:
						<text>{{stgs}}</text>
					</view>
				</view>
			</view>
		</view>
	</view>

</template>

<script>
	import moment from 'moment'
	export default{
		data(){
			return{
				list:{
					"rz":'当前水位m',
					"today":'今日雨量mm',
					'flLowLimLev':'汛限水位m',
					"afsltdz":'比汛期m',
					'wcrstel':'堰顶高程m',
					'crestElev':'坝顶高程m',
					"h24":'24h预报mm',
					"yesterdayDrp":'昨日雨量mm',
					'totCap':'总库容m³',
					"nowCap":'蓄水量万m³'
				},
				tm:	'',
				dataform:{},
				stgs:'',
				shgs:'',
				stStcd:'',
				shStcd:'',
				imageList:[],
				baseUrl:'http://223.75.53.141:9102/test.by-lyf.tmp',
				showImg:''
				
			}
		},
		mounted() {
			this.getList()
			this.getDrp()
		},
		methods:{
			previewImage(item){
				uni.previewImage({
							urls: [this.showImg],
							longPressActions: {
								itemList: ['发送给朋友', '保存图片', '收藏'],
								success: function(data) {
									console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
								},
								fail: function(err) {
									console.log(err.errMsg);
								}
							}
						});
			},
			getDrp(){
				uni.$http.get('/gunshiApp/xyt/reservoir/water/detail?stcd=716164061&_=1731028927554').then(res=>{
					
					this.dataform={...this.dataform,...res.data.data}
					
				})
				uni.$http.post('/gunshiApp/xyt/reservoir/water/list').then(res=>{
					this.dataform={...this.dataform,...res.data.data[0]}
					this.tm = res.data.data[0].tm
				})
				uni.$http.post('/gunshiApp/xyt/stWaterRReal/list').then(res=>{
					res.data.data.forEach(item=>{
						if(item.sttp == 'QQ'){
							this.stgs=item.q
							this.stStcd=item.stcd
						}
						if(item.sttp == 'PQ'){
							this.shgs=item.q
							this.shStcd=item.stcd
						}
					})
				})
				uni.$http.post('/gunshiApp/xyt/resProjectImg/list',{resCode:42120250085}).then(res=>{
					res.data.data.forEach(item=>{
						if(item.projType == 1){
							this.imageList = item.files.map((item,index)=>
							{item.url = this.baseUrl + item.filePath
							if(index == 0){
								
								this.showImg = item.url
							}
							return item})
						}
					})
				})
				
			},
			toDetail(){
				uni.navigateTo({
					url:'/pages/skInfo/detail/index'
				})
			},
			toWaterDetail(name,stcd){
				uni.navigateTo({
                    url:`/pages/skInfo/waterDatail/index?name=${name}&stcd=${stcd}`,
                })
			},
			getList(){
				uni.$http.post('/gunshiApp/xyt/attResBase/list').then(res=>{
					this.dataform=res.data.data[0]
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.skinfo {
		.title {
			display: flex;
			justify-content: space-between;
			align-items: center;
			.left{
				font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑', sans-serif;
				font-weight: 700;
				font-style: normal;
				font-size: 16px;
				display: flex;
			}
			    
		}
		.content{
			.listItem{
				font-size: 13px;
				color: #333333;
				display: flex;
				flex-wrap: wrap;
				width: 70%;
				height: 22px;
				.item-text{
					width: 50%;
				}
			}
		}
		.bottomItem{
			display: flex;
			border-top: 1px solid #f0f0f0;
			padding: 10px 0 0 0;
			font-size: 14px;
		}
	}
	.withd-2{
		width: 50%;
		text-align: center;
	}
</style>