1192b3789a17616ab1bbd962f7fbbbd5a0d6aab8.svn-base 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template>
  2. <j-modal
  3. :title='title'
  4. :width='width'
  5. :visible='visible'
  6. switchFullscreen
  7. @ok='handleOk'
  8. :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
  9. @cancel='handleCancel'
  10. cancelText='关闭'>
  11. <div class='attrPane'>
  12. <rm-boundary-marker-form ref='realForm' @ok='submitCallback' :lng='this.lng' :lat='this.lat'
  13. :disabled='disableSubmit' @coordsChange='coordsChange'></rm-boundary-marker-form>
  14. </div>
  15. <div class='geomPane'>
  16. <basic-map ref="locMap" height='775px' layersUrl='/resManager.catalog/rescatalog/resList' :model="{...model,layerName:'界桩点'}"></basic-map>
  17. </div>
  18. </j-modal>
  19. </template>
  20. <script>
  21. import RmBoundaryMarkerForm from './RmBoundaryMarkerForm'
  22. import BasicMap from "../../../../../components/BasicMap/BasicMap";
  23. import proj4 from "proj4";
  24. import {register} from "ol/proj/proj4";
  25. import {transform} from "ol/proj";
  26. export default {
  27. name: 'RmBoundaryMarkerModal',
  28. components: {
  29. BasicMap,
  30. RmBoundaryMarkerForm
  31. },
  32. data() {
  33. return {
  34. lng: 0,
  35. lat: 0,
  36. title: '',
  37. width: 1200,
  38. visible: false,
  39. disableSubmit: false,
  40. model:{},
  41. }
  42. },
  43. beforeCreate() {
  44. proj4.defs("EPSG:4548",
  45. "+proj=tmerc +lat_0=0 +lon_0=117 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs");
  46. proj4.defs("EPSG:4527",
  47. "+proj=tmerc +lat_0=0 +lon_0=117 +k=1 +x_0=39500000 +y_0=0 +ellps=GRS80 +units=m +no_defs");
  48. proj4.defs("EPSG:4490", "+proj=longlat +ellps=GRS80 +no_defs");
  49. register(proj4);
  50. },
  51. methods: {
  52. add() {
  53. this.visible = true
  54. this.$nextTick(() => {
  55. this.$refs.realForm.add()
  56. })
  57. },
  58. edit(record) {
  59. this.model = record;
  60. let coord=[record.hzb,record.zzb];
  61. //测绘系统的坐标系与正常坐标系XY轴是反的,横坐标对应纬度
  62. if (record.hzb > 39000000 || record.zzb > 39000000) { //情况1:4527坐标,带带号投影坐标,坐标位数应为前8后7
  63. this.lng = record.hzb>record.zzb?record.hzb:record.zzb;
  64. this.lat = record.hzb>record.zzb?record.zzb:record.hzb;
  65. coord= transform([this.lng,this.lat], 'EPSG:4527', 'EPSG:4490');
  66. } else if (record.hzb > 180 || record.zzb > 180) { //情况2:4548坐标,无带号投影坐标,坐标位数应为前6后7
  67. this.lng = record.hzb<record.zzb?record.hzb:record.zzb
  68. this.lat = record.hzb<record.zzb?record.zzb:record.hzb
  69. coord = transform([this.lng,this.lat], 'EPSG:4548', 'EPSG:4490');
  70. } else { //情况3:4490坐标,经纬度坐标
  71. this.lng = record.hzb>record.zzb?record.hzb:record.zzb
  72. this.lat = record.hzb>record.zzb?record.zzb:record.hzb
  73. }
  74. this.lng=parseFloat(coord[0].toFixed(6));
  75. this.lat=parseFloat(coord[1].toFixed(6));
  76. this.visible = true
  77. this.$nextTick(() => {
  78. this.$refs.realForm.edit({...record})
  79. })
  80. this.model=record;
  81. },
  82. close() {
  83. this.$emit('close')
  84. this.visible = false
  85. },
  86. handleOk() {
  87. this.$refs.realForm.submitForm()
  88. },
  89. submitCallback() {
  90. this.$emit('ok')
  91. this.visible = false
  92. },
  93. handleCancel() {
  94. this.close()
  95. },
  96. locateByCoords() {
  97. let loc_x = this.hzb
  98. let loc_y = this.zzb
  99. this.$nextTick(() => {
  100. this.$refs.locMap.locateByCoords(loc_x, loc_y)
  101. })
  102. },
  103. coordsTranslated(coords) {
  104. this.lng = coords[0].toFixed(6)
  105. this.lat = coords[1].toFixed(6)
  106. },
  107. locMapReady() {
  108. this.locateByCoords()
  109. },
  110. coordsChange(x,y) {
  111. this.$refs.locMap.locateByCoords({...this.model,lng:x,lat:y,geoinfo:''});
  112. this.edit({...this.model,hzb:x,zzb:y});
  113. }
  114. }
  115. }
  116. </script>
  117. <style scoped>
  118. .attrPane {
  119. width: 33%;
  120. display: inline-block;
  121. overflow-y: auto;
  122. height: 775px;
  123. }
  124. .geomPane {
  125. width: 66%;
  126. display: inline-block;
  127. }
  128. </style>