From 4f51c5dfbb3354d01c6ad4cfe260b703e15269dd Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 16 十二月 2025 16:05:26 +0800
Subject: [PATCH] 1.海川开心-增加价格字段,所有的原料,材料版块添加供应商字段

---
 src/views/inventoryManagement/receiptManagement/index.vue                    |   10 ++
 src/views/inventoryManagement/issueManagement/index.vue                      |    4 
 src/views/inventoryManagement/receiptManagement/components/formDiaManual.vue |   84 ++++++++-------------
 src/views/inventoryManagement/receiptManagement/components/formDia.vue       |   56 ++++++++-----
 src/views/productionManagement/productionReporting/components/formDia.vue    |   35 +++++++-
 5 files changed, 106 insertions(+), 83 deletions(-)

diff --git a/src/views/inventoryManagement/issueManagement/index.vue b/src/views/inventoryManagement/issueManagement/index.vue
index 0d10247..bc952ec 100644
--- a/src/views/inventoryManagement/issueManagement/index.vue
+++ b/src/views/inventoryManagement/issueManagement/index.vue
@@ -95,7 +95,7 @@
            <el-table-column align="center" label="搴忓彿" type="index" width="60" />
            <el-table-column label="鍏ュ簱鏃堕棿" prop="createTime" width="100" show-overflow-tooltip />
            <!-- <el-table-column label="鍏ュ簱鎵规" prop="inboundBatches" width="160" show-overflow-tooltip /> -->
-<!-- &lt;!&ndash;            <el-table-column label="渚涘簲鍟嗗悕绉�" prop="supplierName" width="240" show-overflow-tooltip />&ndash;&gt; -->
+<el-table-column label="渚涘簲鍟嗗悕绉�" prop="supplierName" width="240" show-overflow-tooltip />
            <el-table-column label="浜у搧澶х被" prop="productCategory" show-overflow-tooltip />
            <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" show-overflow-tooltip />
            <el-table-column label="鍗曚綅" prop="unit" width="70" show-overflow-tooltip />
@@ -153,7 +153,7 @@
             <el-table-column align="center" label="搴忓彿" type="index" width="60" />
             <el-table-column label="鍏ュ簱鏃堕棿" prop="inboundDate" width="100" show-overflow-tooltip />
             <!-- <el-table-column label="鍏ュ簱鎵规" prop="inboundBatches" width="160" show-overflow-tooltip /> -->
-            <!-- <el-table-column label="渚涘簲鍟嗗悕绉�" prop="supplierName" width="240" show-overflow-tooltip /> -->
+             <el-table-column label="渚涘簲鍟嗗悕绉�" prop="supplierName" width="240" show-overflow-tooltip />
             <el-table-column label="浜у搧澶х被" prop="productCategory" show-overflow-tooltip />
             <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" show-overflow-tooltip />
             <el-table-column label="鍗曚綅" prop="unit" width="70" show-overflow-tooltip />
diff --git a/src/views/inventoryManagement/receiptManagement/components/formDia.vue b/src/views/inventoryManagement/receiptManagement/components/formDia.vue
index 7825e1e..6bb7b6c 100644
--- a/src/views/inventoryManagement/receiptManagement/components/formDia.vue
+++ b/src/views/inventoryManagement/receiptManagement/components/formDia.vue
@@ -8,8 +8,6 @@
           placeholder="璇烽�夋嫨閲囪喘璁㈠崟鍙�"
           clearable
           filterable
-          remote
-          :remote-method="loadPurchaseOptions"
           :loading="loadingPurchaseOptions"
           @change="handlePurchaseChange"
           :disabled="operationType === 'edit'"
@@ -44,28 +42,22 @@
         <el-table-column label="寰呭叆搴撴暟閲�" prop="quantity0" width="100" />
         <el-table-column label="鏈鍏ュ簱鏁伴噺" prop="quantityStock" width="150">
           <template #default="scope">
