From 2e77330d87341624c88301562fd137b58f9a101a Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 25 十二月 2025 10:57:35 +0800
Subject: [PATCH] 1.海川开心-录入日期都默认当天,封装公用组件和方法

---
 src/views/inventoryManagement/receiptManagement/components/formDiaManual.vue |   80 ++++++++++++++-------------------------
 1 files changed, 29 insertions(+), 51 deletions(-)

diff --git a/src/views/inventoryManagement/receiptManagement/components/formDiaManual.vue b/src/views/inventoryManagement/receiptManagement/components/formDiaManual.vue
index 5801da0..5fa7fc7 100644
--- a/src/views/inventoryManagement/receiptManagement/components/formDiaManual.vue
+++ b/src/views/inventoryManagement/receiptManagement/components/formDiaManual.vue
@@ -31,14 +31,14 @@
             <el-input v-model="scope.row.unit" placeholder="璇疯緭鍏ュ崟浣�" />
           </template>
         </el-table-column>
-        <!-- <el-table-column label="渚涘簲鍟�" prop="supplierName" width="200">
+        <el-table-column label="渚涘簲鍟�" prop="supplierName" width="200">
           <template #default="scope">
             <el-input v-model="scope.row.supplierName" placeholder="璇疯緭鍏ヤ緵搴斿晢" />
           </template>
-        </el-table-column> -->
-        <el-table-column label="鐗╁搧绫诲瀷" prop="itemType" width="140">
+        </el-table-column>
+        <el-table-column label="鐗╁搧绫诲瀷" prop="itemType" width="150">
           <template #default="scope">
-            <el-select v-model="scope.row.itemType" placeholder="璇烽�夋嫨鐗╁搧绫诲瀷" style="width: 100%">
+            <el-select v-model="scope.row.itemType" filterable allow-create placeholder="璇烽�夋嫨鐗╁搧绫诲瀷" style="width: 100%">
               <el-option
                 v-for="item in itemTypeOptions"
                 :key="item.value"
@@ -65,44 +65,21 @@
             />
           </template>
         </el-table-column>
-        <el-table-column label="绋庣巼(%)" prop="taxRate" width="150">
+        <el-table-column label="鏁伴噺" prop="quantityStock" width="150">
           <template #default="scope">
-            <el-select v-model="scope.row.taxRate" placeholder="璇烽�夋嫨绋庣巼" style="width: 100%" @change="() => calculateExclusivePrice(scope.row)">
-              <el-option
-                v-for="item in taxRateOptions"
-                :key="item.value"
-                :label="item.label"
-                :value="item.value"
-              />
-            </el-select>
+            <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.quantityStock" @change="() => calculateTotalPrice(scope.row)" />
+          </template>
+        </el-table-column>
+        <el-table-column label="鍗曚环(鍏�)" prop="taxInclusiveUnitPrice" width="150">
+          <template #default="scope">
+            <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.taxInclusiveUnitPrice" @change="() => calculateTotalPrice(scope.row)" />
           </template>
         </el-table-column>
         <el-table-column
-          label="鍚◣鍗曚环(鍏�)"
-          prop="taxInclusiveUnitPrice"
-          width="180"
-        >
-          <template #default="scope">
-            <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.taxInclusiveUnitPrice" @change="calculateTotalPrice(scope.row)" />
-          </template>
-        </el-table-column>
-        <el-table-column
-          label="鍚◣鎬讳环(鍏�)"
-          prop="taxInclusiveTotalPrice"
-          width="180"
-        >
-          <template #default="scope">
-            <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.taxInclusiveTotalPrice" @change="calculateExclusivePrice(scope.row)" />
-          </template>
-        </el-table-column>
-        <el-table-column
-          label="涓嶅惈绋庢�讳环(鍏�)"
-          prop="taxExclusiveTotalPrice"
-          width="180"
-        >
-          <template #default="scope">
-            <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.taxExclusiveTotalPrice" />
-          </template>
+           label="鎬讳环(鍏�)"
+           prop="taxInclusiveTotalPrice"
+           width="150"
+         >
         </el-table-column>
         <el-table-column label="鎿嶄綔" width="80" v-if="operationType === 'add'">
           <template #default="scope">
