From ce6a2bac234c48dce836f6c5d45c63da7c1e7424 Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期二, 31 三月 2026 11:48:16 +0800
Subject: [PATCH] Merge branch 'dev_长治_健齿齿科器材' of http://114.132.189.42:9002/r/product-inventory-management into dev_长治_健齿齿科器材

---
 src/views/productionManagement/productionOrder/MaterialRequisitionDialog.vue |   96 ++++++++++++++++++++++++++++----
 src/views/productionManagement/workOrder/index.vue                           |   17 +++++
 src/views/productionManagement/productionOrder/index.vue                     |    5 +
 src/views/productionManagement/productionReporting/Input.vue                 |    8 ++
 4 files changed, 113 insertions(+), 13 deletions(-)

diff --git a/src/views/productionManagement/productionOrder/MaterialRequisitionDialog.vue b/src/views/productionManagement/productionOrder/MaterialRequisitionDialog.vue
index 98d4f71..497ea82 100644
--- a/src/views/productionManagement/productionOrder/MaterialRequisitionDialog.vue
+++ b/src/views/productionManagement/productionOrder/MaterialRequisitionDialog.vue
@@ -2,7 +2,7 @@
   <el-dialog
     v-model="visible"
     title="棰嗘枡"
-    width="1000px"
+    width="1400px"
     top="3vh"
     :close-on-click-modal="false"
     destroy-on-close
@@ -19,11 +19,8 @@
             <el-table-column prop="productName" label="浜у搧鍚嶇О" min-width="150" />
             <el-table-column prop="model" label="鍨嬪彿" min-width="150" />
             <el-table-column prop="unit" label="鍗曚綅" width="80" align="center" />
-            <!-- <el-table-column prop="qualitity" label="鍙鐢ㄦ暟閲�" width="100" align="center">
-              <template #default="{ row }">
-                {{ row.qualitity || 0 }}
-              </template>
-            </el-table-column> -->
+            <el-table-column prop="customer" label="渚涘簲鍟�" min-width="160" show-overflow-tooltip />
+            <el-table-column prop="batchNo" label="鎵瑰彿" min-width="180" show-overflow-tooltip />
             <el-table-column prop="requisitionQty" label="棰嗙敤鏁伴噺" width="120" align="center">
               <template #default="{ row }">
                 <el-input-number
@@ -61,13 +58,43 @@
     <el-dialog
       v-model="addDialogVisible"
       title="閫夋嫨鍘熸潗鏂�"
-      width="800px"
+      width="1000px"
       top="5vh"
       :close-on-click-modal="false"
       append-to-body
     >
+      <div class="material-filter" style="margin-bottom: 20px;">
+        <el-select
+          v-model="filterSupplier"
+          placeholder="渚涘簲鍟�"
+          clearable
+          filterable
+          style="width: 220px"
+        >
+          <el-option
+            v-for="opt in supplierFilterOptions"
+            :key="opt"
+            :label="opt"
+            :value="opt"
+          />
+        </el-select>
+        <el-select
+          v-model="filterBatchNo"
+          placeholder="鎵瑰彿"
+          clearable
+          filterable
+          style="width: 220px; margin-left: 12px"
+        >
+          <el-option
+            v-for="opt in batchFilterOptions"
+            :key="opt"
+            :label="opt"
+            :value="opt"
+          />
+        </el-select>
+      </div>
       <el-table
-        :data="availableMaterials"
+        :data="filteredMaterials"
         border
         style="width: 100%"
         height="50vh"
@@ -78,6 +105,8 @@
         <el-table-column prop="productName" label="浜у搧鍚嶇О" min-width="150" />
         <el-table-column prop="model" label="鍨嬪彿" min-width="150" />
         <el-table-column prop="unit" label="鍗曚綅" width="80" align="center" />
+        <el-table-column prop="customer" label="渚涘簲鍟�" min-width="160" show-overflow-tooltip />
+        <el-table-column prop="batchNo" label="鎵瑰彿" min-width="180" show-overflow-tooltip />
         <!-- <el-table-column prop="qualitity" label="鍙鐢ㄦ暟閲�" width="100" align="center">
           <template #default="{ row }">
             {{ row.qualitity || 0 }}
