<template>
    <div class="mod-config">
      <el-tabs class="tabs" tab-position="left" style="height: 200px;"  type="border-card" v-model="activeName" @tab-click="refreshCurrentTabTable">
        <el-tab-pane label="基本信息"  name="baseInfo" v-if="true">
          <basicInformation ref="basicInformation"  ></basicInformation>
        </el-tab-pane>
        <el-tab-pane label="客户信息"  name="customerInfo" v-if="true">
          <customerInfo ref="customerInfo"  ></customerInfo>
        </el-tab-pane>
        <el-tab-pane label="包装信息"  name="packageInfo" v-if="true">
          <packageInfo ref="packageInfo"></packageInfo>
        </el-tab-pane>
        <el-tab-pane label="材料信息"  name="bom" v-if="true">
          <bom ref="bom"></bom>
        </el-tab-pane>
        <el-tab-pane label="工艺信息"  name="routing">
          <routing ref="routing"></routing>
        </el-tab-pane>
        <el-tab-pane label="印前"  name="prepress">
          <prepress ref="prepress"></prepress>
        </el-tab-pane>
      </el-tabs>
    </div>
</template>

<script>
  import basicInformation from "./com_tsd_basicInformation";/*組件*/
  import customerInfo from "./com_bm_customerInformation";/*客户信息*/
  import packageInfo from "./com_bm_packageInfo";/*包装信息*/
  import bom from "./com_bm_bom";/*BOM*/
  import routing from "./com_bm_routing";/*工艺*/
  import prepress from "./com_bm_prepress";/*印前*/
  export default {
    name: "technicalSpecificationDetail",
    components: {
      basicInformation,
      customerInfo,
      packageInfo,
      bom,
      routing,
      prepress,
    },
    data() {
      return {
        dataForm:{
          site:'',
          codeNo:'',
          buNo:'',
          username:this.$store.state.user.name,
        },
        activeName:'baseInfo',

      }
    },
    mounted() {
      if(localStorage.getItem('tsfData')!=undefined){
        let data=JSON.parse(localStorage.getItem('tsfData'))
        this.dataForm.site=data.site
        this.dataForm.codeNo=data.codeNo
        this.dataForm.buNo=data.buNo
        localStorage.removeItem('tsfData');
      }
      this.$nextTick(() => {
        //页签大小铺满网页
        var tabsElement = document.querySelector('.tabs');
        tabsElement.style.minHeight = window.innerHeight+'px';
        this.refreshCurrentTabTable()
      })
    },
    methods: {
      refreshCurrentTabTable(){
        if (this.activeName == 'baseInfo') {
          this.getBaseInfoData();
        }else if(this.activeName == 'customerInfo'){
          this.getCustomerInfo();
        }else if(this.activeName == 'packageInfo'){
          this.getPackageInfo();
        }else if(this.activeName == 'bom'){
          this.getBom();
        }else if(this.activeName == 'routing'){
          this.getRouting();
        }
      },
      getBaseInfoData(){
        this.$refs.basicInformation.init(JSON.parse(JSON.stringify(this.dataForm)))
      },
      getCustomerInfo(){
        this.$refs.customerInfo.init(JSON.parse(JSON.stringify(this.dataForm)))
      },
      getPackageInfo(){
        this.$refs.packageInfo.init(JSON.parse(JSON.stringify(this.dataForm)))
      },
      getBom(){
        this.$refs.bom.init(JSON.parse(JSON.stringify(this.dataForm)))
      },
      getRouting(){
        this.$refs.routing.init(JSON.parse(JSON.stringify(this.dataForm)))
      },
    },
  }
</script>

<style >

</style>
