|
@@ -28,10 +28,10 @@
|
|
|
<i class="el-icon-upload"></i>
|
|
|
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
|
|
<div class="el-upload__tip" slot="tip">
|
|
|
- * 仅支持上传zip格式的shp压缩包, json(或geojson)格式的数据,且不超过50MB ;<br/>
|
|
|
+ * 仅支持上传zip格式的shp压缩包, json(或geojson)格式的数据,且不超过50MB
|
|
|
+ ;<br />
|
|
|
* 仅支持上传上海2000投影坐标数据 ;
|
|
|
</div>
|
|
|
-
|
|
|
</el-upload>
|
|
|
</div>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
@@ -214,16 +214,12 @@ export default {
|
|
|
|
|
|
// 上传表单提交,开始渲染上传的图层数据,并且添加到我的图层
|
|
|
subMitDialogVisible() {
|
|
|
- setTimeout(() => {
|
|
|
- // 一次只允许上传一个图层
|
|
|
- for (let key in this.fileUniqueObj) {
|
|
|
- // 获取疑点图层数据
|
|
|
- const datajson = this.fileUniqueObj[key];
|
|
|
- this.uploadRender(datajson, key);
|
|
|
- }
|
|
|
+ if (this.layerUniqueName != "") {
|
|
|
+ const datajson = this.fileUniqueObj[this.layerUniqueName];
|
|
|
+ this.uploadRender(datajson, this.layerUniqueName);
|
|
|
this.$message.success("数据上传成功,开始渲染!");
|
|
|
this.clearDialogVisible();
|
|
|
- }, 500);
|
|
|
+ }
|
|
|
},
|
|
|
uploadRender(datajson, uniqueId) {
|
|
|
if (datajson.length === 0) {
|
|
@@ -243,7 +239,7 @@ export default {
|
|
|
handleRemove(file, fileList) {
|
|
|
this.fileList = fileList;
|
|
|
delete this.fileDataList[file.uid];
|
|
|
- delete this.fileUniqueObj[this.layerUniqueName]
|
|
|
+ delete this.fileUniqueObj[this.layerUniqueName];
|
|
|
},
|
|
|
// 点击文件列表中已上传的文件时
|
|
|
handlePreview(file) {},
|
|
@@ -274,28 +270,26 @@ export default {
|
|
|
this.$message.error("上传文件大小不能超过 100MB!");
|
|
|
}
|
|
|
|
|
|
- let enableUpload = true
|
|
|
+ let enableUpload = true;
|
|
|
|
|
|
if (isGeojson) {
|
|
|
this.layerUniqueName =
|
|
|
fileName.slice(0, fileName.indexOf(".json")) ||
|
|
|
fileName.slice(0, fileName.indexOf(".geojson"));
|
|
|
- if(this.fileUniqueObj.hasOwnProperty(this.layerUniqueName)){
|
|
|
- enableUpload = false
|
|
|
- this.$message.warning("已上传过该图层,不允许重复上传!")
|
|
|
+ if (this.fileUniqueObj.hasOwnProperty(this.layerUniqueName)) {
|
|
|
+ enableUpload = false;
|
|
|
+ this.$message.warning("已上传过该图层,不允许重复上传!");
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
- if(isZip){
|
|
|
+ if (isZip) {
|
|
|
this.layerUniqueName = fileName.slice(0, fileName.indexOf(".zip"));
|
|
|
- if(this.fileUniqueObj.hasOwnProperty(this.layerUniqueName)){
|
|
|
- enableUpload = false
|
|
|
- this.$message.warning("已上传过该图层,不允许重复上传")
|
|
|
+ if (this.fileUniqueObj.hasOwnProperty(this.layerUniqueName)) {
|
|
|
+ enableUpload = false;
|
|
|
+ this.$message.warning("已上传过该图层,不允许重复上传");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
return (isGeojson || isZip) && isLt50M && enableUpload;
|
|
|
},
|
|
|
},
|