<template>
	<view class="page-wrap" v-bind:style="{paddingBottom:paddingBottom+'px'}">
		<view class="background"></view>
		<view class="card">
			<!-- <uni-card margin="0" :is-shadow="true"> -->
			<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="ENDTIME" borderBottom>
					<u--input disabled disabledColor="#ffffff" v-model="model.TIME" border="none" inputAlign="right" fontSize="14px"></u--input>
				</u-form-item>
				<u-form-item label="责任部门" prop="ENDTIME" borderBottom>
					<u--input disabled v-if="model.Nav_Department" disabledColor="#ffffff"  v-model="model.Nav_Department.NAME" border="none" inputAlign="right" fontSize="14px"></u--input>
				</u-form-item>
				<u-form-item label="责任人" prop="ENDTIME" borderBottom>
					<u--input disabled v-if="model.Nav_User" disabledColor="#ffffff"  v-model="model.Nav_User.NAME" border="none" inputAlign="right" fontSize="14px"></u--input>
				</u-form-item>
				
				<u-form-item  label="设备设施名称" prop="Nav_Device.NAME" borderBottom >
					<u--input disabled fontSize="14px" disabledColor="#ffffff"  v-model="model.Nav_DeviceBase.NAME" border="none"   inputAlign="right" v-if="model.Nav_DeviceBase"></u--input>
					
				</u-form-item>
				<u-form-item label="设备设施编号" prop="POSITION" borderBottom>
					<u--input disabled disabledColor="#ffffff"  v-model="model.MACHINE_CODE" border="none" inputAlign="right" fontSize="14px">
					</u--input>
				</u-form-item>
				<u-form-item label="规格/型号" prop="POSITION" borderBottom>
					<u--input disabled disabledColor="#ffffff"  v-model="model.SPEC" border="none" inputAlign="right" fontSize="14px">
					</u--input>
				</u-form-item>
				<u-form-item label="设备设施位置" prop="POSITION" borderBottom>
					<u--input disabled disabledColor="#ffffff"  v-model="model.POSITION" border="none" inputAlign="right" fontSize="14px">
					</u--input>
				</u-form-item>
				<u-form-item  label="检测检验结果"  borderBottom>
					<u--input v-model="model.RESULTShow" disabled disabledColor="#ffffff"  border="none" inputAlign="right" fontSize="14px">
					</u--input>
					
				</u-form-item>
				<u-form-item label="检测检验机构" prop="POSITION" borderBottom>
					<u--input disabled disabledColor="#ffffff"  v-model="model.MECHANISM" border="none" inputAlign="right" fontSize="14px">
					</u--input>
				</u-form-item>
				<u-form-item label="检测检验资质" prop="POSITION" borderBottom>
					<u--input disabled  disabledColor="#ffffff"  v-model="model.QUALIFICATION" border="none" inputAlign="right" fontSize="14px">
					</u--input>
				</u-form-item>
				
				
				<u-form-item label="检测检验报告" prop="POSITION">
				</u-form-item>
				<full-upload v-model="model.Nav_Files" :isShowBtn="false" :listProp="listPropUpload" :listPropVal="listPropValUpload"></full-upload>
				
				

			</u--form>

			<check-action v-if="isLoadOK&&tableKey==1&&isAudit" :okApi="okApi" :refuseApi="refuseApi" :dataSource="auditModel"></check-action>
		</view>
		<!-- <view class="bottom-button" style="padding: 10px 16px;" v-if="isLoadOK&&tableKey!==2&&this.isSign">
			<u-button type="primary" @click="onTableBtnAgree" color="#3d4b70">审阅</u-button>
		</view> -->

	</view>
</template>

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

	import {
		DIRecordGet,
		DMDeviceOverhaulSign
	} from '../../../../services/apply/subPages/DM/dm';
	import '../../../../utils/showMsg.js'
	import color from '../../../../uni_modules/uview-ui/libs/config/color'
	import config from '../../../../config/common'
	import {
		getEnum
	} from '../../../../services/common';

	export default {
		data() {
			return {
				model: {
					Nav_Department: {
						NAME: ''
					},
					Nav_User: {
						NAME: ''
					},
					Nav_Details: [{
						Nav_Device: {
							NAME: ''
						},
						Nav_Category: {
							NAME: ''
						},
						Nav_Type: {
							NAME: ''
						},
					}]

				},
				listPropUpload: ['PARENT_ID'],
				listPropValUpload: [],
				paddingBottom: '150',
				TaskID: "",
				tableKey: '0',
				isLoadOK: false,
				isSign: true,
				isAudit: true,
				DEALOPINION: "",
				ORG_ID: uni.getStorageSync('orgId'),
				listISORNOT: [], //是否涉及
				listISORNOTText: [],
			}
		},
		onLoad(option) {
			this.ID = option.ID;
			this.TaskID = option.taskID;
			this.tableKey = option.tableKey ? option.tableKey : '0'
			this.okApi = option.okApi
			this.refuseApi = option.refuseApi
			this.auditModel = {
				...this.$store.state.auditModel,
				TaskID: option.taskID ? option.taskID : ''
			}
			this.getConclusion()
		},
		methods: {
			getEnums() {
				var dataParm = {
					'name': "DMRepairOpinionEnum"
				}
				getEnum(dataParm).then(res => {
					this.listISORNOT = res
					this.listISORNOTText = []
					this.listISORNOT.forEach(e => {
						e.name = e.NAME
						e.code = e.ID
						this.listISORNOTText.push(e.NAME)
					})
					this.getConclusion()
				})
			},
			getConclusion() {
				var dataParm = {
					'name': "DMInspectionResultEnum"
				}
				getEnum(dataParm).then(res => {
					this.listResult = res
					this.listResultText = []
					this.listResult.forEach(e => {
						e.name = e.NAME
						e.code = e.ID
						this.listResultText.push(e.NAME)
			
					})
					this.loadData()
				})
			},
			loadData() {
				const json = initFilter(this.ORG_ID)
				extendRule(json, 'ID', 1, this.ID);
				 extendInclude(json, 'Nav_User');
				        extendInclude(json, 'Nav_Department');
				        extendInclude(json, 'Nav_DeviceBase');
				        extendInclude(json, 'Nav_Files');
				        extendInclude(json, 'Nav_Files.Nav_ImgFile');
				extendIgnoreDataRule(json)
				DIRecordGet(json).then(res => {
					this.model = res
					this.model.TIME = uni.$u.timeFormat(this.model.TIME,
						'yyyy-mm-dd')
					this.model.RESULTShow = this.listResult.find(item => item.code === this.model.RESULT).name
					this.isLoadOK = true
				})
			},
			onTableBtnAgree() {
				const json = {
					ID: this.ID,
					TaskID: this.TaskID
				}
				DMDeviceOverhaulSign(json).then(res => {
					if (res) {
						uni.$showMsgFunc('操作成功!', () => {
							uni.navigateBack()
						}, 'success', 1000)
					}
				})
			}

		}
	}
</script>

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