nikang 6 gadi atpakaļ
vecāks
revīzija
6fbcd797d5
1 mainītis faili ar 17 papildinājumiem un 6 dzēšanām
  1. 17 6
      src/modules/marking/views/MarkWork.vue

+ 17 - 6
src/modules/marking/views/MarkWork.vue

@@ -209,7 +209,12 @@
                 ></el-input>
               </el-form-item>
               <el-form-item style="margin-top:10px;margin-left: 100px">
-                <el-button type="primary" @click="saveMarkWork">保存</el-button>
+                <el-button
+                  :loading="saveLoading"
+                  type="primary"
+                  @click="saveMarkWork"
+                  >保存</el-button
+                >
                 <el-button @click="closeMarkWork">取消</el-button>
                 <el-button @click="resetForm">重置</el-button>
               </el-form-item>
@@ -224,6 +229,7 @@
 <script>
 import { mapState } from "vuex";
 import { CORE_API, MARKING_API, DATA_PROCESS_API } from "@/constants/constants";
+import { error } from "util";
 export default {
   data() {
     return {
@@ -259,6 +265,7 @@ export default {
       loading: false,
       closeClickModal: false,
       isAdmin: false,
+      saveLoading: false,
       oldWorkName: ""
     };
   },
@@ -479,6 +486,7 @@ export default {
               return;
             }
           }
+          this.saveLoading = true;
           this.oldWorkName = "";
           this.loading = true;
           if (this.markWorkId) {
@@ -496,14 +504,15 @@ export default {
                   this.closeMarkWork();
                   this.initMarkWorkData();
                   this.loading = false;
+                  this.saveLoading = false;
                 },
-                response => {
-                  console.log(response);
+                error => {
                   this.$notify({
-                    message: response.response.data,
+                    message: error.response.data,
                     type: "error"
                   });
                   this.loading = false;
+                  this.saveLoading = false;
                 }
               );
           } else {
@@ -518,13 +527,15 @@ export default {
                   this.closeMarkWork();
                   this.initMarkWorkData();
                   this.loading = false;
+                  this.saveLoading = false;
                 },
-                response => {
+                error => {
                   this.$notify({
-                    message: response.response.data,
+                    message: error.response.data,
                     type: "error"
                   });
                   this.loading = false;
+                  this.saveLoading = false;
                 }
               );
           }