<template>
	<div>
		<!-- 		<el-card class="box-card" style="height: 100%;">
 -->
		<!-- <div slot="header" class="clearfix"> -->
		<el-breadcrumb separator-class="el-icon-arrow-right">
			<el-breadcrumb-item>首页</el-breadcrumb-item>
			<!-- <el-breadcrumb-item></el-breadcrumb-item> -->
			<el-breadcrumb-item>任务详情</el-breadcrumb-item>
			<el-breadcrumb-item>抽样</el-breadcrumb-item>
			<el-breadcrumb-item>抽样单详情</el-breadcrumb-item>
		</el-breadcrumb>
		<el-descriptions  title="农产品质量安全抽样单详情" :column="2" border style="margin-top:20px;" :contentStyle="{'text-align': left}">
	<el-descriptions-item label="*样品名称" prop="form.sample_name" class="labelItem" size="mini">
		<el-input v-model="form.sample_name" disabled></el-input>
		<!-- </el-col> -->
	</el-descriptions-item>
	<el-descriptions-item label="样品编码" prop="form.sample_id" class="labelItem" style="" size="mini">
		<el-input v-model="form.sample_id" disabled></el-input>
	</el-descriptions-item>
	<el-descriptions-item label="商标" prop="form.brand" class="labelItem" size="mini">
		<el-input v-model="form.brand" disabled></el-input>
	</el-descriptions-item>
	<el-descriptions-item label="包装" prop="form.ispack" class="labelItem" style="" size="mini">
		<el-radio v-model="form.ispack" label="有" disabled>有</el-radio>
		<el-radio v-model="form.ispack" label="无" disabled>无</el-radio>
	</el-descriptions-item>
	<el-descriptions-item label="型号规格" prop="form.type" class="labelItem" size="mini">
		<el-input v-model="form.type" disabled></el-input>
	</el-descriptions-item>
	<el-descriptions-item label="执行标准" prop="form.standard" class="labelItem" style="" size="mini">
		<el-input v-model="form.standard" disabled></el-input>
	</el-descriptions-item>
	<el-descriptions-item label="*生产日期或批号" prop="form.production_date" class="labelItem" size="mini">
		<el-input v-model="form.production_date" disabled></el-input>
	</el-descriptions-item>
	<el-descriptions-item label="产地" prop="form.place" class="labelItem" style="" size="mini">
		<!-- <el-cascader  :options="options" v-model="selectedOptions" @change="handleChange" style="width:60%"></el-cascader> -->
		<el-input v-model="form.place" disabled></el-input>

	</el-descriptions-item>
	<el-descriptions-item label="*产品认证情况" prop="form.certicfie" class="labelItem" size="mini">
		<el-radio v-model="form.certicfie" label="无公害农产品" disabled>无公害农产品</el-radio>
		<el-radio v-model="form.certicfie" label="绿色食品" disabled>绿色食品</el-radio>
		<el-radio v-model="form.certicfie" label="有机食品" disabled>有机食品</el-radio>
		<el-radio v-model="form.certicfie" label="其他" disabled>其他</el-radio>
	</el-descriptions-item>
	<el-descriptions-item label="证书编号" prop="form.certifie_num" class="labelItem" style="" size="mini">
		<el-input v-model="form.certifie_num" disabled></el-input>
	</el-descriptions-item>
	<el-descriptions-item label="*抽样数量" prop="form.sample_num" class="labelItem" size="mini" required>
		<el-input v-model="form.sample_num" style="width:180px" disabled></el-input>
		<a> * 单位 </a><el-input v-model="form.sample_num_unit" clearable="true" style="width:180px" disabled></el-input>
	</el-descriptions-item>
	<el-descriptions-item label="抽样基数" prop="form.sample_base" class="labelItem" size="mini" required>
		<el-input v-model="form.sample_base" style="width:180px" disabled></el-input>
		<a> * 单位 </a><el-input v-model="form.sample_base_unit" clearable="true" style="width:180px" disabled></el-input>
	</el-descriptions-item>
	<el-descriptions-item label="*抽样场所" prop="form.sample_ground" class="labelItem" size="mini" required >
							<el-radio v-model="form.sample_ground" label="生产基地/企业" disabled>生产基地/企业</el-radio>
							<el-radio v-model="form.sample_ground" label="屠宰场" disabled>屠宰场</el-radio>
							<el-radio v-model="form.sample_ground" label="农贸市场" disabled>农贸市场</el-radio>
							<el-radio v-model="form.ample_ground" label="批发市场" disabled>批发市场</el-radio>
							<el-radio v-model="form.sample_ground" label="超市" disabled>超市</el-radio>
							<el-radio v-model="form.sample_ground" label="其他" disabled>其他</el-radio>
	</el-descriptions-item>
	</el-descriptions>
	<!-- 受检单位情况 -->
	<el-descriptions :column="1" border style="" >
		<el-descriptions-item label="受检单位情况" >
			<el-descriptions  :column="1" border  size="mini" style="width:100%">
				<el-descriptions-item label="*单位名称" prop="unit_test.unit_test_name" class="labelItem" size="mini" required>
									<el-input v-model="unit_test.unit_test_name" disabled></el-input>
				</el-descriptions-item>
				<el-descriptions-item label="*法定代表人" prop="unit_test.represent_name" class="labelItem" size="mini" required>
									<el-input v-model="unit_test.represent_name" disabled></el-input>
				</el-descriptions-item>
				<el-descriptions-item label="*受检人" prop="unit_test.user_name" class="labelItem" size="mini" required>
									<el-input v-model="unit_test.user_name" disabled></el-input>
				</el-descriptions-item>
				<el-descriptions-item label="*联系电话" prop="unit_test.phone" class="labelItem" size="mini">
									<el-input v-model="unit_test.phone" disabled></el-input>
				</el-descriptions-item>
				<el-descriptions-item label="*通讯地址" prop="unit_test.address" class="labelItem" size="mini" required>
									<el-input v-model="unit_test.address" disabled></el-input>
				</el-descriptions-item>
				<el-descriptions-item label="传真" prop="unit_test.fax" class="labelItem" size="mini">
							<el-input v-model="unit_test.fax" disabled></el-input>
				</el-descriptions-item>
			</el-descriptions>
		</el-descriptions-item>
	</el-descriptions>
		<!-- 生产单位情况 -->
		<el-descriptions :column="1" border style="" >
			<el-descriptions-item label="生产单位情况"  >
				<el-descriptions  :column="1" border size="mini" style="width:100%" >
			<el-descriptions-item label="*单位名称" prop="unit_production.unit_production_name" class="labelItem" style="" size="mini" required>
				<el-input v-model="unit_production.unit_production_name" disabled></el-input>
			</el-descriptions-item>
			<el-descriptions-item label="*联系人" prop="unit_production.user_name" class="labelItem" style="" size="mini" required>
				<el-input v-model="unit_production.user_name" disabled></el-input>
			</el-descriptions-item>
			<el-descriptions-item label="*联系电话" prop="unit_production.phone" class="labelItem" style="" size="mini">
				<el-input v-model="unit_production.phone" disabled></el-input>
			</el-descriptions-item>
			<el-descriptions-item label="*通讯地址" prop="unit_production.address" class="labelItem" style="" size="mini" required>
				<el-input v-model="unit_production.address" disabled></el-input>
			</el-descriptions-item>
			<el-descriptions-item label="邮编" prop="unit_production.postcode" class="labelItem" style="" size="mini">
				<el-input v-model="unit_production.postcode" disabled></el-input>
			</el-descriptions-item>
			
			<el-descriptions-item label="传真" prop="unit_production.fax" class="labelItem" style="" size="mini">
				<el-input v-model="unit_production.fax" disabled></el-input>
			</el-descriptions-item>
			<el-descriptions-item label="生产方式" prop="unit_production.production_class" class="labelItem" style=""  required>
				<el-radio v-model="unit_production.production_class" label="自产" disabled>自产</el-radio>
				<el-radio v-model="unit_production.production_class" label="收购" disabled>收购</el-radio>
			</el-descriptions-item>
			</el-descriptions>
			</el-descriptions-item>
		</el-descriptions>


		<!-- 抽样单位情况 -->
		<el-descriptions :column="1" border style="" >
			<el-descriptions-item label="抽样单位情况" >
				<el-descriptions  :column="1" border size="mini" style="width:100%">
			<el-descriptions-item label="*单位名称" prop="unit_sample.unit_sample_name" class="labelItem" style="" size="mini" required>
									<el-input v-model="unit_sample.unit_sample_name" disabled></el-input>
			</el-descriptions-item>
			<el-descriptions-item label="*联系人" prop="unit_sample.unit_user" class="labelItem" style="" size="mini" required>
									<el-input v-model="unit_sample.unit_user" disabled></el-input>
			</el-descriptions-item>
			<el-descriptions-item label="*联系电话" prop="unit_sample.phone" class="labelItem" style="" size="mini">
									<el-input v-model="unit_sample.phone" disabled></el-input>
			</el-descriptions-item>
			<el-descriptions-item label="*通讯地址" prop="unit_sample.address" class="labelItem" style="" size="mini" required>
									<el-input v-model="unit_sample.address" disabled></el-input>
			</el-descriptions-item>
			<el-descriptions-item label="邮编" prop="unit_sample.postcode" class="labelItem" style="" size="mini">
									<el-input v-model="unit_sample.postcode" disabled></el-input>
			</el-descriptions-item>
			<el-descriptions-item label="传真" prop="unit_sample.fax" class="labelItem" style="" size="mini">
									<el-input v-model="unit_sample.fax" disabled></el-input>
			</el-descriptions-item>
			<el-descriptions-item label="Email" prop="unit_sample.email" class="labelItem" style="" size="mini">
									<el-input v-model="unit_sample.email" disabled></el-input>
			</el-descriptions-item>
			</el-descriptions>
			</el-descriptions-item>
		</el-descriptions>

		<el-descriptions  :column="2" border>
			<el-descriptions-item label="检测任务依据" prop="form.base" class="labelItem" style="" size="mini" required>
								<el-input v-model="form.base" disabled></el-input>
			</el-descriptions-item>
			<el-descriptions-item  label="抽样时间" prop="form.sample_date" class="labelItem" style="" size="mini" required>
								<el-date-picker v-model="form.sample_date" type="date" value-format="yyyy-MM-dd" disabled>
								</el-date-picker>
			</el-descriptions-item>
			<el-descriptions-item  label="被抽检单位签字盖章附件" prop="form.file_name" class="labelItem" style="" size="mini">
									<el-input v-model="form.file_name" disabled></el-input>

								<!-- <el-upload class="upload-demo" :file-list="fileList" drag :headers="myHeaders"

									action="http://new.syjcapi.aielab.net/api/v1/ossUpload" :on-success="uploadSuccess" :limit="1">

									<i class="el-icon-upload"></i>
									<div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
								</el-upload> -->
			</el-descriptions-item>
		</el-descriptions>
		<el-form>
			<el-form-item class="btn">
				<el-button type="primary" @click="backTaskDetail()">返回任务详情</el-button>
			</el-form-item>
		</el-form>
	</div>
