<template>
	<el-form
		class="content-main"
		label-width="200px"
		ref="formQuery"
		:rules="rules"
		:model="formQuery"
	>
		<el-row>
			<el-col :span="24">
				<h3 class="h3">仓房基本信息</h3>
				<!-- <el-button type="primary" @click="comeOn">带出上一条信息</el-button> -->
			</el-col>
		</el-row>
		<el-row>
			<el-col :span="12">
				<el-form-item label="仓房编码:">
					<el-input
						clearable
						class="inputWidth"
						:disabled="showLock"
						readonly="readonly"
						placeholder="系统自动生成"
						v-model="formQuery.cfbh"
					></el-input>
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="仓房序号:" prop="cfxh">
					<el-select
						clearable
						class="inputWidth"
						@change="cfxhChange"
						:disabled="showLock"
						v-model="formQuery.cfxh"
						placeholder="请选择"
					>
						<el-option
							v-for="item in cfxhOptions"
							:key="item.dictCode"
							:label="item.dictName"
							:value="item.dictCode"
						></el-option>
					</el-select>
				</el-form-item>
			</el-col>
		</el-row>
		<el-row>
			<el-col :span="12">
				<el-form-item label="廒间序号:" prop="ajxh">
					<el-select
						clearable
						class="inputWidth"
						@change="ojxhChange"
						:disabled="showLock"
						v-model="formQuery.ajxh"
						placeholder="请选择"
					>
						<el-option
							v-for="item in ajxhOptions"
							:key="item.aCode"
							:label="item.aName"
							:value="item.aCode"
						></el-option>
					</el-select>
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="货位序号:" prop="hwxh">
					<el-select
						clearable
						class="inputWidth"
						:disabled="showLock"
						v-model="formQuery.hwxh"
						placeholder="请选择"
					>
						<el-option
							v-for="item in hwxhOptions"
							:key="item.hName"
							:label="item.hName"
							:value="item.hName"
						></el-option>
					</el-select>
				</el-form-item>
			</el-col>
		</el-row>
		<el-row>
			<el-col :span="12">
				<el-form-item label="仓房名称:" prop="cfmc">
					<el-input clearable class="inputWidth" :disabled="showLock" v-model="formQuery.cfmc"></el-input>
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="建设时间:" prop="jssj">
					<el-date-picker
						clearable
						class="inputWidth"
						style="width: 335px;"
						:disabled="showLock"
						v-model="formQuery.jssj"
						type="date"
						value-format="yyyy-MM-dd HH:mm:ss"
						placeholder="选择日期"
					></el-date-picker>
				</el-form-item>
			</el-col>
		</el-row>
		<el-row>
			<el-col :span="12">
				<el-form-item label="交付使用日期:" prop="jfsyrq">
					<el-date-picker
						clearable
						class="inputWidth"
						style="width: 335px;"
						:disabled="showLock"
						v-model="formQuery.jfsyrq"
						type="date"
						value-format="yyyy-MM-dd HH:mm:ss"
						placeholder="选择日期"
					></el-date-picker>
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="仓(罐)型:" prop="cflx">
					<el-select
						clearable
						class="inputWidth"
						:disabled="showLock"
						v-model="formQuery.cflx"
						placeholder="请选择"
					>
						<el-option
							v-for="item in cxOptions"
							:key="item.dictName"
							:label="item.dictName"
							:value="item.dictName"
						></el-option>
					</el-select>
				</el-form-item>
			</el-col>
		</el-row>
		<el-row>
			<el-col :span="12">
				<el-form-item label="单仓仓容(吨):" prop="dczlrj">
					<el-input class="inputWidth" :disabled="showLock" v-model="formQuery.dczlrj"></el-input>
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="防雨防潮性能:" prop="fyfcxn">
					<el-select
						clearable
						class="inputWidth"
						:disabled="showLock"
						v-model="formQuery.fyfcxn"
						placeholder="请选择"
					>
						<el-option
							v-for="item in optionsStr"
							:key="item.value"
							:label="item.label"
							:value="item.value"
						></el-option>
					</el-select>
				</el-form-item>
			</el-col>
		</el-row>
		<el-row>
			<el-col :span="12">
				<el-form-item label="密闭杀虫性能:" prop="mbscxn">
					<el-select
						clearable
						class="inputWidth"
						:disabled="showLock"
						v-model="formQuery.mbscxn"
						placeholder="请选择"
					>
						<el-option
							v-for="item in optionsStr"
							:key="item.value"
							:label="item.label"
							:value="item.value"
						></el-option>
					</el-select>
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="隔热保冷性能:" prop="grblxn">
					<el-select
						clearable
						class="inputWidth"
						:disabled="showLock"
						v-model="formQuery.grblxn"
						placeholder="请选择"
					>
						<el-option
							v-for="item in optionsStr"
							:key="item.value"
							:label="item.label"
							:value="item.value"
						></el-option>
					</el-select>
				</el-form-item>
			</el-col>
		</el-row>
		<el-row>
			<el-col :span="12">
				<el-form-item label="能否散装存储:" prop="sfszcc">
					<el-select
						clearable
						class="inputWidth"
						:disabled="showLock"
						v-model="formQuery.sfszcc"
						placeholder="请选择"
					>
						<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="有无机械通风设施:" prop="ywjxtfss">
					<el-select
						clearable
						class="inputWidth"
						:disabled="showLock"
						v-model="formQuery.ywjxtfss"
						placeholder="请选择"
					>
						<el-option v-for="item in options1" :key="item.value" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-form-item>
			</el-col>
		</el-row>
		<el-row>
			<el-col :span="12">
				<el-form-item label="能否环流熏蒸杀虫:" prop="nfxlsc">
					<el-select
						clearable
						class="inputWidth"
						:disabled="showLock"
						v-model="formQuery.nfxlsc"
						placeholder="请选择"
					>
						<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="有无粮情测控情况:" prop="ywlqckqk">
					<el-select
						clearable
						class="inputWidth"
						:disabled="showLock"
						v-model="formQuery.ywlqckqk"
						placeholder="请选择"
					>
						<el-option v-for="item in options1" :key="item.value" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-form-item>
			</el-col>
		</el-row>
		<el-row>
			<el-col :span="12">
				<el-form-item label="仓房使用情况:" prop="cfsyqk">
					<el-select
						clearable
						class="inputWidth"
						:disabled="showLock"
						v-model="formQuery.cfsyqk"
						placeholder="请选择"
					>
						<el-option v-for="item in options2" :key="item.value" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="低温仓类型:" prop="dwclx">
					<el-select
						clearable
						class="inputWidth"
						:disabled="showLock"
						v-model="formQuery.dwclx"
						placeholder="请选择"
					>
						<el-option
							v-for="item in dwcOptions"
							:key="item.value"
							:label="item.label"
							:value="item.value"
						></el-option>
					</el-select>
				</el-form-item>
			</el-col>
		</el-row>
		<el-row>
			<el-col :span="24">
				<h3 class="h3">结构</h3>
			</el-col>
		</el-row>
		<el-row>
			<el-col :span="12">
				<el-form-item label="墙体:" prop="cfqt">
					<el-input clearable class="inputWidth" :disabled="showLock" v-model="formQuery.cfqt"></el-input>
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="墙体厚度(厘米):" prop="qthd">
					<el-input class="inputWidth" :disabled="showLock" v-model="formQuery.qthd"></el-input>
				</el-form-item>
			</el-col>
		</el-row>
		<el-row>
			<el-col :span="12">
				<el-form-item label="屋面:" prop="cfwm">
					<el-input clearable class="inputWidth" :disabled="showLock" v-model="formQuery.cfwm"></el-input>
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="地面:" prop="cfdm">
					<el-input clearable class="inputWidth" :disabled="showLock" v-model="formQuery.cfdm"></el-input>
				</el-form-item>
			</el-col>
		</el-row>
		<el-row>
			<el-col :span="12">
				<el-form-item label="设计仓容(吨):" prop="sjcr">
					<el-input class="inputWidth" :disabled="showLock" v-model="formQuery.sjcr"></el-input>
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="檐高(米):" prop="cfyg">
					<el-input class="inputWidth" :disabled="showLock" v-model="formQuery.cfyg"></el-input>
				</el-form-item>
			</el-col>
		</el-row>
		<el-row>
			<el-col :span="24">
				<h3 class="h3">仓内</h3>
			</el-col>
		</el-row>
		<el-row>
			<el-col :span="12">
				<el-form-item label="设计装粮高度(米):" prop="zlxgd">
					<el-input class="inputWidth" :disabled="showLock" v-model="formQuery.zlxgd"></el-input>
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="筒仓内径(米):" prop="tczj">
					<el-input class="inputWidth" :disabled="showLock" v-model="formQuery.tczj"></el-input>
				</el-form-item>
			</el-col>
		</el-row>
		<el-row>
			<el-col :span="12">
				<el-form-item label="长(米):" prop="cfnc">
					<el-input class="inputWidth" :disabled="showLock" v-model="formQuery.cfnc"></el-input>
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="宽(米):" prop="cfnk">
					<el-input :min="0" class="inputWidth" :disabled="showLock" v-model="formQuery.cfnk"></el-input>
				</el-form-item>
			</el-col>
		</el-row>
		<el-row>
			<el-col :span="24">
				<h3 class="h3">其他</h3>
			</el-col>
		</el-row>
		<el-row class="warehouseDoorVOList">
			<!-- <el-form-item label="" prop="workOffice"> -->
			<el-form :rules="tableForm.rules" :model="tableForm" ref="tableForm">
				<el-table
					class="cfxxSty"
					:data="tableForm.warehouseDoorVOList"
					:key="tableKey"
					border
					fit
					highlight-current-row
					style="width: 98%;margin-bottom:25px"
				>
					<el-table-column align="center" label="库门名称">
						<template slot-scope="scope">
							<el-form-item
								:prop="'warehouseDoorVOList.' + scope.$index + '.cmmc'"
								:rules="tableForm.rule.cmmc"
							>
								<el-input clearable v-model="scope.row.cmmc" :disabled="showLock"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column align="center" label="库门高度(米)">
						<template slot-scope="scope">
							<el-form-item
								:prop="'warehouseDoorVOList.' + scope.$index + '.cmgd'"
								:rules="tableForm.rule.cmgd"
							>
								<el-input v-model="scope.row.cmgd" style="width:100%" :disabled="showLock"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column align="center" label="库门宽度(米)">
						<template slot-scope="scope">
							<el-form-item
								:prop="'warehouseDoorVOList.' + scope.$index + '.cmkd'"
								:rules="tableForm.rule.cmkd"
							>
								<el-input v-model="scope.row.cmkd" style="width:100%" :disabled="showLock"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column align="center" fixed="right" v-if="!showLock" label="操作" width="100">
						<template slot-scope="scope">
							<el-button @click="addZJ()" size="mini" title="添加" type="text" class="el-icon-plus"></el-button>
							<el-button
								@click="deleteNodeBtn(scope.$index)"
								size="mini"
								title="删除"
								:disabled="showLock"
								type="text"
								class="el-icon-minus"
							></el-button>
						</template>
					</el-table-column>
				</el-table>
			</el-form>

			<!-- </el-form-item> -->
		</el-row>
		<el-row>
			<el-col :span="12">
				<el-form-item label="通风操作:">
					<el-select
						clearable
						class="inputWidth"
						:disabled="showLock"
						v-model="formQuery.tffs"
						placeholder="请选择"
					>
						<el-option v-for="item in options3" :key="item.value" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="屋面隔热:" prop="grfs">
					<el-select
						clearable
						class="inputWidth"
						:disabled="showLock"
						v-model="formQuery.grfs"
						placeholder="请选择"
					>
						<el-option v-for="item in options4" :key="item.value" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-form-item>
			</el-col>
		</el-row>
		<el-row>
			<el-col :span="12">
				<el-form-item label="墙体隔热:" prop="qtgr">
					<el-select
						clearable
						class="inputWidth"
						:disabled="showLock"
						v-model="formQuery.qtgr"
						placeholder="请选择"
					>
						<el-option v-for="item in options5" :key="item.value" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="控温措施:" prop="kwcs">
					<el-select
						clearable
						class="inputWidth"
						:disabled="showLock"
						v-model="formQuery.kwcs"
						placeholder="请选择"
					>
						<el-option v-for="item in options6" :key="item.value" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-form-item>
			</el-col>
		</el-row>
		<el-row>
			<el-col :span="12">
				<el-form-item label="仓门保温:" prop="dwc">
					<el-select
						clearable
						class="inputWidth"
						:disabled="showLock"
						v-model="formQuery.dwc"
						placeholder="请选择"
					>
						<el-option v-for="item in options7" :key="item.value" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="窗户保温:" prop="chbw">
					<el-select
						clearable
						class="inputWidth"
						:disabled="showLock"
						v-model="formQuery.chbw"
						placeholder="请选择"
					>
						<el-option v-for="item in options8" :key="item.value" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-form-item>
			</el-col>
		</el-row>
		<el-row>
			<el-col :span="12">
				<el-form-item label="保温门:" prop="bwm">
					<el-select
						clearable
						class="inputWidth"
						:disabled="showLock"
						v-model="formQuery.bwm"
						placeholder="请选择"
					>
						<el-option v-for="item in options1" :key="item.value" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="保温窗:" prop="bwc">
					<el-select
						clearable
						class="inputWidth"
						:disabled="showLock"
						v-model="formQuery.bwc"
						placeholder="请选择"
					>
						<el-option v-for="item in options1" :key="item.value" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-form-item>
			</el-col>
		</el-row>
		<el-row>
			<el-col :span="12">
				<el-form-item label="双层保温窗:" prop="scbwc">
					<el-select
						clearable
						class="inputWidth"
						:disabled="showLock"
						v-model="formQuery.scbwc"
						placeholder="请选择"
					>
						<el-option v-for="item in options1" :key="item.value" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="外控内开窗:" prop="wknkc">
					<el-select
						clearable
						class="inputWidth"
						:disabled="showLock"
						v-model="formQuery.wknkc"
						placeholder="请选择"
					>
						<el-option v-for="item in options1" :key="item.value" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-form-item>
			</el-col>
		</el-row>
		<el-row>
			<el-col :span="12">
				<el-form-item label="仓内吊顶:" prop="cndd">
					<el-select
						clearable
						class="inputWidth"
						:disabled="showLock"
						v-model="formQuery.cndd"
						placeholder="请选择"
					>
						<el-option v-for="item in options1" :key="item.value" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="仓内保温吊顶:" prop="cdbwdd">
					<el-select
						clearable
						class="inputWidth"
						:disabled="showLock"
						v-model="formQuery.cdbwdd"
						placeholder="请选择"
					>
						<el-option v-for="item in options1" :key="item.value" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-form-item>
			</el-col>
		</el-row>
		<el-row>
			<el-col :span="12">
				<el-form-item label="隔层排积热:" prop="gcpjr">
					<el-select
						clearable
						class="inputWidth"
						:disabled="showLock"
						v-model="formQuery.gcpjr"
						placeholder="请选择"
					>
						<el-option v-for="item in options1" :key="item.value" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="仓顶外隔热层:" prop="cdwgrc">
					<el-select
						clearable
						class="inputWidth"
						:disabled="showLock"
						v-model="formQuery.cdwgrc"
						placeholder="请选择"
					>
						<el-option v-for="item in options1" :key="item.value" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-form-item>
			</el-col>
		</el-row>
		<el-row>
			<el-col :span="12">
				<el-form-item label="保温墙体:" prop="bwqt">
					<el-select
						clearable
						class="inputWidth"
						:disabled="showLock"
						v-model="formQuery.bwqt"
						placeholder="请选择"
					>
						<el-option v-for="item in options1" :key="item.value" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="保温涂料:" prop="bwtl">
					<el-select
						clearable
						class="inputWidth"
						:disabled="showLock"
						v-model="formQuery.bwtl"
						placeholder="请选择"
					>
						<el-option v-for="item in options1" :key="item.value" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-form-item>
			</el-col>
		</el-row>
		<el-row>
			<el-col :span="12">
				<el-form-item label="制冷设备:" prop="zlsb">
					<el-select
						clearable
						class="inputWidth"
						:disabled="showLock"
						v-model="formQuery.zlsb"
						placeholder="请选择"
					>
						<el-option v-for="item in options1" :key="item.value" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="地笼通风:" prop="dltf">
					<el-select
						clearable
						class="inputWidth"
						:disabled="showLock"
						v-model="formQuery.dltf"
						placeholder="请选择"
					>
						<el-option v-for="item in options1" :key="item.value" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-form-item>
			</el-col>
		</el-row>
		<el-row>
			<el-col :span="12">
				<el-form-item label="轴流风机:" prop="zlfj">
					<el-select
						clearable
						class="inputWidth"
						:disabled="showLock"
						v-model="formQuery.zlfj"
						placeholder="请选择"
					>
						<el-option v-for="item in options1" :key="item.value" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="电子测温:" prop="dzcw">
					<el-select
						clearable
						class="inputWidth"
						:disabled="showLock"
						v-model="formQuery.dzcw"
						placeholder="请选择"
					>
						<el-option v-for="item in options1" :key="item.value" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-form-item>
			</el-col>
		</el-row>
		<el-row>
			<el-col :span="12">
				<el-form-item label="自动流粮口:" prop="zdllk">
					<el-select
						clearable
						class="inputWidth"
						:disabled="showLock"
						v-model="formQuery.zdllk"
						placeholder="请选择"
					>
						<el-option v-for="item in options1" :key="item.value" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="环流熏蒸:" prop="hlxz">
					<el-select
						clearable
						class="inputWidth"
						:disabled="showLock"
						v-model="formQuery.hlxz"
						placeholder="请选择"
					>
						<el-option v-for="item in options1" :key="item.value" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-form-item>
			</el-col>
		</el-row>
		<el-row>
			<el-col :span="12">
				<el-form-item label="内环流:" prop="cnhl">
					<el-select
						clearable
						class="inputWidth"
						:disabled="showLock"
						v-model="formQuery.cnhl"
						placeholder="请选择"
					>
						<el-option v-for="item in options1" :key="item.value" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item clearable label="仓内摄像头:" prop="cnsxt">
					<el-select class="inputWidth" :disabled="showLock" v-model="formQuery.cnsxt" placeholder="请选择">
						<el-option v-for="item in options1" :key="item.value" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-form-item>
			</el-col>
		</el-row>
		<el-row v-if="isChecked">
			<el-col :span="24">
				<h3 class="h3">审批信息</h3>
			</el-col>
		</el-row>
		<el-row v-if="isChecked">
			<el-col :span="24">
				<el-form-item label="审批:">
					<el-radio v-model="formQuery.sfba" :disabled="showLock" :label="5">通过</el-radio>
					<el-radio v-model="formQuery.sfba" :disabled="showLock" :label="3">驳回</el-radio>
				</el-form-item>
			</el-col>
			<el-col :span="24">
				<el-form-item label="审核意见:">
					<el-input style="width:90%" :disabled="showLock" v-model="formQuery.shyj"></el-input>
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="审核人:">
					<el-input disabled style="width:80%" v-model="formQuery.shrmc"></el-input>
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="审核时间:">
					<el-input disabled style="width:80%" v-model="formQuery.shsj"></el-input>
				</el-form-item>
			</el-col>
		</el-row>
		<el-col :span="24">
			<div style="text-align:center;margin-top:20px">
				<el-button
					type="primary"
					icon="iconfont icontijiao"
					v-if="!showLock"
					@click="saveSubmit('save')"
				>保存</el-button>
				<el-button
					type="primary"
					icon="iconfont icontijiao"
					v-if="!showLock"
					@click="saveSubmit('send')"
				>提交</el-button>
				<el-button type="primary" icon="iconfont iconfanhui" @click="cancel">返回</el-button>
			</div>
		</el-col>
	</el-form>
