|
|
- <template>
- <div class="template-table">
- <!-- <SP001 v-if="sn == 'SP0012'" />
- <SWYPFXRYPZB v-if="sn == 'SP001'" /> -->
- <component ref="templateComponent" :is="getTemplateComponent()" :templateData="templateData" :fillType="fillType">
- </component>
- </div>
- </template>
-
- <script>
- //色谱
- import SP001 from './comps/sp/SP001';
- import SWYPFXRYPZB from "./comps/sp/SWYPFXRYPZB.vue";
- import SWYPFXCBYPZB from "./comps/sp/SWYPFXCBYPZB.vue";
- import SWYPBQGZYZBB from "./comps/sp/SWYPBQGZYZBB.vue";
- import SYWZPZJHB from "./comps/dl/SYWZPZJHB.vue";
- import SWYPNBGZYZBB from "./comps/sp/SWYPNBGZYZBB.vue";
- import Demo from "./comps/sp/Demo.vue";
- export default {
- name: "TemplateTable",
- components: {
- SP001,SWYPFXRYPZB ,Demo,SWYPFXCBYPZB,SWYPBQGZYZBB,SYWZPZJHB,SWYPNBGZYZBB,
- },
- props: {
- sn: {
- type: String,
- default: '',
- },
- fillType: {
- type: String,
- default: 'preFill',
- },
- templateData: {
- type: Object,
- default: () => {},
- },
- },
- computed: {
-
- templateComponentMap() {
- if (!this.componentMap) {
- this.componentMap = {
- 'SP001': 'SWYPFXRYPZB',
- 'SP002': 'SWYPFXCBYPZB',
- 'SP003': 'SWYPBQGZYZBB',
- 'SP004': 'SWYPNBGZYZBB',
- 'DL001': 'SYWZPZJHB',
- // 'SP001': 'Demo',
- }
- }
- return this.componentMap || "Demo"
- }
- },
- watch: {
- sn: {
- immediate: true,
- handler(v) {
- console.log(v,"sn")
- }
- }
- },
- data() {
- return {
- info: {},
- };
- },
- mounted() {
- console.log(this.fillType,"fillType")
- },
- 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>
|