From b6214bd4bfef81e7d2510e882aa7160ce6763285 Mon Sep 17 00:00:00 2001
From: liupengpeng <276665548@qq.com>
Date: 星期一, 06 二月 2023 19:14:38 +0800
Subject: [PATCH] 文件上传进度条

---
 public/config/config.js             |   13 +++++++------
 src/views/datamanage/dataUpdata.vue |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 53 insertions(+), 6 deletions(-)

diff --git a/public/config/config.js b/public/config/config.js
index 5031c5f..7716c58 100644
--- a/public/config/config.js
+++ b/public/config/config.js
@@ -1,10 +1,11 @@
-var isWeb = location.hostname.indexOf("103.85.165.") > -1;
+//var isWeb = location.hostname.indexOf("103.85.165.") > -1;
+var isWeb = true;
 
-var webHost = isWeb ? location.hostname + ":8052" : '192.168.20.106' + ":12316";
+var webHost = isWeb ? "103.85.165.99" + ":8052" : '192.168.20.205' + ":8088";
 
-var fmeHost = isWeb ? location.hostname + ":8051" : '192.168.20.205' + ":88";
+var fmeHost = isWeb ? "103.85.165.99" + ":8051" : '192.168.20.205' + ":88";
 
-var iisHost = isWeb ? location.hostname + ":8050" : '192.168.20.205' + ":80";
+var iisHost = isWeb ? "103.85.165.99" + ":8050" : '192.168.20.205' + ":80";
 
 var menuStartName = "绠¢亾鍩虹澶ф暟鎹钩鍙�";
 
@@ -16,7 +17,7 @@
 var socketUrl = 'ws://' + webHost + '/server/ws/select';
 
 // GeoServerUrl
-var geoServerURl = 'http://192.168.20.205:8088//geoserver/LF/wms';
+var geoServerURl = 'http://' + webHost + '/geoserver/LF/wms';
 
 var geoserverWFS = '/geoserver/LF/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=LF%3Abs_project&maxFeatures=50&outputFormat=application%2Fjson&cql_filter=projname=';
 
@@ -26,7 +27,7 @@
 var modelUrl = LFData + '/tileset/SN/tileset.json';
 
 // DEM
-var demLayer = 'http://192.168.20.55/LFData/dem';
+var demLayer = LFData + '/dem';
 
 // 缁煎悎灞曠ず
 window.sceneConfig = {
diff --git a/src/views/datamanage/dataUpdata.vue b/src/views/datamanage/dataUpdata.vue
index 0e95bb7..286df8e 100644
--- a/src/views/datamanage/dataUpdata.vue
+++ b/src/views/datamanage/dataUpdata.vue
@@ -946,6 +946,21 @@
       </div>
 
     </el-dialog>
+    <el-dialog
+      :close-on-click-modal="false"
+      title="涓婁紶杩涘害"
+      :visible.sync="jindudialogVisible"
+      width="30%">
+      <div>
+        <div>
+          鏂囦欢浼犺緭杩涘害锛�
+        </div>
+        <div>
+          <el-progress :percentage="jindutiao" :format="format"></el-progress>
+        </div>
+      </div>
+      
+    </el-dialog>
   </div>
 </template>
 
@@ -1129,6 +1144,9 @@
         download: false,
 
       },
+      jindutiao: 0,
+      jindudialogVisible: false,
+      jindutiaoname: []
     }
   },
 
@@ -1753,6 +1771,16 @@
           }
         }
       }
+      const that = this
+      that.jindudialogVisible = true
+      let listval = []
+      formData.forEach((key, val) => {
+        listval.push({
+          name: val
+        })
+      })
+      that.$set(this, 'jindutiaoname', listval)
+      that.$set(this, 'jindutiao', 0)
       this.loading = true;
       $.ajax(BASE_URL + "/dataUpload/uploadFiles?token=" + token + "&path=" + this.formInline.path, {
         type: "post",
@@ -1767,6 +1795,7 @@
             return this.$message.error('鏁版嵁涓婁紶澶辫触');
           }
           this.getFileLength();
+          this.$set(this, 'jindutiao', 100)
           this.$message({
             message: '涓婁紶鎴愬姛',
             type: 'success'
@@ -1776,9 +1805,26 @@
         error: (rs) => {
           this.loading = false;
           this.$message.error('鏁版嵁涓婁紶澶辫触');
+        },
+        xhr: function () {
+            var myXhr = $.ajaxSettings.xhr();
+            if (myXhr.upload) { //妫�鏌pload灞炴�ф槸鍚﹀瓨鍦�
+                myXhr.upload.addEventListener('progress', that.progressHandlingFunction, false); //缁戝畾progress浜嬩欢鐨勫洖璋冨嚱鏁�
+            }
+            return myXhr; //xhr瀵硅薄杩斿洖缁檍Query浣跨敤
         }
       });
     },
+      progressHandlingFunction(event) {
+        var loaded = event.loaded;//宸蹭笂浼�
+        var loaded = Math.floor(100 * (event.loaded / event.total) - 1); //璁$畻宸茬粡涓婁紶鐨勭櫨鍒嗘瘮
+        $("#prog").html(loaded + "%"); //搴旂敤鍒版樉绀篣I锛屽彲鏍规嵁鑷繁闇�瑕佷慨鏀�
+        this.jindutiao = loaded
+        this.$set(this, 'jindutiao', loaded)
+      },
+      format(percentage) {
+        return percentage === 100 ? '涓婁紶瀹屾瘯' : `${percentage}%`;
+      },
     //鑾峰彇鏂囦欢涓婁紶璺緞
     async getFilePath() {
       const res = await dataUploadSelectPath();

--
Gitblit v1.9.3