<!--
 * @Title: 
 * @Description: 设备异常信息
 * @Author: swp
 * @Date: 2022-08-24 10:49:21
 * @LastEditors: 
 * @LastEditTime: 2022-08-24 10:49:21
-->
<template>
	<view class="container">
		<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 class="items-line">
								<text class="item-title-rtu-name">{{item.dangerAreaName}}</text>
							</view>
							<view class="items-line">
								<uni-icons class="input-uni-icon" type="location" size="18" color="lightblue" />
								<text class="item-text-lable">行政区划：</text>
								<text class="item-text-content">{{item.adnm}}</text>
							</view>
							<view class="item-button-group">
								<view class="item-button" @click="toMap(item)">
									<view class="items-line">
										<uni-icons class="input-uni-icon" type="phone" 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 http from '@/http/api.js';
	import {
		pathToBase64,
		base64ToPath
	} from '@/js_sdk/mmmm-image-tools/index.js';
	import {
		oss,
		devUrl,
		prodUrl
	} from '@/common/setting';


	export default {
		components: {

		},
		onLoad(options) {
			this.id = options.id;
			this.baseURL = process.env.NODE_ENV === 'development' ? devUrl : prodUrl;
			this.getPage();
		},
		data() {
			return {
				title: '地图测试',
				pageSize: 10,
				pageCurrent: 1,
				total: 0,
				list: [],
				query: {},
			}
		},
		computed: {

		},
		onShow() {

		},
		created() {

		},
		methods: {

			toBack() {
				uni.navigateBack({
					delta: 1
				})
			},
			toMap(item){
				let url = '/pages/home/leavelinemap?id=' + item.id;
				uni.navigateTo({
					url: url
				})
			},
			// 分页触发
			pageChange(e) {
				this.pageCurrent = e.current;
				this.getPage()
			},
			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/map/leaveline/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>
	/* page {
		background-color: rgb(240, 242, 244);
	} */
	.uni-body {
		font-size: 0.7rem;
	}
</style>