From 58916670fe54367e9c9350596fb293787b73b425 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期一, 23 三月 2026 18:00:36 +0800
Subject: [PATCH] Merge branch 'dev_银川_中盛建材' of http://114.132.189.42:9002/r/product-inventory-management into dev_银川_中盛建材

---
 src/views/productionManagement/productStructure/Detail/index.vue       |   23 +++++++
 src/views/productionManagement/processRoute/processRouteItem/index.vue |   27 +++++++++
 src/views/costAccounting/productionCostAccounting/index.vue            |   94 ++++---------------------------
 src/views/productionManagement/productStructure/StructureEdit.vue      |   18 ++++++
 4 files changed, 81 insertions(+), 81 deletions(-)

diff --git a/src/views/costAccounting/productionCostAccounting/index.vue b/src/views/costAccounting/productionCostAccounting/index.vue
index 8fc60c2..6efd289 100644
--- a/src/views/costAccounting/productionCostAccounting/index.vue
+++ b/src/views/costAccounting/productionCostAccounting/index.vue
@@ -100,13 +100,9 @@
           <div class="kpi-label">鎬荤敓浜ф垚鏈�</div>
           <div class="kpi-value">楼{{ formatMoney(overview.totalCost) }}</div>
         </div>
-        <div class="kpi-item kpi-raw">
-          <div class="kpi-label">鍘熸枡鎴愭湰</div>
-          <div class="kpi-value">楼{{ formatMoney(overview.rawCost) }}</div>
-        </div>
-        <div class="kpi-item kpi-aux">
-          <div class="kpi-label">杈呮枡鎴愭湰</div>
-          <div class="kpi-value">楼{{ formatMoney(overview.auxCost) }}</div>
+        <div class="kpi-item kpi-avg">
+          <div class="kpi-label">姣忚鍗曞钩鍧囨垚鏈�</div>
+          <div class="kpi-value">楼{{ formatMoney(overview.avgCostPerOrder) }}</div>
         </div>
         <div class="kpi-item kpi-order">
           <div class="kpi-label">璁㈠崟鏁伴噺</div>
@@ -125,17 +121,7 @@
           </template>
           <el-table :data="categorySummary" stripe class="lux-table" height="260">
             <el-table-column prop="category" label="浜у搧绫诲埆" min-width="140" />
-            <el-table-column prop="rawCost" label="鍘熸枡鎴愭湰(鍏�)" align="right">
-              <template #default="scope">
-                <span class="price-value">{{ formatMoney(scope.row.rawCost) }}</span>
-              </template>
-            </el-table-column>
-            <el-table-column prop="auxCost" label="杈呮枡鎴愭湰(鍏�)" align="right">
-              <template #default="scope">
-                <span class="price-value">{{ formatMoney(scope.row.auxCost) }}</span>
-              </template>
-            </el-table-column>
-            <el-table-column prop="totalCost" label="鎬绘垚鏈�(鍏�)" align="right">
+            <el-table-column prop="totalCost" label="鎴愭湰(鍏�)" align="right">
               <template #default="scope">
                 <span class="cost-value">楼{{ formatMoney(scope.row.totalCost) }}</span>
               </template>
@@ -175,17 +161,7 @@
         <el-table-column prop="timeLabel" :label="timeColumnLabel" min-width="110" />
         <el-table-column prop="category" label="浜у搧绫诲埆" min-width="120" />
         <el-table-column prop="orderNo" label="鐢熶骇璁㈠崟" min-width="150" />
-        <el-table-column prop="rawCost" label="鍘熸枡鎴愭湰(鍏�)" align="right">
-          <template #default="scope">
-            <span class="price-value">{{ formatMoney(scope.row.rawCost) }}</span>
-          </template>
-        </el-table-column>
-        <el-table-column prop="auxCost" label="杈呮枡鎴愭湰(鍏�)" align="right">
-          <template #default="scope">
-            <span class="price-value">{{ formatMoney(scope.row.auxCost) }}</span>
-          </template>
-        </el-table-column>
-        <el-table-column prop="totalCost" label="鎬绘垚鏈�(鍏�)" align="right">
+        <el-table-column prop="totalCost" label="鎴愭湰(鍏�)" align="right">
           <template #default="scope">
             <span class="cost-value">楼{{ formatMoney(scope.row.totalCost) }}</span>
           </template>
