<template>
<div>
    <el-descriptions title="抽样单" direction="vertical" :column="5" border align="center">
            <!-- 抽样单信息 -->
            <el-descriptions-item label="抽样单编码" prop="cyd_data.cyd_code">{{cyd_data.cyd_code}}</el-descriptions-item>
            <el-descriptions-item label="抽样单状态" prop="cyd_data.cyd_status">{{cyd_data.cyd_status}}</el-descriptions-item>
            <el-descriptions-item label="单位名称" prop="taskProfile_unit.sampleOrgId.name">{{taskProfile_unit.sampleOrgId.name}}</el-descriptions-item>
            <el-descriptions-item label="单位别名" prop="taskProfile_unit.sampleOrgId.name_other">{{taskProfile_unit.sampleOrgId.name_other}}</el-descriptions-item>
            <el-descriptions-item label="组别" prop="taskProfile_unit.sampleOrgId.groupname">{{taskProfile_unit.sampleOrgId.groupname}}</el-descriptions-item>
            <el-descriptions-item label="机构性质" prop="taskProfile_unit.sampleOrgId.properties">{{taskProfile_unit.sampleOrgId.properties}}</el-descriptions-item>
            <el-descriptions-item label="联系人" prop="taskProfile_unit.sampleOrgId.contact_name">{{taskProfile_unit.sampleOrgId.contact_name}}</el-descriptions-item>
            <el-descriptions-item label="联系电话" prop="taskProfile_unit.sampleOrgId.contact_phone">{{taskProfile_unit.sampleOrgId.contact_phone}}</el-descriptions-item>
            <!-- 抽样人员信息 -->
            <el-descriptions-item label="抽样人员1" prop="cydProfile_unit.sample_person_one">{{cydProfile_unit.sample_person_one}}</el-descriptions-item>
            <el-descriptions-item label="抽样人员2" prop="cydProfile_unit.sample_person_two">{{cydProfile_unit.sample_person_two}}</el-descriptions-item>
            <el-descriptions-item label="抽样地区" prop="cydProfile_unit.sample_address">{{cydProfile_unit.sample_address}}</el-descriptions-item>
            <el-descriptions-item label="抽样日期" prop="cydProfile_unit.cyd_date">{{cydProfile_unit.cyd_date}}</el-descriptions-item>
            <el-descriptions-item label="附件名称" prop="cydProfile_unit.cyd_file_name">{{cydProfile_unit.cyd_file_name}}</el-descriptions-item>
            <el-descriptions-item label="附件链接" prop="cydProfile_unit.cyd_file_url">{{cydProfile_unit.cyd_file_url}}</el-descriptions-item>
            <el-descriptions-item label="抽样单备注" prop="cydProfile_unit.cyd_log">{{cydProfile_unit.cyd_log}}</el-descriptions-item>
            <!-- 受检单位信息 -->
            <el-descriptions-item label="受检地区" prop="inspected_unit.inspected_address">{{inspected_unit.inspected_address}}</el-descriptions-item>
            <el-descriptions-item label="受检单位名称" prop="inspected_unit.inspected_name">{{inspected_unit.inspected_name}}</el-descriptions-item>
            <el-descriptions-item label="联系人" prop="inspected_unit.contact_name">{{inspected_unit.contact_name}}</el-descriptions-item>
            <el-descriptions-item label="联系人电话" prop="inspected_unit.contact_phone">{{inspected_unit.contact_phone}}</el-descriptions-item>
            <el-descriptions-item label="联系人邮箱" prop="inspected_unit.contact_email">{{inspected_unit.contact_email}}</el-descriptions-item>
            <!-- 样品信息 -->
            <el-descriptions-item label="样品名称" prop="sample_unit.sample_name">{{sample_unit.sample_name}}</el-descriptions-item>
            <el-descriptions-item label="样品商标" prop="sample_unit.sample_brand">{{sample_unit.sample_brand}}</el-descriptions-item>
            <el-descriptions-item label="样品规格型号" prop="sample_unit.sample_type">{{sample_unit.sample_type}}</el-descriptions-item>
            <el-descriptions-item label="样品生产日期" prop="sample_unit.sample_md_date">{{sample_unit.sample_md_date}}</el-descriptions-item>
            <el-descriptions-item label="样品质量等级" prop="sample_unit.sample_quality_grade">{{sample_unit.sample_quality_grade}}</el-descriptions-item>
            <el-descriptions-item label="样品生产厂家" prop="sample_unit.sample_product_name">{{sample_unit.sample_product_name}}</el-descriptions-item>
            <el-descriptions-item label="样品生产厂家联系电话" prop="sample_unit.sample_product_phone">{{sample_unit.sample_product_phone}}</el-descriptions-item>
            <el-descriptions-item label="样品来源" prop="sample_unit.sample_source">{{sample_unit.sample_source}}</el-descriptions-item>
            <el-descriptions-item label="抽样日期" prop="sample_unit.sample_ing_date">{{sample_unit.sample_ing_date}}</el-descriptions-item>
            <el-descriptions-item label="抽样数量" prop="sample_unit.sample_count">{{sample_unit.sample_count}}</el-descriptions-item>
            <el-descriptions-item label="抽样基数" prop="sample_unit.sample_base">{{sample_unit.sample_base}}</el-descriptions-item>
            <el-descriptions-item label="样品备注" prop="sample_unit.sample_log">{{sample_unit.sample_log}}</el-descriptions-item>
         <!-- 返回 -->
        </el-descriptions> 
        <el-form>
				<el-form-item class="btn">
				<el-button type="primary" @click="back()">返回</el-button>
                </el-form-item>
		</el-form>
</div>
</template>
                    

<script>
	const token = window.sessionStorage.getItem('token')
	export default {
		data() {
			return {
				cyd_data: {},//抽样单信息
                cydProfile_unit:{},//抽样人员信息
                taskProfile_unit:{},//抽样单位信息
				inspected_unit: {},//受检单位信息
				sample_unit: {},//样品信息
			}
		},
		created() {
			this.cyd_id = this.$route.params.cyd_id
			// this.sample_id = 34
			console.log(this.cyd_id)
			console.log(this.sample_id)
			this.getCyd()
		},
		methods: {
          // 返回
			back() {
				var that = this
				console.log(that.task_id)
				this.$router.push({
					name: 'readSampleList',
					params: {
						id: that.task_id
					}
				})
			},
			// 获取抽样单信息
			async getCyd(id) {
				const result = await this.$http.post('getCyd', {
					cyd_id: this.cyd_id,
					sample_id :34
				})
				console.log(result.data.data)
				this.cyd_data = result.data.data//抽样单信息
                this.cydProfile_unit = result.data.data.cydProfile//抽样人员信息
                this.taskProfile_unit = result.data.data.taskProfile//抽样单位信息
				this.inspected_unit = result.data.data.inspectedUnit//受检单位信息
				this.sample_unit = result.data.data.sample//样品信息
				console.log(this.cyd_data)
                console.log(this.cydProfile_unit)
                console.log(this.taskProfile_unit)
				console.log(this.inspected_unit)
				console.log(this.sample_unit)
                console.log(this.cyd_id)
			},
		},
	}
</script>