<!--
 * @Title: 
 * @Description: 巡查历史信息
 * @Author: swp
 * @Date: 2022-08-24 10:49:21
 * @LastEditors: 
 * @LastEditTime: 2022-08-24 10:49:21
-->
<template>
	<view class="wrap">
		<uni-nav-bar dark :fixed="true" backgroundColor="#3F9EFF" statusBar="false" left-icon="left" left-text="返回"
			@clickLeft="toBack">
			<view class="nav-title">
				<text>{{title}}</text>
			</view>
		</uni-nav-bar>
		<view class="container">
			<uni-card title="危险区及行政区">
				<view class="list-item-block">
					<view class="line">
						<text class="lable">危险区：</text>
						<text class="content">{{data.dangerAreaName}}</text>
					</view>
					<view class="line">
						<text class="lable">行政区：</text>
						<text class="content">{{data.fullAadName}}</text>
					</view>
				</view>
			</uni-card>
			<uni-card title="定位信息">
				<view class="list-item-block">
					<view class="line">
						<text class="lable">经纬度：</text>
						<text class="content">{{data.longitude}},{{data.latitude}}</text>
					</view>
					<view class="line">
						<text class="lable">定位地址：</text>
						<text class="content">{{data.address}}</text>
					</view>
					<view class="line">
						<text class="lable">山洪沟名称：</text>
						<text class="content">{{data.riverName}}</text>
					</view>
				</view>
			</uni-card>
			<uni-card title="巡查反馈">
				<view class="list-item-block">
					<view v-if="data.isFlood==1" class="line">
						<text class="lable">是否有山洪：</text>
						<text class="content" style="padding-left:0px">有</text>
					</view>
					<view v-else class="line">
						<text class="lable">是否有山洪：</text>
						<text class="content" style="padding-left:0px">无</text>
					</view>
					<view v-if="data.isDamage==1" class="line">
						<text class="lable">是否成灾：</text>
						<text class="content" style="padding-left:0px">是</text>
					</view>
					<view v-else class="line">
						<text class="lable">是否成灾：</text>
						<text class="content" style="padding-left:0px">否</text>
					</view>
					<view v-if="data.isWarn==1" class="line">
						<text class="lable">是否预警：</text>
						<text class="content" style="padding-left:0px">是</text>
					</view>
					<view v-else class="line">
						<text class="lable">是否预警：</text>
						<text class="content" style="padding-left:0px">否</text>
					</view>
					<view v-if="data.isWarn==1" class="line">
						<text class="lable">预警信息：</text>
						<text class="content" style="padding-left:0px">{{data.warnInfo}}</text>
					</view>
					<view v-if="data.isTransfer==1" class="line">
						<text class="lable">是否转移：</text>
						<text class="content" style="padding-left:0px">是</text>
					</view>
					<view v-else class="line">
						<text class="lable">是否转移：</text>
						<text class="content" style="padding-left:0px">否</text>
					</view>
					<view v-if="data.isTransfer ==1" class="line">
						<text class="lable">转移信息：</text>
						<text class="content" style="padding-left:0px">{{data.transferInfo}}</text>
					</view>
					<view class="line">
						<text class="lable">备注：</text>
						<text class="content">{{data.remark}}</text>
					</view>
				</view>
			</uni-card>
			<uni-card title="巡查照片">
				<view class="view-flex-cc">
					<image v-for="(item, index) in checkPhotos" :key="index" class="cover-image" mode="widthFix"
						style="width: 100%;margin-bottom: 10px;" :src="toOss(item)">
					</image>
				</view>
			</uni-card>
		</view>
	</view>
</template>

<script>
	import http from '@/http/api.js';
	import {
		oss
	} from '@/common/setting';
	export default {
		components: {},
		onLoad(option) {
			let params = {};
			params['id'] = option.id;
			this.getDetail(params);
		},
		data() {
			return {
				title: '巡查详情',
				pageSize: 10,
				pageCurrent: 1,
				total: 0,
				list: [],
				query: {},
				checkPhotos: [],
				data: {},
			}
		},
		computed: {},
		onShow() {},
		methods: {
			toOss(path) {
				return oss + path;
			},
			//返回上一页
			toBack() {
				uni.navigateBack({
					delta: 1
				})
			},
			// 分页触发
			pageChange(e) {
				this.pageCurrent = e.current;
				this.getPage()
			},
			getDetail(params = {}) {
				let that = this;
				Object.assign(this.query, params);
				http.request({
					url: '/galaxy-business/yj/check/detail',
					method: 'GET',
					params: this.query
				}).then(res => {
					if (res.success) {
						that.data = res.data;
						let photos = res.data['checkPhotos'];
						if (null != photos && photos.length > 0) {
							let photoList = photos.split(",");
							that.checkPhotos = photoList;
						}
					}
				}).catch(err => {
					console.log(err)
				})
			},
		}
	}
</script>

<style lang="scss" scoped>

</style>