@@ -234,16 +210,6 @@
       </div>
       <el-table :data="detailMaterials" class="lux-table" stripe>
         <el-table-column prop="materialName" label="鐗╂枡鍚嶇О" min-width="120" />
-        <el-table-column prop="materialType" label="绫诲瀷" width="94">
-          <template #default="scope">
-            <span
-              class="material-type-tag"
-              :class="scope.row.materialType === '鍘熸枡' ? 'is-raw' : 'is-aux'"
-            >
-              {{ scope.row.materialType }}
-            </span>
-          </template>
-        </el-table-column>
         <el-table-column prop="quantity" label="鎶曞叆閲�" align="right" min-width="140">
           <template #default="scope">
             <span class="quantity-cell">
@@ -264,16 +230,8 @@
         </el-table-column>
       </el-table>
       <div class="drawer-foot">
-        <div class="foot-item">
-          <span class="foot-label">鍘熸枡</span>
-          <span class="foot-value no-wrap-money">楼{{ formatMoney(detailRawCost) }}</span>
-        </div>
-        <div class="foot-item">
-          <span class="foot-label">杈呮枡</span>
-          <span class="foot-value no-wrap-money">楼{{ formatMoney(detailAuxCost) }}</span>
-        </div>
         <div class="foot-item total">
-          <span class="foot-label">鍚堣</span>
+          <span class="foot-label">鎴愭湰鍚堣</span>
           <span class="foot-value no-wrap-money">楼{{ formatMoney(detailTotalCost) }}</span>
         </div>
       </div>
@@ -402,15 +360,11 @@
     const key = keyFn(item);
     if (!map.has(key)) {
       map.set(key, {
-        rawCost: 0,
-        auxCost: 0,
         totalCost: 0,
         materials: [],
       });
     }
     const bucket = map.get(key);
-    if (item.materialType === "鍘熸枡") bucket.rawCost += item.cost;
-    if (item.materialType === "杈呮枡") bucket.auxCost += item.cost;
     bucket.totalCost += item.cost;
     bucket.materials.push(item);
   }
@@ -433,8 +387,6 @@
       timeLabel,
       category,
       orderNo,
-      rawCost: val.rawCost,
-      auxCost: val.auxCost,
       totalCost: val.totalCost,
       materials: val.materials,
     });
@@ -458,8 +410,6 @@
   for (const [category, val] of map) {
     rows.push({
       category,
-      rawCost: val.rawCost,
-      auxCost: val.auxCost,
       totalCost: val.totalCost,
     });
   }
@@ -480,18 +430,12 @@
 });
 
 const overview = computed(() => {
-  const rawCost = filteredRecords.value
-    .filter((item) => item.materialType === "鍘熸枡")
-    .reduce((sum, item) => sum + item.cost, 0);
-  const auxCost = filteredRecords.value
-    .filter((item) => item.materialType === "杈呮枡")
-    .reduce((sum, item) => sum + item.cost, 0);
   const orderCount = new Set(filteredRecords.value.map((item) => item.orderNo)).size;
+  const totalCost = filteredRecords.value.reduce((sum, item) => sum + item.cost, 0);
   return {
-    rawCost,
-    auxCost,
-    totalCost: rawCost + auxCost,
+    totalCost,
     orderCount,
+    avgCostPerOrder: orderCount === 0 ? 0 : totalCost / orderCount,
   };
 });
 
@@ -500,16 +444,6 @@
 
 const detailMaterials = computed(() => detailRow.value?.materials || []);
 
