From 7d828bee5a6468b494f57a7984b0a52ec49b1356 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期四, 03 四月 2025 14:36:58 +0800
Subject: [PATCH] 标准库修改

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

diff --git a/src/views/business/reliabilityPlan/index.vue b/src/views/business/reliabilityPlan/index.vue
index 6d0694e..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,18 +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)
-      if (selectedNode) {
-        this.proPlanForm.productId = selectedNode.id
+      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('鎿嶄綔鎴愬姛')
@@ -513,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