Browse Source

地图偏移

shibei_master
jiangyy 3 years ago
parent
commit
762b70be96
  1. 67
      src/assets/scss/buttonstyle copy.scss
  2. 109
      src/views/modules/workSys/mapConfig.vue

67
src/assets/scss/buttonstyle copy.scss

@ -1,67 +0,0 @@
//新增
.el-button--add {
color: #fff;
background-color: #22c1c3;
border-color: #22c1c3;
}
.el-button--add:hover {
color: #fff;
background-color: #05b1b4;
border-color: #05b1b4;
}
.el-button--add:focus {
color: #fff;
background-color: #22c1c3;
border-color: #22c1c3;
}
//删除导入
.el-button--delete {
color: #fff;
background-color: #fe6252;
border-color: #fe6252;
}
.el-button--delete:hover {
color: #fff;
background-color: #fe6252;
border-color: #fe6252;
}
.el-button--delete:focus {
color: #fff;
background-color: #fe6252;
border-color: #fe6252;
}
//重置导出
.el-button--reset {
color: #fff;
background-color: #feb349;
border-color: #feb349;
}
.el-button--reset:hover {
color: #fff;
background-color: #feb349;
border-color: #feb349;
}
.el-button--reset:focus {
color: #fff;
background-color: #feb349;
border-color: #feb349;
}
//查询确定
.el-button--search:hover {
color: #fff;
background-color: #3e8ef7;
border-color: #3e8ef7;
}
.el-button--search:focus {
color: #fff;
background-color: #3e8ef7;
border-color: #3e8ef7;
}
.el-button--search {
color: #fff;
background-color: #3e8ef7;
border-color: #3e8ef7;
}

109
src/views/modules/workSys/mapConfig.vue

