<!--
 * @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-section title="人员信息" type="line">
				<uni-list>
					<uni-list-item v-for="item in list" :key="item.id" showArrow clickable @click="onClick(item)">
						<template v-slot:body>
							<view class="list-item-block">
								<view class="line">
									<text class="title">{{item.personName}}</text>
								</view>
								<view class="line">
									<uni-icons class="input-uni-icon" type="person-filled" size="18"
										color="lightblue" />
									<text class="text">岗位：{{item.postName}}</text>
								</view>
								<view class="line">
									<uni-icons class="input-uni-icon" type="phone" size="18" color="lightblue" />
									<text class="text">电话：{{item.contactPhone}}</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>
			</uni-section>
		</view>
	</view>
</template>

<script>
	import {
		role
	} from "@/api/role.js";
	import http from '@/http/api.js';

	export default {
		components: {

		},
		data() {
			return {
				title: '指定任务负责人',
				pageSize: 10,
				pageCurrent: 1,
				total: 0,
				list: [],
				query: {},
				inputStyles: {
					color: '#808080',
					borderColor: '#d3d3d3'
				},
			}
		},
		computed: {

		},
		onLoad(option) {
			this.pageCurrent = 1;
			this.getPage()
		},
		onShow() {
			this.getPage();
		},
		methods: {
			//返回上一页
			toBack() {
				uni.navigateBack({
					delta: 1
				})
			},
			onBackPress() {
				// #ifdef APP-PLUS
				plus.key.hideSoftKeybord();
				// #endif
			},
			// 分页触发
			pageChange(e) {
				this.pageCurrent = e.current;
				this.getPage()
			},
			onClick(e) {
				console.log('执行click事件', JSON.stringify(e))
				let p = {
					'taskOwnerId': e.id,
					'taskOwnerName': e.personName,
				};
				uni.$emit('taskOwnerInfo', JSON.stringify(p))
				this.toBack();
			},
			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/serviceperson/xjgd/org/user/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>
	.select-checkbox {
		margin-top: 0px;
		margin-bottom: 5px;
		padding-left: 15px;
	}
</style>