boxTabPage.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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. type="sourceBizNo"
  16. ref="componentRef"
  17. v-bind="activeNameProps"
  18. />
  19. </keep-alive>
  20. </div>
  21. </template>
  22. <script>
  23. import { getPSaleEntrustedReceiveDetailAPI } from '@/api/bpm/components/saleManage/entrustedReceive';
  24. import { deepClone } from '@/components/FormGenerator/utils/index';
  25. export default {
  26. name: 'boxTabPage',
  27. components: {
  28. tab1: () => import('./detailDialog.vue'),
  29. tab2: () => import('@/views/bpm/stockManagement/storage.vue'),
  30. tab3: () => import('@/views/bpm/stockManagement/quality.vue'),
  31. tab4: () => import('@/views/bpm/stockManagement/details.vue')
  32. },
  33. props: {
  34. taskDefinitionKey: {
  35. type: String,
  36. default: ''
  37. },
  38. activeComp: {
  39. type: String,
  40. default: ''
  41. },
  42. permissionType: {
  43. type: String,
  44. default: 'view'
  45. },
  46. businessId: {
  47. type: String,
  48. default: ''
  49. }
  50. },
  51. data() {
  52. let activeName;
  53. return {
  54. isUpload: false,
  55. form: {},
  56. activeName: 'tab1',
  57. cKey: 1,
  58. tabOption: [
  59. {
  60. label: '收货单详情',
  61. name: 'tab1',
  62. isShow: true
  63. }
  64. ]
  65. };
  66. },
  67. computed: {
  68. activeNameProps() {
  69. switch (this.activeName) {
  70. case 'tab1':
  71. return {
  72. taskDefinitionKey: this.taskDefinitionKey,
  73. activeComp: this.activeComp,
  74. businessId: this.businessId,
  75. infoData: this.form,
  76. permissionType: this.permissionType
  77. };
  78. case 'tab2':
  79. return {
  80. form: this.form,
  81. bizType: 7,
  82. sourceBizNo: this.form.code,
  83. saleProductList: this.form.productList
  84. };
  85. case 'tab3':
  86. return {
  87. taskDefinitionKey: this.taskDefinitionKey,
  88. businessId: this.form.code
  89. };
  90. case 'tab4':
  91. return {
  92. businessId: this.form.code,
  93. isUpload: this.isUpload
  94. };
  95. }
  96. }
  97. },
  98. async created() {
  99. await this.getSendSaleOrderDetail(this.businessId);
  100. switch (this.taskDefinitionKey) {
  101. case 'storeManagerApprove':
  102. this.tabOption.push({
  103. label: '入库',
  104. name: 'tab2',
  105. isShow: true
  106. });
  107. break;
  108. case 'qualityInspection':
  109. this.tabOption.push({
  110. label: '入库质检',
  111. name: 'tab3',
  112. isShow: true
  113. });
  114. break;
  115. case 'QCLeaderApprove':
  116. this.tabOption.push({
  117. label: '入库详情',
  118. name: 'tab4',
  119. isShow: true
  120. });
  121. this.isUpload = false;
  122. break;
  123. case 'qualityInspectionFeedback':
  124. this.tabOption.push({
  125. label: '质检详情',
  126. name: 'tab4',
  127. isShow: true
  128. });
  129. this.isUpload = true;
  130. break;
  131. }
  132. },
  133. methods: {
  134. isValidComponent(componentName) {
  135. const validComponents = ['tab1', 'tab2', 'tab3', 'tab4'];
  136. return validComponents.includes(componentName);
  137. },
  138. handleClick(val) {
  139. console.log(val.name);
  140. this.activeName = val.name;
  141. if (val.name == 'tab2') {
  142. this.$emit('activeCompChange', 'inoutBound');
  143. // setTimeout(() => {
  144. // console.log(this.$refs.componentRef);
  145. // this.$refs.componentRef.pickerSuccess(this.form);
  146. // }, 500);
  147. } else {
  148. this.$emit('activeCompChange', 'inoutBoundView');
  149. }
  150. },
  151. async getTableValue() {
  152. console.log(this.$refs.componentRef);
  153. return {
  154. form: this.$refs.componentRef.form,
  155. returnStorageData: this.$refs.componentRef.getReturnStorage
  156. ? await this.$refs.componentRef.getReturnStorage()
  157. : '',
  158. isAllChecked:
  159. this.$refs.componentRef.getStatus &&
  160. this.$refs.componentRef.getStatus(),
  161. qualityInspector:
  162. (this.$refs.componentRef.getQualityFile &&
  163. this.$refs.componentRef.getQualityFile()) ||
  164. {}
  165. };
  166. },
  167. //发货单详情
  168. async getSendSaleOrderDetail(id) {
  169. const data = await getPSaleEntrustedReceiveDetailAPI(id);
  170. if (data) {
  171. this.form = deepClone(data);
  172. this.form.supplierId = data.contactId;
  173. this.form.supplierName = data.contactName;
  174. this.form.productList = this.form.productList.map((item) => {
  175. item.supplierMark = item.customerMark;
  176. return item;
  177. });
  178. console.log(this.form);
  179. }
  180. }
  181. }
  182. };
  183. </script>
  184. <style scoped lang="scss"></style>