123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- <template>
- <j-modal
- :title="title"
- :width="width"
- :visible="visible"
- switchFullscreen
- @ok="handleOk"
- :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
- @cancel="handleCancel"
- cancelText="关闭">
- <div class="attrPane">
- <rm-bulletin-board-form ref="realForm" :lng="this.lng" :lat="this.lat" @ok="submitCallback"
- :disabled="disableSubmit" @coordsChange="coordsChange"></rm-bulletin-board-form>
- </div>
- <div class="geomPane">
- <basic-map ref="locMap" height='775px' layersUrl='/resManager.catalog/rescatalog/resList'
- :model="{...model,layerName:'公告牌'}"></basic-map>
- </div>
- </j-modal>
- </template>
- <script>
- import RmBulletinBoardForm from './RmBulletinBoardForm'
- import BasicMap from "../../../../../components/BasicMap/BasicMap";
- import {transform} from "ol/proj";
- import proj4 from "proj4";
- import {register} from "ol/proj/proj4";
- export default {
- name: 'RmBulletinBoardModal',
- components: {
- BasicMap,
- RmBulletinBoardForm
- },
- data() {
- return {
- lng: 0,
- lat: 0,
- title: '',
- width: 1200,
- visible: false,
- disableSubmit: false,
- mapHeight: "775px",
- model: {}
- }
- },
- beforeCreate() {
- proj4.defs("EPSG:4548",
- "+proj=tmerc +lat_0=0 +lon_0=117 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs");
- proj4.defs("EPSG:4527",
- "+proj=tmerc +lat_0=0 +lon_0=117 +k=1 +x_0=39500000 +y_0=0 +ellps=GRS80 +units=m +no_defs");
- proj4.defs("EPSG:4490", "+proj=longlat +ellps=GRS80 +no_defs");
- register(proj4);
- },
- methods: {
- add() {
- this.visible = true
- this.$nextTick(() => {
- this.$refs.realForm.add();
- })
- },
- edit(record) {
- this.model = record;
- let coord = [record.hzb, record.zzb];
- //测绘系统的坐标系与正常坐标系XY轴是反的,横坐标对应纬度
- if (record.hzb > 39000000 || record.zzb > 39000000) { //情况1:4527坐标,带带号投影坐标,坐标位数应为前8后7
- this.lng = record.hzb > record.zzb ? record.hzb : record.zzb;
- this.lat = record.hzb > record.zzb ? record.zzb : record.hzb;
- coord = transform([this.lng, this.lat], 'EPSG:4527', 'EPSG:4490');
- } else if (record.hzb > 180 || record.zzb > 180) { //情况2:4548坐标,无带号投影坐标,坐标位数应为前6后7
- this.lng = record.hzb < record.zzb ? record.hzb : record.zzb
- this.lat = record.hzb < record.zzb ? record.zzb : record.hzb
- coord = transform([this.lng, this.lat], 'EPSG:4548', 'EPSG:4490');
- } else { //情况3:4490坐标,经纬度坐标
- this.lng = record.hzb > record.zzb ? record.hzb : record.zzb
- this.lat = record.hzb > record.zzb ? record.zzb : record.hzb
- coord = [this.lng, this.lat ];
- }
- this.lng = parseFloat(coord[0].toFixed(6));
- this.lat = parseFloat(coord[1].toFixed(6));
- this.visible = true;
- this.$nextTick(() => {
- this.$refs.realForm.edit(record);
- })
- },
- close() {
- this.$emit('close');
- this.visible = false;
- },
- handleOk() {
- this.$refs.realForm.submitForm();
- },
- submitCallback() {
- this.$emit('ok');
- this.visible = false;
- },
- handleCancel() {
- this.close()
- },
- locateByCoords() {
- let loc_x = this.hzb;
- let loc_y = this.zzb;
- this.$nextTick(() => {
- this.$refs.locMap.locateByCoords(loc_x, loc_y);
- })
- },
- locMapReady() {
- this.locateByCoords();
- },
- coordsTranslated(coords) {
- this.lng = coords[0].toFixed(6);
- this.lat = coords[1].toFixed(6);
- },
- coordsChange(hzb, zzb) {
- let coord = [hzb, zzb];
- //测绘系统的坐标系与正常坐标系XY轴是反的,横坐标对应纬度
- if (hzb > 39000000 || zzb > 39000000) { //情况1:4527坐标,带带号投影坐标,坐标位数应为前8后7
- this.lng = hzb > zzb ? hzb : zzb;
- this.lat = hzb > zzb ? zzb : hzb;
- coord = transform([this.lng, this.lat], 'EPSG:4527', 'EPSG:4490');
- } else if (hzb > 180 || zzb > 180) { //情况2:4548坐标,无带号投影坐标,坐标位数应为前6后7
- this.lng = hzb < zzb ? hzb : zzb;
- this.lat = hzb < zzb ? zzb : hzb;
- coord = transform([this.lng, this.lat], 'EPSG:4548', 'EPSG:4490');
- } else { //情况3:4490坐标,经纬度坐标
- this.lng = hzb > zzb ? hzb : zzb;
- this.lat = hzb > zzb ? zzb : hzb;
- coord = [this.lng, this.lat ];u
- }
- this.lng = parseFloat(coord[0].toFixed(6));
- this.lat = parseFloat(coord[1].toFixed(6));
- this.$refs.locMap.locateByCoords({...this.model, lng: this.lng, lat: this.lat, geoinfo: ''});
- this.edit({...this.model, hzb: hzb, zzb: zzb});
- }
- }
- // beforeMount() {
- // if(!this.height){
- // let calcHeight = window.document.documentElement.clientHeight - 160;
- // let m_height = calcHeight.toString()+'px';
- // this.mapHeight = m_height;
- // }
- // }
- }
- </script>
- <style scoped>
- .attrPane {
- width: 33%;
- display: inline-block;
- overflow-y: auto;
- height: 775px;
- }
- .geomPane {
- width: 66%;
- display: inline-block;
- }
- </style>
|