<!--
 * @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-list>
				<uni-list-item v-for="item in list" :key="item.id">
					<template v-slot:body>
						<view class="list-item-block">
							<view v-if="item.checkType == 1" class="items-line">
								<text class="item-text-content">独立巡查</text>
							</view>
							<view v-else class="items-line">
								<text class="item-text-content">应急发起巡查</text>
							</view>
							<view class="items-line">
								<text class="item-text-content">经纬度：{{item.longitude}}/{{item.latitude}}</text>
							</view>
							<view class="items-line">
								<text class="item-text-content">巡查时间：{{item.createTime}}</text>
							</view>
							<view v-if="item.isFlood == 0" class="items-line">
								<text class="item-text-content">是否有山洪：否</text>
							</view>
							<view v-else class="items-line">
								<text class="item-text-content">是否有山洪：有</text>
							</view>
							<view v-if="item.isDamage == 0" class="items-line">
								<text class="item-text-content">是否成灾：否</text>
							</view>
							<view v-else class="items-line">
								<text class="item-text-content">是否成灾：是</text>
							</view>
							<view class="items-line">
								<text class="item-text-content">巡查说明：{{item.remark}}</text>
							</view>
							<view class="item-button-group" style="padding-right: 10px;">
								<view class="item-button mid-size" @click="onCheckPhotoClick(item)">
									<view class="items-line">
										<uni-icons class="input-uni-icon" type="location" size="18" color="coral" />
										<text class="button-text">查看图片</text>
									</view>
								</view>
							</view>
						</view>
					</template>
				</uni-list-item>
			</uni-list>
			<uni-group>
				<view class="pagination-block">
					<uni-pagination show-icon :pageSize="pageSize" :current="pageCurrent" :total="total"
						@change="pageChange" />
				</view>
			</uni-group>
		</view>
	</view>
</template>

<script>
	import {
		role
	} from "@/api/role.js";
	import http from '@/http/api.js';
	export default {
		components: {},
		onLoad(option) {
			this.type = option.type;
			this.warnId = option.warnId;
			this.query = {};
			if (this.type == 2) {
				this.query['warnId'] = this.warnId;
			}
			this.getPage();
		},
		data() {
			return {
				title: '巡查信息',
				pageSize: 10,
				pageCurrent: 1,
				total: 0,
				list: [],
				query: {},
				type: 1,
				warnId: '',
			}
		},
		computed: {},
		onShow() {},
		methods: {
			//返回上一页
			toBack() {
				uni.navigateBack({
					delta: 1
				})
			},
			// 分页触发
			pageChange(e) {
				this.pageCurrent = e.current;
				this.getPage()
			},
			onCheckPhotoClick(item){
				let url='/pages/yjxt/check/dangerareacheckdetail?id=' + item.id;;
				uni.navigateTo({
					url: url
				})
			},
			getPage(params = {}) {
				const current = this.pageCurrent;
				const size = this.pageSize;
				let postData = Object.assign(params, this.query);
				let that = this;
				http.request({
					url: '/galaxy-business/yj/check/page',
					method: 'GET',
					params: {
						current,
						size,
					},
					data: postData,
				}).then(res => {
					if (res.data.records != null) {
						that.list = res.data.records;
					}
					this.total = res.data.total;
				}).catch(err => {
					console.log(err)
				})
			},
		}
	}
</script>

<style lang="scss" scoped>

</style>