<template>
    <el-dialog
      title="详情"
      width="70%"
      :close-on-click-modal="false"
      :visible.sync="visible">
      <div style="margin-left: 20px;margin-right: 20px">
        <e-desc title="基本信息">
          <e-desc-item label="检验单编码">{{dataForm.inspectionCode}}</e-desc-item>
          <e-desc-item label="物品名称">{{dataForm.materialName}}</e-desc-item>
          <e-desc-item label="批次号">{{dataForm.batchNumber}}</e-desc-item>
          <e-desc-item label="规格/图号">{{dataForm.specifications}}</e-desc-item>
          <e-desc-item label="类别">{{dataForm.materialTypeName}}</e-desc-item>
          <e-desc-item label="来源">{{dataForm.source}}</e-desc-item>
          <e-desc-item label="来料类型">{{dataForm.inspectionType?optionsTypes.find(item => item.code === dataForm.inspectionType).value:''}}</e-desc-item>
          <e-desc-item label="检验依据">{{dataForm.inspectionBasis}}</e-desc-item>
          <e-desc-item label="合格证编码">{{dataForm.qualifiedCertificateCode}}</e-desc-item>
          <e-desc-item label="送检数量">{{dataForm.cnt}}</e-desc-item>
          <e-desc-item label="合格数量">{{dataForm.qualifiedCnt}}</e-desc-item>
          <e-desc-item label="检测设备" span="3" style="min-height: 80px">{{dataForm.detectionEquipment}}</e-desc-item>
          <e-desc-item label="检验结论" span="3" style="min-height: 80px">{{dataForm.conclusion}}</e-desc-item>
          <e-desc-item label="备注说明" span="3" style="min-height: 80px">{{dataForm.notes}}</e-desc-item>
        </e-desc>
        <e-desc title="检验项目">
          <el-table
            :data="checkList">
            <el-table-column
              label="序号"
              type="index"
              align="center"
              width="50"
            >
            </el-table-column>
            <el-table-column
              prop="inspectionProject"
              header-align="center"
              align="center"
              label="检验项目">
            </el-table-column>
            <el-table-column
              prop="technicalIndicators"
              header-align="center"
              align="center"
              label="技术指标">
            </el-table-column>
            <el-table-column
              prop="measuredRecords"
              header-align="center"
              align="center"
              label="实测记录">
            </el-table-column>
            <el-table-column
              prop="notes"
              header-align="center"
              align="center"
              label="备注">
            </el-table-column>
          </el-table>
        </e-desc>
      </div><span slot="footer" class="dialog-footer">
        <el-button @click="visible = false">取消</el-button>
      </span>

    </el-dialog>
</template>

<script>
  import EDesc from '../common/e-desc'
  import EDescItem from '../common/e-desc-item'
  import { getIncomingInspectionDetail } from '@/api/check'
  export default {
    name: 'ibc-detail',
    components: {
      EDesc, EDescItem
    },
    data () {
      return {
        visible: false,
        dataForm: {},
        checkList: [],
        optionsTypes: [
          {
            code: '1', value: '原、辅材料'
          },
          {
            code: '2', value: '外协件'
          },
          {
            code: '3', value: '其他'
          }
        ]
      }
    },
    methods: {
      async init (id) {
        this.visible = true
        this.dataForm = {}
        await getIncomingInspectionDetail(id).then(({data}) => {
          if (data && data.code === '200') {
            this.dataForm = data.data
            if (data.data.qualityInspectionItemsList) {
              this.checkList = data.data.qualityInspectionItemsList
            }
          }
        })
      }
    }
  }
</script>

<style scoped>

</style>
