<template>
	<view style="padding-bottom: 80px;" :class="{ 'is-popup': isPopupMode }">
		<view class="card">
			<view class="background" v-if="!isPopupMode"></view>
			<u--form labelPosition="left" labelWidth="auto" labelAlign="center" :model="model" 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="Nav_User.NAME" borderBottom>
					<u--input disabledColor="#fff" v-model="(model.Nav_Company||{}).NAME" disabled fontSize="14px" customStyle="margin:0px;display:flex;padding:3px 0px" border="none" inputAlign="right">
					</u--input>
				</u-form-item>
				<u-form-item label="生产单元：" prop="Nav_User.NAME" borderBottom>
					<u--input disabledColor="#fff" v-model="(model.Nav_ProductionUnit||{}).NAME" disabled fontSize="14px" customStyle="margin:0px;display:flex;padding:3px 0px" border="none" inputAlign="right">
					</u--input>
				</u-form-item>
				<u-form-item label="发起时间：" prop="Nav_User.NAME" borderBottom>
					<u--input disabledColor="#fff" v-model="model.CREATE_TIME" disabled fontSize="14px" customStyle="margin:0px;display:flex;padding:3px 0px" border="none" inputAlign="right">
					</u--input>
				</u-form-item>
				<u-form-item label="发起部门：" prop="Nav_User.NAME" borderBottom>
					<u--input disabledColor="#fff" v-model="(model.Nav_ApplyDepartment||{}).NAME" disabled fontSize="14px" customStyle="margin:0px;display:flex;padding:3px 0px" border="none" inputAlign="right">
					</u--input>
				</u-form-item>
				<u-form-item label="发起人：" prop="Nav_User.NAME" borderBottom>
					<u--input disabledColor="#fff" v-model="(model.Nav_ApplyUser||{}).NAME" disabled fontSize="14px" customStyle="margin:0px;display:flex;padding:3px 0px" border="none" inputAlign="right">
					</u--input>
				</u-form-item>
				<u-form-item label="工作票编号：" prop="Nav_User.NAME" borderBottom>
					<u--input disabledColor="#fff" v-model="model.CODE" disabled fontSize="14px" customStyle="margin:0px;display:flex;padding:3px 0px" border="none" inputAlign="right">
					</u--input>
				</u-form-item>
				<u-form-item label="作业名称：" prop="Nav_User.NAME" borderBottom>
					<u--input disabledColor="#fff" v-model="(model.Nav_OperationStep||{}).NAME" disabled fontSize="14px" customStyle="margin:0px;display:flex;padding:3px 0px" border="none" inputAlign="right">
					</u--input>
				</u-form-item>
				<u-form-item label="审批层级：" prop="Nav_User.NAME" borderBottom>
					<u--input disabledColor="#fff" v-model="model.AUDIT_LEVELName" disabled fontSize="14px" customStyle="margin:0px;display:flex;padding:3px 0px" border="none" inputAlign="right">
					</u--input>
				</u-form-item>
				<u-form-item label="作业风险等级：" prop="Nav_User.NAME" borderBottom>
					<u--input disabledColor="#fff" v-model="model.EVALUATE_LEVELName" disabled fontSize="14px" customStyle="margin:0px;display:flex;padding:3px 0px" border="none" inputAlign="right">
					</u--input>
				</u-form-item>

				<u-form-item label="动火部门：" prop="Nav_User.NAME" borderBottom>
					<u--input disabledColor="#fff" v-model="(model.Nav_FireDepartment||{}).NAME" disabled fontSize="14px" customStyle="margin:0px;display:flex;padding:3px 0px" border="none" inputAlign="right">
					</u--input>
				</u-form-item>
				<u-form-item label="动火部门负责人：" prop="Nav_User.NAME" borderBottom>
					<u--input disabledColor="#fff" v-model="(model.Nav_FireUser||{}).NAME" disabled fontSize="14px" customStyle="margin:0px;display:flex;padding:3px 0px" border="none" inputAlign="right">
					</u--input>
				</u-form-item>
				<u-form-item label="安全生产管理人员：" prop="Nav_User.NAME" borderBottom>
					<u--input disabledColor="#fff" v-model="(model.Nav_SafeUser||{}).NAME" disabled fontSize="14px" customStyle="margin:0px;display:flex;padding:3px 0px" border="none" inputAlign="right">
					</u--input>
				</u-form-item>
				<u-form-item label="动火区域：" prop="Product_Unit" borderBottom>
					<u--input v-model="(model.Nav_Area||{}).NAME" disabled disabledColor="#ffffff" border="none" inputAlign="right" fontSize="14px">
					</u--input>
				</u-form-item>
				<u-form-item label="动火地点" prop="LOCATION" borderBottom>
					<u--input disabled disabledColor="#ffffff" v-model="model.JOB_LOCATION" border="none" inputAlign="right" fontSize="14px"></u--input>
				</u-form-item>
				<u-form-item label="动火方式：" prop="Nav_Type" borderBottom>
					<u--input v-model="(model.Nav_Type||{}).NAME" disabled disabledColor="#ffffff" border="none" inputAlign="right" fontSize="14px">
					</u--input>
				</u-form-item>
				<u-form-item label="动火具体事项" prop="LOCATION" borderBottom>
					<u--input disabled disabledColor="#ffffff" v-model="model.JOB_CONTENT" border="none" inputAlign="right" fontSize="14px"></u--input>
				</u-form-item>
				<u-form-item label="动火计划开始时间" prop="CHECKDATETIME" borderBottom>
					<u--input disabled disabledColor="#fff" v-model="model.JOB_DATE" border="none" inputAlign="right" fontSize="14px"></u--input>

				</u-form-item>
				<u-form-item label="动火计划结束时间" prop="ENDTIME" borderBottom>
					<u--input disabled disabledColor="#fff" v-model="model.JOB_END_DATE" border="none" inputAlign="right" fontSize="14px"></u--input>

				</u-form-item>
				<u-form-item label="存在的风险">
					<!-- <u-icon name="arrow-down" size="12" slot="right"></u-icon> -->
				</u-form-item>
				<view class="tag-view" v-if="model.Nav_Risks">
					<uni-tag class="tag" v-for="(i, k) in model.Nav_Risks.filter(i => !i.IS_DELETED)" :key="k" :inverted="true" :text="i.RISK_NAME" type="primary" />
				</view>
				<view class="upload-title">附件：</view>
				<full-upload v-model="model.Nav_Files" :isShowBtn='false'></full-upload>
			</u--form>
			<u--form labelPosition="left" labelWidth="auto" labelAlign="center" errorType="border-bottom" ref="sForm" class="sub-form" style="margin-top: 20px;" v-if="model.Nav_Details.length>0">
				<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>
				<uni-collapse :border="false" accordion>
					<view v-for="(item, index) in model.Nav_Users" :key="index">
						<uni-collapse-item title-border="none" :border="false">
							<template v-slot:title>
								<view class="uni-collapse-item__title-box">
									<view class="uni-collapse-item__title-text">
										{{item.Nav_User?index+1+'.'+item.Nav_User.NAME:index+1+'.'}}
									</view>
									<view @click.stop style="margin-right: 10px;">
										<!-- <u-icon @click="handleDelRowBefore(index)" name="trash" color="#ff4d4f" size="21" style="margin-right: 10px;"></u-icon> -->
										<!-- <u-icon name="arrow-down" size="12"></u-icon> -->
									</view>
								</view>
							</template>
							<view class="content">
								<u-form-item label="作业人员类别" prop="CERTIFICATE_TYPE_SHOW" borderBottom>
									<u--input disabled disabledColor="#fff" v-model="(item.Nav_UserType||{}).NAME" inputAlign="right" fontSize="14px" customStyle="margin:0px;display:flex;padding:3px 9px"
										border="none"></u--input>
								</u-form-item>
								<u-form-item label="姓名" prop="personName" borderBottom>
									<u--input disabled disabledColor="#fff" v-model="(item.Nav_User||{}).NAME" inputAlign="right" fontSize="14px" customStyle="margin:0px;display:flex;padding:3px 9px" border="none">
									</u--input>
								</u-form-item>
								<!-- <u-form-item label="证件名称" prop="certificateName"  borderBottom>
								<u--input disabled disabledColor="#fff" v-model="(item.Nav_Train||{}).CERTIFICATE_NAME" inputAlign="right"  fontSize="14px" customStyle="margin:0px;display:flex;padding:3px 9px" border="none"></u--input>
							</u-form-item> -->
								<u-form-item label="证书编号" prop="CertificateCode" borderBottom>
									<u--input disabled disabledColor="#fff" inputAlign="right" v-model="item.CERTIFICATE_CODE" fontSize="14px" border="none"
										customStyle="margin:0px;display:flex;padding:3px 9px;"></u--input>
								</u-form-item>
								<view class="upload-title">附件：</view>
								<full-upload v-model="item.Nav_UserFiles" :isShowBtn='false'></full-upload>

							</view>


						</uni-collapse-item>
					</view>
				</uni-collapse>
			</u--form>
			<u--form labelPosition="left" labelWidth="auto" labelAlign="center" errorType="border-bottom" ref="sForm" class="sub-form" style="margin-top: 20px;" v-if="model.Nav_Details.length>0">
				<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>
				<uni-collapse :border="false" accordion>
					<view v-for="(item, index) in model.Nav_Details" :key="index">
						<uni-collapse-item title-border="none" :border="false">
							<template v-slot:title>
								<view class="uni-collapse-item__title-box">
									<view class="uni-collapse-item__title-text">
										{{item.CONTENT?index+1+'.'+item.JOB_STEPName+'--'+item.CONTENT:index+1+'.'}}
									</view>
									<view @click.stop style="margin-right: 10px;">
										<!-- <u-icon @click="handleDelRowBefore(index)" name="trash" color="#ff4d4f" size="21" style="margin-right: 10px;"></u-icon> -->
										<!-- <u-icon name="arrow-down" size="12"></u-icon> -->
									</view>
								</view>
							</template>
							<view class="content">
								<u-form-item label="顺序：" prop="Nav_User.NAME" @ borderBottom>
									<u--input disabled disabledColor="#fff" v-model="item.NUM" type="number" fontSize="14px" customStyle="margin:0px;display:flex;padding:3px 0px" border="none" inputAlign="right">
									</u--input>
								</u-form-item>
								<u-form-item label="作业阶段：" prop="Nav_User.NAME" borderBottom>
									<u--input disabledColor="#fff" v-model="item.JOB_STEPName" disabled fontSize="14px" customStyle="margin:0px;display:flex;padding:3px 0px" border="none" inputAlign="right">
									</u--input>
								</u-form-item>
								<u-form-item label="作业流程及安全措施：">

								</u-form-item>
								<u--textarea disabled v-model="item.CONTENT" border="surround"></u--textarea>
								<view v-if="model.STATUS==30">
									<u-form-item label="是否确认：" prop="Nav_User.NAME" borderBottom>
										<u-switch v-model="item.IS_CONFIRM_NEW" size="18" disabled slot="right"></u-switch>
									</u-form-item>
									<view class="upload-title">附件：</view>
									<full-upload v-model="item.Nav_DetailFiles" :isShowBtn='false'></full-upload>


								</view>

							</view>


						</uni-collapse-item>
					</view>
				</uni-collapse>
			</u--form>
			<u--form v-if="model.STATUS==30||model.FIRE_STATUS>15" labelPosition="left" labelWidth="auto" labelAlign="center" :model="model" 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>


				<view v-if="model.STATUS==30">
					<u-form-item label="动火作业现场条件验收情况：" prop="Nav_User.NAME" borderBottom>
						<u--input disabledColor="#fff" v-model="model.COMPLETED_CONDITION" disabled fontSize="14px" customStyle="margin:0px;display:flex;padding:3px 0px" border="none" inputAlign="right">
						</u--input>
					</u-form-item>
					<u-form-item label="是否可以动火：" prop="Nav_User.NAME" borderBottom>
						<u--input disabledColor="#fff" v-model="model.IS_FIREName" disabled fontSize="14px" customStyle="margin:0px;display:flex;padding:3px 0px" border="none" inputAlign="right">
						</u--input>
					</u-form-item>
					<u-form-item label="动火实际开始时间：" prop="Nav_User.NAME" borderBottom>
						<u--input disabledColor="#fff" v-model="model.ACT_DATE" disabled fontSize="14px" customStyle="margin:0px;display:flex;padding:3px 0px" border="none" inputAlign="right">
						</u--input>
					</u-form-item>
					<view class="upload-title">现场条件验收附件：</view>
					<full-upload v-model="model.Nav_FireFiles" :isShowBtn='false'></full-upload>
					<u-form-item label="矿调度室人员：" prop="Nav_User.NAME" borderBottom>
						<u--input disabledColor="#fff" v-model="(model.Nav_DispatchUser||{}).NAME" disabled fontSize="14px" customStyle="margin:0px;display:flex;padding:3px 0px" border="none" inputAlign="right">
						</u--input>
					</u-form-item>
					<u-form-item label="动火部门负责人签名">
					</u-form-item>
					<image style="width: 150px;height: 60px;" :src="imgurl+model.Nav_FireUser.FILE_PATH" v-if='model.USER_DEAL_STATUS== 1'>
					</image>
					<u-form-item label="安全管理人员签名">
					</u-form-item>
					<image style="width: 150px;height: 60px;" :src="imgurl+model.Nav_SafeUser.FILE_PATH" v-if='model.SAFE_DEAL_STATUS== 1'>
					</image>
					<u-form-item label="矿调度人员签名">
					</u-form-item>
					<image style="width: 150px;height: 60px;" :src="imgurl+model.Nav_DispatchUser.FILE_PATH" v-if='model.DISPATCH_DEAL_STATUS== 1'>
					</image>

				</view>
				<view v-if="model.FIRE_STATUS>15">
					<u-form-item label="动火作业完工验收情况：" prop="Nav_User.NAME" borderBottom>
						<u--input disabledColor="#fff" v-model="model.COMPLETED_CONTENT" disabled fontSize="14px" customStyle="margin:0px;display:flex;padding:3px 0px" border="none" inputAlign="right">
						</u--input>
					</u-form-item>
					<u-form-item label="是否可以撤离：" prop="Nav_User.NAME" borderBottom>
						<u--input disabledColor="#fff" v-model="model.IS_LEAVEName" disabled fontSize="14px" customStyle="margin:0px;display:flex;padding:3px 0px" border="none" inputAlign="right">
						</u--input>
					</u-form-item>
					<u-form-item label="动火实际结束时间：" prop="Nav_User.NAME" borderBottom>
						<u--input disabledColor="#fff" v-model="model.ACT_END_DATE" disabled fontSize="14px" customStyle="margin:0px;display:flex;padding:3px 0px" border="none" inputAlign="right">
						</u--input>
					</u-form-item>
					<u-form-item label="离开现场时间：" prop="Nav_User.NAME" borderBottom>
						<u--input disabledColor="#fff" v-model="model.LEAVE_DATE" disabled fontSize="14px" customStyle="margin:0px;display:flex;padding:3px 0px" border="none" inputAlign="right">
						</u--input>
					</u-form-item>
					<view class="upload-title">完工验收附件：</view>
					<full-upload v-model="model.Nav_MonitorFiles" :isShowBtn='false'></full-upload>
					<u-form-item label="动火部门负责人签字">
					</u-form-item>
					<image style="width: 150px;height: 60px;" :src="imgurl+model.Nav_FireUser.FILE_PATH" v-if='model.USER_DEAL_FINISH_STATUS== 1'>
					</image>
					<u-form-item label="安全生产管理人员签字">
					</u-form-item>
					<image style="width: 150px;height: 60px;" :src="imgurl+model.Nav_SafeUser.FILE_PATH" v-if='model.SAFE_DEAL_FINISH_STATUS== 1'>
					</image>

				</view>
			</u--form>

		</view>
		<audit-process :show="showAudit" @close="handleCloseAudit" :dataSource="auditData" />
		<check-action v-if="isLoadOK && tableKeyLocal === '1'&&isAuditLocal==='true' " :okApi="okApiLocal" :refuseApi="refuseApiLocal" :dataSource="$store.state.auditModel"></check-action>
		<view class="bottom-button" v-if="!isPopupMode">
			<u-button type="primary" class="bottom" v-if="isLoadOK&&tableKeyLocal==='1'&&!isAuditLocal" @click="onTableBtnAgree" color="#3d4b70">审阅</u-button>
			<!-- <button type="primary" class="bottom" v-if='isLoadOK&&tableKey==1' @click="onTableBtnAgree">签到</button> -->
		</view>
	</view>
