Browse Source

Merge branch 'dev-天地图' into dev

dev-用户反馈
jiangyy 3 years ago
parent
commit
c45c2fd496
  1. 140
      src/views/modules/communityParty/regionalParty/activitysDetail.vue
  2. 196
      src/views/modules/communityParty/regionalParty/activitysForm.vue
  3. 141
      src/views/modules/communityParty/regionalParty/unitsDetail.vue
  4. 191
      src/views/modules/communityParty/regionalParty/unitsForm.vue
  5. 215
      src/views/modules/partymember/icpartyorg-add-or-update.vue
  6. 113
      src/views/modules/visual/command/cpts/map.vue
  7. 139
      src/views/modules/visual/cpts/map/index.vue
  8. 160
      src/views/modules/visual/cpts/map/index2.vue

140
src/views/modules/communityParty/regionalParty/activitysDetail.vue

@ -43,7 +43,7 @@
<span class="info-title-2">活动地图</span>
<div class="div_map">
<div id="app_act_detail"></div>
<div id="app_detail_activity"></div>
</div>
</div>
@ -101,7 +101,7 @@ export default {
diaDestroy () {
if (map) {
map.destroy()
// map.destroy()
}
},
@ -120,122 +120,54 @@ export default {
this.initLoading = true
let { latitude, longitude } = this.$store.state.user;
console.log('lat' + latitude + ',lon' + longitude)
if (this.formData.latitude && this.formData.longitude) {
latitude = this.formData.latitude
longitude = this.formData.longitude
}
if (!latitude || latitude == "" || latitude == "0") {
latitude = 39.9088810666821;
longitude = 116.39743841556731;
}
this.$nextTick(() => {
this.initMap()
if (!map) {
this.initMap(latitude, longitude)
} else {
map.setCenter(latitude, longitude);
map.setMarker(latitude, longitude);
}
})
this.endLoading()
},
// init
initMap () {
//
var center = new window.TMap.LatLng(this.formData.latitude, this.formData.longitude)
// map TMap.Map()
map = new window.TMap.Map(document.getElementById('app_act_detail'), {
center: center, //
zoom: 17.2, //
pitch: 43.5, //
rotation: 45 //
})
search = new window.TMap.service.Search({ pageSize: 10 })
//
markers = new TMap.MultiMarker({
map: map,
geometries: []
})
infoWindowList = Array(10)
geocoder = new TMap.service.Geocoder(); //
//
map.on('panend', () => {
this.handleMoveCenter()
})
this.handleMoveCenter()
this.convert()
},
// init
initMap (latitude, longitude) {
setMarker (lat, lng) {
markers.setGeometries([])
markers.add([
map = new daiMap(
document.getElementById("app_detail_activity"),
{ latitude, longitude },
{
id: '4',
styleId: 'marker',
position: new TMap.LatLng(lat, lng),
properties: {
title: 'marker4'
}
zoom: 16.2, //
pitch: 43.5, //
rotation: 45, //
}
])
},
);
handleSearchMap () {
infoWindowList.forEach((infoWindow) => {
infoWindow.close()
})
infoWindowList.length = 0
markers.setGeometries([])
//
search
.searchRectangle({
keyword: this.keyWords,
bounds: map.getBounds()
})
.then((result) => {
let { data } = result
if (Array.isArray(data) && data.length > 0) {
const {
location: { lat, lng }
} = data[0]
map.setCenter(new TMap.LatLng(lat, lng))
this.setMarker(lat, lng)
this.formData.latitude = lat
this.formData.longitude = lng
this.convert()
} else {
this.$message.error('未检索到相关位置坐标')
}
})
},
// //
// map.on("dragend", (e) => {
// this.handleMoveCenter(e);
// });
handleMoveCenter () {
//
const center = map.getCenter()
const lat = center.getLat()
const lng = center.getLng()
this.formData.latitude = lat
this.formData.longitude = lng
this.setMarker(lat, lng)
this.convert(lat, lng)
},
map.setCenter(latitude, longitude);
map.setMarker(latitude, longitude);
convert (lat, lng) {
markers.setGeometries([]);
// var input = document.getElementById('location').value.split(',');
let location
if (lat && lng) {
location = new TMap.LatLng(lat, lng);
} else {
location = new TMap.LatLng(this.formData.latitude, this.formData.longitude);
}
// map.setCenter(location);
markers.updateGeometries([
{
id: 'main', //
position: location,
},
]);
geocoder
.getAddress({ location: location }) //
.then((result) => {
// this.formData.address = result.result.address
//
});
},
//

196
src/views/modules/communityParty/regionalParty/activitysForm.vue

@ -241,6 +241,10 @@ export default {
}
return {
formType: 'add', // addeditdetail
searchOptions: [],
searchValue: '',
resultList: [],
loading: false,
btnDisable: false,
@ -255,7 +259,7 @@ export default {
},
components: { Tinymce },
mounted () {
this.initMap()
// this.initMap()
},
@ -270,13 +274,6 @@ export default {
await this.loadService()
let { latitude, longitude } = this.$store.state.user;
if (!latitude || latitude == "" || latitude == "0") {
latitude = 39.9088810666821;
longitude = 116.39743841556731;
}
this.formData.latitude = latitude
this.formData.longitude = longitude
this.formType = type
if (activityId) {
@ -284,11 +281,17 @@ export default {
this.formData.id = activityId
await this.loadFormData()
} else {
this.formData.latitude = latitude
this.formData.longitude = longitude
}
map.setCenter(new TMap.LatLng(this.formData.latitude, this.formData.longitude))
this.setMarker(this.formData.latitude, this.formData.longitude)
this.$nextTick(() => {
if (!map) {
this.initMap(this.formData.latitude, this.formData.longitude);
} else {
map.setCenter(this.formData.latitude, this.formData.longitude);
map.setMarker(this.formData.latitude, this.formData.longitude);
}
})
this.endLoading()
},
@ -351,8 +354,7 @@ export default {
}
console.log(this.formData.content)
// map.setCenter(new TMap.LatLng(parseFloat(this.formData.latitude), parseFloat(this.formData.longitude)))
// this.setMarker(this.formData.latitude, this.formData.longitude)
} else {
this.$message.error(msg)
}
@ -404,118 +406,90 @@ export default {
},
// init
initMap () {
//
var center = new window.TMap.LatLng(36.0722275, 120.38945519)
// map TMap.Map()
map = new window.TMap.Map(document.getElementById('app'), {
center: center, //
zoom: 16.2, //
pitch: 43.5, //
rotation: 45 //
})
initMap (latitude, longitude) {
search = new window.TMap.service.Search({ pageSize: 10 })
//
markers = new TMap.MultiMarker({
map: map,
geometries: []
})
infoWindowList = Array(10)
geocoder = new TMap.service.Geocoder(); //
map = new daiMap(
document.getElementById("app_activity"),
{ latitude, longitude },
{
zoom: 16.2, //
pitch: 43.5, //
rotation: 45, //
}
);
//
map.on('panend', () => {
this.handleMoveCenter()
})
this.handleMoveCenter()
this.convert()
},
map.on("dragend", (e) => {
this.handleMoveCenter(e);
});
setMarker (lat, lng) {
markers.setGeometries([])
markers.add([
{
id: '4',
styleId: 'marker',
position: new TMap.LatLng(lat, lng),
properties: {
title: 'marker4'
}
}
])
},
map.setCenter(latitude, longitude);
map.setMarker(latitude, longitude);
handleSearchMap () {
infoWindowList.forEach((infoWindow) => {
infoWindow.close()
})
infoWindowList.length = 0
markers.setGeometries([])
//
search
.searchNearby({
keyword: this.keyWords,
radius: 1000,
autoExtend: true,
center: map.getCenter(),
})
.then((result) => {
let { data } = result
if (Array.isArray(data) && data.length > 0) {
const {
location: { lat, lng }
} = data[0]
map.setCenter(new TMap.LatLng(lat, lng))
this.setMarker(lat, lng)
this.formData.latitude = lat
this.formData.longitude = lng
this.convert()
} else {
this.$message.error('未检索到相关位置坐标')
}
})
},
handleMoveCenter () {
async handleMoveCenter () {
//
const center = map.getCenter()
const lat = center.getLat()
const lng = center.getLng()
this.formData.latitude = lat
this.formData.longitude = lng
this.setMarker(lat, lng)
this.convert(lat, lng)
const { lat, lng } = map.getCenter();
this.formData.latitude = lat;
this.formData.longitude = lng;
map.setMarker(lat, lng);
let { msg, data } = await map.getAddress(lat, lng);
if (msg == "success") {
this.formData.address = data.address
this.searchValue = data.address
this.searchOptions = []
}
},
convert (lat, lng) {
markers.setGeometries([]);
// var input = document.getElementById('location').value.split(',');
let location
if (lat && lng) {
location = new TMap.LatLng(lat, lng);
async remoteMethod (query) {
if (query !== '') {
this.loading = true;
const { msg, data } = await map.searchNearby(query);
this.loading = false;
this.resultList = []
if (msg == "success" && data.resultList && data.resultList.length > 0) {
if (data.resultList && data.resultList.length > 0) {
this.resultList = data.resultList
this.searchOptions = this.resultList.map(item => {
return { value: `${item.hotPointID}`, label: `${item.address + item.name}` };
});
}
} else {
this.searchOptions = [
{
value: '0',
label: '未检索到结果'
}
]
}
} else {
location = new TMap.LatLng(this.formData.latitude, this.formData.longitude);
this.searchOptions = [];
}
// map.setCenter(location);
markers.updateGeometries([
{
id: 'main', //
position: location,
},
]);
geocoder
.getAddress({ location: location }) //
.then((result) => {
this.formData.address = result.result.address
//
});
},
handleClickKey (index) {
let selPosition = this.resultList[index]
let lonlat = selPosition.lonlat.split(" ")
map.setCenter(lonlat[1], lonlat[0]);
map.setMarker(lonlat[1], lonlat[0]);
this.formData.latitude = lonlat[1];
this.formData.longitude = lonlat[0];
this.formData.address = selPosition.address + selPosition.name
},
resetData () {
this.searchValue = ''
this.searchOptions = []
this.resultList = []
this.activityId = ''
this.keyWords = ''
this.formData = {

141
src/views/modules/communityParty/regionalParty/unitsDetail.vue

@ -45,7 +45,7 @@
<span class="info-title-2">地图位置</span>
<div class="div_map">
<div id="app_detail"></div>
<div id="app_detail_unit"></div>
</div>
</div>
@ -96,7 +96,7 @@ export default {
diaDestroy () {
if (map) {
map.destroy()
// map.destroy()
}
},
@ -107,22 +107,11 @@ export default {
this.initLoading = true
console.log(this.formData)
// await nextTick(200)
this.$nextTick(() => {
this.initMap()
})
this.endLoading()
},
// init
initMap () {
//
let { latitude, longitude } = this.$store.state.user;
console.log('lat' + latitude + ',lon' + longitude)
if (this.formData.latitude && this.formData.longitude) {
latitude = this.formData.latitude
longitude = this.formData.longitude
}
@ -130,116 +119,44 @@ export default {
latitude = 39.9088810666821;
longitude = 116.39743841556731;
}
// debugger
console.log('lat' + latitude + ',lon' + longitude)
var center = new window.TMap.LatLng(latitude, longitude)
// map TMap.Map()
map = new window.TMap.Map(document.getElementById('app_detail'), {
center: center, //
zoom: 17.2, //
pitch: 43.5, //
rotation: 45 //
})
this.$nextTick(() => {
if (!map) {
this.initMap(latitude, longitude)
} else {
map.setCenter(latitude, longitude);
map.setMarker(latitude, longitude);
}
search = new window.TMap.service.Search({ pageSize: 10 })
//
markers = new TMap.MultiMarker({
map: map,
geometries: []
})
infoWindowList = Array(10)
geocoder = new TMap.service.Geocoder(); //
this.endLoading()
//
map.on('panend', () => {
this.handleMoveCenter()
})
this.handleMoveCenter()
this.convert()
},
setMarker (lat, lng) {
markers.setGeometries([])
markers.add([
// init
initMap (latitude, longitude) {
map = new daiMap(
document.getElementById("app_detail_unit"),
{ latitude, longitude },
{
id: '4',
styleId: 'marker',
position: new TMap.LatLng(lat, lng),
properties: {
title: 'marker4'
}
zoom: 16.2, //
pitch: 43.5, //
rotation: 45, //
}
])
},
);
handleSearchMap () {
infoWindowList.forEach((infoWindow) => {
infoWindow.close()
})
infoWindowList.length = 0
markers.setGeometries([])
//
search
.searchRectangle({
keyword: this.keyWords,
bounds: map.getBounds()
})
.then((result) => {
let { data } = result
if (Array.isArray(data) && data.length > 0) {
const {
location: { lat, lng }
} = data[0]
map.setCenter(new TMap.LatLng(lat, lng))
this.setMarker(lat, lng)
this.formData.latitude = lat
this.formData.longitude = lng
this.convert()
} else {
this.$message.error('未检索到相关位置坐标')
}
})
},
// //
// map.on("dragend", (e) => {
// this.handleMoveCenter(e);
// });
handleMoveCenter () {
//
const center = map.getCenter()
const lat = center.getLat()
const lng = center.getLng()
this.formData.latitude = lat
this.formData.longitude = lng
this.setMarker(lat, lng)
this.convert(lat, lng)
},
map.setCenter(latitude, longitude);
map.setMarker(latitude, longitude);
convert (lat, lng) {
markers.setGeometries([]);
// var input = document.getElementById('location').value.split(',');
let location
if (lat && lng) {
location = new TMap.LatLng(lat, lng);
} else {
location = new TMap.LatLng(this.formData.latitude, this.formData.longitude);
}
// map.setCenter(location);
markers.updateGeometries([
{
id: 'main', //
position: location,
},
]);
geocoder
.getAddress({ location: location }) //
.then((result) => {
// this.formData.address = result.result.address
//
});
},
//
startLoading () {
loading = Loading.service({

191
src/views/modules/communityParty/regionalParty/unitsForm.vue

@ -176,6 +176,10 @@ export default {
}
return {
formType: 'add', // addeditdetail
searchOptions: [],
searchValue: '',
resultList: [],
loading: false,
btnDisable: false,
@ -202,13 +206,7 @@ export default {
await this.loadService()
let { latitude, longitude } = this.$store.state.user;
if (!latitude || latitude == "" || latitude == "0") {
latitude = 39.9088810666821;
longitude = 116.39743841556731;
}
this.formData.latitude = latitude
this.formData.longitude = longitude
this.formType = type
if (unitId) {
@ -216,14 +214,13 @@ export default {
this.formData.id = unitId
await this.loadFormData()
} else {
this.formData.latitude = latitude
this.formData.longitude = longitude
}
this.$nextTick(() => {
this.initMap()
this.setMarker(this.formData.latitude, this.formData.longitude)
})
// if (!map) {
this.initMap(this.formData.latitude, this.formData.longitude);
// }
@ -266,8 +263,7 @@ export default {
}
this.formData = { ...data }
// map.setCenter(new TMap.LatLng(this.formData.latitude, this.formData.longitude))
// this.setMarker(this.formData.latitude, this.formData.longitude)
} else {
this.$message.error(msg)
}
@ -333,123 +329,94 @@ export default {
},
// init
initMap () {
//
var center = new window.TMap.LatLng(this.formData.latitude, this.formData.longitude)
// map TMap.Map()
map = new window.TMap.Map(document.getElementById('app'), {
center: center, //
zoom: 16.2, //
pitch: 43.5, //
rotation: 45 //
})
search = new window.TMap.service.Search({ pageSize: 10 })
//
markers = new TMap.MultiMarker({
map: map,
geometries: []
})
infoWindowList = Array(10)
initMap (latitude, longitude) {
geocoder = new TMap.service.Geocoder(); //
map = new daiMap(
document.getElementById("app_unit"),
{ latitude, longitude },
{
zoom: 16.2, //
pitch: 43.5, //
rotation: 45, //
}
);
//
map.on('panend', () => {
this.handleMoveCenter()
})
this.handleMoveCenter()
this.convert()
},
map.on("dragend", (e) => {
this.handleMoveCenter(e);
});
setMarker (lat, lng) {
markers.setGeometries([])
markers.add([
{
id: '4',
styleId: 'marker',
position: new TMap.LatLng(lat, lng),
properties: {
title: 'marker4'
}
}
])
},
map.setCenter(latitude, longitude);
map.setMarker(latitude, longitude);
handleSearchMap () {
infoWindowList.forEach((infoWindow) => {
infoWindow.close()
})
infoWindowList.length = 0
markers.setGeometries([])
//
search
.searchNearby({
keyword: this.keyWords,
radius: 1000,
autoExtend: true,
center: map.getCenter(),
})
.then((result) => {
let { data } = result
if (Array.isArray(data) && data.length > 0) {
const {
location: { lat, lng }
} = data[0]
map.setCenter(new TMap.LatLng(lat, lng))
this.setMarker(lat, lng)
this.formData.latitude = lat
this.formData.longitude = lng
this.convert()
} else {
this.$message.error('未检索到相关位置坐标')
}
})
},
handleMoveCenter () {
async handleMoveCenter () {
//
const center = map.getCenter()
const lat = center.getLat()
const lng = center.getLng()
this.formData.latitude = lat
this.formData.longitude = lng
this.setMarker(lat, lng)
this.convert(lat, lng)
const { lat, lng } = map.getCenter();
this.formData.latitude = lat;
this.formData.longitude = lng;
map.setMarker(lat, lng);
let { msg, data } = await map.getAddress(lat, lng);
if (msg == "success") {
this.formData.address = data.address
this.searchValue = data.address
this.searchOptions = []
}
},
convert (lat, lng) {
markers.setGeometries([]);
// var input = document.getElementById('location').value.split(',');
let location
if (lat && lng) {
location = new TMap.LatLng(lat, lng);
async remoteMethod (query) {
if (query !== '') {
this.loading = true;
const { msg, data } = await map.searchNearby(query);
this.loading = false;
this.resultList = []
if (msg == "success" && data.resultList && data.resultList.length > 0) {
if (data.resultList && data.resultList.length > 0) {
this.resultList = data.resultList
this.searchOptions = this.resultList.map(item => {
return { value: `${item.hotPointID}`, label: `${item.address + item.name}` };
});
}
} else {
this.searchOptions = [
{
value: '0',
label: '未检索到结果'
}
]
}
} else {
location = new TMap.LatLng(this.formData.latitude, this.formData.longitude);
this.searchOptions = [];
}
},
// map.setCenter(location);
markers.updateGeometries([
{
id: 'main', //
position: location,
},
]);
geocoder
.getAddress({ location: location }) //
.then((result) => {
this.formData.address = result.result.address
//
});
handleClickKey (index) {
let selPosition = this.resultList[index]
let lonlat = selPosition.lonlat.split(" ")
map.setCenter(lonlat[1], lonlat[0]);
map.setMarker(lonlat[1], lonlat[0]);
this.formData.latitude = lonlat[1];
this.formData.longitude = lonlat[0];
this.formData.address = selPosition.address + selPosition.name
},
resetData () {
this.searchValue = ''
this.searchOptions = []
this.resultList = []
if (map) {
console.log(map)
map.destroy()
// map.destroy()
}
this.unitId = ''
this.keyWords = ''

215
src/views/modules/partymember/icpartyorg-add-or-update.vue

@ -88,7 +88,6 @@
</el-form-item>
<el-form-item label="地图位置"
prop="longitude"
label-width="150px"
style="display: block">
<div style="width: 500px">
<el-select v-model="searchValue"
@ -110,9 +109,15 @@
class="div_map"></div>
</div>
</el-form-item>
<el-form-item label="详细地址"
prop="address">
<el-input style="width: 300px"
v-model="dataForm.address"
placeholder="详细地址"></el-input>
</el-form-item>
</el-form>
<template slot="footer">
<el-button @click="visible = false">{{ $t("cancel") }}</el-button>
<el-button @click="handleCancle">{{ $t("cancel") }}</el-button>
<el-button type="primary"
@click="dataFormSubmitHandle()">{{
$t("confirm")
@ -134,6 +139,11 @@ import debounce from "lodash/debounce";
export default {
data () {
return {
searchOptions: [],
searchValue: '',
resultList: [],
loading: false,
visible: false,
keyWords: "",
dataForm: {
@ -168,6 +178,15 @@ export default {
};
},
methods: {
handleCancle () {
this.resetData()
this.visible = false
},
resetData () {
this.searchValue = ''
this.searchOptions = []
this.resultList = []
},
init () {
this.visible = true;
this.agencyId = localStorage.getItem("agencyId");
@ -184,7 +203,15 @@ export default {
this.getInfo();
} else {
this.setPartyOrgType();
this.initMap();
let { latitude, longitude } = this.$store.state.user;
this.$nextTick(() => {
if (!map) {
this.initMap(latitude, longitude);
} else {
map.setCenter(latitude, longitude);
map.setMarker(latitude, longitude);
}
})
if (this.dataForm.orgId) {
this.dataForm.mySelectOrg = this.dataForm.orgId;
this.dataForm.orgPid = this.dataForm.orgId;
@ -372,7 +399,15 @@ export default {
this.getInfoAgencyLisy();
//
this.getOrgList();
this.initMap();
this.$nextTick(() => {
if (!map) {
this.initMap(this.dataForm.latitude, this.dataForm.longitude);
} else {
map.setCenter(this.dataForm.latitude, this.dataForm.longitude);
map.setMarker(this.dataForm.latitude, this.dataForm.longitude);
}
})
})
.catch(() => { });
},
@ -395,128 +430,84 @@ export default {
.catch(() => { });
},
// init
initMap () {
document.getElementById("app").innerHTML = "";
if (document.getElementById("app")) {
document.getElementById("mapSeach_id").style.display = "block";
// document.getElementById('lon_lat_id').style.display = "block"
}
initMap (latitude, longitude) {
//
var center = new window.TMap.LatLng(
this.dataForm.latitude ? this.dataForm.latitude : 36.0722275,
this.dataForm.longitude ? this.dataForm.longitude : 120.38945519
map = new daiMap(
document.getElementById("app_icparty"),
{ latitude, longitude },
{
zoom: 16.2, //
pitch: 43.5, //
rotation: 45, //
}
);
// map TMap.Map()
map = new window.TMap.Map(document.getElementById("app"), {
center: center, //
zoom: 16.2, //
pitch: 43.5, //
rotation: 45, //
});
search = new window.TMap.service.Search({ pageSize: 10 });
//
markers = new TMap.MultiMarker({
map: map,
geometries: [],
//
map.on("dragend", (e) => {
this.handleMoveCenter(e);
});
infoWindowList = Array(10);
geocoder = new TMap.service.Geocoder(); //
map.setCenter(latitude, longitude);
map.setMarker(latitude, longitude);
//
map.on("panend", () => {
this.handleMoveCenter();
});
this.handleMoveCenter();
this.convert();
},
setMarker (lat, lng) {
markers.setGeometries([]);
markers.add([
{
id: "4",
styleId: "marker",
position: new TMap.LatLng(lat, lng),
properties: {
title: "marker4",
},
},
]);
},
handleSearchMap () {
infoWindowList.forEach((infoWindow) => {
infoWindow.close();
});
infoWindowList.length = 0;
markers.setGeometries([]);
//
search
.searchNearby({
keyword: this.keyWords,
radius: 1000,
autoExtend: true,
center: map.getCenter(),
})
.then((result) => {
let { data } = result;
if (Array.isArray(data) && data.length > 0) {
const {
location: { lat, lng },
} = data[0];
map.setCenter(new TMap.LatLng(lat, lng));
this.setMarker(lat, lng);
this.dataForm.latitude = lat;
this.dataForm.longitude = lng;
this.convert();
} else {
this.$message.error("未检索到相关位置坐标");
}
});
},
handleMoveCenter () {
async handleMoveCenter () {
//
const center = map.getCenter();
const lat = center.getLat();
const lng = center.getLng();
if (lng === 120.38945519) {
this.dataForm.latitude = "";
this.dataForm.longitude = "";
} else {
this.dataForm.latitude = lat;
this.dataForm.longitude = lng;
const { lat, lng } = map.getCenter();
this.dataForm.latitude = lat;
this.dataForm.longitude = lng;
map.setMarker(lat, lng);
let { msg, data } = await map.getAddress(lat, lng);
if (msg == "success") {
this.dataForm.address = data.address
this.searchValue = data.address
this.searchOptions = []
}
this.setMarker(lat, lng);
this.convert(lat, lng);
},
convert (lat, lng) {
markers.setGeometries([]);
// var input = document.getElementById('location').value.split(':');
let location;
if (lat && lng) {
location = new TMap.LatLng(lat, lng);
async remoteMethod (query) {
if (query !== '') {
this.loading = true;
const { msg, data } = await map.searchNearby(query);
this.loading = false;
this.resultList = []
if (msg == "success" && data.resultList && data.resultList.length > 0) {
if (data.resultList && data.resultList.length > 0) {
this.resultList = data.resultList
this.searchOptions = this.resultList.map(item => {
return { value: `${item.hotPointID}`, label: `${item.address + item.name}` };
});
}
} else {
this.searchOptions = [
{
value: '0',
label: '未检索到结果'
}
]
}
} else {
location = new TMap.LatLng(
this.dataForm.latitude,
this.dataForm.longitude
);
this.searchOptions = [];
}
// map.setCenter(location);
markers.updateGeometries([
{
id: "main", //
position: location,
},
]);
//
geocoder.getAddress({ location: location }).then((result) => {
this.dataForm.address = result.result.address;
//
});
},
handleClickKey (index) {
let selPosition = this.resultList[index]
let lonlat = selPosition.lonlat.split(" ")
map.setCenter(lonlat[1], lonlat[0]);
map.setMarker(lonlat[1], lonlat[0]);
this.dataForm.latitude = lonlat[1];
this.dataForm.longitude = lonlat[0];
this.dataForm.address = selPosition.address + selPosition.name
},
//
dataFormSubmitHandle: debounce(
@ -550,7 +541,9 @@ export default {
type: "success",
duration: 500,
onClose: () => {
this.resetData()
this.visible = false;
this.$emit("refreshDataList");
},
});

113
src/views/modules/visual/command/cpts/map.vue

@ -1,14 +1,22 @@
<template>
<div class="m-map">
<div class="m-map" :class="{ 'z-td': mapType == 'td' }">
<div id="map"></div>
<div
class="btn"
v-if="mapStyleType == 'light'"
v-show="mapType != 'td'"
@click="shiftMapStyle('dark')"
>
切换深色模式
</div>
<div class="btn" v-else @click="shiftMapStyle('light')">切换浅色模式</div>
<div
class="btn"
v-show="mapType != 'td'"
v-else
@click="shiftMapStyle('light')"
>
切换浅色模式
</div>
<cpt-popup
ref="popup"
@ -52,12 +60,34 @@ let countTextBgLayer;
let searchMarker;
let searchBgLayer;
function reversePix(pixelsTemp) {
//
for (var i = 0; i < pixelsTemp.length; i += 4) {
var r = pixelsTemp[i];
var g = pixelsTemp[i + 1];
var b = pixelsTemp[i + 2];
//
var grey = r * 0.3 + g * 0.59 + b * 0.11;
//rgb
pixelsTemp[i] = grey;
pixelsTemp[i + 1] = grey;
pixelsTemp[i + 2] = grey;
//
pixelsTemp[i] = 55 - pixelsTemp[i];
pixelsTemp[i + 1] = 255 - pixelsTemp[i + 1];
pixelsTemp[i + 2] = 305 - pixelsTemp[i + 2];
}
}
export default {
name: "l7",
inject: ["refresh"],
data() {
return {
mapType,
mapStyleType: localStorage.getItem("mapStyle") || "dark",
// srcGridData: {},
darkStyle: {
@ -377,39 +407,48 @@ export default {
//
iniMapBase(scene) {
console.log("-----------------iniMapBase");
//
const baseLayer = new RasterLayer({
zIndex: 1,
});
baseLayer.source(
"http://t4.tianditu.com/DataServer?T=vec_w&tk=8a08c117ab9ee45d508686b01cc8d397&x={x}&y={y}&l={z}",
{
parser: {
type: "rasterTile",
tileSize: 256,
// minZoom: 6,
// maxZoom: 15,
zoomOffset: 0,
},
}
);
baseLayer
.source(
"http://t7.tianditu.com/DataServer?T=vec_w&tk=8a08c117ab9ee45d508686b01cc8d397&x={x}&y={y}&l={z}",
{
parser: {
type: "rasterTile",
tileSize: 256,
// minZoom: 6,
// maxZoom: 15,
zoomOffset: 0,
},
}
)
.style({
opacity: 0.7,
});
//
const annotionLayer = new RasterLayer({
zIndex: 2,
});
annotionLayer.source(
"https://t4.tianditu.com/DataServer?T=cva_w&X={x}&Y={y}&L={z}&tk=8a08c117ab9ee45d508686b01cc8d397",
{
parser: {
type: "rasterTile",
tileSize: 256,
// minZoom: 6,
// maxZoom: 15,
zoomOffset: 0,
},
}
);
annotionLayer
.source(
"http://t7.tianditu.com/DataServer?T=cva_w&tk=8a08c117ab9ee45d508686b01cc8d397&x={x}&y={y}&l={z}",
{
parser: {
type: "rasterTile",
tileSize: 256,
// minZoom: 6,
// maxZoom: 15,
zoomOffset: 0,
},
}
)
.style({
opacity: 0.5,
});
scene.addLayer(baseLayer);
scene.addLayer(annotionLayer);
@ -893,6 +932,26 @@ export default {
border-radius: 10px;
overflow: hidden;
&.z-td {
#app {
/deep/ .l7-scene {
canvas {
background-color: rgba(43, 51, 73, 0.82);
background-image: radial-gradient(
rgba(0, 0, 0, 0),
rgba(0, 0, 0, 0.3),
#000
);
}
.gray {
-webkit-filter: grayscale(100%);
filter: grayscale(100%);
opacity: 0.7;
}
}
}
}
/deep/ .l7-popup-content {
background: rgba(#020340, 0.58);
box-shadow: 0 0 20px 3px inset rgba(#22f, 0.1);
@ -903,7 +962,7 @@ export default {
color: rgba(#fff, 0.8);
}
#app {
#map {
width: 100%;
height: 100%;
}

139
src/views/modules/visual/cpts/map/index.vue

@ -1,14 +1,22 @@
<template>
<div class="m-map">
<div class="m-map" :class="{ 'z-td': mapType == 'td' }">
<div id="map"></div>
<div
class="btn"
v-if="mapStyleType == 'light'"
v-show="mapType != 'td'"
@click="shiftMapStyle('dark')"
>
切换深色模式
</div>
<div class="btn" v-else @click="shiftMapStyle('light')">切换浅色模式</div>
<div
class="btn"
v-show="mapType != 'td'"
v-else
@click="shiftMapStyle('light')"
>
切换浅色模式
</div>
</div>
</template>
@ -17,10 +25,18 @@ import { requestPost } from "@/js/dai/request";
import cptCard from "@/views/modules/visual/cpts/card";
import cptTb from "@/views/modules/visual/cpts/tb";
import nextTick from "dai-js/tools/nextTick";
import { Scene, PolygonLayer, LineLayer, PointLayer } from "@antv/l7";
import {
Scene,
PolygonLayer,
LineLayer,
RasterLayer,
PointLayer,
} from "@antv/l7";
import { GaodeMap, Map } from "@antv/l7-maps";
import { spliceIntoChunks } from "@/utils/index";
import { mapType, searchNearby } from "@/utils/dai-map";
let myMap;
let scene;
let polygonLayer;
let lineLayer;
@ -37,6 +53,8 @@ export default {
data() {
return {
mapType,
mapStyleType: localStorage.getItem("mapStyle") || "dark",
// srcGridData: {},
darkStyle: {
@ -240,7 +258,6 @@ export default {
};
},
dotData2() {
const { dotList2 } = this;
return {
@ -293,29 +310,44 @@ export default {
styleConfig = lightStyle;
}
scene = new Scene({
id: "map",
logoVisible: false,
map: new GaodeMap({
const iniCenter = [
srcGridData.longitude ||
this.$store.state.user.longitude ||
116.39743841556731,
srcGridData.latitude ||
this.$store.state.user.latitude ||
39.9088810666821,
];
if (mapType == "td") {
myMap = new Map({
center: iniCenter,
zoom: 18,
});
} else {
myMap = new GaodeMap({
pitch: this.pitch,
style: styleConfig.style,
center: [
srcGridData.longitude ||
this.$store.state.user.longitude ||
116.39743841556731,
srcGridData.latitude ||
this.$store.state.user.latitude ||
39.9088810666821,
],
center: iniCenter,
token: "fc14b42e0ca18387866d68ebd4f150c1",
zoom: 18,
isHotspot: false,
resizeEnable: true,
doubleClickZoom: false,
}),
});
}
scene = new Scene({
id: "map",
logoVisible: false,
map: myMap,
});
scene.on("loaded", async () => {
if (mapType == "td") {
this.iniMapBase(scene);
}
this.iniMapGrid(scene);
this.iniMapDot(scene);
this.iniMapDot2(scene);
@ -324,6 +356,55 @@ export default {
});
},
//
iniMapBase(scene) {
console.log("-----------------iniMapBase");
//
const baseLayer = new RasterLayer({
zIndex: 1,
});
baseLayer
.source(
"http://t7.tianditu.com/DataServer?T=vec_w&tk=8a08c117ab9ee45d508686b01cc8d397&x={x}&y={y}&l={z}",
{
parser: {
type: "rasterTile",
tileSize: 256,
// minZoom: 6,
// maxZoom: 15,
zoomOffset: 0,
},
}
)
.style({
opacity: 0.7,
});
//
const annotionLayer = new RasterLayer({
zIndex: 2,
});
annotionLayer
.source(
"http://t7.tianditu.com/DataServer?T=cva_w&tk=8a08c117ab9ee45d508686b01cc8d397&x={x}&y={y}&l={z}",
{
parser: {
type: "rasterTile",
tileSize: 256,
// minZoom: 6,
// maxZoom: 15,
zoomOffset: 0,
},
}
)
.style({
opacity: 0.5,
});
scene.addLayer(baseLayer);
scene.addLayer(annotionLayer);
},
iniMapGrid(scene) {
const { darkStyle, lightStyle, polygonData, polygonDotData } = this;
@ -560,7 +641,7 @@ export default {
},
updateGrid() {
const { polygonData,polygonDotData } = this;
const { polygonData, polygonDotData } = this;
if (polygonLayer) {
polygonLayer.setData(polygonData);
lineLayer.setData(polygonData);
@ -597,7 +678,27 @@ export default {
border-radius: 10px;
overflow: hidden;
#app {
&.z-td {
#app {
/deep/ .l7-scene {
canvas {
background-color: rgba(43, 51, 73, 0.82);
background-image: radial-gradient(
rgba(0, 0, 0, 0),
rgba(0, 0, 0, 0.3),
#000
);
}
.gray {
-webkit-filter: grayscale(100%);
filter: grayscale(100%);
opacity: 0.7;
}
}
}
}
#map {
width: 100%;
height: 100%;
}

160
src/views/modules/visual/cpts/map/index2.vue

@ -1,14 +1,22 @@
<template>
<div class="m-map">
<div class="m-map" :class="{ 'z-td': mapType == 'td' }">
<div id="map"></div>
<div
class="btn"
v-if="mapStyleType == 'light'"
@click="shiftMapStyle('dark')"
v-show="mapType != 'td'"
>
切换深色模式
</div>
<div class="btn" v-else @click="shiftMapStyle('light')">切换浅色模式</div>
<div
class="btn"
v-show="mapType != 'td'"
v-else
@click="shiftMapStyle('light')"
>
切换浅色模式
</div>
</div>
</template>
@ -17,10 +25,19 @@ import { requestPost } from "@/js/dai/request";
import cptCard from "@/views/modules/visual/cpts/card";
import cptTb from "@/views/modules/visual/cpts/tb";
import nextTick from "dai-js/tools/nextTick";
import { Scene, PolygonLayer, LineLayer, PointLayer, Popup } from "@antv/l7";
import {
Scene,
PolygonLayer,
LineLayer,
PointLayer,
RasterLayer,
Popup,
} from "@antv/l7";
import { GaodeMap, Map } from "@antv/l7-maps";
import { spliceIntoChunks } from "@/utils/index";
import { mapType, searchNearby } from "@/utils/dai-map";
let myMap;
let scene;
let polygonLayer;
let lineLayer;
@ -29,7 +46,7 @@ let posLayer;
let circleLayer;
let dotLayer;
let dotBgLayer;
let dotLayer2
let dotLayer2;
export default {
name: "l7",
@ -37,6 +54,8 @@ export default {
data() {
return {
mapType,
mapStyleType: localStorage.getItem("mapStyle") || "dark",
// srcGridData: {},
darkStyle: {
@ -98,7 +117,7 @@ export default {
},
isArea: {
type: Boolean,
default: false
default: false,
},
srcGridData: {
type: Object | Array,
@ -126,8 +145,8 @@ export default {
},
iconSize: {
type: Number,
default: 20
}
default: 20,
},
},
computed: {},
@ -152,9 +171,7 @@ export default {
polygonData() {
const { srcGridData, isArea } = this;
if (isArea) {
if (
!srcGridData || !Array.isArray(srcGridData)
) {
if (!srcGridData || !Array.isArray(srcGridData)) {
return { type: "FeatureCollection", features: [] };
}
} else {
@ -166,8 +183,8 @@ export default {
return { type: "FeatureCollection", features: [] };
}
}
const _Plo = isArea ? srcGridData : srcGridData.children
console.log('_Plo-----', _Plo)
const _Plo = isArea ? srcGridData : srcGridData.children;
console.log("_Plo-----", _Plo);
const polygon = [
..._Plo
.filter((item) => item.coordinates && item.coordinates.length > 0)
@ -257,7 +274,6 @@ export default {
};
},
dotData2() {
const { dotList2 } = this;
return {
@ -313,29 +329,44 @@ export default {
styleConfig = lightStyle;
}
scene = new Scene({
id: "map",
logoVisible: false,
map: new GaodeMap({
const iniCenter = [
srcGridData.longitude ||
this.$store.state.user.longitude ||
116.39743841556731,
srcGridData.latitude ||
this.$store.state.user.latitude ||
39.9088810666821,
];
if (mapType == "td") {
myMap = new Map({
center: iniCenter,
zoom: 18,
});
} else {
myMap = new GaodeMap({
pitch: this.pitch,
style: styleConfig.style,
center: [
srcGridData.longitude ||
this.$store.state.user.longitude ||
116.39743841556731,
srcGridData.latitude ||
this.$store.state.user.latitude ||
39.9088810666821,
],
center: iniCenter,
token: "fc14b42e0ca18387866d68ebd4f150c1",
zoom: 18,
isHotspot: false,
resizeEnable: true,
doubleClickZoom: false,
}),
});
}
scene = new Scene({
id: "map",
logoVisible: false,
map: myMap,
});
scene.on("loaded", async () => {
if (mapType == "td") {
this.iniMapBase(scene);
}
this.iniMapGrid(scene);
this.iniMapDot(scene);
this.iniMapDot2(scene);
@ -344,6 +375,55 @@ export default {
});
},
//
iniMapBase(scene) {
console.log("-----------------iniMapBase");
//
const baseLayer = new RasterLayer({
zIndex: 1,
});
baseLayer
.source(
"http://t7.tianditu.com/DataServer?T=vec_w&tk=8a08c117ab9ee45d508686b01cc8d397&x={x}&y={y}&l={z}",
{
parser: {
type: "rasterTile",
tileSize: 256,
// minZoom: 6,
// maxZoom: 15,
zoomOffset: 0,
},
}
)
.style({
opacity: 0.7,
});
//
const annotionLayer = new RasterLayer({
zIndex: 2,
});
annotionLayer
.source(
"http://t7.tianditu.com/DataServer?T=cva_w&tk=8a08c117ab9ee45d508686b01cc8d397&x={x}&y={y}&l={z}",
{
parser: {
type: "rasterTile",
tileSize: 256,
// minZoom: 6,
// maxZoom: 15,
zoomOffset: 0,
},
}
)
.style({
opacity: 0.5,
});
scene.addLayer(baseLayer);
scene.addLayer(annotionLayer);
},
iniMapGrid(scene) {
const { darkStyle, lightStyle, polygonData, polygonDotData } = this;
@ -411,7 +491,10 @@ export default {
});
scene.addLayer(circleLayer);
scene.addImage("pos-red", require("@/assets/img/shuju/grid/pos-red.png"));
scene.addImage(
"pos-red",
require("@/assets/img/shuju/grid/pos-red.png")
);
scene.addImage(
"pos-green",
require("@/assets/img/shuju/grid/pos-green.png")
@ -630,10 +713,31 @@ export default {
border-radius: 10px;
overflow: hidden;
#app {
#map {
width: 100%;
height: 100%;
}
&.z-td {
#app {
/deep/ .l7-scene {
canvas {
background-color: rgba(43, 51, 73, 0.82);
background-image: radial-gradient(
rgba(0, 0, 0, 0),
rgba(0, 0, 0, 0.3),
#000
);
}
.gray {
-webkit-filter: grayscale(100%);
filter: grayscale(100%);
opacity: 0.7;
}
}
}
}
.btn {
position: absolute;
bottom: 0;

Loading…
Cancel
Save