소스 검색

基本规范参数接口调用

duy 2 달 전
부모
커밋
c58adf70af
1개의 변경된 파일48개의 추가작업 그리고 24개의 파일을 삭제
  1. 48 24
      src/views/codeRule/ruleManage.vue

+ 48 - 24
src/views/codeRule/ruleManage.vue

@@ -254,8 +254,8 @@
                     <el-form-item label="基础信息">
                       <div class="input-with-icon"  v-for="(item, index) in ypDetail.info" :key="index">
                         <el-input v-model="item.name"></el-input>
-                        <i class="el-icon-circle-plus-outline" @click="addBasicInfo"  v-if="index!==0"></i>
-                        <i class="el-icon-remove-outline" @click="removeBasicInfo(index)"></i>
+                        <i class="el-icon-circle-plus-outline" @click="addBasicInfo(index)" ></i>
+                        <i class="el-icon-remove-outline" @click="removeBasicInfo(index)"  v-if="index!==0"></i>
                       </div>
                     </el-form-item>
                     
@@ -285,7 +285,7 @@
                       <el-input v-model="jsDetail.name"></el-input>
                     </el-form-item>
                     <el-form-item label="技术指标">
-                      <div class="input-with-icon"  v-for="(item, index) in jsDetail.basic" :key="index">
+                      <div class="input-with-icon"  v-for="(item, index) in jsDetail.info" :key="index">
                         <el-input placeholder="请输入内容" v-model="item.name" class="input-with-select">
                           <el-select v-model="item.select" slot="prepend" placeholder="请选择符号" style="width: 150px;">
                             <el-option  v-for="(item1,index) in fqOptions" :key="index" :label="item1.label" :value="item1.value"></el-option>
@@ -409,7 +409,7 @@ import {getLazytree} from "@/api/manager/wbsprivate";
 import ConditionsSet from './ConditionsSet.vue'
 import LinkEle from "./LinkEle.vue";
 import PreviewResult from './PreviewResult.vue'
-import {getPage,edit,add,deleteItem,getById, addInfo,getInfoPage } from "@/api/ruleManage/fileRule.js";
+import {getPage,edit,add,deleteItem,getById, addInfo,editInfo,getInfoPage } from "@/api/ruleManage/fileRule.js";
 import { getStore, setStore } from "@/util/store";
 
   export default {
@@ -493,6 +493,7 @@ import { getStore, setStore } from "@/util/store";
           },  
         ],
         isShowJsList:false,
+        isEditYp: false,
         jsDetail: {
           name: '',
           info: [{ name: '',select:[] }, ]
@@ -696,18 +697,13 @@ import { getStore, setStore } from "@/util/store";
              getInfoPage({
                 current:1,
                 size:100,
-                type: 1,
-             
+                type: 1, 
                 standardId: item.id,
               }).then((res) => {
-                console.log(res,'res1111');
-                
                 this.ruleLoading = false;
                 if (res.data.code === 200) {
                   console.log(res.data.data.records,'res.data.data.records');
                   this.ypList = res.data.data.records;
-              
-                  
                 } else {
                  this.ypList = [];
                   this.$message.error(res.data.msg);
@@ -738,7 +734,6 @@ import { getStore, setStore } from "@/util/store";
             this.$message.error('请填写完整的规范信息');
             return;
           }
-          console.log(this.fileForm,'fileForm');
           add({
             ...this.fileForm,
             type: 2,
@@ -782,6 +777,11 @@ import { getStore, setStore } from "@/util/store";
       addYp(){
         this.isShowYpList = false;
         this.isShowJsList = false;
+        this.isEditYp = false;
+        this.ypDetail = {
+          name: '',
+          info: [{ name: '' }]
+        };
 
 
       },
@@ -789,12 +789,10 @@ import { getStore, setStore } from "@/util/store";
         this.isShowYpList = true;
       },
        // 添加基础信息行
-    addBasicInfo() {
-      this.ypDetail.basic.push({ name: '' });
-    },
-   async saveYpLoad(){
-      
+    addBasicInfo(index) {
+      this.ypDetail.info.splice(index + 1, 0, { name: '' });
     },
+
     // 删除基础信息行
     removeBasicInfo(index) {
       this.ypDetail.basic.splice(index, 1);
@@ -806,15 +804,17 @@ import { getStore, setStore } from "@/util/store";
           return;
         }
         this.saveYpLoad = true;
-          addInfo({
+        if(!this.isEditYp){
+               addInfo({
           ...this.ypDetail,
             type: 1,
-            standardId: this.ruleItem.id,
-            parentId: this.ruleItemDetail.id,
+            standardId: this.ruleItemDetail.id,
+            // parentId: this.ruleItemDetail.id,
           }).then((res) => {
             if(res.data.code==200){
                 this.$message.success(res.data.msg)
-                //  this.getRuleDataDetail(item);
+                 this.getRuleDataDetail(this.ruleItemDetail);
+                  this.getRuleDataDetail1(this.ruleItemDetail);
                  this.isShowYpList= true;
                  this.isShowJsList=true
             }else{
@@ -823,6 +823,27 @@ import { getStore, setStore } from "@/util/store";
             }).finally(() => {
                 this.saveYpLoad = false;
             });
+        }else{
+                 editInfo({
+                  ...this.ypDetail,
+                    type: 1,
+                    standardId: this.ruleItemDetail.id,
+                    // parentId: this.ruleItemDetail.id,
+                  }).then((res) => {
+                    if(res.data.code==200){
+                        this.$message.success(res.data.msg)
+                        this.getRuleDataDetail(this.ruleItemDetail);
+                          this.getRuleDataDetail1(this.ruleItemDetail);
+                        this.isShowYpList= true;
+                        this.isShowJsList=true
+                    }else{
+                        this.$message.error(res.data.msg)
+                    }
+                    }).finally(() => {
+                        this.saveYpLoad = false;
+                    });
+        }
+       
           
 
     },
@@ -860,8 +881,8 @@ import { getStore, setStore } from "@/util/store";
     manageSave(){
       this.manageLoad = true;
   
-      const data = this.manageData.map(item => ({ id: item.id, name: item.name,type:this.isShowList?1:2 }));
-      edit({ data }).then((res) => {
+      const arr = this.manageData.map(item => ({ id: item.id, name: item.name,type:this.isShowList?1:2 }));
+      edit(arr ).then((res) => {
         if (res.data.code === 200) {
           this.$message.success(res.data.msg);
           this.manageVisible = false;
@@ -880,8 +901,11 @@ import { getStore, setStore } from "@/util/store";
       });
     },
       handleEdit(item, index) {
-        // 处理编辑逻辑
-        console.log('编辑项目:', item, index);
+  
+        this.isShowYpList = false;
+        this.isShowJsList = false;
+        this.ypDetail = JSON.parse(JSON.stringify(item));
+        this.isEditYp = true;
       },
 
       handleDelete(index) {