Kaynağa Gözat

版本信息维护添加接口没返回按钮不可再次点击(2426)

zhangxc 5 yıl önce
ebeveyn
işleme
25eff5b329
1 değiştirilmiş dosya ile 14 ekleme ve 7 silme
  1. 14 7
      src/components/icss/VersionDesc.vue

+ 14 - 7
src/components/icss/VersionDesc.vue

@@ -30,7 +30,7 @@
             <template slot-scope="scope">
                 <el-button type="text" size="small" @click="toEditDesc(scope.row,scope.$index)">修改</el-button>
                 <span style="margin:0 3px;">|</span>
-                <el-button type="text" size="small" class="delete" @click="showDelDialog(scope.row,scope.row.id)">删除</el-button>
+                <el-button type="text" size="small" class="delete" @click="showDelDialog(scope.row,scope.row.id,scope.$index)">删除</el-button>
             </template>
         </el-table-column>
         <el-table-column
@@ -56,7 +56,7 @@
             <p v-if="showDesc" v-html="form.description" class="cont">{{form.description}}</p>
             <el-input v-else type="textarea" :rows="3" placeholder="请输入内容" v-model="form.description" maxlength="501" @keydown.native="contentInp"></el-input>
           </el-form-item>
-          <el-button class="disclButn1" size="small" type="primary" @click="comfirn('form')">确定</el-button>
+          <el-button class="disclButn1" size="small" type="primary" :disabled="confirmDisable" @click="comfirn('form')">确定</el-button>
           <!-- <el-button class="disclButn can" size="small" type="primary" @click="cancel">取消</el-button> -->
       </el-form>
     </div>
@@ -116,7 +116,8 @@
         modiId:null,
         showDesc:false,
         tip:true,
-        modiIndex:null
+        modiIndex:null,
+        confirmDisable: false
       }
     },
     created(){
@@ -175,6 +176,7 @@
         this.$refs[form].validate((valid) => {
           if (valid) {
               // 修改--直接调修改接口;复制--新增
+            this.confirmDisable = true
             if(this.modiId){//修改
               if(!this.isCopy){
                 const param = {
@@ -183,6 +185,7 @@
                   detailId:this.modiId
                 }
                 api.modiVersionInfo(param).then((res)=>{
+                   this.confirmDisable = false
                   if(res.data.code==0){
                     this.$message({
                       message:"修改成功",
@@ -195,6 +198,7 @@
                         this.list[i].description=this.form.description;
                       }
                     }*/
+                   
                     this.reset();
                   }else{
                     this.$message({
@@ -229,6 +233,7 @@
                   versionInfoId: this.versionId
                 }
                 api.addVersionInfo(params).then((res)=>{
+                   this.confirmDisable = false
                   if(res.data.code==0){
                     this.$message({
                       message:"添加成功",
@@ -245,6 +250,7 @@
                   }
                 })
               }else{//仅添加到本地list
+                this.confirmDisable = false
                 if(this.modiIndex !==null){
                   this.list[this.modiIndex].description = this.form.description;
                   this.list[this.modiIndex].title = this.form.title;
@@ -298,9 +304,10 @@
           resolve();
         }).catch(() => {});
       },
-      showDelDialog(item,id){
+      showDelDialog(item,id,index){
+        console.log('cancel',item,id,index)
         this.showConfirmDialog('是否删除该版本说明?',()=>{
-          if(!this.isCopy){
+          if(!this.isCopy&&id){
             api.delVersionInfo({id}).then((res)=>{
               if(res.data.code=='0'){
                 this.warning(res.data.msg||'操作成功','success');
@@ -322,8 +329,8 @@
             for(let i in newList){
               if(id && newList[i].id==id){
                 this.list.splice(i,1);
-              }else if(newList[i].title == item.title && newList[i].description == item.description){//新增的没有id
-                this.list.splice(i,1);
+              }else {//新增的没有id
+                this.list.splice(index,1);
               }
             }
             this.$emit('func',this.list);