username 3 years ago
parent
commit
0f8cee1136
1 changed files with 21 additions and 10 deletions
  1. 21 10
      src/views/kxcSystem/functionManage/spatialDataImport/template.js

+ 21 - 10
src/views/kxcSystem/functionManage/spatialDataImport/template.js

@@ -63,10 +63,10 @@ export default {
             else
                 this.vectorLayer.setVisible(false)
         },
-        layerType(next, prv) {
-            this.layerType = next;
-            this.getLayerInfo();
-        },
+        // layerType(next, prv) {
+        //     this.layerType = next;
+        //     this.getLayerInfo();
+        // },
 
         /**
          * 监听导入要素Id的变化
@@ -282,10 +282,10 @@ export default {
             uploadForm.append('', this.uploadFile); //传入文件
             this.uploading = true;
             addGisData(uploadForm).then(res => {
-                // if (res.code != 1) {
-                //     this.$message.error(`上传数据失败!`);
-                //     this.uploading = false;
-                // }
+                if (res.code != 1) {
+                    this.$message.error(`上传数据失败!`);
+                    this.uploading = false;
+                }
                 this.loadingtext = "上传成功,正在获取数据……"
                     // this.impFeaturesId = res.resule.id
                     // 在地图上显示临时数据
@@ -490,15 +490,26 @@ export default {
                 uploadId: this.impFeaturesId, //提交要素ID
                 comfirmType: 'N' //comfirmType(Integer):1-Y-确定,2-N-回退
             }
-            this.confirmImport(data);
+            this.$confirm(`即将取消数据导入, 是否继续?`, '提示', {
+                confirmButtonText: '确定',
+                cancelButtonText: '取消',
+                type: 'warning'
+            }).then(() => {
+                this.confirmImport(data);
+            }).catch(() => {});
+
         },
         confirmImport(data) {
+            this.loadingtext = data.uploadId == 'Y' ? '正在导入……' : '正在取消……'
             this.uploading = true;
             confirmDatasetImport(data).then(res => {
                 if (res.code == 1) {
                     this.$message.success('操作成功');
                     //接下来的操作
-                    this.clearSource();
+                    // this.clearSource();
+                    this.vectorLayer.getSource().clear()
+                    Object.assign(this.$data, this.$options.data())
+                    this.getSouceList() // 初始化下拉选择
                 } else {
                     this.$message.error('操作失败,失败原因' + res.message);
                 }