4c0e9097 by 杨威

文件导出在导入

1 parent c2bc1fbb
...@@ -219,9 +219,9 @@ export function exportShp(data) { ...@@ -219,9 +219,9 @@ export function exportShp(data) {
219 219
220 export function exportExcel(data) { 220 export function exportExcel(data) {
221 return request({ 221 return request({
222 url:"/tx/excelGeo/exportExcelp", 222 url:"/tx/excelGeo/exportExcel",
223 method:"post", 223 method:"post",
224 params:data 224 data:data
225 }) 225 })
226 } 226 }
227 227
......
...@@ -162,6 +162,7 @@ export default { ...@@ -162,6 +162,7 @@ export default {
162 dzVisible:false, 162 dzVisible:false,
163 //宗地权属状态 163 //宗地权属状态
164 zdQszt:null, 164 zdQszt:null,
165 wkt:"PROJCS[\"XADFZBX\",GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137.0,298.257223563]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"False_Easting\",0.0],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",0.0],PARAMETER[\"Scale_Factor\",1.0],PARAMETER[\"Latitude_Of_Origin\",0.0],UNIT[\"Meter\",1.0]]"
165 }; 166 };
166 }, 167 },
167 watch: { 168 watch: {
...@@ -519,7 +520,7 @@ export default { ...@@ -519,7 +520,7 @@ export default {
519 var type = this.zdData.type; 520 var type = this.zdData.type;
520 var BSM = type == 'zdt'? this.zdData.zdbsm : this.zdData.bsm; 521 var BSM = type == 'zdt'? this.zdData.zdbsm : this.zdData.bsm;
521 this.queryGeoByBsm(BSM,type,function (features){ 522 this.queryGeoByBsm(BSM,type,function (features){
522 if(features && features.length > 0){ 523 if(features && features.length > 0 && features[0].geometry.rings.length > 0){
523 var data = features[0]; 524 var data = features[0];
524 var jzdInfo = self.craetJZPoint(data); 525 var jzdInfo = self.craetJZPoint(data);
525 var textCotent = ""; 526 var textCotent = "";
...@@ -540,7 +541,7 @@ export default { ...@@ -540,7 +541,7 @@ export default {
540 } 541 }
541 self.downloadTxt(textCotent,"outPut.txt"); 542 self.downloadTxt(textCotent,"outPut.txt");
542 } 543 }
543 }); 544 },{wkt:this.wkt});
544 }, 545 },
545 //导出shp文件 546 //导出shp文件
546 exportToShp(){ 547 exportToShp(){
...@@ -548,7 +549,7 @@ export default { ...@@ -548,7 +549,7 @@ export default {
548 var type = this.zdData.type; 549 var type = this.zdData.type;
549 var BSM = type == 'zdt'? this.zdData.zdbsm : this.zdData.bsm; 550 var BSM = type == 'zdt'? this.zdData.zdbsm : this.zdData.bsm;
550 this.queryGeoByBsm(BSM,type,function (features){ 551 this.queryGeoByBsm(BSM,type,function (features){
551 if(features && features.length > 0){ 552 if(features && features.length > 0 && features[0].geometry.rings.length > 0) {
552 var data = JSON.stringify(features[0]); 553 var data = JSON.stringify(features[0]);
553 window.location.href = "/api/tx/shpUtils/writeShp?strObj="+encodeURI(data) 554 window.location.href = "/api/tx/shpUtils/writeShp?strObj="+encodeURI(data)
554 /* exportShp({ 555 /* exportShp({
...@@ -559,7 +560,7 @@ export default { ...@@ -559,7 +560,7 @@ export default {
559 }else{ 560 }else{
560 self.$message.warning("暂无空间信息!!!!"); 561 self.$message.warning("暂无空间信息!!!!");
561 } 562 }
562 }); 563 },{wkt:this.wkt});
563 }, 564 },
564 //导出excel 565 //导出excel
565 exportExcel(){ 566 exportExcel(){
...@@ -567,7 +568,7 @@ export default { ...@@ -567,7 +568,7 @@ export default {
567 var type = this.zdData.type; 568 var type = this.zdData.type;
568 var BSM = type == 'zdt'? this.zdData.zdbsm : this.zdData.bsm; 569 var BSM = type == 'zdt'? this.zdData.zdbsm : this.zdData.bsm;
569 this.queryGeoByBsm(BSM,type,function (features) { 570 this.queryGeoByBsm(BSM,type,function (features) {
570 if (features && features.length > 0) { 571 if (features && features.length > 0 && features[0].geometry.rings.length > 0) {
571 var data = features[0]; 572 var data = features[0];
572 var jzdInfo = self.craetJZPoint(data); 573 var jzdInfo = self.craetJZPoint(data);
573 var submitData = []; 574 var submitData = [];
...@@ -581,15 +582,15 @@ export default { ...@@ -581,15 +582,15 @@ export default {
581 submitData.push(obj); 582 submitData.push(obj);
582 } 583 }
583 exportExcel(submitData).then((res) => { 584 exportExcel(submitData).then((res) => {
584 if (res.status == 200) { 585 if (res.code == 200) {
585 var path = res.data.result; 586 var path = res.result;
586 window.location.href = "/api/tx/excelGeo/download?filePath=" + encodeURI(path); 587 window.location.href = "/api/tx/excelGeo/download?filePath=" + encodeURI(path);
587 } 588 }
588 }); 589 });
589 }else { 590 }else {
590 self.$message.warning("还没有空间信息!!!!") 591 self.$message.warning("还没有空间信息!!!!")
591 } 592 }
592 }) 593 },{wkt:this.wkt})
593 }, 594 },
594 //导出CAD 595 //导出CAD
595 exportCad(){ 596 exportCad(){
......
...@@ -236,10 +236,10 @@ export default { ...@@ -236,10 +236,10 @@ export default {
236 return; 236 return;
237 } 237 }
238 //this.$emit("closeImportDialog"); 238 //this.$emit("closeImportDialog");
239 var features = [],attributes = {},points = []; 239 var features = [],attributes = {},points = [],j = 1;
240 for(var i =1;i < geoList.length;i++){ 240 for(var i =1;i < geoList.length;i++){
241 var rowData = geoList[i]; 241 var rowData = geoList[i];
242 if(rowData.indexOf("J") != -1 && rowData.indexOf("J") == 0){ 242 if((rowData.indexOf("J") != -1 && rowData.indexOf("J") == 0)||(rowData.indexOf("j") != -1 && rowData.indexOf("j") == 0)){
243 //解析坐标点信息 243 //解析坐标点信息
244 var pointInfo = rowData.split(","); 244 var pointInfo = rowData.split(",");
245 var point = [parseFloat(pointInfo[2]),parseFloat(pointInfo[3])]; 245 var point = [parseFloat(pointInfo[2]),parseFloat(pointInfo[3])];
...@@ -249,7 +249,7 @@ export default { ...@@ -249,7 +249,7 @@ export default {
249 var graphic = { 249 var graphic = {
250 attributes:JSON.parse(JSON.stringify(attributes)), 250 attributes:JSON.parse(JSON.stringify(attributes)),
251 geometry:{ 251 geometry:{
252 rings:[[points]] 252 rings:[points]
253 } 253 }
254 } 254 }
255 features.push(graphic); 255 features.push(graphic);
...@@ -258,7 +258,12 @@ export default { ...@@ -258,7 +258,12 @@ export default {
258 attributes = {}; 258 attributes = {};
259 points = [] 259 points = []
260 var info = rowData.split(","); 260 var info = rowData.split(",");
261 attributes.name = info[3]; 261 if(info[3] || info[3] == 'null'){
262 attributes.name = '地块'+j;
263 j++
264 }else {
265 attributes.name = info[3];
266 }
262 } 267 }
263 } 268 }
264 if(points.length > 0){ 269 if(points.length > 0){
...@@ -302,7 +307,7 @@ export default { ...@@ -302,7 +307,7 @@ export default {
302 } 307 }
303 var wkt = "PROJCS[\"XADFZBX\",GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137.0,298.257223563]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"False_Easting\",0.0],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",0.0],PARAMETER[\"Scale_Factor\",1.0],PARAMETER[\"Latitude_Of_Origin\",0.0],UNIT[\"Meter\",1.0]]"; 308 var wkt = "PROJCS[\"XADFZBX\",GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137.0,298.257223563]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"False_Easting\",0.0],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",0.0],PARAMETER[\"Scale_Factor\",1.0],PARAMETER[\"Latitude_Of_Origin\",0.0],UNIT[\"Meter\",1.0]]";
304 var geometry = { 309 var geometry = {
305 rings:[[points]], 310 rings:[points],
306 spatialReference:{ 311 spatialReference:{
307 wkt:wkt 312 wkt:wkt
308 }, 313 },
......
...@@ -27,7 +27,7 @@ export default { ...@@ -27,7 +27,7 @@ export default {
27 } 27 }
28 return null; 28 return null;
29 }, 29 },
30 queryGeoByBsm(bsm, type, callBackFunction) { 30 queryGeoByBsm(bsm, type, callBackFunction,outSpatialReference) {
31 var layer = null; 31 var layer = null;
32 if (type == 'zd') { 32 if (type == 'zd') {
33 layer = this.getLayerByName("ZDJBXX"); 33 layer = this.getLayerByName("ZDJBXX");
...@@ -41,7 +41,7 @@ export default { ...@@ -41,7 +41,7 @@ export default {
41 console.log("没有找到图层,不能查询"); 41 console.log("没有找到图层,不能查询");
42 return; 42 return;
43 } 43 }
44 queryUtils.methods.queryByWhere(layer.layerUrl+"/"+layer.id, {"BSM": bsm}, null, true, null, null, function (res) { 44 queryUtils.methods.queryByWhere(layer.layerUrl+"/"+layer.id, {"BSM": bsm}, null, true, null, outSpatialReference, function (res) {
45 var features = res.features; 45 var features = res.features;
46 if (callBackFunction && typeof callBackFunction == 'function') { 46 if (callBackFunction && typeof callBackFunction == 'function') {
47 callBackFunction(features); 47 callBackFunction(features);
...@@ -281,11 +281,13 @@ export default { ...@@ -281,11 +281,13 @@ export default {
281 var view = maps["testMap"]; 281 var view = maps["testMap"];
282 loadModules([ 282 loadModules([
283 "esri/Graphic", 283 "esri/Graphic",
284 "esri/geometry/Polygon",
284 "esri/layers/GraphicsLayer", 285 "esri/layers/GraphicsLayer",
285 "esri/geometry/geometryEngineAsync", 286 "esri/geometry/geometryEngineAsync",
286 "esri/geometry/Extent" 287 "esri/geometry/Extent"
287 ]).then(([ 288 ]).then(([
288 Graphic, 289 Graphic,
290 Polygon,
289 GraphicsLayer, 291 GraphicsLayer,
290 geometryEngineAsync, 292 geometryEngineAsync,
291 Extent 293 Extent
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
7 <el-button type="primary" title="放大" icon="iconfont iconlakuangfangda" @click="zoomOut"></el-button> 7 <el-button type="primary" title="放大" icon="iconfont iconlakuangfangda" @click="zoomOut"></el-button>
8 <el-button type="primary" title="缩小" icon="iconfont iconlakuangsuoxiao" @click="zoomIn"></el-button> 8 <el-button type="primary" title="缩小" icon="iconfont iconlakuangsuoxiao" @click="zoomIn"></el-button>
9 <el-button type="primary" title="点选" icon="iconfont iconchaxunshuxing" @click="info"></el-button> 9 <el-button type="primary" title="点选" icon="iconfont iconchaxunshuxing" @click="info"></el-button>
10 <el-button type="primary" title="缓冲区分析" icon="iconfont iconqingchu" @click="bufferAnalysis"></el-button>
10 <el-button type="primary" title="清除" icon="iconfont iconqingchu" @click="clear"></el-button> 11 <el-button type="primary" title="清除" icon="iconfont iconqingchu" @click="clear"></el-button>
11 </el-button-group> 12 </el-button-group>
12 13
...@@ -96,6 +97,10 @@ export default { ...@@ -96,6 +97,10 @@ export default {
96 throw (err); 97 throw (err);
97 }) 98 })
98 }); 99 });
100 },
101 //缓冲区分析
102 bufferAnalysis(){
103
99 } 104 }
100 105
101 } 106 }
...@@ -104,5 +109,8 @@ export default { ...@@ -104,5 +109,8 @@ export default {
104 } 109 }
105 </script> 110 </script>
106 <style lang="less" scoped> 111 <style lang="less" scoped>
112 .tools{
113 position: relative;
114 }
107 115
108 </style> 116 </style>
...\ No newline at end of file ...\ No newline at end of file
......