<template>
  <div class="template-table">
    <!-- <SP001 v-if="sn == 'SP0012'" />
    <SWYPFXRYPZB v-if="sn == 'SP001'" /> -->
     <component ref="templateComponent" :is="getTemplateComponent()" :fillType="fillType">
      </component>
  </div>
</template>

<script>
//色谱
import SP001 from './comps/sp/SP001';
import SWYPFXRYPZB from "./comps/sp/SWYPFXRYPZB.vue";
export default {
  name: "TemplateTable",
  components: { 
    SP001,SWYPFXRYPZB 
  },
  props: {
    sn: {
      type: String,
      default: '',
    },
    fillType: {
      type: String,
      default: 'preFill',
    }
  },
  computed: {
    
    templateComponentMap() {
      if (!this.componentMap) {
        this.componentMap = {
          'SP001': 'SWYPFXRYPZB',
        }
      }
      return this.componentMap
    }
  },
  watch: {
    sn: {
      immediate: true,
      handler(v) {
      }
    }
  },
  data() {
    return {
      info: {},
    };
  },
  mounted() {
  },
  methods: {
    async getFormData() {
      return await this.$refs.templateComponent.getFormData();
    },
    getTemplateComponent() {
      return this.templateComponentMap[this.sn] 
    },
  }
};
</script>
<style rel="stylesheet/scss" lang="scss">
.template-table {
  background: #fff;
  padding: 10px 10px;
}
</style>