</template>

<script>
	const token = window.sessionStorage.getItem('token')

	export default {
		name: 'sampleDetail',
		data() {
			return {
				form: {},
				cyd_data: {},//抽样单信息上部分
				unit_test: {},//受检单位信息
				unit_production: {},//生产单位信息
				unit_sample: {},//抽样单位信息
			}
		},
		created() {
			this.id = this.$route.params.id
			console.log(this.id)
			this.getSampleDetail()
		},
		methods: {
			//返回任务详情页面
			async backTaskDetail() {
					var that = this
					console.log(that.form.task_id)
				this.$router.push({
					name: 'taskSample',
					params: {
						task_id: that.form.task_id
					}
				})
			},
			// 获取样本详情
			async getSampleDetail() {
				// let that = this
				const result = await this.$http.post('getSampleDetail', {
					sample_id: this.id
				})
				console.log(result.data.data)
					this.form = result.data.data
					this.unit_test = this.form.unitTest
					this.unit_production = this.form.unitProduction
					this.unit_sample = this.form.unitSample
					console.log(this.form)
			},
		}
	}
</script>

<style lang="less" scoped>
	// .form {
	// 	display: flex;
	// 	flex-direction: row;
	// 	justify-content: space-between;
	// }
		.el-descriptions {
		width: 80%;
		margin: auto;
	}
	.btn{
		margin-top:20px ;
		// float: right;
		text-align: center;
	}

	/deep/ .el-descriptions__title {
		margin: auto;
		font-size: 1.25rem;
		// font-weight: 31.25rem !important;
	}
</style>