-const detailRawCost = computed(() =>
-  detailMaterials.value
-    .filter((item) => item.materialType === "鍘熸枡")
-    .reduce((sum, item) => sum + item.cost, 0)
-);
-const detailAuxCost = computed(() =>
-  detailMaterials.value
-    .filter((item) => item.materialType === "杈呮枡")
-    .reduce((sum, item) => sum + item.cost, 0)
-);
 const detailTotalCost = computed(() =>
   detailMaterials.value.reduce((sum, item) => sum + item.cost, 0)
 );
@@ -548,14 +482,12 @@
 };
 
 const handleExport = () => {
-  const headers = [timeColumnLabel.value, "浜у搧绫诲埆", "鐢熶骇璁㈠崟", "鍘熸枡鎴愭湰", "杈呮枡鎴愭湰", "鎬绘垚鏈�"];
+  const headers = [timeColumnLabel.value, "浜у搧绫诲埆", "鐢熶骇璁㈠崟", "鎴愭湰(鍏�)"];
   const lines = tableData.value.map((row) =>
     [
       row.timeLabel,
       row.category,
       row.orderNo,
-      row.rawCost.toFixed(2),
-      row.auxCost.toFixed(2),
       row.totalCost.toFixed(2),
     ].join(",")
   );
@@ -694,7 +626,7 @@
 
 .kpi-strip {
   display: grid;
-  grid-template-columns: repeat(4, minmax(0, 1fr));
+  grid-template-columns: repeat(3, minmax(0, 1fr));
   gap: 12px;
 }
 
@@ -712,8 +644,8 @@
   background: linear-gradient(135deg, rgba(22, 163, 74, 0.1), rgba(255, 255, 255, 0.86));
 }
 
-.kpi-aux {
-  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(255, 255, 255, 0.86));
+.kpi-avg {
+  background: linear-gradient(135deg, rgba(99, 102, 241, 0.14), rgba(255, 255, 255, 0.86));
 }
 
 .kpi-order {
diff --git a/src/views/productionManagement/processRoute/processRouteItem/index.vue b/src/views/productionManagement/processRoute/processRouteItem/index.vue
index 1d76eba..d7fadd3 100644
--- a/src/views/productionManagement/processRoute/processRouteItem/index.vue
+++ b/src/views/productionManagement/processRoute/processRouteItem/index.vue
@@ -262,6 +262,21 @@
                       <span v-else>{{ row.unit }}</span>
                     </template>
                   </el-table-column>
+                   <el-table-column prop="unitPrice"
+                                   label="鍗曚环">
+                    <template #default="{ row }">
+                      <el-form-item v-if="bomDataValue.isEdit"
+                                    style="margin: 0">
+                        <el-input-number v-model="row.unitPrice"
+                                         :min="0"
+                                         :step="1"
+                                         controls-position="right"
+                                         style="width: 100%"
+                                         :disabled="!bomDataValue.isEdit" />
+                      </el-form-item>
+                      <span v-else>{{ row.unitPrice }}</span>
+                    </template>
+                  </el-table-column>
                   <el-table-column label="鎿嶄綔"
                                    fixed="right"
                                    v-if="pageType === 'order'"
@@ -777,6 +792,7 @@
         processId: "",
         processName: "",
         unitQuantity: 0,
+        unitPrice: 0,
         unit: "",
         children: [],
         tempId: new Date().getTime(),
@@ -805,6 +821,7 @@
             processId: "",
             processName: "",
             unitQuantity: 0,
+            unitPrice: 0,
             unit: "",
             children: [],
             tempId: new Date().getTime(),
@@ -911,6 +928,15 @@
           ElMessage.error("璇峰~鍐欏崟浣嶄骇鍑烘墍闇�鏁伴噺");
           return false;
         }
