From 9aced09ef31ab77663e6ee052785d87ca3c671ba Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期二, 31 三月 2026 10:44:00 +0800
Subject: [PATCH] Merge branch 'dev_长治_健齿齿科器材' of http://114.132.189.42:9002/r/product-inventory-management into dev_长治_健齿齿科器材

---
 src/views/inventoryManagement/stockManagement/New.vue |  110 +++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 98 insertions(+), 12 deletions(-)

diff --git a/src/views/inventoryManagement/stockManagement/New.vue b/src/views/inventoryManagement/stockManagement/New.vue
index 8243748..913c3fd 100644
--- a/src/views/inventoryManagement/stockManagement/New.vue
+++ b/src/views/inventoryManagement/stockManagement/New.vue
@@ -37,11 +37,48 @@
           <el-input v-model="formState.unit"  disabled />
         </el-form-item>
 
+        <el-form-item label="鎵瑰彿" prop="batchNo" :rules="[{ required: true, message: '璇疯緭鍏ユ壒鍙�', trigger: 'blur' }]">
+          <el-input v-model="formState.batchNo" placeholder="璇疯緭鍏ユ壒鍙�" clearable />
+        </el-form-item>
+
         <el-form-item
-            label="鏁伴噺"
+          label="渚涘簲鍟�"
+          prop="customer"
+          :rules="[{ required: true, message: '璇烽�夋嫨渚涘簲鍟�', trigger: 'change' }]"
+        >
+          <el-select
+            v-model="formState.customer"
+            placeholder="璇烽�夋嫨渚涘簲鍟�"
+            filterable
+            clearable
+            allow-create
+            :reserve-keyword="true"
+            :default-first-option="false"
+          >
+            <el-option
+              v-for="item in supplierList"
+              :key="item.id"
+              :label="item.supplierName"
+              :value="item.supplierName"
+            >
+              {{ item.supplierName}}
+            </el-option>
+          </el-select>
+        </el-form-item>
+
+        <el-form-item
+            label="搴撳瓨鏁伴噺"
             prop="qualitity"
         >
-          <el-input-number v-model="formState.qualitity" :step="1" :min="0" style="width: 100%" />
+          <el-input-number v-model="formState.qualitity" :step="1" :min="1" style="width: 100%" />
+        </el-form-item>
+
+        <el-form-item
+            v-if="type === 'qualified'"
+            label="搴撳瓨棰勮鏁伴噺"
+            prop="warnNum"
+        >
+          <el-input-number v-model="formState.warnNum" :step="1" :min="0" :max="formState.qualitity" style="width: 100%" />
         </el-form-item>
 
         <el-form-item label="澶囨敞" prop="remark">
@@ -66,14 +103,22 @@
 </template>
 
 <script setup>
-import {ref, computed, getCurrentInstance} from "vue";
+import {ref, computed, getCurrentInstance, watch} from "vue";
 import ProductSelectDialog from "@/views/basicData/product/ProductSelectDialog.vue";
 import {createStockInventory} from "@/api/inventoryManagement/stockInventory.js";
+import {createStockUnInventory} from "@/api/inventoryManagement/stockUninventory.js";
+import {getOptions as getSupplierOptions} from "@/api/procurementManagement/procurementLedger.js";
 
 const props = defineProps({
   visible: {
     type: Boolean,
     required: true,
+  },
+
+  type: {
+    type: String,
+    required: true,
+    default: 'qualified',
   },
 });
 
@@ -86,7 +131,10 @@
   productName: "",
   productModelName: "",
   unit: "",
+  batchNo: "",
+  customer: "",
   qualitity: 0,
+  warnNum: 0,
   remark: '',
 });
 
@@ -110,16 +158,43 @@
     productModelId: undefined,
     productName: "",
     productModelName: "",
-    description: '',
+    unit: "",
+    batchNo: "",
+    customer: "",
+    qualitity: 0,
+    warnNum: 0,
+    remark: '',
   };
   isShow.value = false;
 };
+
+const supplierList = ref([]);
+
+const loadSuppliers = async () => {
+  try {
+    const res = await getSupplierOptions();
+    // 澶嶇敤閲囪喘鍙拌处绛涢�夐�昏緫锛歩sWhite=0 鐨勪緵搴斿晢
+    supplierList.value = (res?.data || []).filter(item => item.isWhite === 0);
+  } catch (e) {
+    console.error("鑾峰彇渚涘簲鍟嗗垪琛ㄥけ璐�:", e);
+    supplierList.value = [];
+  }
+};
+
+watch(
+  () => props.visible,
+  (val) => {
+    if (val) {
+      loadSuppliers();
+    }
+  },
+  { immediate: true }
+);
 
 // 浜у搧閫夋嫨澶勭悊
 const handleProductSelect = async (products) => {
   if (products && products.length > 0) {
     const product = products[0];
-    console.log(product)
     formState.value.productId = product.productId;
     formState.value.productName = product.productName;
     formState.value.productModelName = product.model;
@@ -143,13 +218,24 @@
         proxy.$modal.msgError("璇烽�夋嫨瑙勬牸");
         return;
       }
-      createStockInventory(formState.value).then(res => {
-        // 鍏抽棴妯℃�佹
-        isShow.value = false;
-        // 鍛婄煡鐖剁粍浠跺凡瀹屾垚
-        emit('completed');
-        proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
-      })
+      if (props.type === 'qualified') {
+        createStockInventory(formState.value).then(res => {
+          // 鍏抽棴妯℃�佹
+          isShow.value = false;
+          // 鍛婄煡鐖剁粍浠跺凡瀹屾垚
+          emit('completed');
+          proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+        })
+      } else {
+        createStockUnInventory(formState.value).then(res => {
+          // 鍏抽棴妯℃�佹
+          isShow.value = false;
+          // 鍛婄煡鐖剁粍浠跺凡瀹屾垚
+          emit('completed');
+          proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+        })
+      }
+
     }
   })
 };

--
Gitblit v1.9.3