<!-- 隐患上报表 审批  BS006_SHOWPRINT-->
<template>
	<view class="page-wrap" v-bind:style="{paddingBottom:paddingBottom+'px'}">
		<view class="card">
			<uni-card margin="0" :is-shadow="true">
				<u--form labelPosition="left" labelWidth="auto" labelAlign="center" :model="model" :rules="rules"
					ref="wForm" errorType="border-bottom">
					<u-form-item label="检查类型" prop="Nav_Submit.Nav_CheckType.NAME" borderBottom>
						<u--input disabled disabledColor="#ffffff" v-model="model.Nav_Submit.Nav_CheckType.NAME"
							border="none" slot="right" inputAlign="right"></u--input>
					</u-form-item>
					<u-form-item label="检查层级" prop="Nav_Submit.Nav_CheckTypeLevel.Nav_Enums.NAME" borderBottom>
						<u--input disabled disabledColor="#ffffff"
							v-model="model.Nav_Submit.Nav_CheckTypeLevel.Nav_Enums.NAME" border="none" slot="right"
							inputAlign="right"></u--input>
					</u-form-item>
					<u-form-item label="检查时间" prop="CREATE_TIME" borderBottom>
						<u--input disabled disabledColor="#ffffff" v-model="model.Nav_Submit.CREATE_TIME" border="none"
							slot="right" inputAlign="right"></u--input>
					</u-form-item>
					<view class="upload-title">附件</view>
					<full-upload v-model="model.Nav_Submit.Nav_Files" :isShowBtn='false'></full-upload>
				</u--form>
			</uni-card>
		</view>

		<u-sticky offset-top="20">
			<view class="sub-form">
				<view class="sub-form-wrap">
					<u--form labelPosition="left" labelWidth="auto" labelAlign="center" errorType="border-bottom"
						ref="sForm">
						<uni-collapse :border="false" accordion :value='1'>
							<uni-card style="margin-bottom: 16px;" margin="0" spacing="0" :is-shadow="false"
								v-for="(item, index) in model.Nav_ListRiskSubmitContent" :name="index">
								<uni-collapse-item :title="index + 1 + '. ' + item.CHECKCONTENT" name="1">

									<u-form-item label="问题等级" prop="QUESTION_LEVEL_SHOW" borderBottom>
										<u--input disabled disabledColor="#ffffff" v-model="item.QUESTION_LEVEL_SHOW"
											border="none" inputAlign="right"></u--input>
									</u-form-item>

									<view class="label-title">检查问题</view>
									<u-form-item prop="CHECKCONTENT" borderBottom>
										<u--textarea disabled autoHeight v-model="item.CHECKCONTENT"
											placeholder="整改建议与措施" border="surround"></u--textarea>
									</u-form-item>

									<view class="label-title">整改建议与措施</view>
									<u-form-item prop="DEMAND" borderBottom>
										<u--textarea disabled autoHeight v-model="item.DEMAND" placeholder="整改建议与措施"
											border="surround"></u--textarea>
									</u-form-item>

									<u-form-item label="隐患原因" prop="listCheckDetailReason" borderBottom>
										<u--input disabled disabledColor="#ffffff" v-model="item.listCheckDetailReason"
											border="none" inputAlign="right"></u--input>
									</u-form-item>
									<u-form-item label="隐患地点" prop="ADDRESS" borderBottom>
										<u--input disabled disabledColor="#ffffff" v-model="item.ADDRESS" border="none"
											inputAlign="right"></u--input>
									</u-form-item>

									<view class="upload-title">附件</view>
									<full-upload :value="item.Nav_Files" :isShowBtn='false'></full-upload>

									<!-- <u-form-item label="责任单位" prop="Nav_Department.NAME" borderBottom>
										<u--input disabled disabledColor="#fff" v-model="item.Nav_Department.NAME"
											border="none" inputAlign="right"></u--input>
									</u-form-item> -->

									<u-form-item label="整改期限" prop="LastDateUser" borderBottom>
										<u--input disabled disabledColor="#fff" placeholder="请选择整改期限"
											:value="$u.timeFormat(item.LastDateUser, 'yyyy-mm-dd')" border="none"
											inputAlign="right"></u--input>
									</u-form-item>

									<u-form-item label="整改实施单位" prop="Nav_DepartmentDeal.NAME" borderBottom>
										<u--input disabled disabledColor="#fff" v-model="item.Nav_DepartmentDeal.NAME"
											border="none" inputAlign="right"></u--input>
									</u-form-item>

									<u-form-item label="整改责任人" prop="Nav_UserDeal.NAME" borderBottom
										@click="handleChange(index)">
										<u--input disabled disabledColor="#fff" v-model="item.Nav_UserDeal.NAME"
											border="none" inputAlign="right"></u--input>
									</u-form-item>

									<u-form-item label="验收人" prop="Nav_UserCheck.NAME" borderBottom
										@click="handleChange(index)">
										<u--input disabled disabledColor="#fff" v-model="item.Nav_UserCheck.NAME"
											border="none" inputAlign="right"></u--input>
									</u-form-item>
								</uni-collapse-item>
							</uni-card>
						</uni-collapse>
					</u--form>
				</view>
			</view>
		</u-sticky>

		<view class="bottom-button">
			<check-action v-if="isLoadOK && tableKey === '1' && isAudit === 'true'" :okApi="okApi"
				:refuseApi="refuseApi" :dataSource="$store.state.auditModel"></check-action>
		</view>

	</view>
