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

93 lines
2.2 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 SWYPNBGZYZBB from "./comps/sp/SWYPNBGZYZBB.vue";
  16. import Demo from "./comps/sp/Demo.vue";
  17. import IndexDBDemo from "./comps/sp/IndexDBDemo.vue";
  18. //公用
  19. import SYWZPZJHB from "./comps/gy/SYWZPZJHB.vue";
  20. import MJYLQSQD from "./comps/gy/MJYLQSQD.vue";
  21. export default {
  22. name: "TemplateTable",
  23. components: {
  24. MJYLQSQD,SYWZPZJHB,
  25. SP001,SWYPFXRYPZB ,Demo,SWYPFXCBYPZB,SWYPBQGZYZBB,SWYPNBGZYZBB,IndexDBDemo
  26. },
  27. props: {
  28. sn: {
  29. type: String,
  30. default: '',
  31. },
  32. fillType: {
  33. type: String,
  34. default: 'preFill',
  35. },
  36. templateData: {
  37. type: Object,
  38. default: () => {},
  39. },
  40. },
  41. computed: {
  42. templateComponentMap() {
  43. if (!this.componentMap) {
  44. this.componentMap = {
  45. 'SP001': 'SWYPFXRYPZB',
  46. 'SP002': 'SWYPFXCBYPZB',
  47. 'SP003': 'SWYPBQGZYZBB',
  48. 'SP004': 'SWYPNBGZYZBB',
  49. 'SYWZPZJHB': 'SYWZPZJHB',
  50. 'MJYLQSQD': 'MJYLQSQD',
  51. // 'SP001': 'IndexDBDemo',
  52. }
  53. }
  54. return this.componentMap || "Demo"
  55. }
  56. },
  57. watch: {
  58. sn: {
  59. immediate: true,
  60. handler(v) {
  61. console.log(v,"sn")
  62. }
  63. }
  64. },
  65. data() {
  66. return {
  67. info: {},
  68. };
  69. },
  70. mounted() {
  71. console.log(this.fillType,"fillType")
  72. },
  73. methods: {
  74. async getFormData() {
  75. return await this.$refs.templateComponent.getFormData();
  76. },
  77. getResource(){
  78. return this.$refs.templateComponent.getResource();
  79. },
  80. getTemplateComponent() {
  81. return this.templateComponentMap[this.sn]
  82. },
  83. }
  84. };
  85. </script>
  86. <style rel="stylesheet/scss" lang="scss">
  87. .template-table {
  88. background: #fff;
  89. padding: 10px 10px;
  90. }
  91. </style>