+        // 鏍¢獙鍗曚环鏄惁蹇呭~
+        if (
+          item.unitPrice === undefined ||
+          item.unitPrice === null ||
+          item.unitPrice === 0
+        ) {
+          ElMessage.error("璇峰~鍐欏崟浠�");
+          return false;
+        }
         // 閫掑綊鏍¢獙瀛愰」
         if (item.children && item.children.length > 0) {
           if (!validateBomData(item.children)) {
@@ -940,6 +966,7 @@
         productModelId: item.productModelId || null,
         processId: item.processId || null,
         unitQuantity: item.unitQuantity || 0,
+        unitPrice: item.unitPrice || 0,
         demandedQuantity: item.demandedQuantity || null,
         unit: item.unit || "",
         tempId: item.tempId || new Date().getTime(),
diff --git a/src/views/productionManagement/productStructure/Detail/index.vue b/src/views/productionManagement/productStructure/Detail/index.vue
index ae76ed4..252c8fc 100644
--- a/src/views/productionManagement/productStructure/Detail/index.vue
+++ b/src/views/productionManagement/productStructure/Detail/index.vue
@@ -117,6 +117,21 @@
                   </el-form-item>
                 </template>
               </el-table-column>
+               <el-table-column prop="unitPrice"
+                               label="鍗曚环">
+                <template #default="{ row, $index }">
+                  <el-form-item v-if="dataValue.isEdit"
+                                :rules="[{ required: true, message: '璇疯緭鍏ュ崟浠�', trigger: ['blur','change'] }]"
+                                style="margin: 0">
+                    <el-input-number v-model="row.unitPrice"
+                                     :min="0"
+                                     :step="1"
+                                     controls-position="right"
+                                     style="width: 100%"
+                                     :disabled="!dataValue.isEdit" />
+                  </el-form-item>
+                </template>
+              </el-table-column>
               <el-table-column label="鎿嶄綔"
                                fixed="right"
                                width="200">
@@ -344,6 +359,11 @@
         isValid = false;
         return;
       }
+      if (!item.unitPrice) {
+        ElMessage.error("璇疯緭鍏ュ崟浠�");
+        isValid = false;
+        return;
+      }
       if (isOrderPage.value && !item.demandedQuantity) {
         ElMessage.error("璇疯緭鍏ラ渶姹傛�婚噺");
         isValid = false;
@@ -439,6 +459,7 @@
       processId: "",
       processName: "",
       unitQuantity: 0,
+      unitPrice: 0,
       demandedQuantity: 0,
       unit: "",
       children: [],
@@ -461,6 +482,7 @@
           processId: "",
           processName: "",
           unitQuantity: 0,
+          unitPrice: 0,
           demandedQuantity: 0,
           unit: "",
           children: [],
@@ -487,6 +509,7 @@
         productModelId: undefined,
         processId: "",
         unitQuantity: 0,
+        unitPrice: 0,
         demandedQuantity: 0,
         children: [],
         unit: "",
diff --git a/src/views/productionManagement/productStructure/StructureEdit.vue b/src/views/productionManagement/productStructure/StructureEdit.vue
index 732a070..14a5e82 100644
--- a/src/views/productionManagement/productStructure/StructureEdit.vue
+++ b/src/views/productionManagement/productStructure/StructureEdit.vue
@@ -122,6 +122,23 @@
                   </el-form-item>
                 </template>
               </el-table-column>
+              <el-table-column prop="unitPrice"
+                               label="鍗曚环"
+                               width="150">
+                <template #default="{ row, $index }">
+                  <el-form-item :prop="`dataList.${$index}.unitPrice`"
+                                :rules="[{ required: true, message: '璇疯緭鍏ュ崟浠�', trigger: ['blur','change'] }]"
+                                style="margin: 0">
+                    <el-input-number v-model="row.unitPrice"
+                                     :min="0"
+                                     :precision="2"
+                                     :step="1"
+                                     controls-position="right"
+                                     style="width: 100%"
+                                     :disabled="!dataValue.isEdit" />
+                  </el-form-item>
+                </template>
+              </el-table-column>
               <el-table-column prop="diskQuantity"
                                label="鐩樻暟锛堢洏锛�"
                                width="150">
@@ -294,6 +311,7 @@
       productModelId: undefined,
       processId: "",
       unitQuantity: 0,
+      unitPrice: 0,
       demandedQuantity: 0,
       unit: "",
       diskQuantity: 0,

--
Gitblit v1.9.3