From 8ab1513bc36ec9c594cc34a89d25cbf9bf61af55 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期五, 24 四月 2026 09:55:18 +0800
Subject: [PATCH] fix: 调整仓储物流产品大类,增加批次号

---
 src/views/inventoryManagement/dispatchLog/Record.vue        |   19 ++++++
 src/views/inventoryManagement/stockManagement/New.vue       |   15 ++++
 src/views/inventoryManagement/receiptManagement/index.vue   |   59 +++++++++++++------
 src/views/inventoryManagement/stockManagement/Qualified.vue |    1 
 src/views/inventoryManagement/stockManagement/Record.vue    |    1 
 src/views/inventoryManagement/dispatchLog/index.vue         |   61 +++++++++++++-------
 src/views/inventoryManagement/receiptManagement/Record.vue  |   17 +++++
 7 files changed, 128 insertions(+), 45 deletions(-)

diff --git a/src/views/inventoryManagement/dispatchLog/Record.vue b/src/views/inventoryManagement/dispatchLog/Record.vue
index a7a8a4b..ddaea92 100644
--- a/src/views/inventoryManagement/dispatchLog/Record.vue
+++ b/src/views/inventoryManagement/dispatchLog/Record.vue
@@ -67,6 +67,11 @@
 					show-overflow-tooltip
 				/>
 				<el-table-column
+					label="鎵瑰彿"
+					prop="batchNo"
+					show-overflow-tooltip
+				/>
+				<el-table-column
 					label="鍗曚綅"
 					prop="unit"
 					show-overflow-tooltip
@@ -133,6 +138,10 @@
     type: String,
     required: true,
     default: '0'
+  },
+  topParentProductId: {
+    type: [String, Number],
+    default: undefined
   }
 })
 
@@ -163,7 +172,7 @@
 };
 const getList = () => {
 	tableLoading.value = true;
-	getStockOutPage({ ...searchForm.value, ...page, type: props.type })
+	getStockOutPage({ ...searchForm.value, ...page, type: props.type, topParentProductId: props.topParentProductId })
 		.then((res) => {
 			tableLoading.value = false;
 			tableData.value = res.data.records;
@@ -536,6 +545,14 @@
 	getList();
   fetchStockRecordTypeOptions();
 });
+
+watch(
+  () => props.topParentProductId,
+  () => {
+    page.current = 1;
+    getList();
+  }
+);
 </script>
 
 <style scoped lang="scss">
diff --git a/src/views/inventoryManagement/dispatchLog/index.vue b/src/views/inventoryManagement/dispatchLog/index.vue
index 88d9984..458e9ec 100644
--- a/src/views/inventoryManagement/dispatchLog/index.vue
+++ b/src/views/inventoryManagement/dispatchLog/index.vue
@@ -1,38 +1,55 @@
 <!-- 鍦ㄤ綘鐨勪富椤甸潰涓� -->
 <template>
   <div class="app-container">
-    <el-tabs v-model="activeTab" @tab-change="handleTabChange">
+    <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 tabs"
-                   :label="tab.label"
-                   :name="tab.name"
-                   :key="tab.name">
-        <record :type="tab.type" v-if="activeTab === tab.name" />
+                   :label="tab.productName"
+                   :name="tab.id"
+                   :key="tab.id">
+        <Record v-bind="{ type: tab.type, topParentProductId: activeTab }" 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/dispatchLog/Record.vue";
-const activeTab = ref('qualified')
-const type = ref(0)
-const tabs = computed(() => {
-  return [
-    {
-      label: '鍚堟牸鍑哄簱',
-      name: 'qualified',
-      type: '0'
-    },
-    {
-      label: '涓嶅悎鏍煎嚭搴�',
-      name: 'unqualified',
-      type: '1'
-    }
-  ]
-})
+const activeTab = ref(null)
+const tabs = ref([])
+const loading = ref(false)
+
+const resolveTypeByName = (name) => {
+  return String(name || "").includes("涓嶅悎鏍�") ? "1" : "0";
+};
 
 const handleTabChange = (tabName) => {
   activeTab.value = tabName;
-  type.value = tabName === 'qualified' ? 0 : 1
 }
+
+const fetchProducts = async () => {
+  loading.value = true;
+  try {
+    const res = await productTreeList();
+    tabs.value = res
+      .filter((item) => item.parentId === null)
+      .map(({ id, productName }) => ({
+        id,
+        productName,
+        type: resolveTypeByName(productName),
+      }));
+    if (tabs.value.length > 0) {
+      activeTab.value = tabs.value[0].id;
+    }
+  } finally {
+    loading.value = false;
+  }
+}
+
+onMounted(() => {
+  fetchProducts();
+})
 </script>
diff --git a/src/views/inventoryManagement/receiptManagement/Record.vue b/src/views/inventoryManagement/receiptManagement/Record.vue
index 3f90edf..17ac048 100644
--- a/src/views/inventoryManagement/receiptManagement/Record.vue
+++ b/src/views/inventoryManagement/receiptManagement/Record.vue
@@ -67,6 +67,9 @@
         <el-table-column label="瑙勬牸鍨嬪彿"
                          prop="model"
                          show-overflow-tooltip/>
+        <el-table-column label="鎵瑰彿"
+                         prop="batchNo"
+                         show-overflow-tooltip/>
         <el-table-column label="鍗曚綅"
                          prop="unit"
                          show-overflow-tooltip/>
@@ -119,6 +122,10 @@
     type: String,
     required: true,
     default: '0'
+  },
+  topParentProductId: {
+    type: [String, Number],
+    default: undefined
   }
 })
 
