From c3baef217770a17fb2d655ede4747fabd3e57fea Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期五, 24 四月 2026 15:38:42 +0800
Subject: [PATCH] 入库管理按照原材料和成品来区分
---
src/views/inventoryManagement/receiptManagement/index.vue | 58 ++++++++++++++++------------
src/views/inventoryManagement/receiptManagement/Record.vue | 9 +++-
2 files changed, 40 insertions(+), 27 deletions(-)
diff --git a/src/views/inventoryManagement/receiptManagement/Record.vue b/src/views/inventoryManagement/receiptManagement/Record.vue
index b6246ed..466c3b1 100644
--- a/src/views/inventoryManagement/receiptManagement/Record.vue
+++ b/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("宸插彇娑�");
diff --git a/src/views/inventoryManagement/receiptManagement/index.vue b/src/views/inventoryManagement/receiptManagement/index.vue
index 8ca110f..c57e8e3 100644
--- a/src/views/inventoryManagement/receiptManagement/index.vue
+++ b/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>
\ No newline at end of file
--
Gitblit v1.9.3