<template>
	<view class="content" v-if="type != '0'">
		<view class="content-sum" v-if="myCheckAllresult && myCheckAllresult.length > 0">
			<view class="sum-title">汇总结果：</view>
			<view class="sum-item" v-for="(itm,idx) in myCheckAllresult" :key="idx" :style="{'color': colorList[idx]}">
				{{itm.name}} {{itm.num ? itm.num:'0'}}
			</view>
		</view>
		<view class="check-project">
			<view class="item" v-for="(item,index) in allTableData" :key="index" @click="previewDetail(item)">
				<view class="item-left">
					<view class="left-text">
						{{item.createUserName}}检查{{item.checkItemNum}}项
					</view>
					<view class="right-text">
						<view class="sum-item" v-for="(itm,idx) in JSON.parse(item.chooseResult)" :key="idx" :style="{'color': colorList[idx]}">
							{{itm.name}} {{itm.num ? itm.num:'0'}}
						</view>
						<view class="sum-item">隐患 {{item.hiddenDangerNum}}</view>
					</view>
				</view>
				<uni-icons2 type="arrowright" style="margin-top: 4px;" size="18"></uni-icons2>
			</view>
		</view>
		<view class="submit-btn" v-if="type != '0' && isEdit == '1' && myCheckAllresult && myCheckAllresult.length > 0 && status != 2" @click="finishCheck">结束任务</view>
	</view>
</template>

<script>
	export default{
		props:['allTableData','myCheckAllresult', 'taskId', 'type','isEdit', 'status'],
		data(){
			return{
				colorList:['#13B98C','#F0AD4E','#DD524D', '#4396E7'],
				userChooseResult:[{
					name: "符合",
					num: '1'
				},{
					name: "基本符合",
					num: '2'
				},{
					name: "不符合",
					num: '3'
				},{
					name: "待整改后符合",
					num: '4'
				}]
			}
		},
		methods:{
			previewDetail(val){
				console.log(val)
				uni.navigateTo({
					url: './userDetail?id=' + val.createUser + '&taskId=' + val.taskId + '&name=' + encodeURIComponent(val.createUserName)
				})
			},
			finishCheck(){
				if(this.status == 2){
					return;
				}
				this.sendRequest({
					url:'xmgl/acceptanceTableCheckTask/editEndTask',
					method:'post',
					data:{taskId: this.taskId},
					success:res=>{
						uni.hideLoading()
						this.$emit('@upTableData')
						uni.navigateBack({
							
						})
						console.log(res)
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content{
		padding-top: 20rpx;
		padding-bottom: 96rpx;
		.content-sum{
			padding: 20rpx 30rpx;
			background: #fff;
			margin-bottom: 20rpx;
			.sum-title{
				margin-right: 20rpx;
				display: inline;
				line-height: 52rpx;
			}
			.sum-item{
				display: inline;
				margin-right: 18rpx;
				line-height: 52rpx;
			}
		}
		.check-project{
			background: #fff;
			padding: 0 30rpx;
			.item{
				border-bottom: 1px solid #eee;
				display: flex;
				// align-items: center;
				justify-content: space-between;
				padding: 20rpx 0;
				.item-left{
					display: flex;
					.left-text{
						width: 160rpx;
						line-height: 48rpx;
						margin-right: 52rpx;
					}
					.right-text{
						margin-right: 8rpx;
						flex: 1;
						text-align: right;
						.sum-item{
							display: inline;
							margin-right: 18rpx;
							line-height: 52rpx;
						}
					}
				}
			}
		}
		.submit-btn{
			position: fixed;
			bottom: 0;
			left: 0;
			height: 96rpx;
			background: #4a88f5;
			color: #fff;
			width: 100%;
			text-align: center;
			line-height: 96rpx;
		}
	}
</style>
