<template>
	<div class="reportListDetail">
		<headNav :title="'人员信息'" class="headNav"></headNav>
		<!-- 单位信息 -->
		<div class="companyInfo">
			<div v-for="(item, index) in executors" :key="item.user_id" class="missionInfo_cardInfo">
				<div class="missionInfo_cardInfo_contentCard">
                    <div class="headTip FontColorInfo">{{index ? '协' : '主'}}检查人</div>
					<van-cell title="姓名" :value="item.user_name" />
					<van-cell title="联系方式" :value="item.phone" />
                </div>
			</div>
        </div>

		<!-- 遮罩层 -->
		<v-mask :showOverLay="showOverLay"></v-mask>
	</div>
</template>

<script>
import headNav from "@/components/headNav.vue";
import { get, post, put, Get } from "@/utils/http.js";
import dayjs from 'dayjs'
import { enfoceJobStatus, enfoceJobSource, enforceObjPlaceType, enforceObjType,enforceObjArchitectureType } from "@/utils/variables.js";
import baiduMap from "@/components/baiduMap.vue";
import mask_overLay from "@/components/overLay_xy.vue";

export default {
	name: "enforceObjInfo",
	components: {
		headNav,
		baiduMap,
		"v-mask": mask_overLay,
	},
	data() {
		return {
			dayjs,
            enforceObjArchitectureType,
            enforceObjType,
            enforceObjPlaceType,
			enfoceJobStatus,
			enfoceJobSource,
			docIist: [],
			dataList: "",
			companyInfo: "",
			showMap: false,
			showOverLay: false,
			zoom: 14,
			center: "重庆市",
			contNum: "",
			isShowCheckResult: false,
			startCheckBtn: false,
			isReportCheck: false,
			hasJudge: false,
			resultValue: "改正通知书",
		};
	},
    computed: {
        executors() {
            const executors = this.$route.query.executors
			console.log(1231232312, executors);
            return executors ? JSON.parse(executors) : []
        }
    },
	methods: {
		// 初始化
		async init() {
			this.showOverLay = true;
			await this.getDetailInfoApi();
			this.showOverLay = false;
		},

		// 获取任务详情信息
		async getDetailInfoApi() {
			const id = this.$route.params.ID
			await this.$http.get(`/enforce-obj/${id}/his-problem`, {
				params: {
					id
				}
			})
				.then((res) => {
					console.log(res.data);
				})
				.catch((err) => {
					this.$toast.fail("获取历史隐患失败");
					this.showOverLay = false;
				});
		},

		// 获取单位信息
		async getCompanyInfoApi() {
			// await get(`/cdSuperObjE/get/${this.dataList.checkObjId}`)
			// 	.then((res) => {
			// 		if (res.success == true) {
			// 			this.companyInfo = res.data;
			// 		}
			// 	})
			// 	.catch((err) => {
			// 		this.$toast.fail("获取公司信息失败");
			// 		this.showOverLay = false;
			// 	});
		},

		async getCheckJudgeApi() {
			// await get("/cdsupervisionCheckRecord/listByCondition", {
			// 	taskId: this.dataList.taskId,
			// }).then((res) => {
			// 	if (res.data.length > 0) {
			// 		this.hasJudge = true;
			// 	} else {
			// 		this.resultValue = "检查合格";
			// 	}
			// });
		},

		// 后退一个页面
		backPage() {
			this.$router.push("/");
		},

		goBack() {
			this.$router.push("/");
		},

		// 跳转单位信息
		turnToCompany(id) {
			this.$router.push(`/companyInfo/${id}`);
		},

		// 获取地图中心位置
		getCenter(location) {
			this.showMap = true;
			this.center = location;
		},

		// 跳转消防监督检查记录
		turnToRecord() {
			this.$router.push(
				`/reviewRecord/${this.$route.params.ID}/${this.dataList.taskId}/1`
			);
		},

		turnToResult() {
			if (this.hasJudge) {
				this.$router.push(
					`/checkResultDetail/${this.$route.params.ID}/${this.dataList.taskId}/1`
				);
			} else {
				return;
			}
		},

		// 开始检查
		startCheck(id) {
			if (this.dataList.excuteStatus === "1") {
				if (this.dataList.excuteTime) {
					put("/cdsupervisionOthertask/edit", {
						id: this.$route.params.ID,
						excuteStatus: "3",
					}).then((res) => {
						if (res.success === true) {
							this.$router.push(
								`/reviewRecord/${this.$route.params.ID}/${this.dataList.taskId}/1`
							);
						}
					});
				} else {
					this.$toast.fail("暂无检查时间");
				}
			} else {
				this.$router.push(
					`/reviewRecord/${this.$route.params.ID}/${this.dataList.taskId}/1`
				);
			}
		},

		// 复查
		review() {
			this.$router.push("/review");
		},
	},
};
</script>

