From f8d17ac2666198f513a4d5f83dce1135a911f2ee Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期三, 02 四月 2025 17:15:07 +0800
Subject: [PATCH] Merge branch 'radio-frequency-cable' of http://114.132.189.42:9002/r/lims-ruoyi-before into radio-frequency-cable

---
 src/views/business/reliabilityPlan/index.vue |   45 +++++++++++++++++++++++++++------------------
 1 files changed, 27 insertions(+), 18 deletions(-)

diff --git a/src/views/business/reliabilityPlan/index.vue b/src/views/business/reliabilityPlan/index.vue
index 0ff4d4e..c989737 100644
--- a/src/views/business/reliabilityPlan/index.vue
+++ b/src/views/business/reliabilityPlan/index.vue
@@ -79,7 +79,7 @@
       <div slot="footer" class="foot">
         <el-button v-if="operationType !== 'review'" @click="closeProDia">鍙� 娑�</el-button>
         <el-button v-if="operationType !== 'review' && operationType !== 'submit'" type="primary"
-          :loading="submitProLoading" @click="submitProForm">淇�
+          :loading="submitProLoading" @click="submitProForm(0)">淇�
           瀛�</el-button>
         <el-button v-if="operationType == 'submit'" type="primary" :loading="submitProLoading"
           @click="submitProForm(1)">鎻� 浜�</el-button>
@@ -95,9 +95,10 @@
       <el-form :model="materialForm" ref="materialForm" :rules="materialRules" label-width="90px" size="small">
         <el-form-item label="鍘熻緟鏉愬悕绉�" prop="materialName">
           <el-cascader v-model="materialForm.materialName" :options="itemParameterData.cascaderField.sample.tree"
-            :props="{ value: 'name', label: 'name', checkStrictly: false, multiple: false }" :show-all-levels="false"
-            clearable filterable placeholder="璇烽�夋嫨鍘熻緟鏉愬悕绉�" size="small" style="width: 100%;"
-            :disabled="operationType === 'review' || operationType === 'submit'"></el-cascader>
+            :props="{ value: 'name', label: 'name', checkStrictly: false, multiple: false, emitPath: false }"
+            :show-all-levels="false" clearable filterable placeholder="璇烽�夋嫨鍘熻緟鏉愬悕绉�" size="small" style="width: 100%;"
+            :disabled="operationType === 'review' || operationType === 'submit'">
+          </el-cascader>
         </el-form-item>
         <el-form-item label="闆朵欢鍙�" prop="partNo">
           <el-input v-model="materialForm.partNo" placeholder="璇峰~鍐欓浂浠跺彿"
@@ -115,7 +116,7 @@
         <el-button v-if="operationType !== 'review'" @click="closeMaterialRulesDia">鍙�
           娑�</el-button>
         <el-button v-if="operationType !== 'review' && operationType !== 'submit'" type="primary"
-          :loading="submitMatLoading" @click="submitMaterialRulesForm">淇� 瀛�</el-button>
+          :loading="submitMatLoading" @click="submitMaterialRulesForm(0)">淇� 瀛�</el-button>
         <el-button v-if="operationType == 'submit'" type="primary" :loading="submitProLoading"
           @click="submitMaterialRulesForm(1)">鎻� 浜�</el-button>
         <el-button v-if="operationType === 'review'" :loading="submitMatLoading"
@@ -448,9 +449,6 @@
     // 鎵撳紑鏂板寮规
     openAddDia(type, row) {
       this.operationType = type
-      this.getTypeOptions()
-      this.getPartNoOptions()
-      // this.getUserList()
       if (this.tabIndex === 0) {
         this.proPlanDia = true
         if (this.operationType === 'add') {
@@ -463,6 +461,12 @@
           }
         } else {
           this.proPlanForm = { ...row }
+          // 缂栬緫鏃惰幏鍙栭�変腑鑺傜偣鐨処D骞跺姞杞界浉鍏虫暟鎹�
+          const selectedNode = this.findNodeById(this.itemParameterData.cascaderField.sample.tree, row.productName)
+          if (selectedNode) {
+            this.getTypeOptions(selectedNode.id)
+            this.getPartNoOptions(selectedNode.id)
+          }
         }
       } else {
         this.materialDia = true
@@ -482,12 +486,15 @@
     // 鎴愬搧淇℃伅鎻愪氦
     submitProForm(state) {
       this.submitProLoading = true
-      if (this.operationType === 'add') {
-        this.proPlanForm.state = ''
-      } else {
-        this.proPlanForm.state = state
+      // 鑾峰彇閫変腑鑺傜偣鐨処D
+      const selectedNode = this.findNodeById(this.itemParameterData.cascaderField.sample.tree, this.proPlanForm.productName)
+      const params = {
+        ...this.proPlanForm,
+        state: state === undefined ? null : parseInt(state),
+        productId: selectedNode?.id
       }
-      addOrUpdateProduct(this.proPlanForm).then(res => {
+
+      addOrUpdateProduct(params).then(res => {
         if (res.code === 200) {
           this.closeProDia()
           this.$message.success('鎿嶄綔鎴愬姛')
@@ -507,12 +514,14 @@
     // 鍘熻緟鏉愪俊鎭彁浜�
     submitMaterialRulesForm(state) {
       this.submitMatLoading = true
-      if (this.operationType === 'add') {
-        this.materialForm.state = ''
-      } else {
-        this.materialForm.state = state
+      // 鑾峰彇閫変腑鑺傜偣鐨処D
+      const selectedNode = this.findNodeById(this.itemParameterData.cascaderField.sample.tree, this.materialForm.materialName)
+      const params = {
+        ...this.materialForm,
+        state: state === undefined ? null : parseInt(state),
+        materialId: selectedNode?.id
       }
-      addOrUpdateMaterial(this.materialForm).then(res => {
+      addOrUpdateMaterial(params).then(res => {
         if (res.code === 200) {
           this.closeMaterialRulesDia()
           this.$message.success('鎿嶄綔鎴愬姛')

--
Gitblit v1.9.3