boxTabPage.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. <component
  12. v-if="activeName && isValidComponent(activeName)"
  13. :is="activeName"
  14. :key="cKey"
  15. ref="componentRef"
  16. :taskDefinitionKey="taskDefinitionKey"
  17. :activeComp="activeComp"
  18. :businessId="businessId"
  19. :infoData="form"
  20. :permissionType="permissionType"
  21. />
  22. </div>
  23. </template>
  24. <script>
  25. import { getPickOrderById } from '@/api/pda';
  26. export default {
  27. name: 'boxTabPage',
  28. components: {
  29. tab1: () => import('./detailDialog.vue'),
  30. tab2: () => import('./outsourcingOutbound.vue')
  31. },
  32. props: {
  33. taskDefinitionKey: {
  34. type: String,
  35. default: ''
  36. },
  37. activeComp: {
  38. type: String,
  39. default: ''
  40. },
  41. permissionType: {
  42. type: String,
  43. default: 'view'
  44. },
  45. businessId: {
  46. type: String,
  47. default: ''
  48. }
  49. },
  50. data() {
  51. return {
  52. form: {},
  53. activeName: 'tab1',
  54. cKey: 1
  55. };
  56. },
  57. computed: {
  58. tabOption() {
  59. let list = [
  60. {
  61. label: '领料单详情',
  62. name: 'tab1',
  63. isShow: true
  64. },
  65. {
  66. label: '出库',
  67. name: 'tab2',
  68. isShow: true
  69. }
  70. ];
  71. return list.filter((item) => item.isShow);
  72. }
  73. },
  74. async created() {
  75. this.getPickOrderDetail();
  76. },
  77. methods: {
  78. isValidComponent(componentName) {
  79. const validComponents = ['tab1', 'tab2'];
  80. return validComponents.includes(componentName);
  81. },
  82. handleClick(val) {
  83. this.activeName = val.name;
  84. },
  85. async getTableValue() {
  86. console.log(this.$refs.componentRef);
  87. return {
  88. form: this.form,
  89. returnStorageData: this.$refs.componentRef.getReturnStorage
  90. ? await this.$refs.componentRef.getReturnStorage()
  91. : ''
  92. };
  93. },
  94. getPickOrderDetail() {
  95. getPickOrderById(this.businessId).then((data) => {
  96. data.detailList = data.detailList.map((item) => {
  97. item.code = data.code;
  98. return item;
  99. });
  100. this.form = data;
  101. console.log(this.form);
  102. });
  103. }
  104. }
  105. };
  106. </script>
  107. <style scoped lang="scss"></style>