From 1ae52b4e9e4fea731844fae1a9217d2128a9335c Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期五, 12 六月 2026 14:19:40 +0800
Subject: [PATCH] 工资计算逻辑放到后端

---
 src/views/inventoryManagement/stockManagement/New.vue |   80 ++++++++++++++++++++++++++++++++++++++--
 1 files changed, 76 insertions(+), 4 deletions(-)

diff --git a/src/views/inventoryManagement/stockManagement/New.vue b/src/views/inventoryManagement/stockManagement/New.vue
index e55de75..9a49c46 100644
--- a/src/views/inventoryManagement/stockManagement/New.vue
+++ b/src/views/inventoryManagement/stockManagement/New.vue
@@ -32,6 +32,19 @@
           <el-input v-model="formState.unit"
                     disabled />
         </el-form-item>
+        <el-form-item label="鍘傚"
+                      prop="manufacturerId">
+          <el-select v-model="formState.manufacturerId"
+                     placeholder="璇烽�夋嫨鍘傚"
+                     clearable
+                     filterable
+                     style="width: 100%">
+            <el-option v-for="item in manufacturerOptions"
+                       :key="item.id"
+                       :label="item.name"
+                       :value="item.id" />
+          </el-select>
+        </el-form-item>
         <el-form-item label="搴撳瓨绫诲瀷"
                       prop="type"
                       :rules="[
@@ -42,11 +55,32 @@
               }
             ]">
           <el-select v-model="formState.type"
-                     placeholder="璇烽�夋嫨搴撳瓨绫诲瀷">
-            <el-option label="鍚堟牸搴撳瓨"
+                     placeholder="璇烽�夋嫨搴撳瓨绫诲瀷"
+                     @change="handleTypeChange">
+            <el-option label="鍚堟牸搴�"
                        value="qualified" />
-            <el-option label="涓嶅悎鏍煎簱瀛�"
+            <el-option label="搴熷搧搴�"
+                       value="waste" />
+            <el-option label="涓嶅悎鏍煎簱"
                        value="unqualified" />
+          </el-select>
+        </el-form-item>
+        <el-form-item v-if="formState.type && formState.type !== 'unqualified'"
+                      label="鏉ユ簮"
+                      prop="source"
+                      :rules="[
+                {
+                required: true,
+                message: '璇烽�夋嫨鏉ユ簮',
+                trigger: 'change',
+              }
+            ]">
+          <el-select v-model="formState.source"
+                     placeholder="璇烽�夋嫨鏉ユ簮">
+            <el-option v-for="item in sourceOptions"
+                       :key="item.value"
+                       :label="item.label"
+                       :value="item.value" />
           </el-select>
         </el-form-item>
         <el-form-item label="搴撳瓨鏁伴噺"
@@ -95,10 +129,11 @@
 </template>
 
 <script setup>
-  import { ref, computed, watch, getCurrentInstance } from "vue";
+  import { ref, computed, watch, getCurrentInstance, onMounted } from "vue";
   import ProductSelectDialog from "@/views/basicData/product/ProductSelectDialog.vue";
   import { addStockInRecordOnly } from "@/api/inventoryManagement/stockInventory.js";
   import { createStockUnInventory } from "@/api/inventoryManagement/stockUninventory.js";
+  import { getManufacturerOptions } from "@/api/inspectionManagement/manufacturerManageFile.js";
 
   const props = defineProps({
     visible: {
@@ -122,11 +157,35 @@
     productModelName: "",
     unit: "",
     type: undefined,
+    manufacturerId: "",
+    source: "",
     qualitity: 0,
     batchNo: null,
     warnNum: 0,
     remark: "",
   });
+
+  const sourceOptions = computed(() => {
+    if (formState.value.type === "qualified") {
+      return [
+        { value: "purchaseReceipt", label: "閲囪喘鍏ュ簱" },
+        { value: "productionReceipt", label: "鐢熶骇鍏ュ簱" },
+        { value: "outsourcedReceipt", label: "澶栧崗鍏ュ簱" },
+        { value: "repairReceipt", label: "淇鍏ュ簱" },
+      ];
+    } else if (formState.value.type === "waste") {
+      return [
+        { value: "prodGenerated", label: "鐢熶骇浜х敓" },
+        { value: "transGenerated", label: "杩愯緭浜х敓" },
+        { value: "cuttingGenerated", label: "瑁佸壀浜х敓" },
+      ];
+    }
+    return [];
+  });
+
+  const handleTypeChange = val => {
+    formState.value.source = "";
+  };
 
   const isShow = computed({
     get() {
@@ -138,6 +197,17 @@
   });
 
   const showProductSelectDialog = ref(false);
+  const manufacturerOptions = ref([]);
+
+  const loadManufacturerOptions = () => {
+    getManufacturerOptions().then(res => {
+      manufacturerOptions.value = res.data || [];
+    });
+  };
+
+  onMounted(() => {
+    loadManufacturerOptions();
+  });
 
   // 鎵瑰彿涓虹┖鏃惰浆涓� null
   watch(
@@ -160,6 +230,8 @@
       productModelName: "",
       unit: "",
       type: undefined,
+      manufacturerId: "",
+      source: "",
       qualitity: 0,
       batchNo: null,
       warnNum: 0,

--
Gitblit v1.9.3