4c0e9097 by 杨威

文件导出在导入

1 parent c2bc1fbb
......@@ -219,9 +219,9 @@ export function exportShp(data) {
export function exportExcel(data) {
return request({
url:"/tx/excelGeo/exportExcelp",
url:"/tx/excelGeo/exportExcel",
method:"post",
params:data
data:data
})
}
......
......@@ -162,6 +162,7 @@ export default {
dzVisible:false,
//宗地权属状态
zdQszt:null,
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]]"
};
},
watch: {
......@@ -519,7 +520,7 @@ export default {
var type = this.zdData.type;
var BSM = type == 'zdt'? this.zdData.zdbsm : this.zdData.bsm;
this.queryGeoByBsm(BSM,type,function (features){
if(features && features.length > 0){
if(features && features.length > 0 && features[0].geometry.rings.length > 0){
var data = features[0];
var jzdInfo = self.craetJZPoint(data);
var textCotent = "";
......@@ -540,7 +541,7 @@ export default {
}
self.downloadTxt(textCotent,"outPut.txt");
}
});
},{wkt:this.wkt});
},
//导出shp文件
exportToShp(){
......@@ -548,7 +549,7 @@ export default {
var type = this.zdData.type;
var BSM = type == 'zdt'? this.zdData.zdbsm : this.zdData.bsm;
this.queryGeoByBsm(BSM,type,function (features){
if(features && features.length > 0){
if(features && features.length > 0 && features[0].geometry.rings.length > 0) {
var data = JSON.stringify(features[0]);
window.location.href = "/api/tx/shpUtils/writeShp?strObj="+encodeURI(data)
/* exportShp({
......@@ -559,7 +560,7 @@ export default {
}else{
self.$message.warning("暂无空间信息!!!!");
}
});
},{wkt:this.wkt});
},
//导出excel
exportExcel(){
......@@ -567,7 +568,7 @@ export default {
var type = this.zdData.type;
var BSM = type == 'zdt'? this.zdData.zdbsm : this.zdData.bsm;
this.queryGeoByBsm(BSM,type,function (features) {
if (features && features.length > 0) {
if (features && features.length > 0 && features[0].geometry.rings.length > 0) {
var data = features[0];
var jzdInfo = self.craetJZPoint(data);
var submitData = [];
......@@ -581,15 +582,15 @@ export default {
submitData.push(obj);
}
exportExcel(submitData).then((res) => {
if (res.status == 200) {
var path = res.data.result;
if (res.code == 200) {
var path = res.result;
window.location.href = "/api/tx/excelGeo/download?filePath=" + encodeURI(path);
}
});
}else {
self.$message.warning("还没有空间信息!!!!")
}
})
},{wkt:this.wkt})
},
//导出CAD
exportCad(){
......
......@@ -236,10 +236,10 @@ export default {
return;
}
//this.$emit("closeImportDialog");
var features = [],attributes = {},points = [];
var features = [],attributes = {},points = [],j = 1;
for(var i =1;i < geoList.length;i++){
var rowData = geoList[i];
if(rowData.indexOf("J") != -1 && rowData.indexOf("J") == 0){
if((rowData.indexOf("J") != -1 && rowData.indexOf("J") == 0)||(rowData.indexOf("j") != -1 && rowData.indexOf("j") == 0)){
//解析坐标点信息
var pointInfo = rowData.split(",");
var point = [parseFloat(pointInfo[2]),parseFloat(pointInfo[3])];
......@@ -249,7 +249,7 @@ export default {
var graphic = {
attributes:JSON.parse(JSON.stringify(attributes)),
geometry:{
rings:[[points]]
rings:[points]
}
}
features.push(graphic);
......@@ -258,9 +258,14 @@ export default {
attributes = {};
points = []
var info = rowData.split(",");
if(info[3] || info[3] == 'null'){
attributes.name = '地块'+j;
j++
}else {
attributes.name = info[3];
}
}
}
if(points.length > 0){
var graphic = {
attributes:JSON.parse(JSON.stringify(attributes)),
......@@ -302,7 +307,7 @@ export default {
}
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]]";
var geometry = {
rings:[[points]],
rings:[points],
spatialReference:{
wkt:wkt
},
......
......@@ -27,7 +27,7 @@ export default {
}
return null;
},
queryGeoByBsm(bsm, type, callBackFunction) {
queryGeoByBsm(bsm, type, callBackFunction,outSpatialReference) {
var layer = null;
if (type == 'zd') {
layer = this.getLayerByName("ZDJBXX");
......@@ -41,7 +41,7 @@ export default {
console.log("没有找到图层,不能查询");
return;
}
queryUtils.methods.queryByWhere(layer.layerUrl+"/"+layer.id, {"BSM": bsm}, null, true, null, null, function (res) {
queryUtils.methods.queryByWhere(layer.layerUrl+"/"+layer.id, {"BSM": bsm}, null, true, null, outSpatialReference, function (res) {
var features = res.features;
if (callBackFunction && typeof callBackFunction == 'function') {
callBackFunction(features);
......@@ -281,11 +281,13 @@ export default {
var view = maps["testMap"];
loadModules([
"esri/Graphic",
"esri/geometry/Polygon",
"esri/layers/GraphicsLayer",
"esri/geometry/geometryEngineAsync",
"esri/geometry/Extent"
]).then(([
Graphic,
Polygon,
GraphicsLayer,
geometryEngineAsync,
Extent
......
......@@ -7,6 +7,7 @@
<el-button type="primary" title="放大" icon="iconfont iconlakuangfangda" @click="zoomOut"></el-button>
<el-button type="primary" title="缩小" icon="iconfont iconlakuangsuoxiao" @click="zoomIn"></el-button>
<el-button type="primary" title="点选" icon="iconfont iconchaxunshuxing" @click="info"></el-button>
<el-button type="primary" title="缓冲区分析" icon="iconfont iconqingchu" @click="bufferAnalysis"></el-button>
<el-button type="primary" title="清除" icon="iconfont iconqingchu" @click="clear"></el-button>
</el-button-group>
......@@ -96,6 +97,10 @@ export default {
throw (err);
})
});
},
//缓冲区分析
bufferAnalysis(){
}
}
......@@ -104,5 +109,8 @@ export default {
}
</script>
<style lang="less" scoped>
.tools{
position: relative;
}
</style>
\ No newline at end of file
......