<!--
 * @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 class="items-line">
								<text class="item-text-content">姓名：{{item.personName}}</text>
							</view>
							<view class="items-line">
								<text class="item-text-content">手机号：{{item.personId}}</text>
							</view>
							<view v-if="item.warnId" class="items-line">
								<text class="item-text-content">转移记录时间：{{item.recordTime}}</text>
							</view>
							<view v-else class="items-line">
								<text class="item-text-content" style="color: red;">未转移</text>
							</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.warnId = option.id;
			this.query = {};
			this.query['warnId'] = this.warnId;
			this.getPage();
		},
		data() {
			return {
				title: '转移人员清单',
				pageSize: 10,
				pageCurrent: 1,
				total: 0,
				list: [],
				query: {},
				warnId: '',
			}
		},
		computed: {},
		onShow() {},
		methods: {
			//返回上一页
			toBack() {
				uni.navigateBack({
					delta: 1
				})
			},
			// 分页触发
			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/yj/transfer/page',
					method: 'GET',
					params: {
						current,
						size,
					},
					data: postData,
				}).then(res => {
					if (res.data.records != null) {
						that.list = res.data.records;
						//console.log(JSON.stringify(that.list))
						// that.list =res.data.records.map(item => {
						// 	let id = item.personId.replace(/^(\d{6})\d+(\d{4})$/, '$1******$2')
						// 	return {
						// 		...item,
						// 		'pId':id
						// 	}
						// })
					}
					this.total = res.data.total;
				}).catch(err => {
					console.log(err)
				})
			},
		}
	}
</script>

<style lang="scss" scoped>

</style>