<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 class="subRequired" label="设备设施名称" prop="Nav_Device.NAME" borderBottom>
					<u--input disabled fontSize="14px" disabledColor="#fff" v-model="model.Nav_Device.NAME" border="none" inputAlign="right" v-if="model.Nav_Device"></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="故障描述" prop="POSITION" borderBottom>
					<u--input disabled disabledColor="#ffffff" v-model="model.DESCRPTION" border="none" inputAlign="right" fontSize="14px">
					</u--input>
				</u-form-item>
				<u-form-item label="维修紧迫性" prop="Product_Unit" borderBottom>
					<u--input v-model="model.DMRepairStatusEnumShow" disabled disabledColor="#ffffff" border="none" inputAlign="right" fontSize="14px">
					</u--input>

				</u-form-item>
				<u-form-item label="是否申请外部援助" prop="Product_Unit" borderBottom>
					<u--input v-model="model.IS_HELPShow" disabled disabledColor="#ffffff" border="none" inputAlign="right" fontSize="14px">
					</u--input>

				</u-form-item>
				<u-form-item label="维修人员" prop="USER_ID" borderBottom>
					<u--input disabled disabledColor="#ffffff" v-model="model.Nav_Repair_User.NAME" border="none" inputAlign="right" fontSize="14px" v-if="model.Nav_Repair_User"></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==1||tableKey==4)&&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 {
		DMRepairGet
	} 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.getEnums()
		},
		methods: {
			getEnums() {
				var dataParm = {
					'name': "DMRepairStatusEnum"
				}
				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.loadData()
				})
			},
			loadData() {
				const json = initFilter(this.ORG_ID)
				extendRule(json, 'ID', 1, this.ID);
				extendIgnoreDataRule(json)
				extendInclude(json, 'Nav_Device')
				// extendInclude(json, 'Nav_Repair_Charge_User')
				extendInclude(json, 'Nav_Repair_User')
				extendInclude(json, 'Nav_Files.Nav_ImgFile')
				DMRepairGet(json).then(res => {
					this.model = res
					this.model.IS_HELPShow = this.model.IS_HELP?'是':'否'
					this.model.DMRepairStatusEnumShow = this.listISORNOT.find(item => item.code === this.model.EMERGENCY_LEVEL_NAME).name
					this.isLoadOK = true
				})
			}

		}
	}
</script>

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