duy 2 місяців тому
батько
коміт
31956d62d3
1 змінених файлів з 42 додано та 11 видалено
  1. 42 11
      src/views/codeRule/ruleManage.vue

+ 42 - 11
src/views/codeRule/ruleManage.vue

@@ -247,12 +247,12 @@
                   <span>新增</span>
                 </div>
                 <div class="add-yp-detail">
-                  <el-form label-position="left" label-width="80px" :model="ypDetail"  :rules="ypRuleForm">
+                  <el-form label-position="left" label-width="80px" :model="ypDetail"  :rules="ypRuleForm" ref="ypFormRef">
                     <el-form-item label="样品信息" prop="name">
                       <el-input v-model="ypDetail.name"></el-input>
                     </el-form-item>
                     <el-form-item label="基础信息">
-                      <div class="input-with-icon"  v-for="(item, index) in ypDetail.basic" :key="index">
+                      <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>
@@ -262,7 +262,7 @@
                   </el-form>
                 </div>
                 <div class="add-yp-footer">
-                   <el-button type="primary">保存</el-button>
+                   <el-button type="primary" @click="saveYpForm" :loading="saveYpLoad">保存</el-button>
                 </div>
                 </template>
     
@@ -409,8 +409,9 @@ 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 } from "@/api/ruleManage/fileRule.js";
+import {getPage,edit,add,deleteItem,getById, addInfo } from "@/api/ruleManage/fileRule.js";
 import { getStore, setStore } from "@/util/store";
+
   export default {
   components: {
     ConditionsSet,
@@ -452,14 +453,16 @@ import { getStore, setStore } from "@/util/store";
         pageSize: 40, // 8列 * 5行 = 40
         currentPage1: 1,
         ruleItem: {},
+        ruleItemDetail: {},
         pageSize1: 40, // 8列 * 5行 = 40
         isShowYpList:true,
         isShowDetail:false,
         ruleDataDetail: {},
         ypDetail: {
           name: '',
-          basic: [{ name: '' }, { name: '' }, { name: '' }, { name: '' }]
+          info: [{ name: '' }]
         },
+        saveYpLoad: false,
         ypRuleForm: {
           name: [
             { required: true, message: '请输入样品名称', trigger: 'blur' }
@@ -480,7 +483,7 @@ import { getStore, setStore } from "@/util/store";
         ypList:[
           {id:1,name:'样品名称',
           basic:
-          [{name:'基本信息1'} , {name:'基本信息2'}    , {name:'基本信息3'}    , {name:'基本信息4'}]
+          [{}]
           },  
         ],
         jsList:[
@@ -669,6 +672,8 @@ import { getStore, setStore } from "@/util/store";
 
          ruleDetailClick1(item){
             this.getRuleDataDetail(item);
+            this.ruleItemDetail=item
+
           this.isShowDetail = true;
          },
          //获取规范数据详情
@@ -685,8 +690,6 @@ import { getStore, setStore } from "@/util/store";
             });
          },
          addFile(){
-          console.log(this.treeId,'this.treeId');
-          
          //新增规范文件
          this.addFileDialogVisible = true;
          },
@@ -764,11 +767,41 @@ import { getStore, setStore } from "@/util/store";
     addBasicInfo() {
       this.ypDetail.basic.push({ name: '' });
     },
-    
+   async saveYpLoad(){
+      
+    },
     // 删除基础信息行
     removeBasicInfo(index) {
       this.ypDetail.basic.splice(index, 1);
     },
+  async  saveYpForm(){
+        const isValid = await this.$refs.ypFormRef.validate()
+        if (!isValid) {
+          this.$message.error('请填写完整的样品信息');
+          return;
+        }
+        this.saveYpLoad = true;
+          addInfo({
+          ...this.ypDetail,
+            type: 1,
+            standardId: this.ruleItem.id,
+            parentId: this.ruleItemDetail.id,
+          }).then((res) => {
+            if(res.data.code==200){
+                this.$message.success(res.data.msg)
+                //  this.getRuleDataDetail(item);
+                 this.isShowYpList= true;
+                 this.isShowJsList=true
+            }else{
+                this.$message.error(res.data.msg)
+            }
+            }).finally(() => {
+                this.saveYpLoad = false;
+            });
+          
+
+    },
+    
     // 管理文件夹
     manageFolder(){
       this.manageVisible = true;
@@ -807,8 +840,6 @@ import { getStore, setStore } from "@/util/store";
         if (res.data.code === 200) {
           this.$message.success(res.data.msg);
           this.manageVisible = false;
-        
-          // this.getRuleItemOptions();
           if(!this.isShowList){
             this.getRuleDetail(this.ruleItem);
             this.manageData = JSON.parse(JSON.stringify(this.ruleItemOptionsDetail));