</template>

<script>
	import {
		guid,
		initFilter,
		extendRule,
		extendInclude,
		extendGroupRule,
		initFilterGroup,
		extendFilterGroup,
		extendFilterGroupGroupRules
	} from '../../../../utils/common'

	import {
		GetNotice
	} from '../../../../services/apply/subPages/BS/riskSubmit'

	export default {
		data() {
			return {
				isLoadOK: false,
				isAudit: false,
				paddingBottom: '170',
				ApproveID: '',
				okApi: '',
				refuseApi: '',
				DEALOPINION: '',

				tableKey: '0',
				TaskID: '',
				// listPropUpload: ['RISK_SUBMIT_ID'],
				// listPropValUpload: [],
				// listPropSubUpload: ['RISK_SUBMIT_ID', 'RISK_SUBMIT_CONTENT_ID'],
				model: {
					ID: '',
					TaskID: '',
					// Nav_CheckType: {
					// 	NAME: ''
					// },
					// Nav_CheckTypeLevel: {
					// 	Nav_Enums: {
					// 		NAME: ''
					// 	}
					// },
					Nav_Submit: {
						Nav_CheckType: {
							NAME: ''
						},
						Nav_CheckTypeLevel: {
							Nav_Enums: {
								NAME: ''
							}
						},
						Nav_Files: []
					},
					// Nav_Files: [],
					Nav_ListRiskSubmitContent: [{
						Nav_Department: {
							NAME: '',
						},
						Nav_UserCheck: {
							NAME: ''
						},
						Nav_UserDeal: {
							NAME: ''
						},
						Nav_DepartmentDeal: {
							NAME: '',
						},

						LastDateUser: '',
						departmentName: '',
						userChecker: '',
						userDetailer: '',
						// listPropValSubUpload: [],
						Nav_Files: [],
						listCheckDetailReason: '',

					}]
				}
			}
		},
		onLoad(option) {
			this.model.ID = option.ID
			this.model.TaskID = option.taskID
			this.TaskID = option.taskID
			this.tableKey = option.tableKey

			this.isAudit = option.isAudit
			this.ApproveID = option.ApproveID
			this.okApi = option.okApi
			this.refuseApi = option.refuseApi
			this.auditModel = {
				...this.$store.state.auditModel,
				TaskID: this.TaskID
			}
			if (!this.tableKey || this.tableKey != 1)
				this.paddingBottom = 10

			this.loadData()
		},
		methods: {
			handleTab(t) {
				this.currentTab = t
			},

			loadData() {
				const orgId = uni.getStorageSync('orgId')
				const json = initFilter(orgId)
				extendRule(json, 'ID', 1, this.model.ID)
				json.IgnoreDataRule = true
				GetNotice(json).then(res => {

					let listCheckDetailReason = ''
					res.Nav_ListRiskSubmitContent.forEach(e => {
						listCheckDetailReason = ''
						if (e.Nav_ListRiskQuestionReason != null && e.Nav_ListRiskQuestionReason.length >
							0)
							e.Nav_ListRiskQuestionReason.forEach(se => {
								listCheckDetailReason += ' ' + se.Nav_RiskReason.NAME
							})
						e.listCheckDetailReason = ''
						e.listCheckDetailReason = listCheckDetailReason
					})

					this.model = res
					this.isLoadOK = true
				})
			}

		},
		computed: {},
	}
</script>


<style scoped>
	@import url("../../../../style/css/editTemplate.css");
</style>