@@ -160,7 +167,7 @@
 
 const getList = () => {
   tableLoading.value = true;
-  const params = {...page, type: props.type};
+  const params = {...page, type: props.type, topParentProductId: props.topParentProductId};
   params.timeStr = searchForm.value.timeStr;
   params.productName = searchForm.value.productName;
   params.recordType = searchForm.value.recordType;
@@ -243,6 +250,14 @@
   getList();
   fetchStockRecordTypeOptions();
 });
+
+watch(
+  () => props.topParentProductId,
+  () => {
+    page.current = 1;
+    getList();
+  }
+);
 </script>
 
 <style scoped lang="scss"></style>
diff --git a/src/views/inventoryManagement/receiptManagement/index.vue b/src/views/inventoryManagement/receiptManagement/index.vue
index 8ca110f..17a0823 100644
--- a/src/views/inventoryManagement/receiptManagement/index.vue
+++ b/src/views/inventoryManagement/receiptManagement/index.vue
@@ -1,36 +1,55 @@
 <template>
   <div class="app-container">
-    <el-tabs v-model="activeTab" @tab-change="handleTabChange">
+    <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 tabs"
-                   :label="tab.label"
-                   :name="tab.name"
-                   :key="tab.name">
-        <record :type="tab.type" v-if="activeTab === tab.name" />
+                   :label="tab.productName"
+                   :name="tab.id"
+                   :key="tab.id">
+        <Record v-bind="{ type: tab.type, topParentProductId: activeTab }" 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 activeTab = ref(null)
+const tabs = ref([])
+const loading = ref(false)
+
+const resolveTypeByName = (name) => {
+  return String(name || "").includes("涓嶅悎鏍�") ? "1" : "0";
+};
 
 const handleTabChange = (tabName) => {
   activeTab.value = tabName;
-  type.value = tabName === 'qualified' ? 0 : 1
 }
+
+const fetchProducts = async () => {
+  loading.value = true;
+  try {
+    const res = await productTreeList();
+    tabs.value = res
+      .filter((item) => item.parentId === null)
+      .map(({ id, productName }) => ({
+        id,
+        productName,
+        type: resolveTypeByName(productName),
+      }));
+    if (tabs.value.length > 0) {
+      activeTab.value = tabs.value[0].id;
+    }
+  } finally {
+    loading.value = false;
+  }
+}
+
+onMounted(() => {
+  fetchProducts();
+})
 </script>
diff --git a/src/views/inventoryManagement/stockManagement/New.vue b/src/views/inventoryManagement/stockManagement/New.vue
index df92c21..653e027 100644
--- a/src/views/inventoryManagement/stockManagement/New.vue
+++ b/src/views/inventoryManagement/stockManagement/New.vue
@@ -62,6 +62,13 @@
         </el-form-item>
 
         <el-form-item
+            label="鎵瑰彿"
+            prop="batchNo"
+        >
+          <el-input v-model="formState.batchNo" placeholder="璇疯緭鍏ユ壒鍙�" />
+        </el-form-item>
+
+        <el-form-item
             v-if="formState.type === 'qualified'"
             label="搴撳瓨棰勮鏁伴噺"
             prop="warnNum"
@@ -120,6 +127,7 @@
   unit: "",
   type: undefined,
   qualitity: 0,
+  batchNo: "",
   warnNum: 0,
   remark: '',
 });
@@ -144,7 +152,12 @@
     productModelId: undefined,
     productName: "",
     productModelName: "",
-    description: '',
+    unit: "",
+    type: undefined,
+    qualitity: 0,
+    batchNo: "",
+    warnNum: 0,
+    remark: '',
   };
   isShow.value = false;
 };
diff --git a/src/views/inventoryManagement/stockManagement/Qualified.vue b/src/views/inventoryManagement/stockManagement/Qualified.vue
index a958f42..4286772 100644
--- a/src/views/inventoryManagement/stockManagement/Qualified.vue
+++ b/src/views/inventoryManagement/stockManagement/Qualified.vue
@@ -25,6 +25,7 @@
         <el-table-column align="center" label="搴忓彿" type="index" width="60" />
         <el-table-column label="浜у搧澶х被" prop="productName" show-overflow-tooltip />
         <el-table-column label="瑙勬牸鍨嬪彿" prop="model" show-overflow-tooltip />
+        <el-table-column label="鎵瑰彿" prop="batchNo" show-overflow-tooltip />
         <el-table-column label="鍗曚綅" prop="unit" show-overflow-tooltip />
         <el-table-column label="搴撳瓨鏁伴噺" prop="qualitity" show-overflow-tooltip />
         <el-table-column label="鍐荤粨鏁伴噺" prop="lockedQuantity" show-overflow-tooltip />
diff --git a/src/views/inventoryManagement/stockManagement/Record.vue b/src/views/inventoryManagement/stockManagement/Record.vue
index 4f9537f..340b4b1 100644
--- a/src/views/inventoryManagement/stockManagement/Record.vue
+++ b/src/views/inventoryManagement/stockManagement/Record.vue
@@ -26,6 +26,7 @@
         <el-table-column label="浜у搧澶х被" prop="productName" show-overflow-tooltip />
         <el-table-column label="瑙勬牸鍨嬪彿" prop="model" show-overflow-tooltip />
         <el-table-column label="鍗曚綅" prop="unit" show-overflow-tooltip />
+        <el-table-column label="鎵瑰彿" prop="batchNo" show-overflow-tooltip />
         <el-table-column label="鍚堟牸搴撳瓨鏁伴噺" prop="qualifiedQuantity" show-overflow-tooltip />
         <el-table-column label="涓嶅悎鏍煎簱瀛樻暟閲�" prop="unQualifiedQuantity" show-overflow-tooltip />
         <el-table-column label="鍚堟牸鍐荤粨鏁伴噺" prop="qualifiedLockedQuantity" show-overflow-tooltip />

--
Gitblit v1.9.3