<template>
  <div class="app-container">

        <el-tabs type="border-card">
          <el-tab-pane label="申请信息" style="overflow-y:auto;overflow-x:hidden;">
            <CCCform :action="action" @handleCommit="save" :certapp="certapp" v-if="kind=='CCC'&isLoad"></CCCform>
            <QMSform :action="action" @handleCommit="save" :certapp="certapp" v-if="kind=='QMS'&isLoad"></QMSform>
          </el-tab-pane>
        
          <el-tab-pane label="产品单元" v-if="certapp">
            <Productunit :certapp="certapp"></Productunit>
          </el-tab-pane>
          <el-tab-pane label="原材料供应商" v-if="certapp">
          </el-tab-pane>
         
            <el-tab-pane label="检测设备" v-if="certapp">

            </el-tab-pane>
            <el-tab-pane label="资料评审" v-if="certapp">
              <REVIEW :certapp="certapp"></REVIEW>
            </el-tab-pane>
            <el-tab-pane label="收费信息" v-if="certapp">
              <CHARGE :certapp="certapp"></CHARGE>
              <!--<el-button type="primary"
             @click="handleComplete()">完成受理</el-button>-->
            </el-tab-pane>
        </el-tabs>
  </div>
</template>
<script>
import CCCform from "@/views/certapp/cccform"
import REVIEW from "@/views/certapp/review"
  
import CHARGE from "@/views/certapp/charge"
import Productunit from "@/views/certapp/productunit"
import { getCertapp, completeCertapp } from "@/api/certapp"
import router from '@/router';
import QMSform from "@/views/certapp/qmsform"
export default {
  components: { CCCform, Productunit, QMSform,REVIEW,CHARGE},
  props: [],
  data() {
    return {
      action:'create',
      certapp:null,
      kind:'CCC',
      isLoad:false
    };
  },
  computed: {},
  watch: {
    // "formData.cert_field": "changeRules"
  },
  created() {
    this.getParams()
  },
  mounted() {},
  methods: {
      getParams(){
          var action = this.$route.params.action
          var kind = this.$route.params.kind
          this.action = action
          this.kind = kind
          if(action=='update'){
            getCertapp(this.$route.query.id).then(res=>{
              this.certapp = res.data
              this.isLoad = true
            })
          }else{
            this.isLoad = true
          }
      },
      save(val){
        this.certapp=val
      },
      handleComplete(){
        completeCertapp(this.certapp.id).then(res=>{
          this.$message.success('成功')
          this.$router.go(-1)
        })
      }
  }
};
</script>
