<!--
 * @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="text text-ellipsis">行政区：{{data.adName}}</text>
					</view>
					<view class="line">
						<text class="text text-ellipsis">危险区：{{data.dangerAreaName}}</text>
					</view>
				</view>
			</uni-card>
			<uni-card title="定位信息">
				<view class="list-item-block">
					<view class="line">
						<text class="text text-ellipsis">经纬度：{{data.longitude}},{{data.latitude}}</text>
					</view>
					<view class="line">
						<text class="text text-ellipsis">定位地址：{{data.address}}</text>
					</view>
					<view class="line">
						<text class="text text-ellipsis">山洪沟名称：{{data.riverName}}</text>
					</view>
				</view>
			</uni-card>
			<uni-card title="巡查反馈">
				<view class="list-item-block">
					<view class="line">
						<text v-if="data.isFlood==1" class="text">是否有山洪：有</text>
						<text v-else class="text">是否有山洪：无</text>
					</view>
					<view class="line">
						<text v-if="data.isDamage==1" class="text">是否成灾：是</text>
						<text v-else class="text">是否成灾：否</text>
					</view>
					<view v-if="data.isWarn ==1" class="line">
						<text class="text">是否预警：是</text>
					</view>
					<view v-else class="line">
						<text class="text">是否预警：否</text>
					</view>
					<view v-if="data.isWarn ==1" class="line">
						<text class="text">预警信息：{{data.warnInfo}}</text>
					</view>
					<view v-if="data.isTransfer ==1" class="line">
						<text class="text">是否转移：是</text>
					</view>
					<view v-else class="line">
						<text class="text">是否转移：否</text>
					</view>
					<view v-if="data.isTransfer ==1" class="line">
						<text class="text">转移信息：{{data.transferInfo}}</text>
					</view>
					<view class="line">
						<text class="text">备注：{{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 {
	// 	role
	// } from "@/api/role.js";
	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 = {}) {
				//console.log("111" + JSON.stringify(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) {
						//console.log(JSON.stringify(res))
						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>