<style lang="scss" scoped>
.reportListDetail {
	font-size: 14px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    .headNav {
        flex: 0 0 50px;
    }
    .companyInfo {
        flex: 1;
        overflow: auto;
    }
	.mt2 {
		margin-top: 3px;
	}

	.headTip {
		padding: 8px 15px;
        background-color: rgba(0,0,0,.1);
        color: #565656; 
	}

	.missionInfo {
		margin-top: 57px;

		.missionInfo_cardInfo {
			background-color: #fff;
            /deep/ {
                .van-cell {
                    padding: 8px 15px;
                    border-bottom: 1px solid #ddd;
                    &:after {
                        display: none;
                    }
                }
            }
		}
	}

	.companyInfo {
		@extend .missionInfo;
        margin-top: 50px;
	}


	.inspectContent {
		margin-top: 10px;

		.inspectContent_content {
			padding: 5px 15px;
			background-color: #fff;
		}
	}

	.checkResult {
		margin-top: 10px;

		.unChecked,
		.Checked {
			padding: 5px 15px;
			background-color: #fff;

			.checkedItem {
				color: #616161;
				border-bottom: 1px solid #e8e8e8;

				&:last-child {
					border-bottom: none;
				}
			}
		}
	}

	.reCheckResult {
		margin-top: 10px;

		.unChecked,
		.Checked {
			padding: 5px 15px;
			background-color: #fff;
		}

		.unChecked {
			padding-bottom: 10px;
		}
	}

	.lawRecord {
		margin-top: 10px;

		.unChecked,
		.Checked {
			padding: 8px 15px;
			background-color: #fff;

			.checkedItem {
				padding: 8px 0;
				align-items: center;
			}
		}
	}
}
</style>

<style lang="scss">
.reportListDetail {
	.van-cell {
		padding: 8px 0;
		// border-bottom: 1px solid #cfcfcf;
		font-size: 12px;

		&:last-child {
			border-bottom: none;
		}

		.van-cell__title {
			color: #565656;
		}
	}

	.missionInfo {
		.missionInfo_cardInfo {
			.search-icon.van-icon.van-icon-location {
				display: flex;
				align-items: center;
				color: #00f;
				margin-left: 10px;
			}

			.van-icon.van-icon-arrow.van-cell__right-icon {
				margin-left: 10px;
			}
		}
	}

	.missionInfo_cardInfo_more {
		.van-button.van-button--info.van-button--small {
			padding: 5px 20px;
			height: auto;
			margin-bottom: 5px;
			background-color: transparent;
			border: none;
			color: #448fff;
			font-size: 13px;
			font-weight: bold;
		}
	}

	.inspectContent_content {
		.van-cell__value {
			color: #02a7f0;

			span {
				font-size: 9px;
			}
		}

		.van-icon.van-icon-arrow.van-cell__right-icon {
			color: #02a7f0;
			font-size: 12px;
		}
	}

	.van-empty {
		padding: 0;
		padding-bottom: 10px;
	}

	.van-empty__description {
		color: #878787;
		font-weight: bold;
	}

	.checkResult,
	.reCheckResult {
		.unChecked,
		.Checked {
			.checkedItem {
				.van-cell,
				.van-cell.van-cell--clickable {
					border: none;

					&::after {
						border: none;
					}
				}

				.van-cell__value {
					color: #02a7f0;

					span {
						font-size: 9px;
					}
				}

				.van-icon.van-icon-arrow.van-cell__right-icon {
					color: #02a7f0;
					font-size: 12px;
				}
			}
		}
	}

	.van-empty__image {
		width: 140px;
		height: 130px;
	}

	.van-empty__bottom {
		margin-top: 5px;

		.van-button.van-button--info.van-button--normal {
			width: 120px;
			height: 40px;
			border-radius: 5px;
		}
	}
}
</style>