-            <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.quantityStock" />
+            <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="taxRate" width="120" />-->
-<!--        <el-table-column-->
-<!--          label="鍚◣鍗曚环(鍏�)"-->
-<!--          prop="taxInclusiveUnitPrice"-->
-<!--          :formatter="formattedNumber"-->
-<!--          width="150"-->
-<!--        />-->
-<!--        <el-table-column-->
-<!--          label="鍚◣鎬讳环(鍏�)"-->
-<!--          prop="taxInclusiveTotalPrice"-->
-<!--          :formatter="formattedNumber"-->
-<!--          width="150"-->
-<!--        />-->
-<!--        <el-table-column-->
-<!--          label="涓嶅惈绋庢�讳环(鍏�)"-->
-<!--          prop="taxExclusiveTotalPrice"-->
-<!--          :formatter="formattedNumber"-->
-<!--          width="150"-->
-<!--        />-->
+        <el-table-column label="绋庣巼(%)" prop="taxRate" width="120" />
+        <el-table-column label="鍗曚环(鍏�)" prop="unitPrice" width="150">
+					<template #default="scope">
+						<el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.unitPrice" @change="() => calculateTotalPrice(scope.row)" />
+					</template>
+				</el-table-column>
+        <el-table-column
+          label="鎬讳环(鍏�)"
+					:formatter="formattedNumber"
+          prop="totalPrice"
+          width="150"
+        >
+        </el-table-column>
       </el-table>
     </el-form>
     <template #footer>
@@ -199,6 +191,18 @@
   return parseFloat(cellValue).toFixed(2);
 };
 
+// 璁$畻鎬讳环
+const calculateTotalPrice = (row) => {
+  const quantityStock = Number(row?.quantityStock ?? 0);
+  const unitPrice = Number(row?.unitPrice ?? 0);
+  
+  if (Number.isFinite(quantityStock) && Number.isFinite(unitPrice)) {
+    row.totalPrice = quantityStock * unitPrice;
+  } else {
+    row.totalPrice = 0;
+  }
+};
+
 const fetchProductsByContract = async () => {
   if (!form.value.purchaseContractNumber) {
     proxy.$modal.msgWarning('璇烽�夋嫨鍚堝悓鍙�')
@@ -217,6 +221,8 @@
     productList.value = productRes.data.map(item => ({
       ...item,
       quantityStock: 0,
+      unitPrice: Number(item?.unitPrice ?? 0),
+      totalPrice: 0,
       originalQuantityStock: Number(item.quantityStock ?? item.inboundQuantity ?? 0),
     }))
   } catch (error) {
@@ -283,7 +289,9 @@
       nickName: userStore.nickName,
       details: selectedRows.value.map(product => ({
         id: product.id,
-        inboundQuantity: Number(product.quantityStock)
+        inboundQuantity: Number(product.quantityStock),
+				unitPrice: Number(product.unitPrice),
+				totalPrice: Number(product.totalPrice)
       })),
     };
     loading.value = true
@@ -365,6 +373,8 @@
       productList.value = res.data.map(item => ({
         ...item,
         quantityStock: Number(item.quantityStock ?? item.inboundQuantity ?? row.inboundNum ?? 0),
+        unitPrice: Number(item?.unitPrice ?? 0),
+        totalPrice: Number(item?.quantityStock ?? 0) * Number(item?.unitPrice ?? 0),
         originalQuantityStock: Number(item.quantityStock ?? item.inboundQuantity ?? row.inboundNum ?? 0),
       }))
       selectedRows.value = productList.value
diff --git a/src/views/inventoryManagement/receiptManagement/components/formDiaManual.vue b/src/views/inventoryManagement/receiptManagement/components/formDiaManual.vue
index fa6566c..16039e6 100644
--- a/src/views/inventoryManagement/receiptManagement/components/formDiaManual.vue
+++ b/src/views/inventoryManagement/receiptManagement/components/formDiaManual.vue
@@ -31,12 +31,12 @@
             <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">
+        </el-table-column>
+        <el-table-column label="鐗╁搧绫诲瀷" prop="itemType" width="150">
           <template #default="scope">
             <el-select v-model="scope.row.itemType" filterable allow-create placeholder="璇烽�夋嫨鐗╁搧绫诲瀷" style="width: 100%">
               <el-option
@@ -48,7 +48,7 @@
             </el-select>
           </template>
         </el-table-column>
-        <el-table-column label="鍏ュ簱鏁伴噺" prop="inboundNum">
+        <el-table-column label="鍏ュ簱鏁伴噺" prop="inboundNum" width="150">
           <template #default="scope">
             <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.inboundNum" @change="() => calculateTotalPrice(scope.row)" />
           </template>
@@ -65,45 +65,22 @@
             />
           </template>
         </el-table-column>
-<!--        <el-table-column label="绋庣巼(%)" prop="taxRate" 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>-->
-<!--          </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>-->
-<!--        </el-table-column>-->
+        <el-table-column label="鏁伴噺" prop="quantityStock" width="150">
+          <template #default="scope">
+            <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="taxInclusiveTotalPrice" 
+           width="150" 
+         >
+        </el-table-column>
         <el-table-column label="鎿嶄綔" width="80" v-if="operationType === 'add'">
           <template #default="scope">
             <el-button type="danger" size="small" @click="removeProductRow(scope.$index)">鍒犻櫎</el-button>
@@ -199,9 +176,10 @@
     itemType: '',
     inboundNum: 0,
     inboundDate: '',
-    taxRate: null,
+    quantityStock: 0,
     taxInclusiveUnitPrice: 0,
     taxInclusiveTotalPrice: 0,
+    taxRate: null,
     taxExclusiveTotalPrice: 0,
   });
 };
