boxTabPage.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <template>
  2. <div>
  3. <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
  4. <el-tab-pane
  5. v-for="item in tabOption"
  6. :label="item.label"
  7. :name="item.name"
  8. >
  9. </el-tab-pane>
  10. </el-tabs>
  11. <keep-alive>
  12. <component
  13. v-if="activeName && isValidComponent(activeName)"
  14. :is="activeName"
  15. ref="componentRef"
  16. v-bind="activeNameProps"
  17. />
  18. </keep-alive>
  19. </div>
  20. </template>
  21. <script>
  22. import { getPurchaseOutSourceSendDetailAPI } from '@/api/bpm/components/purchasingManage/outSourceSend';
  23. export default {
  24. name: 'boxTabPage',
  25. components: {
  26. tab1: () => import('./detailDialog.vue'),
  27. tab2: () => import('@/views/bpm/outgoingManagement/outbound2.vue')
  28. },
  29. props: {
  30. taskDefinitionKey: {
  31. type: String,
  32. default: ''
  33. },
  34. activeComp: {
  35. type: String,
  36. default: ''
  37. },
  38. permissionType: {
  39. type: String,
  40. default: 'view'
  41. },
  42. businessId: {
  43. type: String,
  44. default: ''
  45. }
  46. },
  47. data() {
  48. return {
  49. form: {},
  50. activeName: 'tab1',
  51. cKey: 1
  52. };
  53. },
  54. computed: {
  55. tabOption() {
  56. let list = [
  57. {
  58. label: '发货单详情',
  59. name: 'tab1',
  60. isShow: true
  61. },
  62. {
  63. label: '出库',
  64. name: 'tab2',
  65. isShow: true
  66. }
  67. ];
  68. return list.filter((item) => item.isShow);
  69. },
  70. activeNameProps() {
  71. switch (this.activeName) {
  72. case 'tab1':
  73. return {
  74. businessId: this.businessId
  75. };
  76. case 'tab2':
  77. return {
  78. form: this.form,
  79. bizType: 7,
  80. sourceBizNo: this.form.code
  81. };
  82. }
  83. }
  84. },
  85. async created() {
  86. this.form = await getPurchaseOutSourceSendDetailAPI(this.businessId);
  87. console.log(this.form, 'sssssssssssssssssssssssssssssss');
  88. },
  89. methods: {
  90. isValidComponent(componentName) {
  91. const validComponents = ['tab1', 'tab2'];
  92. return validComponents.includes(componentName);
  93. },
  94. handleClick(val) {
  95. this.activeName = val.name;
  96. },
  97. async getTableValue() {
  98. return {
  99. form: this.form,
  100. returnStorageData: this.$refs.componentRef.getReturnStorage
  101. ? await this.$refs.componentRef.getReturnStorage()
  102. : ''
  103. };
  104. }
  105. }
  106. };
  107. </script>
  108. <style scoped lang="scss"></style>