@@ -127,6 +104,7 @@
   addStockInCustom,
   updateStockInCustom,
 } from "@/api/inventoryManagement/stockIn.js";
+import { getCurrentDate } from "@/utils/index.js";
 
 const userStore = useUserStore()
 const { proxy } = getCurrentInstance()
@@ -155,9 +133,6 @@
   return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
 }
 
-function getCurrentDate() {
-  return formatDateTime(new Date(), false);
-}
 
 const itemTypeOptions = [
   { label: '鐗╂枡', value: '鐗╂枡' },
@@ -198,10 +173,11 @@
     supplierName: form.value.supplierName || '',
     itemType: '',
     inboundNum: 0,
-    inboundDate: '',
-    taxRate: null,
+    inboundDate: getCurrentDate(), // 榛樿褰撳ぉ鏃ユ湡
+    quantityStock: 0,
     taxInclusiveUnitPrice: 0,
     taxInclusiveTotalPrice: 0,
+    taxRate: null,
     taxExclusiveTotalPrice: 0,
   });
 };
@@ -211,19 +187,20 @@
   productList.value.splice(index, 1);
 };
 
-// 璁$畻鍚◣鎬讳环锛堟牴鎹崟浠峰拰鏁伴噺锛�
+// 璁$畻鎬讳环锛堟牴鎹暟閲忋�佸崟浠峰拰鍚◣鍗曚环锛�
 const calculateTotalPrice = (row) => {
-  const unitPrice = Number(row.taxInclusiveUnitPrice || 0);
-  const quantity = Number(row.inboundNum || 0);
-  row.taxInclusiveTotalPrice = unitPrice * quantity;
+  // 璁$畻鏅�氭�讳环锛歲uantityStock * taxInclusiveUnitPrice
+  const quantity = Number(row.quantityStock || 0);
+  const taxInclusiveUnitPrice = Number(row.taxInclusiveUnitPrice || 0);
+  row.taxInclusiveTotalPrice = quantity * taxInclusiveUnitPrice;
   calculateExclusivePrice(row);
 };
 
 // 璁$畻涓嶅惈绋庢�讳环锛堟牴鎹惈绋庢�讳环鍜岀◣鐜囷級
 const calculateExclusivePrice = (row) => {
-  const totalPrice = Number(row.taxInclusiveTotalPrice || 0);
+  const taxInclusiveTotalPrice = Number(row.taxInclusiveTotalPrice || 0);
   const taxRate = Number(row.taxRate || 0);
-  row.taxExclusiveTotalPrice = totalPrice / (1 + taxRate / 100);
+  row.taxExclusiveTotalPrice = taxInclusiveTotalPrice / (1 + taxRate / 100);
 };
 
 const submitForm = async () => {
@@ -267,9 +244,9 @@
       itemType: product.itemType,
       inboundDate: formatDateTime(product.inboundDate, false),
       taxRate: Number(product.taxRate || 0),
-      taxInclusiveUnitPrice: Number(product.taxInclusiveUnitPrice || 0),
-      taxInclusiveTotalPrice: Number(product.taxInclusiveTotalPrice || 0),
       taxExclusiveTotalPrice: Number(product.taxExclusiveTotalPrice || 0),
+			taxInclusiveUnitPrice: Number(product.taxInclusiveUnitPrice || 0),
+			taxInclusiveTotalPrice: Number(product.taxInclusiveTotalPrice || 0),
     }));
     loading.value = true
     if (operationType.value === 'edit') {
@@ -335,6 +312,7 @@
       itemType: row?.itemType ?? '',
       inboundNum: Number(row?.inboundNum ?? row?.inboundQuantity ?? 0),
       inboundDate: row?.inboundDate ?? row?.createTime ?? '',
+      quantityStock: Number(row?.quantityStock ?? 0),
       taxRate: Number(row?.taxRate ?? 0),
       taxInclusiveUnitPrice: Number(row?.taxInclusiveUnitPrice ?? 0),
       taxInclusiveTotalPrice: Number(row?.taxInclusiveTotalPrice ?? 0),

--
Gitblit v1.9.3