<template>
	<view class="fullHeight bgWhite">
		<headers :showBack="true">
			<view class="headerName">
				人员列表
			</view>
		</headers>
		<scroll-view scroll-y="true" class="pageContent">
			<view class="personContent">
				<view class="personItem" v-for="(item,index) in personList" :key="index" @click="searchPerson(item.id)">
					<image v-if="item.fieldAcquisitionUrl" :src="url_config+'image/'+item.fieldAcquisitionUrl"
						class="profile_photo"></image>
					<image v-else src="/static/profile_photo.png" class="profile_photo"></image>
					<view class="personInfo">
						<view class="name">
							{{item.workerName}}
						</view>
						<view class="teamName">
							{{item.teamName}}
						</view>
						<view class="small">
							{{item.sex==2?'女':'男'}} {{item.age}}
						</view>
					</view>
					<image src="/static/icon-right.png" class="icon-right"></image>
				</view>
				<view class="placeholderBox" v-show="personList.length==0">
					<image src="/static/noData.png" class="noDataImg"></image>
					<view class="text">
						暂无数据
					</view>
				</view>
			</view>
		</scroll-view>

	</view>
</template>

<script>
	import headers from "@/components/headers/headers.vue"
	export default {
		components: {
			headers
		},
		data() {
			return {
				personList: [],
				projectDetail: {},
				workerName: '',
				teamId: 0,
				departmentId: 0,
			};
		},
		onLoad(options) {
			this.departmentId = options.id;
			this.teamId = options.teamId;
			this.projectDetail = JSON.parse(uni.getStorageSync('projectDetail'))
			this.loadData()
		},
		methods: {
			loadData() {
				var that = this
				this.sendRequest({
					url: 'xmgl/workerInfo/selectWorkerInfoList',
					data: {
						departmentId: this.departmentId != 'undefined' ? this.departmentId : '',
						teamId: this.teamId != 'undefined' ? this.teamId : '',
						projectSn: this.projectDetail.projectSn,
						pageNo: 1,
						pageSize: -1
					},
					method: "POST",
					success(res) {
						that.personList = res.result.records
					}
				})
			},
			searchPerson(id) {
				uni.navigateTo({
					url: './personDetail?id=' + id
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.personContent {
		padding: 30rpx;
	}

	.personItem {
		display: flex;
		align-items: center;
		box-shadow: 0px 4px 26rpx 0px rgba(212, 220, 236, 0.53);
		position: relative;
		margin-bottom: 10rpx;
		padding: 30rpx;
		border-radius: 16rpx;
		// padding: 0 30rpx;
		font-size: 30rpx;

		.teamName {
			font-size: 26rpx;
		}

		.small {
			font-size: 24rpx;
			opacity: 0.8;
		}

	}

	.profile_photo {
		width: 100rpx;
		height: 120rpx;
		margin-right: 20rpx;
	}

	.icon-right {
		position: absolute;
		width: 16rpx;
		height: 28rpx;
		right: 30rpx;
		top: calc(50% - 7px);
	}
</style>