boxTabPage.vue 3.8 KB

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