From 5448c9032abebbbaf4761670dfd90c8e5ea058fc Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期一, 23 三月 2026 16:53:49 +0800
Subject: [PATCH] bom的产品结构添加单价

---
 src/views/productionManagement/productStructure/Detail/index.vue       |   23 +++++++++++
 src/views/productionManagement/processRoute/processRouteItem/index.vue |   27 +++++++++++++
 src/views/productionManagement/productStructure/StructureEdit.vue      |   18 +++++++++
 3 files changed, 68 insertions(+), 0 deletions(-)

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