<template>
	<div class="checkResultDetail">
		<headNav :title="'检查判断'"></headNav>

		<div style="margin-top: 1.4rem;"></div>

		<div class="detail" v-for="(item, index) in checkStatus" :key="index">
			<van-cell is-link @click="correct_immedia(item.amendType)">
				<template #title>
					<div v-if="item.amendType == '1'">部分情况异常，责令立即改正</div>
					<div v-else>部分情况异常，责令限期改正</div>
				</template>
				<template #default>
					<div class="FontColorOther fb" v-if="item.isSend">已下发</div>
					<div class="FontColorError fb" v-else>未下发</div>
				</template>
			</van-cell>
			<div class="content">
				<div class="mb10" v-if="item.amendType == '1'">《责令立即改正通知》</div>
				<div class="mb10" v-else>《责令限期改正通知》</div>
				<div class="mr10" v-if="item.isSend">{{ item.sendTime }}</div>
			</div>
		</div>

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

<script>
import headNav from '@/components/headNav.vue';
import { get, post } from '@/utils/http.js';
import mask_overLay from '@/components/overLay_xy.vue';

export default {
	name: 'checkResultDetail',
	components: {
		headNav,
		'v-mask': mask_overLay
	},
	mounted() {
		this.init();
	},
	data() {
		return {
			isReportCheck: false,
			checkStatus: '',
			showOverLay: false
		};
	},
	methods: {
		// 初始化
		init() {
			if (this.$route.params.status != undefined && this.$route.params.status === '1') {
				this.isReportCheck = true;
				
				this.showOverLay = true;
				
				get('/cdsupervisionAmend/taskAmendStatus/' + this.$route.params.taskId).then(res => {
					this.showOverLay = false;
				
					if (res.success === true) {
						this.checkStatus = res.data;
					}
				});
			} else {
				this.showOverLay = true;

				get('/cdsupervisionAmend/taskAmendStatus/' + this.$route.params.ID).then(res => {
					this.showOverLay = false;

					if (res.success === true) {
						this.checkStatus = res.data;
					}
				});
			}
		},

		backPage() {
			this.$router.go(-1);
		},

		// 责令立即改正
		correct_immedia(type) {
			if (type == '1') {
				if (this.isReportCheck) {
					this.$router.push(
						`/correctImmediately/${this.$route.params.taskId}/${
							this.$route.params.ID
						}/1`
					);
				} else {
					this.$router.push(
						`/correctImmediately/${this.$route.params.ID}/${
							this.$route.params.currentID
						}`
					);
				}
			} else {
				if (this.isReportCheck) {
					this.$router.push(
						`/correctDeadline/${this.$route.params.taskId}/${this.$route.params.ID}/1`
					);
				} else {
					this.$router.push(
						`/correctDeadline/${this.$route.params.ID}/${this.$route.params.currentID}`
					);
				}
			}
		}
	}
};
</script>

<style lang="scss" scoped>
.checkResultDetail {
	font-size: 14px;

	.detail {
		margin: 0 10px;
		margin-top: 10px;
		border: 1px solid #dfdfdf;

		.content {
			background-color: #fff;
			display: flex;
			justify-content: space-between;
			padding: 5px 10px;
			font-size: 12px;
			color: #aaa;
		}
	}
}
</style>

<style lang="scss">
.checkResultDetail {
	.van-cell.van-cell--clickable {
		&::after {
			border: none;
		}
	}

	.van-cell__title {
		flex: 2;
	}
}
</style>
