<template>
	<view class="todo-page">
		<step-title :stepPage="stepsPage" :stepText="stepsText"></step-title>
		<view class="allview">
			<view class="card">
				<u--form labelWidth="auto" :model="model" ref="wForm" class="demo-ruleForm">
					<view style="position: relative;">
						<view style="position: absolute;left: -10px;color: #3d4b70;top: -3px;">*</view>
					</view>

					<view style="font-size: 15px; font-weight: bold;color: #3d4b70;margin-bottom: 10px;">基本信息填写</view>
					<u-form-item label="审核意见：" prop="CONTEXT" borderBottom v-if="model.STATUS==40">
					</u-form-item>
					<u--textarea v-html="model.CONTEXT" border="surround" v-if="model.STATUS==40" disabled></u--textarea>
					<u-form-item label="生产单元：" prop="Product_Unit" @click="handleChange('SKProductionUnit')">
						<u--input v-model="(model.Nav_ProductionUnit||{}).NAME" disabled disabledColor="#ffffff" placeholder="请选择生产单元" border="none" inputAlign="right" fontSize="14px">
						</u--input>
						<u-icon style="margin-left: 4px;" slot="right" name="arrow-down" size="12">
						</u-icon>
					</u-form-item>
					<u-form-item required label="检查区域:" >
						<u--input v-model="(model.Nav_RiskArea||{}).NAME"  disabled disabledColor="#ffffff" border="none" inputAlign="right"
							fontSize="14px">
						</u--input>
					</u-form-item>
					<u-form-item label="隐患地点:" prop="HIDDEN_PLACE">
						<u--input v-model="model.HIDDEN_PLACE" disabled disabledColor="#ffffff" inputAlign="right" fontSize="14px" border="none">
						</u--input>
					</u-form-item>
					<u-form-item label="隐患原因" prop="Nav_Reasons" @click="handleShowSheet({title: '隐患原因', name: 'Nav_Reasons'})">
						<u-icon style="margin-left: 4px;" slot="right" name="arrow-down" size="12"></u-icon>
					</u-form-item>
					<u--textarea disabled autoHeight disabledColor="#fff" v-model="model.ReasonsNAME" placeholder="隐患原因" border="none"></u--textarea>


					<u-form-item label="隐患描述:" prop="HIDDEN_DESCRIPTION">
						<u--input v-model="model.HIDDEN_DESCRIPTION" disabled disabledColor="#ffffff" inputAlign="right" fontSize="14px" border="none">
						</u--input>
					</u-form-item>
					<u-form-item required label="隐患照片:"></u-form-item>
					<full-upload v-model="model.Nav_Photos" :isShowBtn='true' :listProp='listPropUpload' :listPropVal='listPropValUpload' v-if="model.Nav_Photos"></full-upload>

				</u--form>
				<u--form labelWidth="auto" :model="model" ref="wForm" class="demo-ruleForm" style="margin-top: 20px;">
					<view style="position: relative;">
						<view style="position: absolute;left: -10px;color: #3d4b70;top: -3px;">*</view>
					</view>

					<view style="font-size: 15px; font-weight: bold;color: #3d4b70;margin-bottom: 10px;">隐患确认</view>
					<u-form-item required label="检查内容：" @click="handleShowSheet({title: '检查内容', name: 'Nav_Contents'})">
						<u--input v-model="(model.Nav_Contents || {}).CHECKCONTENT" disabled disabledColor="#ffffff" placeholder="请选择检查内容" border="none" inputAlign="right" fontSize="14px">
						</u--input>
						<u-icon style="margin-left: 4px;" slot="right" name="arrow-down" size="12">
						</u-icon>
					</u-form-item>
					<!-- <u-form-item label="检查依据:" @click="handleChangeStep('Inspection')" >  
						<u-icon style="margin-left: 4px;" slot="right" name="arrow-down" size="12">
						</u-icon>
					</u-form-item>
					<u--textarea v-model="model.Nav_BasicsName" disabled maxlength="-1"></u--textarea>
					<u-form-item label="判定标准:">
						<u--input v-model="model.CHECKSTANDARD" disabledColor="#ffffff" border="none" inputAlign="right" fontSize="14px">
						</u--input>
					</u-form-item> -->
					<u-form-item required label="隐患描述:" prop="HIDDEN_DESCRIPTION" @click="handleShowSheet({title: '隐患描述', name: 'Nav_Question'})">
						<u-icon style="margin-left: 4px;" slot="right" name="arrow-down" size="12">
						</u-icon>
					</u-form-item>
					<u--textarea v-model="(model.Nav_Question || {}).DESCREPTION" disabled placeholder="请选择隐患描述" maxlength="-1"></u--textarea>
					<u-form-item required label="隐患等级" prop="HIDDEN_LEVEL" @click="handleChange('SKHiddenLevel')">
						<u--input v-model="model.HIDDEN_LEVELName" placeholder="请选择隐患等级" suffixIcon="arrow-down" suffixIconStyle="font-size: 12px" disabledColor="#ffffff" inputAlign="right" fontSize="14px" border="none">
						</u--input>
					</u-form-item>
					<u-form-item label="整改措施:">
					</u-form-item>
					<u--textarea v-model="model.RECTIFICATION_MEASURES" placeholder="整改措施" maxlength="-1" disabled></u--textarea>
					<!-- 	<u-form-item label="检查层级：" prop="Check_Level" @click="handleChange('SKDepartmentTypeEnum')">
						<u--input v-model="model.DEPARTMENT_TYPEName" disabled disabledColor="#ffffff" placeholder="请选择检查层级" border="none" inputAlign="right" fontSize="14px">

						</u--input>
						<u-icon style="margin-left: 4px;" slot="right" name="arrow-down" size="12">
						</u-icon>
					</u-form-item>
					<u-form-item label="检查类型：" prop="Check_Type" @click="handleShowSheet({title: '检查类型', name: 'Nav_CheckType'})">
						<u--input v-model="(model.Nav_CheckType || {}).NAME" disabled disabledColor="#ffffff" placeholder="请选择检查类型" border="none" inputAlign="right" fontSize="14px"></u--input>
						<u-icon style="margin-left: 4px;" slot="right" name="arrow-down" size="12">
						</u-icon>
					</u-form-item>
					<u-form-item label="检查周期：" prop="Check_Period" @click="handleChange('SKPLANCHECKFREQUENCYEnum')">
						<u--input v-model="model.PLANCHECKFREQUENCYName" disabled disabledColor="#ffffff" placeholder="请选择检查周期" border="none" inputAlign="right" fontSize="14px"></u--input>
						<u-icon style="margin-left: 4px;" slot="right" name="arrow-down" size="12">
						</u-icon>
					</u-form-item> -->
					<u-form-item required label="整改责任人" prop="HIDDEN_PLACE" @click="handleShowSheet({title: '整改责任人', name: 'Nav_RecitifyUser'})">
						<u--input v-model="(model.Nav_RecitifyUser||{}).NAME" placeholder="请选择整改责任人" suffixIcon="arrow-down" suffixIconStyle="font-size: 12px" disabled disabledColor="#ffffff" inputAlign="right"
							fontSize="14px" border="none">
						</u--input>
					</u-form-item>
					<u-form-item required label="整改期限" prop="HIDDEN_PLACE" @click="handleChangeRecitify()">
						<u--input v-model="model.RECITIFY_TIME" placeholder="请选择整改期限" disabled disabledColor="#ffffff" inputAlign="right" fontSize="14px" border="none">
						</u--input>
						<u-icon style="margin-left: 4px;" slot="right" name="arrow-down" size="12">
						</u-icon>
					</u-form-item>
					<view class="upload-title">附件：</view>
					<full-upload v-model="model.Nav_Files" :isShowBtn='true' :listProp='listPropUpload' :listPropVal='listPropValUpload'></full-upload>
				<!-- 	<u-form-item label="备注" prop="HIDDEN_PLACE" border-bottom>
					</u-form-item>
					<u-textarea v-model="item.REMARK"  placeholder="请填写备注">
					</u-textarea> -->
				</u--form>
			</view>
			<view style="padding: 10px 16px;display: flex;flex-direction: row;" class="bottom-button">
				<u-button type="primary" @click="goRiskDes" color="#3d4b70" :plain="true" style="margin-right: 5px;">新增隐患描述</u-button>
				<u-button type="primary" @click="submit" :loading="stepLoad" color="#3d4b70" style="margin-left: 5px;">提交</u-button>
			</view>
			<u-picker :show="comPickerInfo.showSheet" :columns="comPickerInfo.columns" @confirm="onConfirmPicker" @close="comPickerInfo.showSheet=false" @cancel="comPickerInfo.showSheet=false" keyName="NAME"></u-picker>
			<u-modal :show="showDelModalIndex >= 0" @confirm="confirmDel" @cancel="cacelDel" :showCancelButton="true" title="确认删除？"></u-modal>
			<u-datetime-picker :show="showPopupRecitifyDate" v-model="dateRecitifyTime" mode="date" @confirm="confirmRecitifyDate" @cancel="cancelRecitifyDate"></u-datetime-picker>
			<people-selector :defaultChecked="peopleSelectOption.defaultChecked" :show="peopleSelectOption.showSelector" @select="handleSelectorPeople" @close="peopleSelectOption.showSelector = false">
			</people-selector>
			<query-selector :multiple="selectorInfo.isMultiple" :show="selectorInfo.showPopup" :title="selectorInfo.title" :lists="selectorInfo.dataLists" :defaultChecked="selectorInfo.defaultChecked"
				@search="handleSearch" @select="handleSelected" @close="selectorInfo.showPopup=false" :total="selectorInfo.totalCount" />
		</view>
	</view>
