<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 style="font-size: 14px;" v-html="model.CONTEXT" border="surround" v-if="model.STATUS==40" disabled></u--textarea>
					<u-form-item required 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="检查区域:" @click="handleShowSheet({title: '检查区域', name: 'Nav_RiskArea'})">
						<u--input v-model="(model.Nav_RiskArea||{}).NAME" placeholder="请选择检查区域" suffixIcon="arrow-down" suffixIconStyle="font-size: 12px" disabled disabledColor="#ffffff" border="none" inputAlign="right"
							fontSize="14px">
						</u--input>
					</u-form-item>
					<u-form-item required label="检查内容:" @click="handleShowSheet({title: '检查内容', name: 'Nav_Contents'})">
						<u-icon style="margin-left: 4px;" slot="right" name="arrow-down" size="12">
						</u-icon>
					</u-form-item>
					<u-textarea v-model="(model.Nav_Contents||{}).CHECKCONTENT" disabled placeholder="请选择检查内容"></u-textarea>
					<u-form-item label="隐患地点:" prop="HIDDEN_PLACE">
						<u--input v-model="model.HIDDEN_PLACE" placeholder="请填写隐患地点" 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" @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="请选择隐患描述"></u-textarea>
					<u-form-item label="隐患具体描述：" prop="CHECK_TIME">
					
					</u-form-item>
					<u-textarea v-model="model.HIDDEN_DESCRIPTION"  placeholder="请填写隐患具体描述">
					</u-textarea>
					<u-form-item required label="隐患等级" prop="HIDDEN_LEVEL" @click="handleChange('SKHiddenLevel')">
						<u--input v-model="model.HIDDEN_LEVELNAME" disabled 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="整改措施" prop="HIDDEN_PLACE">
					
					</u-form-item>
					<u--textarea disabled autoHeight disabledColor="#fff" v-model="(model.Nav_Question||{}).DEMAND" border="none"></u--textarea>
					<u-form-item label="整改措施具体描述" prop="HIDDEN_PLACE">
					</u-form-item>
					<u-textarea v-model="model.REMARK" placeholder="请填写整改措施具体描述">
					</u-textarea>
					<u-form-item label="整改期限" prop="HIDDEN_PLACE" @click="showCheckDate(1)">
						<u--input v-model="model.RECITIFY_TIME" disabled placeholder="请选择整改期限" 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>
					<u-form-item required label="整改责任人:" @click="handleShowSheet({title: '整改责任人', name: 'Nav_RecitifyUser'})">
						<u--input v-model="(model.Nav_RecitifyUser||{}).NAME" disabled disabledColor="#ffffff" border="none" suffixIcon="arrow-down" suffixIconStyle="font-size: 12px" inputAlign="right" fontSize="14px">
						</u--input>
					</u-form-item>
					<u-form-item required label="验收人" prop="HIDDEN_PLACE" @click="handleShowSheet({title: '验收人', name: 'Nav_AcceptUser'})">
						<u--input v-model="(model.Nav_AcceptUser||{}).NAME" disabled 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--input v-model="model.RECTIFICATION_DESCRIPTION" placeholder="请填写整改情况描述" disabledColor="#ffffff" border="none" inputAlign="right" fontSize="14px">
						</u--input>
					</u-form-item>
					<u-form-item label="整改资金(万元):">
						<u--input v-model="model.RECTIFICATION_MONEY" placeholder="请填写整改资金" 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.COMPLETE_DATE" disabled  disabledColor="#ffffff" inputAlign="right" fontSize="14px" border="none">
						</u--input>
						
					</u-form-item>
					<view class="upload-title">整改前照片：</view>
					<full-upload v-model="model.Nav_RectifyPhotoas" :isShowBtn='true' :listProp='listPropUpload' :listPropVal='listPropValUpload' v-if="model.Nav_RectifyPhotoas"></full-upload>
					<view class="upload-title">整改后照片：</view>
					<full-upload v-model="model.Nav_RectifyPhotobs" :isShowBtn='true' :listProp='listPropUpload' :listPropVal='listPropValUpload' v-if="model.Nav_RectifyPhotobs"></full-upload>
					<view class="upload-title">预案或方案：</view>
					<full-upload v-model="model.Nav_RectifyFiles" :isShowBtn='true' :listProp='listPropUpload' :listPropVal='listPropValUpload' v-if="model.Nav_RectifyFiles"></full-upload>
					<view v-if="model.STATUS !== 0&&model.STATUS!==40">
						<u-form-item label="验收时间" prop="HIDDEN_PLACE" @click="showCheckDate(3)" v-if="model.STATUS !== 10">
							<u--input v-model="model.ACCEPT_DATE" disabled placeholder="请选择验收时间" 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>
						<u-form-item label="验收结论" prop="HIDDEN_LEVEL" @click="handleChange('SKAcceptResultEnum')">
							<u--input v-model="model.ACCEPT_RESULTENAME" disabled 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--input v-model="model.ACCEPT_OPINION" placeholder="请填写验收意见" disabledColor="#ffffff" border="none" inputAlign="right" fontSize="14px">
							</u--input>
						</u-form-item>
					</view>
					

				</u--form>

			</view>
			<view style="padding: 10px 16px;" class="bottom-button">
				<u-button type="primary" @click="submit" color="#3d4b70">提交</u-button>
			</view>
			<u-datetime-picker :show="dateTimePickerInfo.showCheckDate" v-model='dateTimePickerInfo.defaultDateTime' @confirm="handleCheckDate" @close="dateTimePickerInfo.showCheckDate = false"
				@cancel="dateTimePickerInfo.showCheckDate = false" :mode="dateTimePickerInfo.mode"></u-datetime-picker>
			<u-picker :show="comPickerInfo.showSheet" :columns="comPickerInfo.columns" @confirm="onConfirmPicker" @close="comPickerInfo.showSheet=false" @cancel="comPickerInfo.showSheet=false" keyName="NAME"></u-picker>
			<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,
		SKAcceptResultEnum,
		MineTypeIndex,
		MineTypeName
	} from '../../../../utils/enums.js'
	import {
		GetNewRiskAreaInfo,
		GetRiskVerifyRecodrReport,
		RectifyFullUpdateEdit,
		GetCheckContentsInfo,
		GetHiddenScripList,
		getUserLists,
		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 {
				showDelModalIndex: undefined,
				showDelModalIndex1: undefined,
				subsectionList: ['入库', '不入库', ],
				radiolist1: [{
					name: '是',
					disabled: false
				}, {
					name: '否',
					disabled: false
				}],

				listPropUpload: ['NOTIFY_ID'],
				listPropValUpload: [],
				ORG_ID: uni.getStorageSync('orgId'),
				model: {
					Product_Unit: '',
					Nav_RiskArea: {
						NAME: ''
					},
					RISK_AREA_ID: '',
					HIDDEN_PLACE: '',
					HIDDEN_DESCRIPTION: '',
					HIDDEN_LEVEL: '',
					RECTIFICATION_MEASURES: '',
					RECITIFY_TIME: '',
					Nav_AcceptUser: {
						NAME: ''
					},
					ACCEPT_USER_ID: '',
					RECTIFICATION_DESCRIPTION: '',
					RECTIFICATION_MONEY: '',
					COMPLETE_DATE: '',
					Nav_RectifyPhotoas: [],
					Nav_RectifyPhotobs: [],
					Nav_RectifyFiles: [],
					ACCEPT_DATE: '',
					ACCEPT_RESULTE: '',
					ACCEPT_OPINION: '',

				},
				comPickerInfo: {
					showSheet: false,
					dataItem: {},
					columns: [],
					title: '',
					dataIndex: undefined,
					formIndex: undefined,
					name: ''
				},
				selectorInfo: {
					name: 'user',
					isMultiple: false,
					showPopup: false,
					totalCount: 0,
					title: '考核结果选择',
					dataItem: {},
					index: 0,
					columns: [],
					dataLists: [],
					defaultText: '',
					defaultChecked: []
				},
				dateTimePickerInfo: {
					showCheckDate: false,
					dataIndex: undefined,
					defaultDateTime: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM:ss'),
					value: '',
					name: '',
					mode: ''
				},
				stepsText: ['发起', '确认', '审批', '归档'],
				stepsPage: 0,
				stepsPageList: 0,
				TaskID: '',
				enumsData: {}, // 存储所有枚举数据（键：枚举名称，值：处理后的枚举列表）
				enumsText: {} // 存储枚举文本列表（用于下拉选择等场景）

			}
		},
		onLoad(option) {
			this.TaskID = option.taskID ? option.taskID : '';
			this.ID = option.ID ? option.ID : '';
			this.fetchEnums(['SKProductionUnit', 'SKHiddenLevel', 'SKAcceptResultEnum']);
		},
		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();
				})
			},
			loadData() {
				// const json = {}
				const orgId = uni.getStorageSync('orgId')
				const json = initFilter(orgId, "", "")
				extendRule(json, 'ID', 1, this.ID);
				extendInclude(json, 'Nav_RiskArea');
				extendInclude(json, 'Nav_ProductionUnit');
				extendInclude(json, 'Nav_Question');
				extendInclude(json, 'Nav_Contents');
				extendInclude(json, 'Nav_AcceptUser');
				extendInclude(json, 'Nav_RectifyFiles.Nav_ImgFile');
				extendInclude(json, 'Nav_RectifyPhotobs.Nav_ImgFile');
				extendInclude(json, 'Nav_RectifyPhotoas.Nav_ImgFile');
				extendIgnoreDataRule(json)
				// extendRule(json, 'TASK_ID', 1, this.TaskID);
				GetRiskVerifyRecodrReport(json).then(res => {
					this.model = res;
					this.model.RECITIFY_TIME = uni.$u.timeFormat(res.RECITIFY_TIME,
						'yyyy-mm-dd')
					this.model.COMPLETE_DATE =res.COMPLETE_DATE? uni.$u.timeFormat(res.COMPLETE_DATE,
						'yyyy-mm-dd'):''
					this.model.ACCEPT_DATE = uni.$u.timeFormat(res.ACCEPT_DATE,
						'yyyy-mm-dd')
						let ReasonsNAME = ''
						if (this.model.Nav_RectifyReasons && this.model.Nav_RectifyReasons.length > 0) {
							for (let i = 0; i < this.model.Nav_RectifyReasons.length; i++) {
								ReasonsNAME += (ReasonsNAME.length > 0 ? "," : "") + this.model
									.Nav_RectifyReasons[i].Nav_Reason.NAME;
							}
						}
						this.model.ReasonsNAME = ReasonsNAME
					this.model.HIDDEN_LEVELNAME = res.HIDDEN_LEVEL !== undefined ? this.enumsData['SKHiddenLevel'].find(item => item.code === res.HIDDEN_LEVEL).name : '';
					this.model.ACCEPT_RESULTENAME = res.ACCEPT_RESULTE !== undefined ? this.enumsData['SKAcceptResultEnum'].find(item => item.code === res.ACCEPT_RESULTE).name : '';
					this.stepsPage = res.STATUS == 0 || res.STATUS == 40 ? 0 : res.STATUS == 10 ? 1 : res.STATUS == 20 ? 2 : 3

				})
			},
			showCheckDate(dataIndex, item) {
				// let date = new Date()
				// this.dateTimePickerInfo.showCheckDate = true
				this.dateTimePickerInfo = {
					showCheckDate: true,
					defaultDateTime: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd'),
					dataIndex: dataIndex,
					item: item,
					mode: 'date'
				}
			},
			//隐藏控件 显示时间
			handleCheckDate(e) {

				if (this.dateTimePickerInfo.dataIndex == 1) {
					this.model.RECITIFY_TIME = uni.$u.timeFormat(e.value,
						'yyyy-mm-dd')
				} else if (this.dateTimePickerInfo.dataIndex == 2) {
					this.model.COMPLETE_DATE = uni.$u.timeFormat(e.value,
						'yyyy-mm-dd')
				} else if (this.dateTimePickerInfo.dataIndex == 3) {
					this.model.ACCEPT_DATE = uni.$u.timeFormat(e.value,
						'yyyy-mm-dd')
				}
				this.dateTimePickerInfo.showCheckDate = 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.enumsData[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].name
					this.model.HIDDEN_LEVEL = this.enumsData['SKHiddenLevel'][e.indexs[0]].code
				} else if (this.comPickerInfo.name == 'SKAcceptResultEnum') {
					this.model.ACCEPT_RESULTENAME = e.value[0].name
					this.model.ACCEPT_RESULTE = this.enumsData['SKAcceptResultEnum'][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




				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') {
					if (p.val) {
						extendRule(json, 'NAME', 9, p.val);
					}
					// 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') {
					if (p.val) {
						extendRule(json, 'CHECKCONTENT', 9, p.val);
					}
					json.Sort = 'CHECKCONTENT'
					// extendRule(json, 'DEVICE_STATUS', 1, '1');
					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 (p.val) {
						extendRule(json, 'DESCREPTION', 9, p.val);
					}
					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'
					// extendRule(json, 'DEVICE_STATUS', 1, '1');
					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_AcceptUser'||p.name == 'Nav_RecitifyUser') {
					if (p.val) {
						extendRule(json, 'NAME', 9, p.val);
					}

					// extendRule(json, 'DEVICE_STATUS', 1, '1');
					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_RectifyReasons.length > 0 && this.model.Nav_RectifyReasons[0]
						.Nav_Reason != null) {
						// this.selectorInfo.defaultChecked = []
						this.model.Nav_RectifyReasons.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,
						index: p.index
					}
				} else {
					// 暂无数据
				}
			},
			//数据加载
			handleSearch(val, pageIndex) {
				var p = {
					name: this.selectorInfo.name,
					title: this.selectorInfo.title,
					val: val,
					pageIndex: pageIndex,
					index: this.selectorInfo.index
				}
				this.handleShowSheet(p)
			},

			handleSelected(e) {
				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') {
					this.model.Nav_Question = e;
					this.model.CHECK_QUESTION_ID = e.ID;
				} else if (this.selectorInfo.name == 'Nav_AcceptUser') {
					this.model.Nav_AcceptUser = e;
					this.model.ACCEPT_USER_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_RECTIFY_NOTICE_DETAIL_ID: this.ID,
									REASON_ID: item.ID,
									ORG_ID: item.ORG_ID,
									Nav_Reason: item
								})
								projectShow += item.NAME
							}
						})
					}
					this.model.Nav_RectifyReasons = listProject
					this.model.ReasonsNAME = projectShow
				}
				this.selectorInfo.showPopup = false

			},


			submit() {
				if (!this.model.PRODUCTION_UNIT_ID) {
					uni.showToast({
						title: '请选择生产单元',
						icon: 'none'
					})
					return
				}
				if (!this.model.Nav_RiskArea || !this.model.Nav_RiskArea.NAME) {
					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.HIDDEN_LEVELNAME) {
					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.Nav_AcceptUser || !this.model.Nav_AcceptUser.NAME) {
					uni.showToast({
						title: '请选择验收人',
						icon: 'none'
					})
					return
				}
				if (!this.model.Nav_RectifyPhotobs || this.model.Nav_RectifyPhotobs.length == 0) {
					uni.showToast({
						title: '请上传整改后照片',
						icon: 'none'
					})
					return
				}

				this.modelEdit = JSON.parse(JSON.stringify(this.model))
				delete this.modelEdit.Nav_ProductionUnit
				delete this.modelEdit.Nav_AcceptUser
				delete this.modelEdit.Nav_ApplyDepartment
				delete this.modelEdit.Nav_ApplyUser
				delete this.modelEdit.Nav_CheckType
				delete this.modelEdit.Nav_Contents
				delete this.modelEdit.Nav_ImplementUser
				delete this.modelEdit.Nav_Question
				delete this.modelEdit.Nav_RecitifyUser
				delete this.modelEdit.Nav_RiskArea
				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'
				RectifyFullUpdateEdit(this.modelEdit).then(res => {
					if (res) {
						uni.$showMsgFunc('操作成功!', () => {
							uni.navigateBack()
						}, 'success', 1000)
					}
				})


			}

		}



	}
</script>

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