boxTabPage.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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. :key="activeName"
  16. ref="componentRef"
  17. v-bind="activeNameProps"
  18. />
  19. </keep-alive>
  20. </div>
  21. </template>
  22. <script>
  23. import { deepClone } from '@/components/FormGenerator/utils/index';
  24. import { getPickOrderById } from '@/api/pda';
  25. export default {
  26. name: 'boxTabPage',
  27. components: {
  28. tab1: () => import('./detailDialog.vue'),
  29. tab2: () => import('@/views/bpm/outgoingManagement/outbound.vue')
  30. },
  31. props: {
  32. taskDefinitionKey: {
  33. type: String,
  34. default: ''
  35. },
  36. activeComp: {
  37. type: String,
  38. default: ''
  39. },
  40. permissionType: {
  41. type: String,
  42. default: 'view'
  43. },
  44. businessId: {
  45. type: String,
  46. default: ''
  47. }
  48. },
  49. data() {
  50. return {
  51. form: {},
  52. activeName: 'tab1',
  53. cKey: 1,
  54. extractedList: [],
  55. wwType: ''
  56. };
  57. },
  58. computed: {
  59. tabOption() {
  60. let list = [
  61. {
  62. label: '领料单详情',
  63. name: 'tab1',
  64. isShow: true
  65. },
  66. {
  67. label: '出库',
  68. name: 'tab2',
  69. isShow: true
  70. }
  71. ];
  72. return list.filter((item) => item.isShow);
  73. },
  74. activeNameProps() {
  75. switch (this.activeName) {
  76. case 'tab1':
  77. return {
  78. businessId: this.businessId,
  79. form: this.form
  80. };
  81. case 'tab2':
  82. return {
  83. form: this.form,
  84. bizType: 11,
  85. sourceBizNo: this.form.code,
  86. detailList: this.form.detailList,
  87. type: '自选领用出库',
  88. wwType: this.wwType,
  89. extractedList: this.extractedList
  90. };
  91. }
  92. }
  93. },
  94. async created() {
  95. this.getPickOrderDetail();
  96. },
  97. methods: {
  98. isValidComponent(componentName) {
  99. const validComponents = ['tab1', 'tab2'];
  100. return validComponents.includes(componentName);
  101. },
  102. handleClick(val) {
  103. this.activeName = val.name;
  104. if (val.name == 'tab2') {
  105. this.$emit('activeCompChange', 'inoutBound');
  106. } else {
  107. console.log('activeCompChange------------');
  108. this.$emit('activeCompChange', 'inoutBoundView');
  109. }
  110. },
  111. async getTableValue() {
  112. console.log(this.$refs.componentRef);
  113. return {
  114. form: this.form,
  115. returnStorageData: this.$refs.componentRef.getReturnStorage
  116. ? await this.$refs.componentRef.getReturnStorage()
  117. : ''
  118. };
  119. },
  120. getPickOrderDetail() {
  121. getPickOrderById(this.businessId).then((data) => {
  122. data.detailList = data.detailList.map((item) => {
  123. item.code = data.code;
  124. return item;
  125. });
  126. this.wwType = data.type;
  127. this.extractedList = data.detailList.map((item) => ({
  128. taskId: item.taskId,
  129. workOrderId: item.workOrderId
  130. }));
  131. let categoryLevelTopIds = data.detailList.map(
  132. (item) => item.rootCategoryLevelId
  133. );
  134. let filterCategoryLevelTopIds = Array.from(
  135. new Set(categoryLevelTopIds)
  136. );
  137. data.categoryLevelTopId = filterCategoryLevelTopIds.join(',');
  138. this.form = deepClone(data);
  139. });
  140. }
  141. }
  142. };
  143. </script>
  144. <style scoped lang="scss"></style>