huminmin
2026-04-24 c3baef217770a17fb2d655ede4747fabd3e57fea
入库管理按照原材料和成品来区分
已修改2个文件
67 ■■■■■ 文件已修改
src/views/inventoryManagement/receiptManagement/Record.vue 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/inventoryManagement/receiptManagement/index.vue 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/inventoryManagement/receiptManagement/Record.vue
@@ -147,6 +147,11 @@
    type: String,
    required: true,
    default: '0'
  },
  productId: {
    type: Number,
    required: true,
    default: 0
  }
})
@@ -206,7 +211,7 @@
const getList = () => {
  tableLoading.value = true;
  const params = {...page, type: props.type};
  const params = {...page, topParentProductId: props.productId};
  params.timeStr = searchForm.value.timeStr;
  params.productName = searchForm.value.productName;
  params.recordType = searchForm.value.recordType;
@@ -278,7 +283,7 @@
  })
      .then(() => {
        // 根据不同的 tab 类型调用不同的导出接口
        proxy.download("/stockInRecord/exportStockInRecord", {type: props.type}, props.type === '0' ? "合格入库.xlsx" : "不合格入库.xlsx");
        proxy.download("/stockInRecord/exportStockInRecord", {topParentProductId: props.productId}, "入库信息.xlsx");
      })
      .catch(() => {
        proxy.$modal.msg("已取消");
src/views/inventoryManagement/receiptManagement/index.vue
@@ -1,36 +1,44 @@
<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 v-loading="loading" element-loading-text="加载中..." style="min-height: 80vh;">
      <el-tabs v-model="activeTab" @tab-change="handleTabChange" v-if="!loading">
        <el-tab-pane v-for="tab in products"
                     :label="tab.productName"
                     :name="tab.id"
                     :key="tab.id">
          <Record :product-id="tab.id" v-if="tab.id === activeTab" />
        </el-tab-pane>
      </el-tabs>
    </div>
  </div>
</template>
<script setup>
import { ref, onMounted } from 'vue';
import { productTreeList } from "@/api/basicData/product.js";
import Record from "@/views/inventoryManagement/receiptManagement/Record.vue";
const activeTab = ref('qualified')
const type = ref(0)
const tabs = ref([
  {
    label: '合格入库',
    name: 'qualified',
    type: '0'
  },
  {
    label: '不合格入库',
    name: 'unqualified',
    type: '1'
  }
])
const products = ref([])
const activeTab = ref(null)
const loading = ref(false)
const handleTabChange = (tabName) => {
  activeTab.value = tabName;
  type.value = tabName === 'qualified' ? 0 : 1
}
</script>
const fetchProducts = async () => {
  loading.value = true;
  try {
    const res = await productTreeList();
    products.value = res.filter((item) => item.parentId === null).map(({ id, productName }) => ({ id, productName }));
    if (products.value.length > 0) {
      activeTab.value = products.value[0].id;
    }
  } finally {
    loading.value = false;
  }
}
onMounted(() => {
  fetchProducts();
})
</script>