华西海圻ELN前端工程
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
1.7 KiB

2 weeks ago
2 weeks ago
2 weeks ago
  1. <template>
  2. <div class="template-table">
  3. <!-- <SP001 v-if="sn == 'SP0012'" />
  4. <SWYPFXRYPZB v-if="sn == 'SP001'" /> -->
  5. <component ref="templateComponent" :is="getTemplateComponent()" :templateData="templateData" :fillType="fillType">
  6. </component>
  7. </div>
  8. </template>
  9. <script>
  10. //色谱
  11. import SP001 from './comps/sp/SP001';
  12. import SWYPFXRYPZB from "./comps/sp/SWYPFXRYPZB.vue";
  13. import SWYPFXCBYPZB from "./comps/sp/SWYPFXCBYPZB.vue";
  14. import SWYPBQGZYZBB from "./comps/sp/SWYPBQGZYZBB.vue";
  15. import Demo from "./comps/sp/Demo.vue";
  16. export default {
  17. name: "TemplateTable",
  18. components: {
  19. SP001,SWYPFXRYPZB ,Demo,SWYPFXCBYPZB,SWYPBQGZYZBB,
  20. },
  21. props: {
  22. sn: {
  23. type: String,
  24. default: '',
  25. },
  26. fillType: {
  27. type: String,
  28. default: 'preFill',
  29. },
  30. templateData: {
  31. type: Object,
  32. default: () => {},
  33. },
  34. },
  35. computed: {
  36. templateComponentMap() {
  37. if (!this.componentMap) {
  38. this.componentMap = {
  39. 'SP001': 'SWYPFXRYPZB',
  40. // 'SP002': 'SWYPFXCBYPZB',
  41. 'SP002': 'SWYPBQGZYZBB',
  42. 'SP003': 'SWYPBQGZYZBB',
  43. // 'SP001': 'Demo',
  44. }
  45. }
  46. return this.componentMap || "Demo"
  47. }
  48. },
  49. watch: {
  50. sn: {
  51. immediate: true,
  52. handler(v) {
  53. console.log(v,"sn")
  54. }
  55. }
  56. },
  57. data() {
  58. return {
  59. info: {},
  60. };
  61. },
  62. mounted() {
  63. console.log(this.fillType,"fillType")
  64. },
  65. methods: {
  66. async getFormData() {
  67. return await this.$refs.templateComponent.getFormData();
  68. },
  69. getTemplateComponent() {
  70. return this.templateComponentMap[this.sn]
  71. },
  72. }
  73. };
  74. </script>
  75. <style rel="stylesheet/scss" lang="scss">
  76. .template-table {
  77. background: #fff;
  78. padding: 10px 10px;
  79. }
  80. </style>