Bläddra i källkod

合并申请人/权利人弹窗关闭问题

zhuliu 1 år sedan
förälder
incheckning
837b434ede
1 ändrade filer med 30 tillägg och 8 borttagningar
  1. 30 8
      src/views/project/patentCollection/components/drawer/merge.vue

+ 30 - 8
src/views/project/patentCollection/components/drawer/merge.vue

@@ -59,7 +59,7 @@
         <template v-if="ruleForm.id">
           <el-divider content-position="left">基本信息</el-divider>
           <div style="display:flex;justify-content: flex-end;margin: 10px 0 10px 0px;">
-            <el-button type="primary" size="small" @click="handleSave">保存</el-button>
+            <el-button type="primary" size="small" :loading="btnLoading" @click="handleSave">保存</el-button>
           </div>
         </template>
         <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="80px">
@@ -71,7 +71,7 @@
               <el-input v-model="ruleForm.abbreviation" placeholder="请输入名称"></el-input>
             </el-form-item>
             <el-form-item label="国家" prop="country" >
-              <el-select v-model="ruleForm.country" placeholder="请选择" filterable class="width_100">
+              <el-select v-model="ruleForm.country" @change="changeCountry" placeholder="请选择" filterable class="width_100">
                 <el-option v-for="(item, index) in commonData" :label="item.label" :key="index"
                   :value="item.label"></el-option>
               </el-select>
@@ -113,7 +113,7 @@
       </div>
       <div slot="footer" class="dialog-footer">
         <el-button @click="closeDialog">关 闭</el-button>
-        <el-button v-if="!ruleForm.id" type="primary" @click="handleSave">确认</el-button>
+        <el-button v-if="!ruleForm.id" :loading="btnLoading" type="primary" @click="handleSave">确认</el-button>
       </div>
     </el-dialog>
 
@@ -186,13 +186,18 @@ export default {
       // 地区
       areaTree: [],
       /**编辑合并人及基本信息 end*/
-
+      btnLoading:false
     }
   },
   mounted() {
 
   },
   methods: {
+    changeCountry(val){
+      if(val != '中国'){
+        this.$set(this.ruleForm,'provinceOld','')
+      }
+    },
     // 表格排序 等后端
     sortChange({ column, prop, order }) {
       let obj = {
@@ -281,10 +286,11 @@ export default {
         this.$api.delMergePerson(params).then(response => {
           if (response.code == 200) {
             this.$message.success('删除成功')
-            this.loading = false
+            // this.loading = false
             this.getList()
           }
         }).catch(error => {
+          this.$message.error('删除失败')
           this.loading = false
         })
       })
@@ -312,6 +318,7 @@ export default {
         if (valid) {
           this.ruleForm.projectId = this.projectId
           this.ruleForm.type = this.mergeType
+          this.btnLoading = true
           // if (this.title.indexOf('新增') != -1) {//新增
           if (this.ruleForm.needMergedName && this.ruleForm.needMergedName.length == 0) {//新增
             // this.ruleForm.mergedName = this.mergedName
@@ -320,10 +327,14 @@ export default {
                 this.$message.success('合并成功')
                 this.$emit('close')
                 this.mergedList = []
+                this.btnLoading = false
                 this.closeDialog()
-                this.close()
+                // this.close()
                 this.getList()
               }
+            }).catch(error=>{
+              this.$message.error('合并失败')
+              this.btnLoading = false
             })
           } else {
             if (this.ruleForm.needMergedName && this.ruleForm.needMergedName.length > 0) {//
@@ -331,21 +342,29 @@ export default {
                 if (res.code == 200) {
                   this.$message.success('编辑成功')
                   this.$emit('close')
+                  this.btnLoading = false
                   this.closeDialog()
-                  this.close()
+                  // this.close()
                   this.getList()
                 }
+              }).catch(error=>{
+                this.$message.error('编辑失败')
+                this.btnLoading = false
               })
             } else {
               this.$api.updateMergePerson(this.ruleForm).then(res => {
                 if (res.code == 200) {
                   this.$message.success('编辑成功')
                   this.$emit('close')
+                  this.btnLoading = false
                   this.closeDialog()
-                  this.close()
+                  // this.close()
                   this.getList()
 
                 }
+              }).catch(error=>{
+                this.$message.error('编辑失败')
+                this.btnLoading = false
               })
             }
           }
@@ -520,10 +539,12 @@ export default {
         projectId: this.projectId,//项目id
         type: this.mergeType,
       }
+      this.loading = true
       this.$api.getMergePerson(params).then(res => {
         if (res.code == 200) {
           this.tableData = res.data.data
           this.total = res.data.total
+          this.loading  =false
           this.refresh = false
           this.$nextTick(() => {
             this.refresh = true
@@ -532,6 +553,7 @@ export default {
       }).catch(error => {
         this.tableData = []
         this.total = 0
+        this.loading  =false
       })
     },
     // 关闭抽屉