@@ -129,6 +158,45 @@
 const availableMaterials = ref([]);
 const selectedMaterials = ref([]);
 
+// 閫夋嫨寮圭獥绛涢�夋潯浠讹紙渚涘簲鍟�/鎵瑰彿锛�
+const filterSupplier = ref('');
+const filterBatchNo = ref('');
+
+// 灏嗗悗绔彲鑳借繑鍥炵殑瀛楁鍋氫竴涓嬪綊涓�鍖栵細渚涘簲鍟�/鎵瑰彿瀛楁鍚嶅彲鑳戒笉涓�鑷�
+const normalizeMaterial = (m) => {
+  return {
+    ...m,
+    customer: m.customer ?? m.supplierName ?? '',
+    batchNo: m.batchNo ?? m.batchNumber ?? m.batch_number ?? m.lotNo ?? '',
+  };
+};
+
+const supplierFilterOptions = computed(() => {
+  return Array.from(new Set(availableMaterials.value.map((m) => m.customer).filter(Boolean)));
+});
+
+const batchFilterOptions = computed(() => {
+  const list = filterSupplier.value
+    ? availableMaterials.value.filter((m) => m.customer === filterSupplier.value)
+    : availableMaterials.value;
+  return Array.from(new Set(list.map((m) => m.batchNo).filter(Boolean)));
+});
+
+const filteredMaterials = computed(() => {
+  return availableMaterials.value.filter((m) => {
+    if (filterSupplier.value && m.customer !== filterSupplier.value) return false;
+    if (filterBatchNo.value && m.batchNo !== filterBatchNo.value) return false;
+    return true;
+  });
+});
+
+watch(filterSupplier, () => {
+  // 濡傛灉褰撳墠鈥滄壒鍙封�濅笉灞炰簬鎵�閫変緵搴斿晢锛屽垯娓呯┖
+  if (filterBatchNo.value && !batchFilterOptions.value.includes(filterBatchNo.value)) {
+    filterBatchNo.value = '';
+  }
+});
+
 // 鐩戝惉寮规鎵撳紑锛屽姞杞芥暟鎹�
 watch(() => props.modelValue, (val) => {
   if (val && props.orderData) {
@@ -146,7 +214,7 @@
   if (bomId) {
     try {
       const res = await getMaterials({ bomId });
-      materialsFromApi = res.data || [];
+      materialsFromApi = (res.data || []).map(normalizeMaterial);
     } catch (error) {
       console.error('鏌ヨ鍘熸潗鏂欏垪琛ㄥけ璐�:', error);
     }
@@ -164,7 +232,9 @@
         return {
           ...savedItem,
           qualitity: apiItem?.qualitity ?? savedItem.qualitity ?? 0,
-          requisitionQty: savedItem.requisitionQty || 0
+          requisitionQty: savedItem.requisitionQty || 0,
+          customer: savedItem.customer ?? savedItem.supplierName ?? apiItem?.customer ?? '',
+          batchNo: savedItem.batchNo ?? savedItem.batchNumber ?? apiItem?.batchNo ?? '',
         };
       });
     } catch (e) {
@@ -190,7 +260,9 @@
     const res = await getMaterials({ bomId });
     console.log('getMaterials杩斿洖鏁版嵁:', res.data);
     // 鐩存帴灞曠ず鎵�鏈夋暟鎹紝涓嶈繃婊�
-    availableMaterials.value = res.data || [];
+    availableMaterials.value = (res.data || []).map(normalizeMaterial);
+    filterSupplier.value = '';
+    filterBatchNo.value = '';
     selectedMaterials.value = [];
     addDialogVisible.value = true;
   } catch (error) {
@@ -222,7 +294,7 @@
     .map(item => ({
       ...item,
       requisitionQty: 0,
-      remark: ''
+      remark: '',
     }));
 
   if (newItems.length === 0) {
diff --git a/src/views/productionManagement/productionOrder/index.vue b/src/views/productionManagement/productionOrder/index.vue
index f05afaf..788d5d6 100644
--- a/src/views/productionManagement/productionOrder/index.vue
+++ b/src/views/productionManagement/productionOrder/index.vue
@@ -159,6 +159,11 @@
     width: '120px',
   },
   {
+    label: "鎵瑰彿",
+    prop: "batchNo",
+    width: '120px',
+  },
+  {
     label: "宸ヨ壓璺嚎缂栧彿",
     prop: "processRouteCode",
     width: '200px',
diff --git a/src/views/productionManagement/productionReporting/Input.vue b/src/views/productionManagement/productionReporting/Input.vue
index 06c2d9d..7b0e10a 100644
--- a/src/views/productionManagement/productionReporting/Input.vue
+++ b/src/views/productionManagement/productionReporting/Input.vue
@@ -71,6 +71,14 @@
     prop: 'uidNo',
   },
   {
+    label: '渚涘簲鍟�',
+    prop: 'customer',
+  },
+  {
+    label: '鎵瑰彿',
+    prop: 'batchNo',
+  },
+  {
     label: '鎶曞叆鏁伴噺',
     prop: 'quantity',
   },
diff --git a/src/views/productionManagement/workOrder/index.vue b/src/views/productionManagement/workOrder/index.vue
index ea22e4f..eaceff1 100644
--- a/src/views/productionManagement/workOrder/index.vue
+++ b/src/views/productionManagement/workOrder/index.vue
@@ -173,6 +173,13 @@
                label-width="120px">
         <el-row :gutter="30">
           <el-col :span="12">
+            <el-form-item label="浜у搧鍚嶇О">
+              <el-input v-model="reportForm.productName"
+                        readonly
+                        style="width: 300px" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
             <el-form-item label="寰呯敓浜ф暟閲�">
               <el-input v-model="reportForm.planQuantity"
                         readonly
@@ -250,6 +257,8 @@
             <el-table-column prop="productName" label="浜у搧鍚嶇О" min-width="160" />
             <el-table-column prop="model" label="鍨嬪彿" min-width="150" />
             <el-table-column prop="unit" label="鍗曚綅" width="90" align="center" />
+            <el-table-column prop="customer" label="渚涘簲鍟�" min-width="160" show-overflow-tooltip />
+            <el-table-column prop="batchNo" label="鎵瑰彿" min-width="180" show-overflow-tooltip />
             <el-table-column prop="reportQty" label="棰嗙敤鏁伴噺" width="160" align="center">
               <template #default="{ row }">
                 <el-input-number
@@ -288,7 +297,7 @@
     <el-dialog
       v-model="addMaterialDialogVisible"
       title="閫夋嫨鍘熸潗鏂�"
-      width="1000px"
+      width="1400px"
       top="5vh"
       :close-on-click-modal="false"
       append-to-body
@@ -308,6 +317,8 @@
           <el-table-column prop="productName" label="浜у搧鍚嶇О" min-width="160" />
           <el-table-column prop="model" label="鍨嬪彿" min-width="150" />
           <el-table-column prop="unit" label="鍗曚綅" width="90" align="center" />
+          <el-table-column prop="customer" label="渚涘簲鍟�" min-width="160" show-overflow-tooltip />
+          <el-table-column prop="batchNo" label="鎵瑰彿" min-width="180" show-overflow-tooltip />
           <el-table-column prop="requisitionQty" label="鍙鐢ㄦ暟閲�" width="140" align="center" />
         </el-table>
 
@@ -476,6 +487,8 @@
   const userOptions = ref([]);
   const deviceOptions = ref([]);
   const reportForm = reactive({
+    // 鎶ュ伐寮规閲屸�滀骇鍝佸悕绉扳�濆彧璇诲洖鏄�
+    productName: "",
     planQuantity: 0,
     totalInvestment: 0,
     quantity: null,
@@ -889,6 +902,8 @@
   const showReportDialog = async row => {
     currentReportRowData.value = row;
     processParamList.value = await getProcessParamList(row)
+    // 鍏煎鍚庣/琛ㄦ牸瀛楁鍛藉悕锛氫紭鍏� row.productName锛屽叾娆� row.productCategory
+    reportForm.productName = row.productName ?? row.productCategory ?? ''
     reportForm.planQuantity = row.planQuantity;
     reportForm.totalInvestment = row.totalInvestment;
     reportForm.quantity =

--
Gitblit v1.9.3