@@ -211,19 +189,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 +246,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 +314,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),
diff --git a/src/views/inventoryManagement/receiptManagement/index.vue b/src/views/inventoryManagement/receiptManagement/index.vue
index c9f6e46..33c5f39 100644
--- a/src/views/inventoryManagement/receiptManagement/index.vue
+++ b/src/views/inventoryManagement/receiptManagement/index.vue
@@ -42,6 +42,8 @@
             <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" show-overflow-tooltip />
             <el-table-column label="鍗曚綅" prop="unit" width="70" show-overflow-tooltip />
             <el-table-column label="鍏ュ簱鏁伴噺" prop="inboundNum" width="90" show-overflow-tooltip />
+						<el-table-column label="鍗曚环(鍏�)" prop="unitPrice" width="150"></el-table-column>
+						<el-table-column label="鎬讳环(鍏�)" prop="totalPrice" width="150"></el-table-column>
 <!--            <el-table-column label="鍚◣鍗曚环" prop="taxInclusiveUnitPrice" width="100" show-overflow-tooltip />-->
 <!--            <el-table-column label="鍚◣鎬讳环" prop="taxInclusiveTotalPrice" width="100" show-overflow-tooltip />-->
 <!--            <el-table-column label="绋庣巼(%)" prop="taxRate" width="80" show-overflow-tooltip />-->
@@ -92,11 +94,13 @@
            <el-table-column align="center" label="搴忓彿" type="index" width="60" />
            <el-table-column label="鍏ュ簱鏃堕棿" prop="createTime" width="100" show-overflow-tooltip />
            <!-- <el-table-column label="鍏ュ簱鎵规" prop="inboundBatches" width="160" show-overflow-tooltip /> -->
-<!--&lt;!&ndash;            <el-table-column label="渚涘簲鍟嗗悕绉�" prop="supplierName" width="240" show-overflow-tooltip />&ndash;&gt;-->
+<el-table-column label="渚涘簲鍟嗗悕绉�" prop="supplierName" width="240" show-overflow-tooltip />
            <el-table-column label="浜у搧澶х被" prop="productCategory" show-overflow-tooltip />
            <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" show-overflow-tooltip />
            <el-table-column label="鍗曚綅" prop="unit" width="70" show-overflow-tooltip />
            <el-table-column label="鍏ュ簱鏁伴噺" prop="inboundNum" width="90" show-overflow-tooltip />
+					 <el-table-column label="鍗曚环(鍏�)" prop="unitPrice" width="150"></el-table-column>
+					 <el-table-column label="鎬讳环(鍏�)" prop="totalPrice" width="150"></el-table-column>
 <!--&lt;!&ndash;            <el-table-column label="鍚◣鍗曚环" prop="taxInclusiveUnitPrice" width="100" show-overflow-tooltip />&ndash;&gt;-->
 <!--&lt;!&ndash;            <el-table-column label="鍚◣鎬讳环" prop="taxInclusiveTotalPrice" width="100" show-overflow-tooltip />&ndash;&gt;-->
 <!--&lt;!&ndash;            <el-table-column label="绋庣巼(%)" prop="taxRate" width="80" show-overflow-tooltip />&ndash;&gt;-->
@@ -152,12 +156,14 @@
             <el-table-column align="center" label="搴忓彿" type="index" width="60" />
             <el-table-column label="鍏ュ簱鏃堕棿" prop="inboundDate" width="100" show-overflow-tooltip />
             <!-- <el-table-column label="鍏ュ簱鎵规" prop="inboundBatches" show-overflow-tooltip /> -->
