华西海圻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.

80 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. 'SP003': 'SWYPBQGZYZBB',
  42. // 'SP001': 'Demo',
  43. }
  44. }
  45. return this.componentMap || "Demo"
  46. }
  47. },
  48. watch: {
  49. sn: {
  50. immediate: true,
  51. handler(v) {
  52. console.log(v,"sn")
  53. }
  54. }
  55. },
  56. data() {
  57. return {
  58. info: {},
  59. };
  60. },
  61. mounted() {
  62. console.log(this.fillType,"fillType")
  63. },
  64. methods: {
  65. async getFormData() {
  66. return await this.$refs.templateComponent.getFormData();
  67. },
  68. getTemplateComponent() {
  69. return this.templateComponentMap[this.sn]
  70. },
  71. }
  72. };
  73. </script>
  74. <style rel="stylesheet/scss" lang="scss">
  75. .template-table {
  76. background: #fff;
  77. padding: 10px 10px;
  78. }
  79. </style>