<template>
	<div class="content-main">
		<h2
			style="text-align:center;font-weight:600;padding-top:10px;padding-bottom:10px;"
		>
			企业备案申请详情
		</h2>
		<table
			width="1200"
			cellspacing="1"
			border="2"
			:data="tablemodel"
			style="margin:0 auto"
		>
			<tr>
				<td style="padding:8px;width:80px;">单位名称</td>
				<td colspan="3" style="width:200px;">
					{{ tablemodel.qymc }}
				</td>
				<td style="padding:8px;">企业代码</td>
				<td style="width:200px;">
					{{ tablemodel.dwdm }}
				</td>
			</tr>
			<tr>
				<td style="padding:8px;">地址</td>
				<td colspan="3" style="width:200px;">
					{{ tablemodel.qygszcd }}
				</td>
				<td style="padding:8px;">邮政编码</td>
				<td style="width:200px;">
					{{ tablemodel.qyyb }}
				</td>
			</tr>
			<tr>
				<td style="padding:8px;">法定代表人或负责人</td>
				<td>
					{{ tablemodel.fddbr }}
				</td>
				<td style="padding:8px;">联系电话</td>
				<td>
					{{ tablemodel.bgdh }}
				</td>
				<td style="padding:8px;">手机号码</td>
				<td>
					{{ tablemodel.frsjh }}
				</td>
			</tr>
			<tr>
				<td style="padding:8px;">电子信箱</td>
				<td colspan="3">
					{{ tablemodel.qydzyx }}
				</td>
				<td style="padding:8px;">企业性质</td>
				<td>
					{{ tablemodel.qyxz }}
				</td>
			</tr>
			<tr>
				<td style="padding:8px;">通讯地址</td>
				<td colspan="3">
					{{ tablemodel.qytxdz }}
				</td>
				<td style="padding:8px;">隶属关系</td>
				<td>
					{{ tablemodel.qylsgx }}
				</td>
			</tr>
			<tr>
				<td style="padding:8px;">经营范围</td>
				<td colspan="3">
					{{ tablemodel.jyfw }}
				</td>
				<td style="padding:8px;">主营业务</td>
				<td>
					{{ tablemodel.qyzyyw }}
				</td>
			</tr>
			<tr>
				<td style="padding:8px;">占地面积(平方)</td>
				<td>
					{{ tablemodel.sszdmj }}
				</td>
				<td style="padding:8px;">库区个数(个)</td>
				<td>
					{{ tablemodel.kqsl }}
				</td>
				<td style="padding:8px;">总仓容(吨)</td>
				<td>
					{{ tablemodel.zcr }}
				</td>
			</tr>
			<tr>
				<td style="padding:8px;">其中有效仓容</td>
				<td>
					{{ tablemodel.kdyxcr }}
				</td>
				<td style="padding:8px;">需大修仓容</td>
				<td>
					{{ tablemodel.zdxcr }}
				</td>
				<td style="padding:8px;">待报废仓容</td>
				<td>
					{{ tablemodel.dbfcr }}
				</td>
			</tr>
			<tr>
				<td style="padding:8px;">油罐个数(个)</td>
				<td>
					{{ tablemodel.ygsl }}
				</td>
				<td style="padding:8px;">总罐容(吨)</td>
				<td>
					{{ tablemodel.gr }}
				</td>
				<td style="padding:8px;">其中有效罐容</td>
				<td>
					{{ tablemodel.yxgr }}
				</td>
			</tr>
			<tr>
				<td style="padding:8px;">从业人员(个)</td>
				<td>
					{{ tablemodel.qycyrys }}
				</td>
				<td style="padding:8px;">其中:保管员(人)</td>
				<td>
					{{ tablemodel.bgyrs }}
				</td>
				<td style="padding:8px;">质量检验员(人)</td>
				<td>
					{{ tablemodel.jhyyrs }}
				</td>
			</tr>
			<tr>
				<td style="padding:8px;">基本条件</td>
				<td colspan="5" style="padding:8px;">
					<p
						v-for="(item, index) in jbtj"
						:key="index"
						style="text-align:left;"
					>
						{{ item.key }}
						<el-radio-group v-model="item.val" disabled>
							<el-radio label="是"></el-radio>
							<el-radio label="否"></el-radio>
						</el-radio-group>
					</p>
				</td>
			</tr>
			<tr>
				<td style="padding:8px;">单位收储粮油主要品种</td>
				<td colspan="5">
					{{ tablemodel.qysclszypz }}
				</td>
			</tr>
			<tr>
				<td align="center">序号</td>
				<td align="center">库点名称</td>
				<td colspan="2" align="center">库点详细地址</td>
				<td colspan="2" align="center" style="padding:8px;">
					库点仓容(吨)
				</td>
			</tr>
			<tr
				v-for="(item, index) in tablemodel.grainDepot"
				:key="index"
				style="padding:8px 0"
			>
				<td align="center" v-if="index == 0">主库区</td>
				<td align="center" v-if="index > 0">{{ index }}库区</td>
				<td align="center" style="padding:8px 0">
					{{ item.kdmc }}
				</td>
				<td colspan="2" align="center" style="padding:8px 0">
					{{ item.kddz }}
				</td>
				<td colspan="2" align="center" style="padding:8px 0">
					{{ item.kdcz }}
				</td>
			</tr>
			<tr>
				<td style="padding:8px;"></td>
				<td></td>
				<td colspan="2"></td>
				<td colspan="2"></td>
			</tr>
			<tr>
				<td style="padding:8px;">填表人:</td>
				<td>
					{{ tablemodel.tbr }}
				</td>
				<td style="padding:8px;">联系电话:</td>
				<td>
					{{ tablemodel.lxdh }}
				</td>
				<td style="padding:8px;">手机:</td>
				<td>
					{{ tablemodel.sjh }}
				</td>
			</tr>
		</table>

		<div v-if="tablemodel.auditVO">
			<el-row class="sub_title">
				备案审核
			</el-row>

			<el-form
				:model="auditData"
				inline
				label-position="right"
				label-width="5em"
			>
				<el-row type="flex" justify="space-around">
					<el-col :span="10">
						<el-form-item label="审核结果">
							<el-radio-group
								v-model="tablemodel.auditVO.shjg"
								disabled
							>
								<el-radio label="1">通过</el-radio>
								<el-radio label="0">驳回</el-radio>
							</el-radio-group>
						</el-form-item>
					</el-col>
					<el-col :span="10">
						<el-form-item label="审核意见">
							<el-input
								v-model="tablemodel.auditVO.shyj"
								style="min-width:300px;"
								disabled
							></el-input
						></el-form-item>
					</el-col>
				</el-row>
				<el-row type="flex" justify="space-around">
					<el-col :span="10">
						<el-form-item label="审核人"
							><el-input
								style="min-width:300px;"
								v-model="tablemodel.auditVO.qybashr"
								disabled
							></el-input
						></el-form-item>
					</el-col>
					<el-col :span="10">
						<el-form-item label="审核时间">
							<el-date-picker
								style="min-width:300px;"
								type="date"
								value-format="yyyy-MM-dd"
								format="yyyy-MM-dd"
								disabled
								v-model="tablemodel.auditVO.shrq"
							></el-date-picker
						></el-form-item>
					</el-col>
				</el-row>
			</el-form>
		</div>
		<div v-if="formData.qymc">
			<el-row class="sub_title">
				企业备案变更
			</el-row>
			<table width="90%" cellspacing="1" border="2">
				<tr>
					<th width="20%">项目</th>
					<th width="40%">原备案登记事项</th>
					<th width="40%">申请变更备案登记事项</th>
				</tr>
				<tr>
					<td>单位名称</td>
					<td>{{ tabledata.qymc }}</td>
					<td>{{ formData.qymc }}</td>
				</tr>
				<tr>
					<td>经营项目</td>
					<td>{{ tabledata.jyfw }}</td>
					<td>{{ formData.jyfw }}</td>
				</tr>
				<tr>
					<td>通讯地址</td>
					<td>{{ tabledata.qytxdz }}</td>
					<td>{{ formData.qytxdz }}</td>
				</tr>
				<tr>
					<td>法人代表</td>
					<td>{{ tabledata.fddbr }}</td>
					<td>{{ formData.fddbr }}</td>
				</tr>
				<tr>
					<td>联系电话</td>
					<td>{{ tabledata.bgdh }}</td>
					<td>{{ formData.bgdh }}</td>
				</tr>
				<tr>
					<td>手机号码</td>
					<td>{{ tabledata.frsjh }}</td>
					<td>{{ formData.frsjh }}</td>
				</tr>
				<tr>
					<td>电子信箱</td>
					<td>{{ tabledata.qydzyx }}</td>
					<td>{{ formData.qydzyx }}</td>
				</tr>
				<tr>
					<td>企业性质</td>
					<td>{{ tabledata.qyxz }}</td>
					<td>{{ formData.qyxz }}</td>
				</tr>
				<tr>
					<td>主营业务</td>
					<td>{{ tabledata.qyzyyw }}</td>
					<td>{{ formData.qyzyyw }}</td>
				</tr>
				<tr>
					<td>总仓容(吨)</td>
					<td>{{ tabledata.zcr }}</td>
					<td>{{ formData.zcr }}</td>
				</tr>

				<tr>
					<td>有效仓容/罐容</td>
					<td>{{ tabledata.yxcr }}</td>
					<td>{{ formData.yxcr }}</td>
				</tr>
				<tr>
					<td>需大修仓容</td>
					<td>{{ tabledata.zdxcr }}</td>
					<td>{{ formData.zdxcr }}</td>
				</tr>
				<tr>
					<td>待报废仓容</td>
					<td>{{ tabledata.dbfcr }}</td>
					<td>{{ formData.dbfcr }}</td>
				</tr>
				<tr>
					<td>油罐个数(个)</td>
					<td>{{ tabledata.ygsl }}</td>
					<td>{{ formData.ygsl }}</td>
				</tr>
				<tr>
					<td>总罐容(吨)</td>
					<td>{{ tabledata.gr }}</td>
					<td>{{ formData.gr }}</td>
				</tr>
				<tr>
					<td>其中:有效罐容</td>
					<td>{{ tabledata.yxgr }}</td>
					<td>{{ formData.yxgr }}</td>
				</tr>
				<tr style="padding:8px;">
					<td style="padding:8px;">变更日期</td>

					<td></td>

					<td>{{ formData.bgsj && formData.bgsj.slice(0, 10) }}</td>
				</tr>
				<tr>
					<td>备注</td>
					<td colspan="2">{{ formData.remark }}</td>
				</tr>
			</table>

			<el-row class="sub_title">
				企业备案变更审核
			</el-row>
			<table width="90%" cellspacing="1" border="2" class="audit">
				<tr>
					<th width="20%">审核部门</th>
					<th width="10%">审核人</th>
					<th width="20%">审核结果</th>
					<th width="20%">审核日期</th>
					<th width="30%">申请意见</th>
				</tr>
				<tr v-for="(item, index) in formData.auditList" :key="index">
					<td>{{ item.qymc }}</td>
					<td>{{ item.qybashr }}</td>
					<td>
						<el-radio-group v-model="item.shjg" disabled>
							<el-radio label="1">通过</el-radio
							><el-radio label="0">驳回</el-radio></el-radio-group
						>
					</td>
					<td>{{ item.shrq && item.shrq.slice(0, 10) }}</td>
					<td>
						<el-input
							type="text"
							clearable
							v-model="item.shyj"
							disabled
						></el-input>
					</td>
				</tr>
			</table>
		</div>
		<div v-if="tablemodel.stopIndustryVO">
			<el-row class="sub_title">
				企业停歇业详情
			</el-row>
			<table width="80%" cellspacing="1" border="2">
				<tr>
					<td width="120px">单位名称</td>
					<td>
						{{ tablemodel.stopIndustryVO.qymc || tablemodel.qymc }}
					</td>
				</tr>
				<tr>
					<td>经营项目</td>
					<td>
						{{ tablemodel.stopIndustryVO.jyfw || tablemodel.jyfw }}
					</td>
				</tr>
				<tr>
					<td>通讯地址</td>
					<td>
						{{
							tablemodel.stopIndustryVO.qytxdz ||
								tablemodel.qytxdz
						}}
					</td>
				</tr>
				<tr>
					<td>法人代表</td>
					<td>
						{{
							tablemodel.stopIndustryVO.fddbr || tablemodel.fddbr
						}}
					</td>
				</tr>

				<tr>
					<td>手机号码</td>
					<td>
						{{
							tablemodel.stopIndustryVO.frsjh || tablemodel.frsjh
						}}
					</td>
				</tr>
				<tr>
					<td>电子信箱</td>
					<td>
						{{
							tablemodel.stopIndustryVO.qydzyx ||
								tablemodel.qydzyx
						}}
					</td>
				</tr>
				<tr>
					<td>企业性质</td>
					<td>
						{{ tablemodel.stopIndustryVO.qyxz || tablemodel.qyxz }}
					</td>
				</tr>
				<tr>
					<td>主营业务</td>
					<td>
						{{
							tablemodel.stopIndustryVO.qyzyyw ||
								tablemodel.qyzyyw
						}}
					</td>
				</tr>

				<tr>
					<td>有效仓容</td>
					<td>
						{{ tablemodel.stopIndustryVO.yxcr || tablemodel.yxcr }}
					</td>
				</tr>
				<tr>
					<td>有效罐容</td>
					<td>
						{{ tablemodel.stopIndustryVO.yxcr || tablemodel.yxcr }}
					</td>
				</tr>
				<tr>
					<td>备案编号</td>
					<td>
						{{
							tablemodel.stopIndustryVO.qybabh ||
								tablemodel.qybabh
						}}
					</td>
				</tr>

				<tr>
					<td>申请原因</td>
					<td colspan="2">
						本单位因<el-input
							placeholder="请输入"
							disabled
							v-model="tablemodel.stopIndustryVO.sqyy"
						></el-input
						>原因，暂时停止（或者终止）粮油仓储经营业务，特此申报。
					</td>
				</tr>
				<tr>
					<td>联系电话</td>
					<td>
						<el-input
							v-model="tablemodel.stopIndustryVO.lxdh"
							disabled
						></el-input>
					</td>
				</tr>
				<tr>
					<td>停歇业日期</td>
					<td>
						<el-date-picker
							type="date"
							value-format="yyyy-MM-dd"
							format="yyyy-MM-dd"
							v-model="tablemodel.stopIndustryVO.txyrq"
							disabled
						></el-date-picker>
					</td>
				</tr>
			</table>

			<div v-if="tablemodel.stopIndustryVO.auditList">
				<el-row class="sub_title">
					企业停歇业审核
				</el-row>
				<table width="90%" cellspacing="1" border="2" class="audit">
					<tr>
						<th width="20%">审核部门</th>
						<th width="10%">审核人</th>
						<th width="20%">审核结果</th>
						<th width="20%">审核日期</th>
						<th width="30%">申请意见</th>
					</tr>
					<tr
						v-for="(item, index) in tablemodel.stopIndustryVO
							.auditList"
						:key="index"
					>
						<td>{{ item.qymc }}</td>
						<td>{{ item.qybashr }}</td>
						<td>
							<el-radio-group v-model="item.shjg" disabled>
								<el-radio label="1">通过</el-radio
								><el-radio label="0"
									>驳回</el-radio
								></el-radio-group
							>
						</td>
						<td>{{ item.shrq && item.shrq.slice(0, 10) }}</td>
						<td>
							<el-input
								type="text"
								clearable
								v-model="item.shyj"
								disabled
							></el-input>
						</td>
					</tr>
				</table>
			</div>
		</div>
		<div
			slot="footer"
			class="dialog-footer"
			style="text-align:center;margin-top:15px;"
		>
			<el-button
				type="primary"
				size="small"
				class="iconfont iconfanhui"
				@click="handleReturn"
				>返回</el-button
			>
		</div>
	</div>