-            <!-- <el-table-column label="渚涘簲鍟嗗悕绉�" prop="supplierName" width="240" show-overflow-tooltip /> -->
+             <el-table-column label="渚涘簲鍟嗗悕绉�" prop="supplierName" width="240" show-overflow-tooltip />
             <el-table-column label="浜у搧澶х被" prop="productCategory" show-overflow-tooltip />
             <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" show-overflow-tooltip />
             <el-table-column label="鍗曚綅" prop="unit" width="70" show-overflow-tooltip />
             <el-table-column label="鐗╁搧绫诲瀷" prop="itemType" show-overflow-tooltip />
             <el-table-column label="鍏ュ簱鏁伴噺" prop="inboundNum" show-overflow-tooltip />
+						<el-table-column label="鍗曚环(鍏�)" prop="taxInclusiveUnitPrice" width="150"></el-table-column>
+						<el-table-column label="鎬讳环(鍏�)" prop="taxInclusiveTotalPrice" width="150"></el-table-column>
 <!--            <el-table-column label="鍚◣鍗曚环" prop="taxInclusiveUnitPrice" width="100" show-overflow-tooltip />-->
 <!--            <el-table-column label="鍚◣鎬讳环" prop="taxInclusiveTotalPrice" width="100" show-overflow-tooltip />-->
 <!--            <el-table-column label="绋庣巼(%)" prop="taxRate" width="80" show-overflow-tooltip />-->
diff --git a/src/views/productionManagement/productionReporting/components/formDia.vue b/src/views/productionManagement/productionReporting/components/formDia.vue
index e5adbc2..2eb1c0b 100644
--- a/src/views/productionManagement/productionReporting/components/formDia.vue
+++ b/src/views/productionManagement/productionReporting/components/formDia.vue
@@ -13,8 +13,15 @@
               <el-input v-model="form.schedulingNum" placeholder="璇疯緭鍏�" clearable disabled/>
             </el-form-item>
           </el-col>
-          <el-col :span="12">
-            <el-form-item label="鏈鐢熶骇鏁伴噺锛�" prop="finishedNum">
+					<el-col :span="12">
+						<el-form-item label="寰呯敓浜ф暟閲忥細" prop="pendingNum">
+							<el-input v-model="form.pendingNum" placeholder="璇疯緭鍏�" clearable disabled/>
+						</el-form-item>
+					</el-col>
+        </el-row>
+        <el-row :gutter="30">
+					<el-col :span="12">
+						<el-form-item label="鏈鐢熶骇鏁伴噺锛�" prop="finishedNum">
 							<el-input-number
 								v-model="form.finishedNum"
 								placeholder="璇疯緭鍏�"
@@ -25,13 +32,18 @@
 								style="width: 100%"
 								@change="changeNum"
 							/>
+						</el-form-item>
+					</el-col>
+          <el-col :span="12">
+            <el-form-item label="鍗曚环(鍏�)锛�" prop="unitPrice">
+              <el-input v-model="form.unitPrice" placeholder="璇疯緭鍏�" clearable @input="calculateTotalPrice"/>
             </el-form-item>
           </el-col>
         </el-row>
         <el-row :gutter="30">
           <el-col :span="12">
-            <el-form-item label="寰呯敓浜ф暟閲忥細" prop="pendingNum">
-              <el-input v-model="form.pendingNum" placeholder="璇疯緭鍏�" clearable disabled/>
+            <el-form-item label="鎬讳环(鍏�)锛�" prop="totalPrice">
+              <el-input v-model="form.totalPrice" placeholder="璇疯緭鍏�" clearable disabled/>
             </el-form-item>
           </el-col>
         </el-row>
@@ -98,6 +110,8 @@
 		finishedNum: "",
 		schedulingUserId: "",
 		schedulingDate: "",
+		unitPrice: "",
+		totalPrice: "",
   },
   rules: {
 		schedulingNum: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" },],
@@ -121,6 +135,19 @@
 		proxy.$modal.msgWarning('鏈鐢熶骇鏁伴噺涓嶅彲澶т簬鎺掍骇鏁伴噺')
 	}
 	form.value.pendingNum = form.value.schedulingNum - form.value.finishedNum;
+	calculateTotalPrice();
+}
+
+// 璁$畻鎬讳环
+const calculateTotalPrice = () => {
+	const quantity = Number(form.value.finishedNum ?? 0);
+	const unitPrice = Number(form.value.unitPrice ?? 0);
+	
+	if (quantity > 0 && unitPrice > 0) {
+		form.value.totalPrice = (quantity * unitPrice).toFixed(2);
+	} else {
+		form.value.totalPrice = '0.00';
+	}
 }
 // 鎻愪氦浜у搧琛ㄥ崟
 const submitForm = () => {

--
Gitblit v1.9.3