<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.productName}}</e-desc-item>
          <e-desc-item label="产品编号">{{dataForm.prodCode}}</e-desc-item>
          <e-desc-item label="状态">{{dataForm.state?optionsStates.find(item => item.code === dataForm.state).value:''}}</e-desc-item>

          <e-desc-item label="工艺名称">{{dataForm.techName}}</e-desc-item>
          <e-desc-item label="工序号">{{dataForm.stepName}}</e-desc-item>

          <e-desc-item label="记录说明" span="3">{{dataForm.recordsNote}}</e-desc-item>

          <e-desc-item label="检验员">{{dataForm.operation}}</e-desc-item>
          <e-desc-item label="检验时间">{{dataForm.operationTime}}</e-desc-item>

          <e-desc-item label="备注说明" span="3">{{dataForm.notes}}</e-desc-item>
        </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 { getFinishedInspectionDetail } from '@/api/check'
  export default {
    name: 'fc-detail',
    components: {
      EDesc, EDescItem
    },
    data () {
      return {
        visible: false,
        dataForm: {},
        checkList: [],
        optionsStates: [
          {
            code: '0', value: '等待'
          },
          {
            code: '1', value: '未开始'
          },
          {
            code: '2', value: '进行中'
          },
          {
            code: '3', value: '已完成'
          }
        ]
      }
    },
    methods: {
      async init (id) {
        console.log('id = ' + id)
        this.visible = true
        this.dataForm = {}
        await getFinishedInspectionDetail(id).then(({data}) => {
          if (data && data.code === '200' && data.data) {
            this.dataForm = data.data
          }
        })
      }
    }
  }
</script>

<style scoped>

</style>
