boxTabPage.vue 2.3 KB

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