1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<template>
  <div class="app-container">
    <el-tabs v-model="activeTab" @tab-change="handleTabChange">
      <el-tab-pane v-for="tab in tabs"
                   :label="tab.label"
                   :name="tab.name"
                   :key="tab.name">
        <record :type="tab.type" v-if="activeTab === tab.name" />
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
 
<script setup>
import Record from "@/views/inventoryManagement/receiptManagement/Record.vue";
 
const activeTab = ref('selfMade')
const type = ref(1)
const tabs = ref([
  {
    label: '自制',
    name: 'selfMade',
    type: 1
  },
  {
    label: '外购',
    name: 'purchase',
    type: 2
  },
  {
    label: '委外',
    name: 'outsourcing',
    type: 3
  }
])
 
const handleTabChange = (tabName) => {
  activeTab.value = tabName;
  const tab = tabs.value.find(t => t.name === tabName);
  type.value = tab ? tab.type : 1;
}
</script>