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 |   57 ++++++++++++++++++++++++++++++++-------------------------
 1 files changed, 32 insertions(+), 25 deletions(-)

diff --git a/src/views/productionManagement/productStructure/Detail/index.vue b/src/views/productionManagement/productStructure/Detail/index.vue
index 9cd0976..252c8fc 100644
--- a/src/views/productionManagement/productStructure/Detail/index.vue
+++ b/src/views/productionManagement/productStructure/Detail/index.vue
@@ -38,11 +38,10 @@
                                label="瑙勬牸">
                 <template #default="{ row, $index }">
                   <el-form-item v-if="dataValue.isEdit"
-                                :rules="[{ required: true, message: '璇烽�夋嫨瑙勬牸', trigger: ['blur','change'] }]"
+                                :rules="[{ required: false, message: '璇烽�夋嫨瑙勬牸', trigger: ['blur','change'] }]"
                                 style="margin: 0">
                     <el-select v-model="row.model"
                                placeholder="璇烽�夋嫨瑙勬牸"
-                               clearable
                                :disabled="!dataValue.isEdit"
                                style="width: 100%"
                                @visible-change="(v) => { if (v) openDialog(row.tempId) }">
@@ -81,7 +80,6 @@
                                 style="margin: 0">
                     <el-input-number v-model="row.unitQuantity"
                                      :min="0"
-                                     :precision="2"
                                      :step="1"
                                      controls-position="right"
                                      style="width: 100%"
@@ -119,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">
@@ -141,16 +154,12 @@
       </el-table-column>
       <el-table-column label="BOM缂栧彿"
                        prop="bomNo" />
-      <el-table-column label="浜у搧缂栫爜"
-                       prop="productCode" />
-      <el-table-column label="浜у搧鍚嶇О"
-                       prop="productName" />
-      <el-table-column label="瑙勬牸鍨嬪彿"
-                       prop="model" />
+      <el-table-column label="浜у搧绫诲瀷"
+                       prop="dictLabel" />
     </el-table>
-    <div v-if="dataValue.isEdit && dataValue.dataList.length == 0"
+    <div v-if="dataValue.isEdit"
          style="text-align: center;border: 1px solid #e4e7ed;padding: 10px;transition: all 0.3s ease;cursor: pointer;"
-         :class="{'hover-effect': dataValue.isEdit && dataValue.dataList.length == 0}">
+         :class="{'hover-effect': dataValue.isEdit}">
       <el-button type="primary"
                  text
                  @click="addItem">
@@ -206,11 +215,8 @@
 
   // 浠庤矾鐢卞弬鏁拌幏鍙栦骇鍝佷俊鎭�
   const routeBomNo = computed(() => route.query.bomNo || "");
-  const routeProductCode = computed(() => route.query.productCode || "");
-  const routeProductName = computed(() => route.query.productName || "");
-  const routeProductModelName = computed(
-    () => route.query.productModelName || ""
-  );
+  const routeDictLabel = computed(() => route.query.dictLabel || "");
+
   const routeOrderId = computed(() => route.query.orderId);
   const pageType = computed(() => route.query.type);
   const isOrderPage = computed(
@@ -230,9 +236,8 @@
 
   const tableData = reactive([
     {
-      productName: "",
-      model: "",
       bomNo: "",
+      dictLabel: "",
     },
   ]);
 
@@ -344,11 +349,6 @@
     const validateItem = (item: any, isTopLevel = false) => {
       console.log(item, "item");
       // 鏍¢獙褰撳墠椤圭殑蹇呭~瀛楁
-      if (!item.model) {
-        ElMessage.error("璇烽�夋嫨瑙勬牸");
-        isValid = false;
-        return;
-      }
       if (!item.processId) {
         ElMessage.error("璇烽�夋嫨娑堣�楀伐搴�");
         isValid = false;
@@ -356,6 +356,11 @@
       }
       if (!item.unitQuantity) {
         ElMessage.error("璇疯緭鍏ュ崟浣嶄骇鍑烘墍闇�鏁伴噺");
+        isValid = false;
+        return;
+      }
+      if (!item.unitPrice) {
+        ElMessage.error("璇疯緭鍏ュ崟浠�");
         isValid = false;
         return;
       }
@@ -454,6 +459,7 @@
       processId: "",
       processName: "",
       unitQuantity: 0,
+      unitPrice: 0,
       demandedQuantity: 0,
       unit: "",
       children: [],
@@ -476,6 +482,7 @@
           processId: "",
           processName: "",
           unitQuantity: 0,
+          unitPrice: 0,
           demandedQuantity: 0,
           unit: "",
           children: [],
@@ -502,6 +509,7 @@
         productModelId: undefined,
         processId: "",
         unitQuantity: 0,
+        unitPrice: 0,
         demandedQuantity: 0,
         children: [],
         unit: "",
@@ -539,9 +547,8 @@
 
   onMounted(async () => {
     // 浠庤矾鐢卞弬鏁板洖鏄炬暟鎹�
-    tableData[0].productName = routeProductName.value as string;
-    tableData[0].model = routeProductModelName.value as string;
     tableData[0].bomNo = routeBomNo.value as string;
+    tableData[0].dictLabel = routeDictLabel.value as string;
 
     // 璁㈠崟鎯呭喌涓嬬鐢ㄧ紪杈�
     if (isOrderPage.value) {

--
Gitblit v1.9.3