<template>
	<view class="addPlanss">
		<headers class="fixedheader" :themeType="true" :showBack="true">
			<view class="headerName">
				{{title}}
			</view>
		</headers>
		<view class="backlogList-admin" v-for="item in listData" :key="item.id" @click="jobTrial(item)">
			<view class="backlogList backlogMargin">
				<span>
					危大工程名称：{{item.engineeringName}}
				</span>
				<span class="backlogList-span" v-if="!item.acceptanceResult">待确认</span>
				<span class="backlogList-span" v-if="item.acceptanceResult === 1">合格</span>
				<span class="backlogList-span" v-if="item.acceptanceResult === 2">不合格</span>
			</view>
			<view class="backlogMargin">
					计划执行时间：{{item.planTime}}
			</view>
			<view class="backlogMargin">
					申请验收单位：{{item.applyAcceptanceUnitName}}
			</view>
			<view class="backlogMargin">
					申请验收人：{{item.applyAcceptanceUserName}}
			</view>
		</view>
		<view class="no-data"  v-if="listData.length === 0">
			<image class="img" src="/static/noData.png"></image>
			<text class="txt">暂无数据</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: "查看待办",
				listData: [],
				projectSn: '',
				userInfo: {},
			};
		},
		created() {
			
		},
		onLoad() {
			this.projectSn = JSON.parse(uni.getStorageSync('projectDetail')).projectSn
			this.userInfo = JSON.parse(uni.getStorageSync('userInfo'))
			this.initData()
		},
		methods:{
			initData(){
				this.sendRequest({
					url:'xmgl/xzDangerousEngineeringAcceptance/list',
					method:'get',
					data:{
						projectSn: this.projectSn,
						acceptanceUserId: this.userInfo.userId
					},
					success:res=>{
						uni.hideLoading()
						this.listData = res.result
					}
				})
			},
			jobTrial(item){
				console.log('sssssss');
				let checkRecord = {
					id: item.id,
					engineeringName: item.engineeringName,
					planTime: item.planTime,
					applyAcceptanceUnitName: item.applyAcceptanceUnitName,
					applyAcceptanceUserName: item.applyAcceptanceUserName
				}
				checkRecord = item
				uni.navigateTo({
					url:'./backlogTrial/backlogTrial?checkRecord='+encodeURIComponent(JSON.stringify(checkRecord))
				})
			}
		}
	}
</script>

<style lang="scss">
	.addPlanss {
		height: 100%;
		background-color: #f6f6f6;
	}

	.backlogList-admin {
		margin: 10px;
		background-color: #fff;
		height: 160px;
		padding: 15px;

		.backlogList {
			display: flex;
			justify-content: space-between;
			align-items: center;
			.backlogList-span{
				padding: 3px 5px;
				border: 1px solid #ccc;
				color: #d17b00;
				border-radius: 3px;
			}
		}
	}
	.no-data{
		text-align: center;
		.img{
			display: block;
			height: 200rpx;
			width: 200rpx;
			margin: 0 auto;
			margin-top: 60rpx;
			margin-bottom: 60rpx;
		}
		.txt{
			color: #C0C4CC;
		}
	}
	
	.backlogMargin{
		margin-bottom: 15px;
	}
</style>