Forráskód Böngészése

优化输入项前后空格,导出按钮loading状态

qule 3 éve
szülő
commit
8d6cff370f
2 módosított fájl, 16 hozzáadás és 13 törlés
  1. 5 3
      src/api/scan/httpUtil.js
  2. 11 10
      src/views/syncManage/index.vue

+ 5 - 3
src/api/scan/httpUtil.js

@@ -36,7 +36,7 @@ function errorResponse(vm, response, err) {
   }
 }
 
-function downFile(blob, fileName) {
+function downFile(blob, fileName, success) {
   // 非IE下载
   if ("download" in document.createElement("a")) {
     let link = document.createElement("a");
@@ -47,9 +47,11 @@ function downFile(blob, fileName) {
     link.click(); // 点击下载
     window.URL.revokeObjectURL(link.href); // 释放掉blob对象
     document.body.removeChild(link); // 下载完成移除元素
+    success && success()
   } else {
     // IE10+下载
     window.navigator.msSaveBlob(blob, fileName);
+    success && success()
   }
 }
 
@@ -169,7 +171,7 @@ export default {
         console.log(error);
       });
   },
-  download(url, requestData) {
+  download(url, requestData, success) {
     // 响应类型:arraybuffer, blob
     fetch
       .post(url, requestData, { responseType: "blob" })
@@ -193,7 +195,7 @@ export default {
             );
           }
           console.log("文件名称:", fileName);
-          downFile(blob, fileName);
+          downFile(blob, fileName, success);
         }
       })
       .catch(function(error) {

+ 11 - 10
src/views/syncManage/index.vue

@@ -61,8 +61,7 @@
                     size='small'
                     @sort-change="handleSort"
                 >
-
-                    <el-table-column label="对象id" >
+                    <el-table-column label="Id" >
                         <template slot-scope="scope">
                             <span style="margin-left: 10px">{{ scope.row.targetId ? scope.row.targetId : "--" }}</span>
                         </template>
@@ -248,12 +247,14 @@ export default {
                     targetUrl: this.httpValue
                 },
                 res => {
+                    this.pageObj = {
+                        ...this.pageObj,
+                        pageNumber: 1
+                    }
                     this.syncBtnLoading = false
                     this.getData();
-                    console.log({res})
                 },
                 err => {
-                    console.log({err})
                     this.syncBtnLoading = false;
                     // this.getData();
                 }
@@ -261,10 +262,10 @@ export default {
         },
 
         httpInputChange(val) {               
-            this.httpValue = val; 
+            this.httpValue = val.trim(); 
         },
         httpInputBlur(e) {
-            const value = e.target.value
+            const value = e.target.value;
             const regExp = /^(?=^.{3,255}$)(http(s)?:\/\/)?(www\.)?[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+(:\d+)*(\/\w+\.\w+)*$/  //域名校验正则   
             this.$message.closeAll();
             if (value && !regExp.test(value)) {
@@ -279,12 +280,12 @@ export default {
                 {
                     targetUrl: this.httpValue
                 },
-                res => {
-                    console.log({res})
+                () => {
+                    this.httpBtnLoading = false
                 }
             )
             
-            this.httpBtnLoading = false
+           
             
         },
 
@@ -339,7 +340,7 @@ export default {
         },
         // 对象id变化
         objIdChange(val) {
-            this.targetId = val;
+            this.targetId = val.trim();
             this.getTable();
         },
         // 请求table