36e2bd77 by 杨威

文件导出 模板下载

1 parent b7acbe79
No preview for this file type
1 [属性描述]
2 格式版本号=1.0
3 数据产生单位=国土资源信息中心
4 数据产生日期=2013-06-06
5 坐标系=80国家大地坐标系
6 几度分带=3
7 投影类型=高斯克吕格
8 计量单位=米
9 带号=36
10 精度=0.01
11 转换参数=0,0,0,0,0,0,0
12 [地块坐标]
13 24,0.2208,1,南州村0076地块,面,,土地开垦,,@
14 J1,1,2463703.8585,36531532.3508
15 J2,1,2463702.9272,36531526.0600
16 J3,1,2463703.0435,36531520.8176
17 J4,1,2463705.0225,36531515.5752
18 J5,1,2463711.3086,36531507.3037
19 J6,1,2463721.4852,36531497.3517
20 J7,1,2463734.8724,36531483.0222
21 J8,1,2463742.5555,36531476.2652
22 J9,1,2463753.2985,36531471.8972
23 J10,1,2463761.7966,36531467.0041
24 J11,1,2463762.1610,36531466.5756
25 J12,1,2463761.8898,36531473.4882
26 J13,1,2463758.4897,36531483.3309
27 J14,1,2463754.5525,36531495.4999
28 J15,1,2463753.2146,36531498.4235
29 J16,1,2463738.9903,36531524.8811
30 J17,1,2463732.0653,36531534.9303
31 J18,1,2463730.6173,36531539.4498
32 J19,1,2463725.3825,36531545.7865
33 J20,1,2463723.4140,36531550.0816
34 J21,1,2463722.7101,36531553.4604
35 J22,1,2463721.4368,36531552.6210
36 J23,1,2463710.3776,36531540.9715
37 J24,1,2463703.8585,36531532.3508
38 12,0.0190,2,南洲林场0003地块,面,,土地开垦,,@
39 J1,1,2463808.0212,36532005.7911
40 J2,1,2463804.6898,36532002.0500
41 J3,1,2463806.2514,36531991.6196
42 J4,1,2463805.5426,36531984.8565
43 J5,1,2463807.0018,36531981.6012
44 J6,1,2463809.2139,36531978.2832
45 J7,1,2463813.1225,36531974.6382
46 J8,1,2463813.1224,36531990.7858
47 J9,1,2463812.7449,36532000.9968
48 J10,1,2463812.3011,36532002.5509
49 J11,1,2463810.1033,36532005.2700
50 J12,1,2463808.0212,36532005.7911
...\ No newline at end of file ...\ No newline at end of file
...@@ -217,6 +217,13 @@ export function exportShp(data) { ...@@ -217,6 +217,13 @@ export function exportShp(data) {
217 }) 217 })
218 } 218 }
219 219
220 export function exportExcel(data) {
221 return request({
222 url:"/tx/excelGeo/exportExcelp",
223 method:"post",
224 params:data
225 })
226 }
220 227
221 /** 228 /**
222 * 获取该宗地上的所有自然幢 229 * 获取该宗地上的所有自然幢
...@@ -241,3 +248,4 @@ export function ZdHb(data) { ...@@ -241,3 +248,4 @@ export function ZdHb(data) {
241 data:data 248 data:data
242 }) 249 })
243 } 250 }
251
......
1 {
2 "exprotTextAttr": "[属性描述]\n格式版本号=1.0\n数据产生单位=国土资源信息中心\n数据产生日期=2013-06-06\n坐标系=80国家大地坐标系\n几度分带=3\n投影类型=高斯克吕格\n计量单位=米\n带号=36\n精度=0.01\n转换参数=0,0,0,0,0,0,0\n"
3 }
...\ No newline at end of file ...\ No newline at end of file
...@@ -58,13 +58,13 @@ ...@@ -58,13 +58,13 @@
58 > 58 >
59 <li @click="postionToMap">定位</li> 59 <li @click="postionToMap">定位</li>
60 <li @click="importGeo">导入图形</li> 60 <li @click="importGeo">导入图形</li>
61 <li @click="exportToShp"> 61 <li>
62 导出图形 62 导出图形
63 <ul class="contextmenu childUl"> 63 <ul class="contextmenu childUl">
64 <li>文本</li> 64 <li @click="exportText">文本</li>
65 <li>CAD</li> 65 <li @click="exportCad">CAD</li>
66 <li>Excel</li> 66 <li @click="exportExcel">Excel</li>
67 <li>ESRI Shape</li> 67 <li @click="exportToShp">ESRI Shape</li>
68 </ul> 68 </ul>
69 </li> 69 </li>
70 <li v-show="isZD">导入属性</li> 70 <li v-show="isZD">导入属性</li>
...@@ -112,12 +112,13 @@ ...@@ -112,12 +112,13 @@
112 </template> 112 </template>
113 <script> 113 <script>
114 import lineItem from "./lineItem.vue"; 114 import lineItem from "./lineItem.vue";
115 import {deleteZdInfoByBsm,exportShp} from "../../api/zd"; 115 import {deleteZdInfoByBsm,exportShp,exportExcel} from "../../api/zd";
116 import Create from "../../views/panel/create/index"; 116 import Create from "../../views/panel/create/index";
117 import ImportGeo from './tx/importGeo' 117 import ImportGeo from './tx/importGeo'
118 import geoUtils from "@components/lineTree/tx/js/geoUtils"; 118 import geoUtils from "@components/lineTree/tx/js/geoUtils";
119 import featureUpdate from "@libs/map/featureUpdate"; 119 import featureUpdate from "@libs/map/featureUpdate";
120 import {deleteLjz,deleteZdy} from "./../../api/lpb" 120 import {deleteLjz,deleteZdy} from "./../../api/lpb"
121 import exportTemJson from '@/assets/json/exportTemplate.json'
121 export default { 122 export default {
122 inheritAttrs: false, 123 inheritAttrs: false,
123 props: { 124 props: {
...@@ -456,25 +457,96 @@ export default { ...@@ -456,25 +457,96 @@ export default {
456 } 457 }
457 }); 458 });
458 }, 459 },
459 //导出 460 //导出文本文件
461 exportText(){
462 var self = this;
463 var BSM = this.zdData.zdbsm;
464 var type = this.zdData.type;
465 this.queryGeoByBsm(BSM,type,function (features){
466 if(features && features.length > 0){
467 var data = features[0];
468 var jzdInfo = self.craetJZPoint(data);
469 var textCotent = "";
470 textCotent += exportTemJson.exprotTextAttr;
471 textCotent += "[地块坐标]\n";
472 var dkMc = "",dkYt = "";
473 if(type == 'zd'){
474 dkMc = data.attributes.ZL;
475 dkYt = data.attributes.YT;
476 }else {
477 dkMc = data.attributes.XMMC + data.attributes.JZWMC ;
478 dkYt = "建设用地";
479 }
480 textCotent += ",,,"+dkMc+",面,,"+dkYt+",,@\n";
481 for(var i = 0;i < jzdInfo.length;i++){
482 textCotent += jzdInfo[i].jzdh +","+jzdInfo[i].sxh+"," +
483 jzdInfo[i].x+","+jzdInfo[i].y+"\n"
484 }
485 self.downloadTxt(textCotent,"outPut.txt");
486 }
487 });
488 },
489 //导出shp文件
460 exportToShp(){ 490 exportToShp(){
461 var self = this; 491 var self = this;
462 var BSM = this.zdData.zdbsm; 492 var BSM = this.zdData.zdbsm;
463 var type = this.zdData.type; 493 var type = this.zdData.type;
464 this.queryGeoByBsm(BSM,type,function (features){ 494 this.queryGeoByBsm(BSM,type,function (features){
465 var data = JSON.stringify(features[0]);
466 if(features && features.length > 0){ 495 if(features && features.length > 0){
496 var data = JSON.stringify(features[0]);
467 window.location.href = "/api/tx/shpUtils/writeShp?strObj="+encodeURI(data) 497 window.location.href = "/api/tx/shpUtils/writeShp?strObj="+encodeURI(data)
468 /*exportShp({ 498 /* exportShp({
469 "strObj":encodeURI(data) 499 "strObj":encodeURI(data)
470 }).then(res => { 500 }).then(res => {
471 debugger 501 debugger
472 });*/ 502 });*/
503
473 }else{ 504 }else{
474 self.$message.warning("暂无空间信息!!!!"); 505 self.$message.warning("暂无空间信息!!!!");
475 } 506 }
476 }); 507 });
477 }, 508 },
509 //导出excel
510 exportExcel(){
511 var self = this;
512 var BSM = this.zdData.zdbsm;
513 var type = this.zdData.type;
514 this.queryGeoByBsm(BSM,type,function (features) {
515 if (features && features.length > 0) {
516 var data = features[0];
517 var jzdInfo = self.craetJZPoint(data);
518 var submitData = [];
519 for (var i = 0; i < jzdInfo.length; i++) {
520 var obj = {
521 jzdHao: jzdInfo[i].jzdh,
522 x: jzdInfo[i].x,
523 y: jzdInfo[i].y,
524 diKuaiQuanHao: jzdInfo.sxh
525 }
526 submitData.push(obj);
527 }
528 exportExcel(submitData).then((res) => {
529 if (res.status == 200) {
530 var path = res.data.result;
531 window.location.href = "/api/tx/excelGeo/download?filePath=" + encodeURI(path);
532 }
533 });
534 }else {
535 self.$message.warning("还没有空间信息!!!!")
536 }
537 })
538 },
539 //导出CAD
540 exportCad(){
541 //TODO
542 },
543 downloadTxt(text, fileName){
544 let element = document.createElement('a')
545 element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text))
546 element.setAttribute('download', fileName)
547 element.style.display = 'none'
548 element.click()
549 },
478 //图形定位 550 //图形定位
479 postionToMap(){ 551 postionToMap(){
480 var curretRouterInfo = { 552 var curretRouterInfo = {
......
1 <template> 1 <template>
2 <div > 2 <div >
3 <div v-if="!resultDialog" class="importDiv"> 3 <div v-if="!resultDialog && !txtResultDialog" class="importDiv">
4 <el-upload 4 <el-upload
5 class="upload-demo" 5 class="upload-demo"
6 action="#" 6 action="#"
7 accept=".txt" 7 accept=".txt"
8 :auto-upload="false"
8 :show-file-list="false" 9 :show-file-list="false"
9 :on-change="txtFileChange" 10 :on-change="txtFileChange"
10 > 11 >
...@@ -15,7 +16,7 @@ ...@@ -15,7 +16,7 @@
15 </div> 16 </div>
16 <div solt="tip" class="uploadRight"> 17 <div solt="tip" class="uploadRight">
17 <div solt="tip" class="title">TXT文本格式</div> 18 <div solt="tip" class="title">TXT文本格式</div>
18 <div slot="tip" class="el-upload__tip">支持TXT文本格式,点击查看详情<a href="">文本详情</a></div> 19 <div class="el-upload__tip" slot="tip">支持TXT文本格式,点击查看详情<a class="down" href="#" @click.stop="downloadFile('./fileTemplate/txttemplet.txt','txttemplet.txt')" >文本详情</a></div>
19 </div> 20 </div>
20 </div> 21 </div>
21 </el-upload> 22 </el-upload>
...@@ -69,7 +70,7 @@ ...@@ -69,7 +70,7 @@
69 </div> 70 </div>
70 <div solt="tip" class="uploadRight"> 71 <div solt="tip" class="uploadRight">
71 <div slot="tip" class="title">Excel文件格式</div> 72 <div slot="tip" class="title">Excel文件格式</div>
72 <div slot="tip" class="el-upload__tip">.xls、.xlsx版本,点击查看详情<a href="">Excel格式</a></div> 73 <div class="el-upload__tip" slot="tip">.xls、.xlsx版本,点击查看详情<a class="downloadFile" @click.stop="downloadFile('./fileTemplate/exceltemplet.xlsx','exceltemplet.xlsx')" href="#">Excel格式</a></div>
73 </div> 74 </div>
74 </div> 75 </div>
75 </el-upload> 76 </el-upload>
...@@ -98,6 +99,30 @@ ...@@ -98,6 +99,30 @@
98 </el-form-item> 99 </el-form-item>
99 </el-form> 100 </el-form>
100 </div> 101 </div>
102 <div v-if="txtResultDialog">
103 <el-form :model="txtZd" ref="txtZdForm" label-width="100px" size="small" @submit.native.prevent class="demo-ruleForm">
104 <el-form-item
105 label="地块名称"
106 prop="name"
107 :rules="[
108 { required: true, message: '请选择地块', trigger: 'change' },
109 ]"
110 >
111 <el-select v-model="txtZd.name" filterable placeholder="请选择">
112 <el-option
113 v-for="(item,index) in txtResult"
114 :key="index"
115 :label="item.attributes.name"
116 :value="item.attributes.name">
117 </el-option>
118 </el-select>
119 </el-form-item>
120 <el-form-item>
121 <el-button type="primary" @click="submitTxtForm('txtZdForm')">导入</el-button>
122 <el-button @click="cancelTxtForm('txtZdForm')">取消</el-button>
123 </el-form-item>
124 </el-form>
125 </div>
101 </div> 126 </div>
102 </template> 127 </template>
103 <script> 128 <script>
...@@ -123,7 +148,12 @@ export default { ...@@ -123,7 +148,12 @@ export default {
123 zdForm:{ 148 zdForm:{
124 zdBsm: "" 149 zdBsm: ""
125 }, 150 },
126 currentClickZd:null 151 currentClickZd:null,
152 txtResult:[],
153 txtResultDialog:null,
154 txtZd:{
155 name:""
156 }
127 } 157 }
128 }, 158 },
129 methods:{ 159 methods:{
...@@ -133,9 +163,63 @@ export default { ...@@ -133,9 +163,63 @@ export default {
133 fileReader.readAsText(file.raw); 163 fileReader.readAsText(file.raw);
134 fileReader.onload = function (res){ 164 fileReader.onload = function (res){
135 var content = this.result; 165 var content = this.result;
136 self.$emit("closeImportDialog"); 166 if(!content || content.length == 0){
167 self.$message.warning("文件内容为空!!!");
168 return;
169 }
170 self.analysisTextFile(content);
137 } 171 }
138 }, 172 },
173 analysisTextFile(content){
174 var index = content.indexOf("[地块坐标]"),
175 geoInfos = content.substr(index),
176 geoList = geoInfos.split("\n");
177 if(geoList.length < 1){
178 this.$message.warning("文本内容格式有误,请效验文本内容格式!!!");
179 return;
180 }
181 //this.$emit("closeImportDialog");
182 var features = [],attributes = {},points = [];
183 for(var i =1;i < geoList.length;i++){
184 var rowData = geoList[i];
185 if(rowData.indexOf("J") != -1 && rowData.indexOf("J") == 0){
186 //解析坐标点信息
187 var pointInfo = rowData.split(",");
188 var point = [parseFloat(pointInfo[2]),parseFloat(pointInfo[3])];
189 points.push(point);
190 }else {
191 if(points.length > 0){
192 var graphic = {
193 attributes:JSON.parse(JSON.stringify(attributes)),
194 geometry:{
195 rings:[[points.concat()]]
196 }
197 }
198 features.push(graphic);
199 }
200 //新建一个信息 坐标名称 类型
201 attributes = {};
202 points = []
203 var info = rowData.split(",");
204 attributes.name = info[3];
205 }
206 }
207 if(points.length > 0){
208 var graphic = {
209 attributes:JSON.parse(JSON.stringify(attributes)),
210 geometry:{
211 rings:[[points.concat()]]
212 }
213 }
214 features.push(graphic);
215 }
216 //新建一个信息 坐标名称 类型
217 attributes = {};
218 points = []
219 this.txtResult = features;
220 this.txtZd.name = "";
221 this.txtResultDialog = true;
222 },
139 shpFileSuccess(response, file, fileList){ 223 shpFileSuccess(response, file, fileList){
140 var self = this; 224 var self = this;
141 if(response.success){ 225 if(response.success){
...@@ -180,6 +264,49 @@ export default { ...@@ -180,6 +264,49 @@ export default {
180 this.$message.warning(response.message); 264 this.$message.warning(response.message);
181 } 265 }
182 }, 266 },
267 //文本文档导入
268 submitTxtForm(formName){
269 var self = this;
270 this.$refs[formName].validate((valid) => {
271 if(valid){
272 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]]";
273 var graphics = self.txtResult.filter(item => {
274 return item.attributes.name == self.txtZd.name;
275 })
276 var graphic = graphics[0];
277 graphic.geometry.type = "polygon";
278 graphic.geometry.spatialReference = {
279 wkt:wkt
280 }
281 //校验完整性 直接调用空间方法 提交空间表
282 self.geoJoint(geometry,function (isJoint,message) {
283 if(isJoint){
284 self.$message.warning(message)
285 return;
286 }else {
287 if(self.propertyInfo.type == "zd"){
288 self.saveZd(graphic);
289 }else{
290 self.saveZRZ(graphic);
291 }
292 }
293 });
294 }else{
295 console.log('error submit!!');
296 return false;
297 }
298 })
299 },
300 //下载文档模板
301 downloadFile(url,fileName){
302 let link = document.createElement("a");
303 link.style.display = "none";
304 link.href = url;
305 link.setAttribute("download", fileName);
306 document.body.appendChild(link);
307 link.click();
308 document.body.removeChild(link);
309 },
183 //导入 310 //导入
184 submitForm(formName){ 311 submitForm(formName){
185 //校验完整性 直接调用空间方法 提交空间表 312 //校验完整性 直接调用空间方法 提交空间表
...@@ -370,13 +497,18 @@ export default { ...@@ -370,13 +497,18 @@ export default {
370 cancel(){ 497 cancel(){
371 this.zdForm.zdBsm = ""; 498 this.zdForm.zdBsm = "";
372 this.currentClickZd = null; 499 this.currentClickZd = null;
500 this.resultDialog = false;
501 },
502 //取消文本选择的弹出框
503 cancelTxtForm(){
504 this.txtZd.name = "";
505 this.txtResultDialog = false;
373 }, 506 },
374 //宗地选择发生改变 507 //宗地选择发生改变
375 zdChange(value){ 508 zdChange(value){
376 this.zdForm.zdBsm = value.XMMC; 509 this.zdForm.zdBsm = value.XMMC;
377 this.currentClickZd = value; 510 this.currentClickZd = value;
378 } 511 }
379
380 } 512 }
381 } 513 }
382 </script> 514 </script>
......
1 
2 export default {
3 methods:{
4 downloadTxt(text, fileName){
5 let element = document.createElement('a')
6 element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text))
7 element.setAttribute('download', fileName)
8 element.style.display = 'none'
9 element.click()
10 },
11 createTextContent(jzdInfo){
12 var textContent = "";
13 for(var i = 0;i < jzdInfo.length;i++){
14 textContent += jzdInfo[i].jzdh +","+jzdInfo[i].sxh+"," +
15 jzdInfo[i].x+","+jzdInfo[i].y+"\n"
16 }
17 return textContent;
18 },
19
20 }
21 }
...\ No newline at end of file ...\ No newline at end of file
...@@ -133,8 +133,9 @@ export default { ...@@ -133,8 +133,9 @@ export default {
133 doSearch(){ 133 doSearch(){
134 var self = this; 134 var self = this;
135 if(!this.inputBsm){ 135 if(!this.inputBsm){
136 this.$message.warning(" 请输入标识码!!!");
136 return; 137 return;
137 }else if(this.inputBsm.length != 19){ 138 }else if(this.inputBsm.length != 32){
138 this.$message.warning("标识码格式输入有误!!!"); 139 this.$message.warning("标识码格式输入有误!!!");
139 return; 140 return;
140 } 141 }
...@@ -242,7 +243,7 @@ export default { ...@@ -242,7 +243,7 @@ export default {
242 position: absolute; 243 position: absolute;
243 top: 12px; 244 top: 12px;
244 left: 7px; 245 left: 7px;
245 width: 35%; 246 width: 30%;
246 max-height: 100%; 247 max-height: 100%;
247 /deep/ .el-input-group__append{ 248 /deep/ .el-input-group__append{
248 background-color: #409eff; 249 background-color: #409eff;
......