</template>

<script>
	import {
		initFilter,
		extendRule,
		extendInclude,
		transformData
	} from '../../../../utils/common'

	import {
		getRequest,
	} from '../../../../services/apply/FOServices/FOServices'

	import '../../../../utils/showMsg.js'
	import color from '../../../../uni_modules/uview-ui/libs/config/color'
	import config from '../../../../config/common'
	import {
		getEnum,
		GetEnumAnyOrder
	} from '../../../../services/common';

	export default {
		// 添加 props 接收外部传入的参数
		props: {
			// 动火工作票ID
			id: {
				type: [String, Number],
				default: null
			},
			// 是否为弹窗模式
			isPopupMode: {
				type: Boolean,
				default: false
			},
			// 任务ID
			taskID: {
				type: String,
				default: ''
			},
			// 表格标识
			tableKey: {
				type: [String, Number],
				default: '0'
			},
			// 审批相关
			okApi: {
				type: String,
				default: ''
			},
			refuseApi: {
				type: String,
				default: ''
			},
			approveID: {
				type: String,
				default: ''
			},
			isAudit: {
				type: [String, Boolean],
				default: false
			}
		},
		data() {
			return {
				imgurl: config.uni_app_web_api_url + ':5199',
				model: {
					Nav_ApplyUser: {
						NAME: ''
					},
					Nav_ApplyDepartment: {
						NAME: ''
					},
					Nav_ProductionUnit: {
						NAME: ''
					},
					Nav_OperationStep: {
						NAME: ''
					},
					Nav_FireDepartment: {
						NAME: ''
					},
					Nav_FireUser: {
						NAME: ''
					},
					Nav_SafeUser: {
						NAME: ''
					},
					Nav_Area: {
						NAME: ''
					},
					Nav_Type: {
						NAME: ''
					},
					IS_HOLIDAY: false,
					IS_HOLIDAYName: '否',
					EVALUATE_LEVEL: '',
					EVALUATE_LEVELName: '',
					JOB_LOCATION: '',
					JOB_CONTENT: '',
					JOB_DATE: '',
					JOB_END_DATE: '',
					Nav_Users: [],
					Nav_Risks: [],
					Nav_Details: [],
					Nav_Files: [],
					Nav_FireFiles: [],
					Nav_MonitorFiles: [],
					Nav_DispatchUser: {
						NAME: ''
					},


				},
				listPropUpload: ['PRE_SHIFT_MEETING_RECORD_ID'],
				listPropValUpload: [],
				TaskID: "",
				tableKeyLocal: '0',
				okApiLocal: '',
				refuseApiLocal: '',
				isAuditLocal: false,
				isLoadOK: false,
				showAudit: false,
				auditData: [],
				ID: '',
				enumsData: {}, // 存储所有枚举数据（键：枚举名称，值：处理后的枚举列表）
				enumsText: {} // 存储枚举文本列表（用于下拉选择等场景）
			}
		},
		// 页面加载时调用（仅页面模式）
		onLoad(option) {
			if (option && option.ID) {
				this.ID = option.ID;
				this.TaskID = option.taskID || '';
				this.tableKeyLocal = option.tableKey ? option.tableKey : '0'
				this.okApiLocal = option.okApi || ''
				this.refuseApiLocal = option.refuseApi || ''
				this.ApproveID = option.approveID || ''
				this.isAuditLocal = option.isAudit || false
				
				if (this.isAuditLocal && this.TaskID) {
					this.$store.commit('setAuditModel', {
						...this.$store.state.auditModel,
						TaskID: this.TaskID
					})
				}
				
				this.fetchEnums(['HMOperationTaskAuditEnum', 'SKEvaluateLevelEnum', 'FOJobStepEnum', 'FOYesOrNoEnum']);
			}
		},
		watch: {
			// 监听 props 的 id 变化，用于弹窗模式
			id: {
				immediate: true,
				handler(val) {
					if (val && !this.ID) {
						this.ID = val;
						this.TaskID = this.taskID || '';
						this.tableKeyLocal = this.tableKey || '0'
						this.okApiLocal = this.okApi || ''
						this.refuseApiLocal = this.refuseApi || ''
						this.isAuditLocal = this.isAudit || false
						
						if (this.isAuditLocal && this.TaskID) {
							this.$store.commit('setAuditModel', {
								...this.$store.state.auditModel,
								TaskID: this.TaskID
							})
						}
						
						this.fetchEnums(['HMOperationTaskAuditEnum', 'SKEvaluateLevelEnum', 'FOJobStepEnum', 'FOYesOrNoEnum']);
					}
				}
			}
		},
		mounted() {
			// 如果 props 有 id 且 onLoad 未处理，在这里处理
			if (this.id && !this.ID) {
				this.ID = this.id;
				this.TaskID = this.taskID || '';
				this.tableKeyLocal = this.tableKey || '0'
				this.okApiLocal = this.okApi || ''
				this.refuseApiLocal = this.refuseApi || ''
				this.isAuditLocal = this.isAudit || false
				
				if (this.isAuditLocal && this.TaskID) {
					this.$store.commit('setAuditModel', {
						...this.$store.state.auditModel,
						TaskID: this.TaskID
					})
				}
				
				this.fetchEnums(['HMOperationTaskAuditEnum', 'SKEvaluateLevelEnum', 'FOJobStepEnum', 'FOYesOrNoEnum']);
			}
		},
		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();
					this.loadAuditData()
				}).catch(err => {
					console.error('获取枚举数据失败:', err)
				})

			},
			loadData() {
				if (!this.ID) {
					console.warn('jobFireShow: 未获取到 ID')
					return
				}
				const orgId = uni.getStorageSync('orgId')
				const json = initFilter(orgId, "", "CODE", 1)
				extendRule(json, 'ID', 1, this.ID);
				getRequest(json, "/FO/FOFireJob/GetEdit").then(res => {
					this.model = res
					this.model.EVALUATE_LEVELName = res.EVALUATE_LEVEL !== '' && res.EVALUATE_LEVEL !== undefined ? this.enumsData['SKEvaluateLevelEnum'].find(item => item.code === res.EVALUATE_LEVEL).name : ''
					this.model.AUDIT_LEVELName = res.AUDIT_LEVEL !== '' && res.AUDIT_LEVEL !== undefined ? this.enumsData['HMOperationTaskAuditEnum'].find(item => item.code === res.AUDIT_LEVEL).name : ''
					this.model.IS_FIREName = res.IS_FIRE !== '' && res.IS_FIRE !== undefined ? this.enumsData['FOYesOrNoEnum'].find(item => item.code === res.IS_FIRE).name : ''
					this.model.IS_LEAVEName = res.IS_LEAVE !== '' && res.IS_LEAVE !== undefined ? this.enumsData['FOYesOrNoEnum'].find(item => item.code === res.IS_LEAVE).name : ''
					if (this.model.Nav_Details && this.model.Nav_Details.length > 0) {
						this.model.Nav_Details.map(item => {
							item.JOB_STEPName = item.JOB_STEP !== '' && item.JOB_STEP !== undefined ? this.enumsData['FOJobStepEnum'].find(item1 => item1.code === item.JOB_STEP).name : ''
						})
					}
					this.isLoadOK = true;
				}).catch(err => {
					console.error('获取动火工作票数据失败:', err)
					uni.$showErrorInfo('获取动火工作票数据失败')
				})
			},
			onTableBtnAgree() {
				let json = {};
				json.ID = this.ID;
				json.TaskID = this.TaskID;
				getRequest(json, "/FO/FOFireJob/IdentityUpdate").then(res => {
					if (res) {
						uni.$showMsgFunc('操作成功!', () => {
							uni.navigateBack()
						}, 'success', 1000)
					}
				})

			},
			loadAuditData() {
				if (!this.ID) {
					return Promise.resolve([])
				}
				const orgId = uni.getStorageSync('orgId')
				const json = initFilter(orgId, this.ID, "CODE", 1)
				return new Promise((resolve, reject) => {
					getRequest(json, "/PF/Approve/GetApproveInfo").then(res => {
						if (res && res.length > 0) {
							if (res[0].Nav_ApproveDetails && res[0].Nav_ApproveDetails.length > 0) {
								res[0].Nav_ApproveDetails.sort((a, b) => a.NUM - b.NUM)
							}
							this.auditData = res
							resolve(res)
						} else {
							this.auditData = []
							resolve([])
						}
					}).catch(err => {
						console.error('获取审批数据失败:', err)
						reject(err)
					})
				})
			},
			handleCloseAudit() {
				this.showAudit = false
			},
			async onNavigationBarButtonTap() {
				this.showAudit = true
			}
		},
		computed: {

		}
	}
</script>

<style>
	@import url("../../../../style/css/newTemplate.css");
	
	/* 弹窗模式下隐藏底部按钮 */
	.is-popup .bottom-button {
		display: none !important;
	}
	
	/* 弹窗模式下调整内边距 */
	.is-popup {
		padding-bottom: 16px !important;
	}
</style>