</template>

<script>
import {
	detail,
	audit,
	subDetail
} from '@/api/grainCoManage/warehousingLogistics/dynamicFiling/index.js'
// '@/api/basq/qybasq'
import { getNowDate } from '@/utils/index'
function compare(property) {
	return function(a, b) {
		var value1 = a[property]
		var value2 = b[property]
		return value1 - value2
	}
}
export default {
	data() {
		return {
			tablemodel: {},
			tabledata: {},
			formData: {},
			qyxzs: [],
			auditData: {},
			jbtj: [
				{
					key:
						'拥有固定经营场地,符合有关污染源,危险源安全距离的规定:',
					val: '是'
				},
				{
					key:
						'拥有与从事粮油仓储活动相适应的设施设备,并符合粮油储藏技术规范的要求:',
					val: '是'
				},
				{
					key: '拥有相应的专业技术管理人员:',
					val: '是'
				}
			]
			//0，驳回，1，通过
		}
	},
	created() {
		let { id } = this.$route.query

		this.getDetail(id)
	},
	directives: {},
	methods: {
		getDetail(id) {
			detail(id).then((res) => {
				if (res.infoCode == 200) {
					this.tablemodel = res.data
					if (res.data.historyList) {
						this.tabledata = res.data.historyList[0]
						this.formData = res.data.historyList[0].modifyVO
						if (!this.formData || !this.formData.auditList) return
						this.formData.auditList = [
							...this.formData.auditList.sort(compare('qybm'))
						]
					}
				}
			})
		},
		handleReturn() {
			this.$router.push('index')
			// this.$router.push({ path: '/basq/qybasq' })
		}
	}
}
</script>
<style lang="scss" scoped>
$content_width: 90%;
table {
	border-collapse: collapse;
	margin: 0 auto;
	text-align: center;
	width: $content_width;
	tr {
		th {
			text-align: center;
			padding: 8px 0;
			font-weight: 500;
		}
		td:first-child {
			text-align: right;
			padding-right: 10px;
		}
		td {
			padding: 8px 0;
			&:first-child {
				text-align: right;
				padding-right: 10px;
			}
		}
	}
	&.audit {
		td {
			&:first-child {
				text-align: center;
			}
		}
	}
}
.footer_btn {
	text-align: center;
	margin: 20px;
}
.sub_title {
	height: 2.5em;
	line-height: 2.5em;
	color: white;
	text-align: center;
	margin: 20px auto;
	width: $content_width;
	background-color: #49a2fa;
}
</style>