</template>

<script>
import {
	detailsFn,
	addFn,
	editFn,
	dataDictionary,
	getPageList
} from '@/api/jcxxwh/cfxx'
import { MessageBox, Message } from 'element-ui'
export default {
	name: 'slqyxxsb',
	data() {
		const validateUsername = (rule, value, callback) => {
			if (value > 3) {
				callback(new Error('请输入正确的用户名'))
			} else {
				callback()
			}
		}
		return {
			pageForm: {
				page: 1,
				size: 10,
				total: 0
			},
			showLock: false,
			formQuery: {
				cfbh: ''
			},
			formInline: {
				cfbh: '',
				cfmc: '',
				jssj: '',
				sfba: ''
			},
			tableForm: {
				warehouseDoorVOList: [{}],
				rule: {
					cmmc: { max: 20, message: '长度在 20 个字符', trigger: 'blur' },
					cmgd: {
						pattern: /^\d{1,10}(\.\d{1,2})?$/,
						message: '长度最多10位，且最多保留2位小数',
						trigger: 'blur'
					},
					cmkd: {
						pattern: /^\d{1,10}(\.\d{1,2})?$/,
						message: '长度最多10位，且最多保留2位小数',
						trigger: 'blur'
					}
				}
			},
			tableKey: '',
			isChecked: false,
			options: [
				{
					value: 1,
					label: '能'
				},
				{
					value: 0,
					label: '否'
				}
			],
			optionsStr: [
				{
					value: '1',
					label: '有'
				},
				{
					value: '0',
					label: '无'
				}
			],
			options1: [
				{
					value: 1,
					label: '有'
				},
				{
					value: 0,
					label: '无'
				}
			],
			options2: [
				{
					value: 0,
					label: '空闲中'
				},
				{
					value: 1,
					label: '使用中'
				},
				{
					value: 2,
					label: '已停用'
				}
			],
			options3: [
				{
					value: 0,
					label: '自然通风'
				},
				{
					value: 1,
					label: '轴流通风'
				},
				{
					value: 2,
					label: '离心通风'
				},
				{
					value: 3,
					label: '单管通风'
				}
			],
			options4: [
				{
					value: 0,
					label: '双层屋面'
				},
				{
					value: 1,
					label: '仓内吊顶'
				},
				{
					value: 2,
					label: '保温隔热涂料'
				}
			],
			options5: [
				{
					value: 0,
					label: '保温隔热涂料'
				},
				{
					value: 1,
					label: '墙体增厚'
				}
			],
			options6: [
				{
					value: 0,
					label: '内环流'
				},
				{
					value: 1,
					label: '空调'
				}
			],
			options7: [
				{
					value: 0,
					label: '单层'
				},
				{
					value: 1,
					label: '双层'
				}
			],
			options8: [
				{
					value: 0,
					label: '单层'
				},
				{
					value: 1,
					label: '双层'
				},
				{
					value: 2,
					label: '三层'
				}
			],
			dwcOptions: [
				{
					value: 1,
					label: '低温仓'
				},
				{
					value: 2,
					label: '准低温仓'
				},
				{
					value: 3,
					label: '普通仓'
				},
				{
					value: 4,
					label: '保温仓'
				}
			],
			cfxhOptions: [],
			ajxhOptions: [],
			hwxhOptions: [],
			cxOptions: [],
			rules: {
				cfmc: [
					{ required: true, message: '请输入仓房名称', trigger: 'blur' },
					{ max: 20, message: '长度在 20 个字符', trigger: 'blur' }
				],
				jssj: [
					{ required: true, message: '请选择建设时间', trigger: 'change' }
				],
				cflx: [
					{ required: true, message: '请选择仓(罐)型', trigger: 'change' }
				],
				dczlrj: [
					{ required: true, message: '请输入单仓仓容(吨)', trigger: 'blur' },
					{
						pattern: /^\d{1,10}?$/,
						message: '长度最多10位，且为正整数',
						trigger: 'blur'
					}
				],
				bwm: [{ required: true, message: '请选择保温门', trigger: 'change' }],
				bwc: [{ required: true, message: '请选择保温窗', trigger: 'change' }],
				scbwc: [
					{ required: true, message: '请选择双层保温窗', trigger: 'change' }
				],
				wknkc: [
					{ required: true, message: '请选择外控内开窗', trigger: 'change' }
				],
				cndd: [
					{ required: true, message: '请选择仓内吊顶', trigger: 'change' }
				],
				cdbwdd: [
					{ required: true, message: '请选择仓内保温吊顶', trigger: 'change' }
				],
				gcpjr: [
					{ required: true, message: '请选择隔层排积热', trigger: 'change' }
				],
				cdwgrc: [
					{ required: true, message: '请选择仓顶外隔热层', trigger: 'change' }
				],
				bwqt: [
					{ required: true, message: '请选择保温墙体', trigger: 'change' }
				],
				bwtl: [
					{ required: true, message: '请选择保温涂料', trigger: 'change' }
				],
				zlsb: [
					{ required: true, message: '请选择制冷设备', trigger: 'change' }
				],
				dltf: [
					{ required: true, message: '请选择地笼通风', trigger: 'change' }
				],
				dzcw: [
					{ required: true, message: '请选择电子测温', trigger: 'change' }
				],
				zdllk: [
					{ required: true, message: '请选择自动流粮口', trigger: 'change' }
				],
				hlxz: [
					{ required: true, message: '请选择环流熏蒸', trigger: 'change' }
				],
				cnhl: [{ required: true, message: '请选择内环流', trigger: 'change' }],
				cnsxt: [
					{ required: true, message: '请选择仓内摄像头', trigger: 'change' }
				],
				dwclx: [
					{ required: true, message: '请选择低温仓类型', trigger: 'change' }
				],
				zlfj: [
					{ required: true, message: '请选择轴流风机', trigger: 'change' }
				],
				cfxh: [
					{ required: true, message: '请选择仓房序号', trigger: 'change' }
				],
				cmkd: [
					{ required: true, message: '请选择仓房序号', trigger: 'change' }
				],
				ajxh: [
					{ required: true, message: '请选择敖间序号', trigger: 'change' }
				],
				hwxh: [
					{ required: true, message: '请选择货位序号', trigger: 'change' }
				],
				qthd: [
					{
						pattern: /^\d{1,10}?$/,
						message: '长度最多10位，且为正整数',
						trigger: 'blur'
					}
				],
				cfqt: [{ max: 20, message: '长度在 20 个字符', trigger: 'blur' }],
				cfwm: [{ max: 20, message: '长度在 20 个字符', trigger: 'blur' }],
				cfdm: [{ max: 20, message: '长度在 20 个字符', trigger: 'blur' }],
				sjcr: [
					{
						pattern: /^\d{1,10}?$/,
						message: '长度最多10位，且为正整数',
						trigger: 'blur'
					}
				],
				cfyg: [
					{
						pattern: /^\d{1,10}(\.\d{1,2})?$/,
						message: '长度最多10位，且最多保留2位小数',
						trigger: 'blur'
					}
				],
				zlxgd: [
					{
						pattern: /^\d{1,10}(\.\d{1,2})?$/,
						message: '长度最多10位，且最多保留2位小数',
						trigger: 'blur'
					}
				],
				tczj: [
					{
						pattern: /^\d{1,10}(\.\d{1,2})?$/,
						message: '长度最多10位，且最多保留2位小数',
						trigger: 'blur'
					}
				],
				cfnc: [
					{
						pattern: /^\d{1,10}(\.\d{1,2})?$/,
						message: '长度最多10位，且最多保留2位小数',
						trigger: 'blur'
					}
				],
				cfnk: [
					{
						pattern: /^\d{1,10}(\.\d{1,2})?$/,
						message: '长度最多10位，且最多保留2位小数',
						trigger: 'blur'
					}
				]
			}
		}
	},
	methods: {
		ojxhChange(val) {
			if (val) {
				console.log(val)
				this.$set(this.formQuery, 'hwxh', '')
				let _field = this.$refs['formQuery'].fields
				_field.map((i) => {
					if (i.prop === 'hwxh') {
						i.resetField()
						return false
					}
				})
				dataDictionary('5471').then((res) => {
					if (res.infoCode == 200) {
						res.data.map((item) => {
							item.hName = val + '-' + item.dictName
							item.hCode = val + '-' + item.dictName
						})
						console.log(val, res.data)
						res.data.unshift({ hName: '无', hCode: val + '-' + 0 })
						this.hwxhOptions = res.data
					}
				})
			}
		},
		// comeOn(){
		// 	this.formInline.tyshxydm = sessionStorage.getItem('tyshxydm')
		// 	this.formInline.kddm = `${sessionStorage.getItem('tyshxydm')}001`
		// 	this.formInline.zts = this.formInline.sfba
		// 		? [this.formInline.sfba]
		// 		: [1, 2, 3, 5]
		// 	getPageList(this.pageForm, this.formInline).then((res) => {
		// 		this.formQuery = res.data.list[0]
		// 		this.formQuery.cfxh = ""
		// 		this.formQuery.ajxh = ""
		// 		this.formQuery.hwxh = ""
		// 		console.log(this.formQuery,"sssssk")
		// 		this.formQuery.map((item) => {
		// 			item.jssj = dateFormat(item.jssj)
		// 			if(item.ajxh.slice(1) == '-0'){
		// 				item.ajxh = '无'
		// 			}
		// 		})

		// 	})
		// },
		cfxhChange(val) {
			if (val) {
				this.$set(this.formQuery, 'ajxh', '')
				this.$set(this.formQuery, 'hwxh', '')
				let _field = this.$refs['formQuery'].fields
				_field.map((i) => {
					if (i.prop === 'ajxh' || i.prop === 'hwxh') {
						i.resetField()
						return false
					}
				})
				dataDictionary('5471').then((res) => {
					if (res.infoCode == 200) {
						res.data.map((item) => {
							item.aName = val + '-' + item.dictName
							item.aCode = val + '-' + item.dictName
						})
						res.data.unshift({ aName: '无', aCode: val + '-' + 0 })
						this.ajxhOptions = res.data
					}
				})
			}
		},
		ojxhChange(val) {
			if (val) {
				console.log(val)
				this.$set(this.formQuery, 'hwxh', '')
				let _field = this.$refs['formQuery'].fields
				_field.map((i) => {
					if (i.prop === 'hwxh') {
						i.resetField()
						return false
					}
				})
				dataDictionary('5471').then((res) => {
					if (res.infoCode == 200) {
						res.data.map((item) => {
							item.hName = val + '-' + item.dictName
							item.hCode = val + '-' + item.dictName
						})
						console.log(val, res.data)
						res.data.unshift({ hName: '无', hCode: val + '-' + 0 })
						this.hwxhOptions = res.data
					}
				})
			}
		},
		getInfo(code) {
			detailsFn(code).then((res) => {
				this.formQuery = res.data
				this.formQuery.tffs = this.formQuery.tffs
					? Number(this.formQuery.tffs)
					: this.formQuery.tffs
				this.formQuery.grfs = this.formQuery.grfs
					? Number(this.formQuery.grfs)
					: this.formQuery.grfs
				this.formQuery.kwcs = this.formQuery.kwcs
					? Number(this.formQuery.kwcs)
					: this.formQuery.kwcs
				if (this.formQuery.ajxh.slice(1) == '-0') {
					this.formQuery.ajxh = '无'
				}
				this.tableForm.warehouseDoorVOList = res.data.warehouseDoorVOList
			})
		},
		// 库门的动态添加
		addZJ() {
			const newList = {
				cmmc: '',
				cmgd: '',
				cmkd: ''
			}
			this.tableForm.warehouseDoorVOList.push(newList)
		},
		// 库门的动态删除
		deleteNodeBtn(i) {
			if (this.tableForm.warehouseDoorVOList.length == 1) {
				this.tableForm.warehouseDoorVOList = [{ cmmc: '', cmgd: '', cmkd: '' }]
			} else {
				this.tableForm.warehouseDoorVOList.splice(i, 1)
			}
		},
		saveSubmit(status) {
			// this.$refs.dialogForm.validate((valid) => {
			// 	if (valid) {
			// 		this.saves()
			// 	} else {
			// 		this.$message.warning('请填写正确的必填信息')
			// 	}
			// })
			this.$refs.formQuery.validate((valid) => {
				if (valid) {
					this.$refs['tableForm'].validate((valid) => {
						if (valid) {
							if (this.$route.query.status == 'edit') {
								if (status == 'save') {
									this.formQuery.sfba = '1'
									this.formQuery.tyshxydm = sessionStorage.getItem('tyshxydm')
									editFn({
										...this.formQuery,
										warehouseDoorVOList: this.tableForm.warehouseDoorVOList
									}).then((res) => {
										if (res.infoCode == 200) {
											Message({
												message: '编辑成功',
												type: 'success'
											})
											this.$router.push({ path: '/grainCoManage/warehousingLogistics/facilitiesSituation/coRegAudit/index' })
										} else {
											Message({
												message: res.msg,
												type: 'error'
											})
										}
									})
								} else if (status == 'send') {
									this.formQuery.tyshxydm = sessionStorage.getItem('tyshxydm')
									this.formQuery.sfba = '2'
									let data = {}
									editFn({
										...this.formQuery,
										warehouseDoorVOList: this.tableForm.warehouseDoorVOList
									}).then((res) => {
										if (res.infoCode == 200) {
											Message({
												message: '提交成功',
												type: 'success'
											})
											this.$router.push({ path: '/grainCoManage/warehousingLogistics/facilitiesSituation/coRegAudit/index' })
										} else {
											Message({
												message: res.msg,
												type: 'error'
											})
										}
									})
								}
							} else {
								if (status == 'save') {
									this.formQuery.tyshxydm = sessionStorage.getItem('tyshxydm')
									this.formQuery.sfba = '1'
									this.formQuery.kddm = `${sessionStorage.getItem(
										'tyshxydm'
									)}001`
									addFn({
										...this.formQuery,
										warehouseDoorVOList: this.tableForm.warehouseDoorVOList
									}).then((res) => {
										if (res.infoCode == 200) {
											Message({
												message: '保存成功',
												type: 'success'
											})
											this.$router.push({ path: '/grainCoManage/warehousingLogistics/facilitiesSituation/coRegAudit/index' })
										} else {
											// alert(res.msg)
											Message({
												message: res.msg,
												type: 'error'
											})
										}
									})
								} else if (status == 'send') {
									this.formQuery.tyshxydm = sessionStorage.getItem('tyshxydm')
									this.formQuery.sfba = '2'
									this.formQuery.kddm = `${sessionStorage.getItem(
										'tyshxydm'
									)}001`
									addFn({
										...this.formQuery,
										warehouseDoorVOList: this.tableForm.warehouseDoorVOList
									}).then((res) => {
										if (res.infoCode == 200) {
											Message({
												message: '提交成功',
												type: 'success'
											})
											this.$router.push({ path: '/grainCoManage/warehousingLogistics/facilitiesSituation/coRegAudit/index' })
										} else {
											// alert(res.msg)
											Message({
												message: res.msg,
												type: 'error'
											})
										}
									})
								}
							}
						}
					})
				} else {
					this.$message.warning('请填写正确的必填信息')
				}
			})
		},
		cancel() {
			this.$router.push({ path: '/grainCoManage/warehousingLogistics/facilitiesSituation/coRegAudit/index' })
		}
	},
	created() {
		if (this.$route.query.status == 'detail') {
			if (this.$route.query.sfba == 3 || this.$route.query.sfba == 5) {
				this.isChecked = true
			}
			this.showLock = true
			this.getInfo(this.$route.query.cfbhNum)
		} else if (this.$route.query.status == 'edit') {
			this.showLock = false
			this.getInfo(this.$route.query.cfbhNum)
		} else {
			this.showLock = false
		}
		dataDictionary('5472').then((res) => {
			if (res.infoCode == 200) {
				this.cfxhOptions = res.data
			}
		})
		dataDictionary('5473').then((res) => {
			if (res.infoCode == 200) {
				this.cxOptions = res.data
			}
		})
	}
}
</script>

<style scoped lang="scss">
.content-main {
	margin: 10px 10px 0;
	padding-top: 20px;
}

.span-inline-block {
	float: left;
	margin-right: 5px;
	width: 80px;
	text-align: right;
	line-height: 30px;
}

.inputWidth {
	width: 335px;
}

.h3 {
	width: 98%;
	text-align: center;
	font-size: 1em;
	line-height: 2.5;
	color: #fff;
	background-color: #49a2fa;
	margin-bottom: 20px;
}

.el-form {
	overflow: hidden;
	overflow-y: auto;
}

.el-row {
	.el-tooltip {
		float: left;
		padding: 0 12px 0 0;
		width: 118px;
		white-space: nowrap;
		text-align: right;
		vertical-align: middle;
		color: #525357;
		font-size: 14px;
		line-height: 40px;
		box-sizing: border-box;
	}
}

.warehouseDoorVOList .el-form-item {
	margin: 0 !important;
}
</style>