@ -49,8 +49,8 @@
resize="none" resize="none"
size="small" size="small"
style="width:200px" style="width:200px"
:precision="6" :precision="5"
:step="0.00001" :step="0.0001"
placeholder='请输入经度偏差' placeholder='请输入经度偏差'
v-model="xOffset"> v-model="xOffset">
</el-input-number> </el-input-number>
@ -58,8 +58,8 @@
<el-input-number v-if="showBtn&&hasPolygon" <el-input-number v-if="showBtn&&hasPolygon"
resize="none" resize="none"
size="small" size="small"
:precision="6" :precision="5"
:step="0.00001" :step="0.0001"
style="width:200px" style="width:200px"
placeholder='请输入维度偏差' placeholder='请输入维度偏差'
v-model="yOffset"> v-model="yOffset">
@ -100,14 +100,52 @@
width="50%" width="50%"
:before-close="handleClose"> :before-close="handleClose">
<div class="div_textarea"> <div class="div_textarea">
<div style="margin-top:10px">
<span> 中心点经度</span>
<el-input resize="none"
size="small"
style="width:200px"
placeholder='请输入中心点经度'
v-model="longitude">
</el-input>
<span style="margin-left:15px"> 中心点纬度</span>
<el-input resize="none"
size="small"
style="width:200px"
placeholder='请输入中心点纬度'
v-model="latitude">
</el-input>
</div>
<div style="margin-top:20px">
<el-input type="textarea" <el-input type="textarea"
:autosize="{ minRows: 20, maxRows: 50}" :rows="15"
:rows="20" style="width:600px;max-height:500px"
style="width:600px;height:500px"
placeholder='请复制坐标数据' placeholder='请复制坐标数据'
v-model="polygonManullyString"> v-model="polygonManullyString">
</el-input> </el-input>
</div> </div>
<div style="margin-top:20px">
<span> 经度偏差</span>
<el-input-number resize="none"
size="small"
style="width:200px"
:precision="5"
:step="0.0001"
placeholder='请输入经度偏差'
v-model="xOffset_customize">
</el-input-number>
<span style="margin-left:15px"> 纬度偏差</span>
<el-input-number resize="none"
size="small"
:precision="5"
:step="0.0001"
style="width:200px"
placeholder='请输入维度偏差'
v-model="yOffset_customize">
</el-input-number>
</div>
</div>
<span slot="footer" <span slot="footer"
class="dialog-footer"> class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button> <el-button @click="dialogVisible = false"> </el-button>
@ -248,10 +286,14 @@ const vueGis = {
showOffset: false, showOffset: false,
// polygonManullyString: "POLYGON (( 120.33902844 36.10290786, 120.33928218 36.10292997, 120.33956336 36.10316381, 120.34016675 36.10367715, 120.34044913 36.10391476, 120.34045707 36.10392145, 120.34068696 36.10411489, 120.34103181 36.10436285, 120.34117309 36.10441824, 120.34134613 36.10447927, 120.34164715 36.10465122, 120.34124679 36.10507284, 120.34088128 36.10538902, 120.34076198 36.10549222, 120.34053890 36.10520966, 120.34044967 36.10507284, 120.34030632 36.10494761, 120.34019091 36.10484679, 120.33976558 36.10448095, 120.33966658 36.10439980, 120.33947147 36.10425822, 120.33932037 36.10417613, 120.33913002 36.10411307, 120.33895751 36.10406073, 120.33879451 36.10403693, 120.33864104 36.10403158, 120.33864031 36.10395235, 120.33863211 36.10305897, 120.33902175 36.10290728, 120.33902844 36.10290786))", // polygonManullyString: "POLYGON (( 120.33902844 36.10290786, 120.33928218 36.10292997, 120.33956336 36.10316381, 120.34016675 36.10367715, 120.34044913 36.10391476, 120.34045707 36.10392145, 120.34068696 36.10411489, 120.34103181 36.10436285, 120.34117309 36.10441824, 120.34134613 36.10447927, 120.34164715 36.10465122, 120.34124679 36.10507284, 120.34088128 36.10538902, 120.34076198 36.10549222, 120.34053890 36.10520966, 120.34044967 36.10507284, 120.34030632 36.10494761, 120.34019091 36.10484679, 120.33976558 36.10448095, 120.33966658 36.10439980, 120.33947147 36.10425822, 120.33932037 36.10417613, 120.33913002 36.10411307, 120.33895751 36.10406073, 120.33879451 36.10403693, 120.33864104 36.10403158, 120.33864031 36.10395235, 120.33863211 36.10305897, 120.33902175 36.10290728, 120.33902844 36.10290786))",
polygonManullyString: "", polygonManullyString: "",
polygonStringResult: '',
xOffset: 0, xOffset: 0,
yOffset: 0, yOffset: 0,
xOffset_customize: 0.0051,
yOffset_customize: 0.0002,
longitude: '',
latitude: '',
} }
}, },
async mounted () { async mounted () {
@ -725,6 +767,14 @@ const vueGis = {
}, },
handleManuallyOk () { handleManuallyOk () {
if (this.longitude || this.latitude) {
if (!(this.longitude && this.latitude)) {
this.$message({
type: "warning",
message: "请同时填写中心点经纬度,或不填写"
});
}
}
// //
//120.54033616308595,36.53603370922851,120.69620469335939,36.5408402277832,120.63166001562502,36.46771248120117,120.52728989843752,36.458786089599606,120.54033616308595,36.53603370922851 //120.54033616308595,36.53603370922851,120.69620469335939,36.5408402277832,120.63166001562502,36.46771248120117,120.52728989843752,36.458786089599606,120.54033616308595,36.53603370922851
// //
@ -734,18 +784,27 @@ const vueGis = {
const arrayString = this.polygonManullyString const arrayString = this.polygonManullyString
let array = arrayString.split(/[, ]/) let array = arrayString.split(/[, ]/)
console.log(array) console.log(array)
this.polygonStringResult = '' let polygonStringResult = ''
array.forEach(element => { array.forEach(element => {
let num = Number(element) let num = Number(element)
if (num) { if (num) {
this.polygonStringResult = this.polygonStringResult + element + ',' polygonStringResult = polygonStringResult + element + ','
} }
}); });
this.polygonStringResult = this.polygonStringResult.substring(0, this.polygonStringResult.length - 1) polygonStringResult = polygonStringResult.substring(0, polygonStringResult.length - 1)
if (this.xOffset_customize !== 0 || this.yOffset_customize !== 0) {
this.saveOffset(this.xOffset_customize, this.yOffset_customize, polygonStringResult)
} else {
this.addPolygon(polygonStringResult)
}
this.addPolygon(this.polygonStringResult)
}, },
handleSetOffset () { handleSetOffset () {
@ -753,7 +812,7 @@ const vueGis = {
}, },
handleOffsetOk () { handleOffsetOk () {
let selPolygonString = "" let selPolygonString = ""
let offsetPolygonString = ''//
this.subAgencyArray.forEach(element => { this.subAgencyArray.forEach(element => {
if (element.id === this.selAgencyId && element.coordinates && element.coordinates.length > 0) { if (element.id === this.selAgencyId && element.coordinates && element.coordinates.length > 0) {
selPolygonString = element.coordinates selPolygonString = element.coordinates
@ -761,15 +820,21 @@ const vueGis = {
}); });
if (selPolygonString) { if (selPolygonString) {
this.saveOffset(tyhis.xOffset, this.yOffset, selPolygonString)
}
},
saveOffset (xOffset, yOffset, selPolygonString) {
let offsetPolygonString = ''//
let tempArray = selPolygonString.split(',') let tempArray = selPolygonString.split(',')
tempArray.forEach((element, index) => { tempArray.forEach((element, index) => {
let aaa = 0 let aaa = 0
if (index % 2 === 0) {// if (index % 2 === 0) {//
aaa = parseFloat(element) + parseFloat(this.xOffset) aaa = parseFloat(element) + parseFloat(xOffset)
} else { } else {
aaa = parseFloat(element) + parseFloat(this.yOffset) aaa = parseFloat(element) + parseFloat(yOffset)
} }
if (index % 2 !== 0) {// if (index % 2 !== 0) {//
@ -780,16 +845,7 @@ const vueGis = {
}); });
offsetPolygonString = offsetPolygonString.substring(0, offsetPolygonString.length - 1) offsetPolygonString = offsetPolygonString.substring(0, offsetPolygonString.length - 1)
}
console.log('selPolygonString', selPolygonString)
console.log('offsetPolygonString', offsetPolygonString)
this.addPolygon(offsetPolygonString) this.addPolygon(offsetPolygonString)
}, },
handleSetOffset () { handleSetOffset () {
this.handleOffsetCancel = false this.handleOffsetCancel = false
@ -924,7 +980,9 @@ const vueGis = {
let params = { let params = {
orgId: this.selAgency.id, orgId: this.selAgency.id,
level: this.selAgency.level, level: this.selAgency.level,
coordinates: coorString coordinates: coorString,
longitude: this.longitude,
latitude: this.latitude
} }
const { data, code, msg } = await requestPost(url, params) const { data, code, msg } = await requestPost(url, params)
@ -935,6 +993,7 @@ const vueGis = {
message: "绘制成功" message: "绘制成功"
}); });
if (this.dialogVisible) { if (this.dialogVisible) {
this.polygonManullyString = ' '
this.dialogVisible = false this.dialogVisible = false
} }
this.refreshMap(false) this.refreshMap(false)

Loading…
Cancel
Save