</template>

<script>
	import {
		extendFilterGroup,
		extendGroupRule,
		extendInclude,
		extendOrder,
		extendRule,
		extendIgnoreDataRule,
		guid,
		initFilter,
		initFilterGroup,
		transformData
	} from '../../../../utils/common'
	import {
		FMProductionUnit,
		CheckPeriods,
		CheckLevels,
		MineTypeIndex,
		MineTypeName
	} from '../../../../utils/enums.js'
	import {
		GetCheckContentsInfo,
		GetNewRiskAreaInfo,
		GetRiskVerifyReport,
		HiddenVerifyFullUpdate,
		GetRiskAreaInfo,
		getUserLists,
		CheckTypeNewOrderPaged,
		GetCheckInspection,
		GetHiddenScripList,
		SKHiddenReason
	} from '../../../../services/apply/subPages/SK/SKServices.js'
	import {
		getRequest,
	} from '../../../../services/apply/FOServices/FOServices';
	import stepTitle from '@/components/custom/step-title.vue'
	import swipeActionItem from '../../../../uni_modules/uview-ui/libs/config/props/swipeActionItem';
	import {
		getEnum,
		GetEnumAnyOrder
	} from '../../../../services/common';
	export default {
		components: {
			stepTitle,
		},
		data() {
			return {
				isMultiple: false,
				showDelModalIndex: undefined,
				showDelModalIndex1: undefined,
				stepLoad: true,
				showPopupDate: false,
				showPopupRecitifyDate: false,
				listPropUpload: ['NOTIFY_ID'],
				listPropValUpload: [],
				ORG_ID: uni.getStorageSync('orgId'),
				model: {
					ORG_ID: '',
					MineType: '',
					Nav_RiskArea: {
						NAME: ''
					},
					HIDDEN_PLACE: '',
					HIDDEN_DESCRIPTION: '',
					Nav_Photos: [],
					Nav_Contents: {
						CHECKCONTENT: ''
					},
					Nav_Reasons: [],
					CHECKPROOF: '',
					CHECKSTANDARD: '',
					HIDDEN_DESCRIPTION_DETAIL: '',
					HIDDEN_LEVEL: '',
					RECTIFICATION_MEASURES: '',
					DEPARTMENT_TYPE: '',
					Nav_CheckType: {
						NAME: ''
					},
					PLANCHECKFREQUENCY: '',
					Nav_RecitifyUser: {
						NAME: ''
					},
					RECITIFY_TIME: '',
					IS_STORE: '',
					Nav_Files: []

				},
				peopleSelectOption: {
					showSelector: false,
					value: null,
					index: 0,
					defaultChecked: []
				},
				selectorInfo: {
					name: 'user',
					isMultiple: false,
					showPopup: false,
					totalCount: 0,
					title: '考核结果选择',
					dataItem: {},
					index: 0,
					columns: [],
					dataLists: [],
					defaultText: '',
					defaultChecked: []
				},
				comPickerInfo: {
					showSheet: false,
					dataItem: {},
					columns: [],
					title: '',
					dataIndex: undefined,
					formIndex: undefined,
					name: ''
				},
				dateTime: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM'),
				dateRecitifyTime: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM'),
				stepsText: ['发起', '审批', '归档'],
				stepsPage: 0,
				stepsPageList: 0,

				TaskID: '',

				showPopupMonitor: false,
				currentOperateMonitor: {},
				monitorLists: [],
				curTotalMonitor: 0,
				chooseCheckMonitor: '',
				chooseRecitify: '',
				STATUS: 0,
				enumsData: {}, // 存储所有枚举数据（键：枚举名称，值：处理后的枚举列表）
				enumsText: {} // 存储枚举文本列表（用于下拉选择等场景）

			}
		},
		onLoad(option) {
			this.TaskID = option.taskID ? option.taskID : '';
			this.ID = option.ID ? option.ID : '';
			this.fetchEnums(['SKProductionUnit', 'SKPLANCHECKFREQUENCYEnum', 'SKDepartmentTypeEnum',
				'SKHiddenLevel'
			]);
		},
		methods: {
			fetchEnums(enumNames) {
				var dataParm = {
					'name': enumNames.join('|')
				}
				GetEnumAnyOrder(dataParm).then(res => {
					let newd = transformData(res, enumNames)
					this.enumsData = newd[0];
					// 生成文本列表（如需要）
					this.enumsText = newd[1]
					this.loadData();
				})
			},
			goRiskDes() {
				if (!this.model.CHECK_CONTENTS_ID) {
					uni.showToast({
						title: '请先选择检查内容',
						icon: 'none'
					});
					return
				}
				uni.navigateTo({
					url: 'riskContentEdit?CHECK_CONTENTS_ID=' + this.model.CHECK_CONTENTS_ID
				})
			},
			loadData() {
				// const json = {}
				const orgId = uni.getStorageSync('orgId')
				const json = initFilter(orgId, "", "")
				extendRule(json, 'ID', 1, this.ID);
				extendInclude(json, 'Nav_Basics');
				extendInclude(json, 'Nav_ProductionUnit');
				extendInclude(json, 'Nav_Question');
				extendInclude(json, 'Nav_ApplyUser');
				extendInclude(json, 'Nav_Basics.Nav_Law');
				extendInclude(json, 'Nav_RiskArea');
				extendInclude(json, 'Nav_Reasons');
				extendInclude(json, 'Nav_Reasons.Nav_Reason');
				extendInclude(json, 'Nav_Contents');
				extendInclude(json, 'Nav_CheckType');
				extendInclude(json, 'Nav_RecitifyUser');
				extendInclude(json, 'Nav_Photos');
				extendInclude(json, 'Nav_Files');
				extendInclude(json, 'Nav_Files.Nav_ImgFile');
				extendInclude(json, 'Nav_Photos.Nav_ImgFile');
				extendIgnoreDataRule(json)

				// extendRule(json, 'TASK_ID', 1, this.TaskID);
				GetRiskVerifyReport(json).then(res => {
					this.stepLoad = false
					this.model = res;
					this.model.ID = this.ID
					this.model.RECITIFY_TIME = uni.$u.timeFormat(res.RECITIFY_TIME,
						'yyyy-mm-dd')
					this.stepsPage = res.STATUS == 0 ? 0 : res.STATUS == 20 ? 1 : res.STATUS == 10 ? 2 : 3
					// this.model.PLANCHECKFREQUENCYName = res.PLANCHECKFREQUENCY !== undefined ? this.enumsData['SKPLANCHECKFREQUENCYEnum'].find(item => item.code === res.PLANCHECKFREQUENCY).name : '';
					// this.model.DEPARTMENT_TYPEName = res.DEPARTMENT_TYPE !== undefined ? this.enumsData['SKDepartmentTypeEnum'].find(item => item.code === res.DEPARTMENT_TYPE).name : '';
					this.model.HIDDEN_LEVELName = res.HIDDEN_LEVEL !== undefined ? this.enumsData['SKHiddenLevel'].find(item => item.code === res.HIDDEN_LEVEL).name : '';
					let ReasonsNAME = ''
					if (res.Nav_Reasons && res.Nav_Reasons.length > 0) {
						for (let i = 0; i < res.Nav_Reasons.length; i++) {
							ReasonsNAME += (ReasonsNAME.length > 0 ? "," : "") + res
								.Nav_Reasons[i].Nav_Reason.NAME;
						}
					}
					this.model.ReasonsNAME = ReasonsNAME

				})
			},
			cancelRecitifyDate() {
				this.showPopupRecitifyDate = false
			},
			handleChangeRecitify() {
				this.showPopupRecitifyDate = true
			},
			confirmRecitifyDate(e) {
				this.model.RECITIFY_TIME = uni.$u.timeFormat(e.value,
					'yyyy-mm-dd ')
				this.dateRecitifyTime = uni.$u.timeFormat(e.value,
					'yyyy-mm-dd ')

				this.showPopupRecitifyDate = false
			},
			handleChange(name) {
				if (name == 'SKProductionUnit') {
					const json = initFilter(this.ORG_ID)
					getRequest(json, "/FM/UserProductionUnitSet/OrderPaged").then(res => {
						this.comPickerInfo = {
							showSheet: true,
							columns: [res],
							name: name
						}
					})


				} else {
					this.comPickerInfo = {
						showSheet: true,
						columns: [this.enumsText[name]],
						name: name
					}
				}


			},
			onConfirmPicker(e) {
				if (this.comPickerInfo.name == 'SKProductionUnit') {
					this.model.Nav_ProductionUnit = e.value[0]
					this.model.PRODUCTION_UNIT_ID = e.value[0].ID
				} else if (this.comPickerInfo.name == 'SKHiddenLevel') {
					this.model.HIDDEN_LEVELName = e.value[0]
					this.model.HIDDEN_LEVEL = this.enumsData['SKHiddenLevel'][e.indexs[0]].code
				} else if (this.comPickerInfo.name == 'SKDepartmentTypeEnum') {
					this.model.DEPARTMENT_TYPEName = e.value[0]
					this.model.DEPARTMENT_TYPE = this.enumsData['SKDepartmentTypeEnum'][e.indexs[0]].code
				} else if (this.comPickerInfo.name == 'SKPLANCHECKFREQUENCYEnum') {
					this.model.PLANCHECKFREQUENCYName = e.value[0]
					this.model.PLANCHECKFREQUENCY = this.enumsData['SKPLANCHECKFREQUENCYEnum'][e.indexs[0]].code
				}
				this.comPickerInfo = {
					showSheet: false,
					columns: [],
					title: '',
					formIndex: undefined
				}

			},
			async handleShowSheet(p) {
				const orgId = uni.getStorageSync('orgId')
				const json = initFilter(orgId, "", "", 0, p.pageIndex ?? 1)
				// const json = initFilter(this.ORG_ID, "", "", 0, p.pageIndex ?? 1)
				let dataSelect = []
				var defaultChecked = []
				this.selectorInfo.isMultiple = false


				if (p.val) {
					if (p.name == 'Nav_Question') {
						extendRule(json, 'DESCREPTION', 9, p.val);
					} else if (p.name == 'Nav_Contents') {
						extendRule(json, 'CHECKCONTENT', 9, p.val);
					} else {
						extendRule(json, 'NAME', 9, p.val);
					}
				}
				json.Limit = 20
				if (p.pageIndex) {
					json.Start = (p.pageIndex - 1) * json.Limit;
				}
				json.Sort = 'NAME'
				// json.SelectField = ["ID", "NAME", "NAME", "CODE"]
				// json.Sort = "NAME"
				// json.Order = 1
				if (p.name == 'Nav_RiskArea') {
					// extendRule(json, 'DEVICE_STATUS', 1, '1');
					dataSelect = await GetNewRiskAreaInfo(json).then(res => {
						this.selectorInfo.totalCount = res.TotalCount
						if (res != undefined && res.Data.length > 0) {
							for (let i = 0; i < res.Data.length; i++) {
								res.Data[i].name = res.Data[i].NAME
							}
						}
						return res.Data
					})
				} else if (p.name == 'Nav_Contents') {
					json.Sort = 'CHECKCONTENT'
					json.Order = 0
					dataSelect = await GetCheckContentsInfo(json).then(res => {
						this.selectorInfo.totalCount = res.TotalCount
						if (res != undefined && res.Data.length > 0) {
							for (let i = 0; i < res.Data.length; i++) {
								res.Data[i].name = res.Data[i].CHECKCONTENT
							}
						}
						return res.Data
					})
				} else if (p.name == 'Nav_Question') {
					if (this.model.CHECK_CONTENTS_ID && this.model.CHECK_CONTENTS_ID !== '') {
						extendRule(json, 'CHECK_CONTENTS_ID', 1, this.model.CHECK_CONTENTS_ID);
					}
					json.Sort = 'DESCREPTION'
					dataSelect = await GetHiddenScripList(json).then(res => {
						this.selectorInfo.totalCount = res.TotalCount
						if (res != undefined && res.Data.length > 0) {
							for (let i = 0; i < res.Data.length; i++) {
								res.Data[i].name = res.Data[i].DESCREPTION
							}
						}
						return res.Data
					})

				} else if (p.name == 'Nav_CheckType') {
					if (this.model.PRODUCTION_UNIT_ID) {
						extendRule(json, 'PRODUCTION_UNIT_ID', 1, this.model.PRODUCTION_UNIT_ID);
					}
					dataSelect = await CheckTypeNewOrderPaged(json).then(res => {
						this.selectorInfo.totalCount = res.TotalCount
						if (res != undefined && res.Data.length > 0) {
							for (let i = 0; i < res.Data.length; i++) {
								res.Data[i].name = res.Data[i].NAME
							}
						}
						return res.Data
					})

				} else if (p.name == 'Nav_RecitifyUser') {
					dataSelect = await getUserLists(json).then(res => {
						this.selectorInfo.totalCount = res.TotalCount
						if (res != undefined && res.Data.length > 0) {
							for (let i = 0; i < res.Data.length; i++) {
								res.Data[i].name = res.Data[i].NAME
							}
						}
						return res.Data
					})

				} else if (p.name == 'Nav_Reasons') {
					if (p.val) {
						extendRule(json, 'NAME', 9, p.val);
					}

					this.selectorInfo.isMultiple = true
					json.Sort = 'NAME'
					json.Limit = 20
					if (p.pageIndex) {
						json.Start = (p.pageIndex - 1) * json.Limit;
					}
					// extendRule(json, 'CHECKOBJECT', 1, this.model.CHECKOBJECT);
					dataSelect = await SKHiddenReason(json).then(res => {
						this.selectorInfo.totalCount = res.TotalCount
						if (res != undefined && res.Data != undefined && res.Data.length > 0) {
							for (let i = 0; i < res.Data.length; i++) {
								res.Data[i].name = res.Data[i].NAME
								// res[i].code = res[i].CODE
							}
						}
						return res.Data
					})
					if (this.model.Nav_Reasons.length > 0 && this.model.Nav_Reasons[0]
						.Nav_Reason != null) {
						// this.selectorInfo.defaultChecked = []
						this.model.Nav_Reasons.forEach(e => {
							defaultChecked.push(e.Nav_Reason)
						})
					} else {
						defaultChecked = null
					}
				}

				if (defaultChecked == null)
					defaultChecked = []
				if (dataSelect.length) {
					this.selectorInfo = {
						itemData: p.itemData != undefined ? p.itemData : this.selectorInfo
							.itemData, //itemData: p.itemData,  搜索的时候  p.itemData为空  赋值修改 为 她自己本身 this.selectorInfo.itemData
						isMultiple: this.selectorInfo.isMultiple,
						totalCount: this.selectorInfo.totalCount,
						showPopup: true,
						title: p.title,
						name: p.name,
						dataLists: dataSelect,
						defaultChecked: defaultChecked,
					}
				} else {
					// 暂无数据
				}
			},
			//数据加载
			handleSearch(val, pageIndex) {
				var p = {
					name: this.selectorInfo.name,
					title: this.selectorInfo.title,
					val: val,
					pageIndex: pageIndex,
				}
				this.handleShowSheet(p)
			},

			handleSelected(e) {
				this.selectorInfo.showPopup = false
				if (this.selectorInfo.name == 'Nav_RiskArea') {
					this.model.Nav_RiskArea = e;
					this.model.RISK_AREA_ID = e.ID;
				} else if (this.selectorInfo.name == 'Nav_Contents') {
					this.model.Nav_Contents = e;
					this.model.CHECK_CONTENTS_ID = e.ID;
				} else if (this.selectorInfo.name == 'Nav_Question') {
					console.log(e, '111')
					this.model.Nav_Question = e;
					this.model.CHECK_QUESTION_ID = e.ID;
					this.model.RECTIFICATION_MEASURES = e.DEMAND
					this.model.HIDDEN_LEVELName = e.QUESTION_LEVEL !== undefined ? this.enumsData['SKHiddenLevel'].find(item => item.code === e.QUESTION_LEVEL).name : '';
				} else if (this.selectorInfo.name == 'Nav_CheckType') {
					this.model.Nav_CheckType = e;
					this.model.CHECK_TYPE_ID = e.ID;
				} else if (this.selectorInfo.name == 'Nav_RecitifyUser') {
					this.model.Nav_RecitifyUser = e;
					this.model.RECITIFY_USER_ID = e.ID;
				} else if (this.selectorInfo.name == 'Nav_Reasons') {
					let listProject = []
					let projectShow = ''
					if (e.length > 0) {
						e.forEach((item, i) => {
							if (item.name != null || item.NAME != null) {
								if (i > 0) {
									projectShow += ' '
								}
								listProject.push({
									ID: guid(),
									HIDDEN_DANGER_CONFIRM_ID: this.model.ID,
									REASON_ID: item.ID,
									ORG_ID: item.ORG_ID,
									Nav_Reason: item
								})
								projectShow += item.NAME
							}
						})
					}
					this.model.Nav_Reasons = listProject
					this.model.ReasonsNAME = projectShow
				}


			},

			submit() {
				if (!this.model.Nav_RiskArea || !this.model.Nav_RiskArea.NAME) {
					uni.showToast({
						title: '请选择检查区域',
						icon: 'none'
					})
					return
				}
				if (this.model.Nav_Photos.length == 0) {
					uni.showToast({
						title: '请上传隐患照片',
						icon: 'none'
					})
					return
				}
				if (!this.model.Nav_Contents || !this.model.Nav_Contents.CHECKCONTENT) {
					uni.showToast({
						title: '请选择检查内容',
						icon: 'none'
					})
					return
				}

				if (!this.model.Nav_Question || !this.model.Nav_Question.DESCREPTION) {
					uni.showToast({
						title: '请选择隐患描述',
						icon: 'none'
					})
					return
				}
				if (!this.model.HIDDEN_LEVELName) {
					uni.showToast({
						title: '请选择隐患等级',
						icon: 'none'
					})
					return
				}

				// if (!this.model.DEPARTMENT_TYPEName) {
				// 	uni.showToast({
				// 		title: '请选择检查层级',
				// 		icon: 'none'
				// 	})
				// 	return
				// }
				// if (!this.model.Nav_CheckType||!this.model.Nav_CheckType.NAME) {
				// 	uni.showToast({
				// 		title: '请选择检查类型',
				// 		icon: 'none'
				// 	})
				// 	return
				// }
				// if (!this.model.PLANCHECKFREQUENCYName) {
				// 	uni.showToast({
				// 		title: '请选择检查周期',
				// 		icon: 'none'
				// 	})
				// 	return
				// }
				if (!this.model.Nav_RecitifyUser || !this.model.Nav_RecitifyUser.NAME) {
					uni.showToast({
						title: '请选择整改责任人',
						icon: 'none'
					})
					return
				}
				if (!this.model.RECITIFY_TIME) {
					uni.showToast({
						title: '请选择整改期限',
						icon: 'none'
					})
					return
				}
				// this.model = this.model

				this.modelEdit = JSON.parse(JSON.stringify(this.model))
				delete this.modelEdit.Nav_ApplyUser
				delete this.modelEdit.Nav_Basics
				delete this.modelEdit.Nav_Contents
				delete this.modelEdit.Nav_CheckType
				delete this.modelEdit.Nav_RiskArea
				delete this.modelEdit.Nav_RecitifyUser
				if (this.TaskID == null || this.TaskID == '') {
					this.modelEdit.TaskID = '00000000-0000-0000-0000-000000000000'
				} else {
					this.modelEdit.TaskID = this.TaskID
				}
				if (this.modelEdit.ORG_ID == null || this.modelEdit.ORG_ID == '')
					this.modelEdit.ORG_ID = this.ORG_ID

				this.modelEdit.PUBLISH = 'SaveAndNotify'
				// console.log(this.modelEdit,'this.modelEdit')
				HiddenVerifyFullUpdate(this.modelEdit).then(res => {
					if (res) {
						uni.$showMsgFunc('操作成功!', () => {
							uni.navigateBack()
						}, 'success', 1000)
					}
				})


			}

		}



	}
</script>

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