From 7d5f9791941d0ef9cd6d2daae80b5ae391e18b43 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期三, 01 七月 2026 16:10:10 +0800
Subject: [PATCH] 银川 1.联调产品维护页面 2.添加采购申请页面、联调

---
 src/views/erp/purchase/request/modules/item-form.vue |   62 +++++++++++++++++++------------
 1 files changed, 38 insertions(+), 24 deletions(-)

diff --git a/src/views/erp/purchase/request/modules/item-form.vue b/src/views/erp/purchase/request/modules/item-form.vue
index 14b2713..8cd2a2f 100644
--- a/src/views/erp/purchase/request/modules/item-form.vue
+++ b/src/views/erp/purchase/request/modules/item-form.vue
@@ -35,10 +35,10 @@
 /** 鑾峰彇琛ㄦ牸鍚堣鏁版嵁 */
 const summaries = computed(() => {
   return {
-    count: tableData.value.reduce((sum, item) => sum + (item.requestCount || 0), 0),
+    count: tableData.value.reduce((sum, item) => sum + (item.count || 0), 0),
     totalPrice: tableData.value.reduce(
       (sum, item) => {
-        const price = erpPriceMultiply(item.estimatedPrice || 0, item.requestCount || 0) ?? 0;
+        const price = erpPriceMultiply(item.productPrice || 0, item.count || 0) ?? 0;
         return sum + price;
       },
       0,
@@ -89,11 +89,13 @@
   const newRow = {
     id: undefined,
     productId: undefined,
+    productUnitId: undefined,
     productUnitName: undefined,
     productBarCode: undefined,
-    requestCount: 1,
-    estimatedPrice: undefined,
-    requiredDate: undefined,
+    count: 1,
+    productPrice: undefined,
+    taxPercent: undefined,
+    demandTime: undefined,
     remark: undefined,
     totalPrice: 0,
   };
@@ -118,10 +120,11 @@
   }
   row.productId = productId;
   row.productBarCode = product.barCode;
+  row.productUnitId = product.unitMeasureId;
   row.productUnitName = product.unitMeasureName;
   row.productName = product.name;
-  row.estimatedPrice = product.purchasePrice || 0;
-  row.requestCount = row.requestCount || 1;
+  row.productPrice = product.purchasePrice || 0;
+  row.count = row.count || 1;
   handleRowChange(row);
 }
 
@@ -134,16 +137,16 @@
     tableData.value[index] = row;
   }
   // 璁$畻棰勪及閲戦
-  if (row.estimatedPrice && row.requestCount) {
-    row.totalPrice = erpPriceMultiply(row.estimatedPrice, row.requestCount) ?? 0;
+  if (row.productPrice && row.count) {
+    row.totalPrice = erpPriceMultiply(row.productPrice, row.count) ?? 0;
   }
   emit('update:items', [...tableData.value]);
 }
 
 /** 鍒濆鍖栬鏁版嵁 */
 function initRow(row: ErpPurchaseRequestApi.PurchaseRequestItem) {
-  if (row.estimatedPrice && row.requestCount) {
-    row.totalPrice = erpPriceMultiply(row.estimatedPrice, row.requestCount) ?? 0;
+  if (row.productPrice && row.count) {
+    row.totalPrice = erpPriceMultiply(row.productPrice, row.count) ?? 0;
   }
 }
 
@@ -155,8 +158,8 @@
       if (!item.productId) {
         throw new Error(`绗� ${i + 1} 琛岋細浜у搧涓嶈兘涓虹┖`);
       }
-      if (!item.requestCount || item.requestCount <= 0) {
-        throw new Error(`绗� ${i + 1} 琛岋細鐢宠鏁伴噺涓嶈兘涓虹┖`);
+      if (!item.count || item.count <= 0) {
+        throw new Error(`绗� ${i + 1} 琛岋細鏁伴噺涓嶈兘涓虹┖`);
       }
     }
   }
@@ -191,35 +194,46 @@
       />
       <span v-else>{{ row.productName || '-' }}</span>
     </template>
-    <template #requestCount="{ row }">
+    <template #count="{ row }">
       <InputNumber
         v-if="!disabled"
-        v-model:value="row.requestCount"
+        v-model:value="row.count"
         :min="0"
         :precision="3"
         @change="handleRowChange(row)"
       />
-      <span v-else>{{ erpCountInputFormatter(row.requestCount) || '-' }}</span>
+      <span v-else>{{ erpCountInputFormatter(row.count) || '-' }}</span>
     </template>
-    <template #estimatedPrice="{ row }">
+    <template #productPrice="{ row }">
       <InputNumber
         v-if="!disabled"
-        v-model:value="row.estimatedPrice"
+        v-model:value="row.productPrice"
         :min="0"
         :precision="2"
         @change="handleRowChange(row)"
       />
-      <span v-else>{{ erpPriceInputFormatter(row.estimatedPrice) || '-' }}</span>
+      <span v-else>{{ erpPriceInputFormatter(row.productPrice) || '-' }}</span>
     </template>
-    <template #requiredDate="{ row }">
+    <template #taxPercent="{ row }">
+      <InputNumber
+        v-if="!disabled"
+        v-model:value="row.taxPercent"
+        :min="0"
+        :max="100"
+        :precision="2"
+        @change="handleRowChange(row)"
+      />
+      <span v-else>{{ row.taxPercent ? `${row.taxPercent}%` : '-' }}</span>
+    </template>
+    <template #demandTime="{ row }">
       <DatePicker
         v-if="!disabled"
-        v-model:value="row.requiredDate"
+        v-model:value="row.demandTime"
         valueFormat="YYYY-MM-DD"
         class="w-full"
         @change="handleRowChange(row)"
       />
-      <span v-else>{{ row.requiredDate || '-' }}</span>
+      <span v-else>{{ row.demandTime || '-' }}</span>
     </template>
     <template #remark="{ row }">
       <Input v-if="!disabled" v-model:value="row.remark" class="w-full" @change="handleRowChange(row)" />
@@ -246,7 +260,7 @@
         <div class="flex justify-between text-sm text-muted-foreground">
           <span class="font-medium text-foreground">鍚堣锛�</span>
           <div class="flex space-x-4">
-            <span>鐢宠鏁伴噺锛歿{ erpCountInputFormatter(summaries.count) }}</span>
+            <span>鏁伴噺锛歿{ erpCountInputFormatter(summaries.count) }}</span>
             <span>棰勪及閲戦锛歿{ erpPriceInputFormatter(summaries.totalPrice) }}</span>
           </div>
         </div>
@@ -264,4 +278,4 @@
       />
     </template>
   </Grid>
-</template>
\ No newline at end of file
+</template>

--
Gitblit v1.9.3