Browse Source

社区党建

V1.0
jiangyy 3 years ago
parent
commit
46b9d95275
  1. 196
      src/views/modules/communityParty/heart/heartDetail.vue
  2. 40
      src/views/modules/communityParty/heart/heartForm.vue
  3. 55
      src/views/modules/communityService/dqfwzx/cpts/edit.vue

196
src/views/modules/communityParty/heart/heartDetail.vue

@ -113,13 +113,13 @@
<div class="info-prop">
<span class="info-title-3">活动地图位置</span>
<div class="div_map2">
<div id="map_act_id"></div>
<div id="app_heart_detail_act"></div>
</div>
</div>
<div class="info-prop">
<span class="info-title-3">签到地图位置</span>
<div class="div_map2">
<div id="map_signin_id"></div>
<div id="app_heart_detail_signin"></div>
</div>
</div>
@ -227,10 +227,10 @@ export default {
methods: {
diaDestroy () {
if (map_act) {
map_act.destroy()
// map_act.destroy()
}
if (map_signin) {
map_signin.destroy()
// map_signin.destroy()
}
},
@ -242,9 +242,27 @@ export default {
await this.loadFormData()
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_act) {
this.initMap(this.formData.actLatitude, this.formData.actLongitude, this.formData.signInLatitude, this.formData.signInLongitude)
} else {
map_act.setCenter(this.formData.actLatitude, this.formData.actLongitude);
map_act.setMarker(this.formData.actLatitude, this.formData.actLongitude);
map_signin.setCenter(this.formData.signInLatitude, this.formData.signInLongitude);
map_signin.setMarker(this.formData.signInLatitude, this.formData.signInLongitude);
}
})
this.endLoading()
@ -292,150 +310,44 @@ export default {
return c || content
},
// init
initMap () {
//
var centerAct = new window.TMap.LatLng(this.formData.actLatitude, this.formData.actLongitude);
var centerSign = new window.TMap.LatLng(this.formData.signInLatitude, this.formData.signInLongitude);
// map TMap.Map()
map_act = new window.TMap.Map(document.getElementById("map_act_id"), {
center: centerAct, //
zoom: 17.2, //
pitch: 43.5, //
rotation: 45, //
});
map_signin = new window.TMap.Map(document.getElementById("map_signin_id"), {
center: centerSign, //
zoom: 17.2, //
pitch: 43.5, //
rotation: 45, //
});
// search_act = new window.TMap.service.Search({ pageSize: 10 });
//
markers_act = new TMap.MultiMarker({
map: map_act,
geometries: [],
});
infoWindowList_act = Array(10);
geocoder_act = new TMap.service.Geocoder(); //
// search_signin = new window.TMap.service.Search({ pageSize: 10 });
//
markers_signin = new TMap.MultiMarker({
map: map_signin,
geometries: [],
});
infoWindowList_signin = Array(10);
geocoder_signin = new TMap.service.Geocoder(); //
//
map_act.on("panend", (e) => {
this.handleMoveCenterAct(e);
});
this.handleMoveCenterAct();
//
map_signin.on("panend", (e) => {
this.handleMoveCenterSignin(e);
});
this.handleMoveCenterSignin();
},
initMap (latitude1, longitude1, latitude2, longitude2) {
setMarkerAct (lat, lng) {
markers_act.setGeometries([]);
markers_act.add([
map_act = new daiMap(
document.getElementById("app_heart_detail_act"),
{ latitude1, longitude1 },
{
id: "4",
styleId: "marker",
position: new TMap.LatLng(lat, lng),
properties: {
title: "marker4",
},
},
]);
},
zoom: 16.2, //
pitch: 43.5, //
rotation: 45, //
}
);
map_signin = new daiMap(
document.getElementById("app_heart_detail_signin"),
{ latitude2, longitude2 },
{
zoom: 16.2, //
pitch: 43.5, //
rotation: 45, //
}
);
// //
// map_act.on("dragend", (e) => {
// this.handleMoveCenterAct(e);
// });
handleMoveCenterAct (e) {
//
const center = map_act.getCenter();
const lat = center.getLat();
const lng = center.getLng();
this.formData.actLatitude = lat;
this.formData.actLongitude = lng;
this.setMarkerAct(lat, lng);
map_act.setCenter(latitude1, longitude1);
map_act.setMarker(latitude1, longitude1);
if (e && e.originalEvent) {
geocoder_act
.getAddress({ location: new TMap.LatLng(lat, lng) }) //
.then((result) => {
this.formData.actAddress = result.result.address;
});
}
},
setMarkerSignin (lat, lng) {
markers_signin.setGeometries([]);
markers_signin.add([
{
id: "4",
styleId: "marker",
position: new TMap.LatLng(lat, lng),
properties: {
title: "marker4",
},
},
]);
},
// //
// map_signin.on("dragend", (e) => {
// this.handleMoveCenterSignin(e);
// });
handleSearchMapSignin () {
infoWindowList_signin.forEach((infoWindow) => {
infoWindow.close();
});
infoWindowList_signin.length = 0;
markers_signin.setGeometries([]);
//
search_signin
.searchRectangle({
keyword: this.formData.signInAddress,
bounds: map_signin.getBounds(),
})
.then((result) => {
let { data } = result;
if (Array.isArray(data) && data.length > 0) {
const {
location: { lat, lng },
} = data[0];
map_signin.setCenter(new TMap.LatLng(lat, lng));
this.setMarkerSignin(lat, lng);
this.formData.signInLatitude = lat;
this.formData.signInLongitude = lng;
} else {
this.$message.error("未检索到相关位置坐标");
}
});
},
map_signin.setCenter(latitude2, longitude2);
map_signin.setMarker(latitude2, longitude2);
handleMoveCenterSignin (e) {
//
const center = map_signin.getCenter();
const lat = center.getLat();
const lng = center.getLng();
this.formData.signInLatitude = lat;
this.formData.signInLongitude = lng;
this.setMarkerSignin(lat, lng);
if (e && e.originalEvent) {
geocoder_signin
.getAddress({ location: new TMap.LatLng(lat, lng) }) //
.then((result) => {
this.formData.signInAddress = result.result.address;
});
}
},
handleCancle () {

40
src/views/modules/communityParty/heart/heartForm.vue

@ -183,7 +183,7 @@
<el-form-item label="签到有效范围(米)"
prop="signInRadius"
style="display: block"
label-width="150px">
label-width="160px">
<el-input-number class="item_width_2"
:min="0"
v-model="formData.signInRadius"
@ -205,7 +205,7 @@
:reserve-keyword="true"
placeholder="请输入关键词"
:remote-method="remoteMethodAct"
:loading="loading">
:loading="loadingAct">
<el-option v-for="(item,index) in searchOptionsAct"
@click.native="handleClickKeyAct(index)"
:key="item.value"
@ -243,7 +243,7 @@
:reserve-keyword="true"
placeholder="请输入关键词"
:remote-method="remoteMethodSignin"
:loading="loading">
:loading="loadingSignin">
<el-option v-for="(item,index) in searchOptionsSignin"
@click.native="handleClickKeySignin(index)"
:key="item.value"
@ -345,16 +345,7 @@ import daiMap from "@/utils/dai-map";
let loading; //
var map_act;
var search_act;
var markers_act;
var infoWindowList_act;
var geocoder_act; //
var map_signin;
var search_signin;
var markers_signin;
var infoWindowList_signin;
var geocoder_signin; //
export default {
data () {
@ -396,9 +387,13 @@ export default {
searchOptionsAct: [],
searchValueAct: '',
resultListAct: [],
loadingAct: false,
searchOptionsSignin: [],
searchValueSignin: '',
resultListSignin: [],
loadingSignin: false,
btnDisable: false,
customerId: "",
actId: "",
@ -481,9 +476,7 @@ export default {
mounted () {
this.customerId = localStorage.getItem("customerId");
this.loadSponsorlist();
// this.initMap();
// this.replayImgList.push()
},
methods: {
@ -509,7 +502,16 @@ export default {
}
this.$nextTick(() => {
this.initMap(this.formData.actLatitude, this.formData.actLongitude, this.formData.signInLatitude, this.formData.signInLongitude)
if (!map_act) {
this.initMap(this.formData.actLatitude, this.formData.actLongitude, this.formData.signInLatitude, this.formData.signInLongitude)
} else {
map_act.setCenter(this.formData.actLatitude, this.formData.actLongitude);
map_act.setMarker(this.formData.actLatitude, this.formData.actLongitude);
map_signin.setCenter(this.formData.signInLatitude, this.formData.signInLongitude);
map_signin.setMarker(this.formData.signInLatitude, this.formData.signInLongitude);
}
})
},
@ -784,10 +786,10 @@ export default {
async remoteMethodAct (query) {
if (query !== '') {
this.loading = true;
this.loadingAct = true;
const { msg, data } = await map_act.searchNearby(query);
this.loading = false;
this.loadingAct = false;
this.resultListAct = []
if (msg == "success" && data.resultList && data.resultList.length > 0) {
@ -814,10 +816,10 @@ export default {
async remoteMethodSignin (query) {
if (query !== '') {
this.loading = true;
this.loadingSign = true;
const { msg, data } = await map.searchNearby(query);
this.loading = false;
this.loadingSign = false;
this.resultListSignin = []
if (msg == "success" && data.resultList && data.resultList.length > 0) {

55
src/views/modules/communityService/dqfwzx/cpts/edit.vue

@ -31,18 +31,6 @@
</el-input>
</el-form-item>
<el-form-item label="社区地址"
prop="address"
label-width="150px"
style="display: block">
<el-input class="item_width_1"
maxlength="50"
show-word-limit
placeholder="请输入社区地址 "
v-model="dataForm.address">
</el-input>
</el-form-item>
<el-form-item label="办公时间"
prop="amStartTime"
label-width="150px"
@ -119,15 +107,15 @@
class="div_map"></div>
</div>
</el-form-item>
<el-form-item label="详细地址 "
<el-form-item label="社区地址"
prop="address"
label-width="150px"
style="display: block">
<el-input class="item_width_1"
maxlength="50"
show-word-limit
placeholder="请输入位置 "
v-model="formData.address">
placeholder="请输入社区地址 "
v-model="dataForm.address">
</el-input>
</el-form-item>
@ -254,6 +242,7 @@ export default {
searchOptions: [],
searchValue: '',
resultList: [],
loading: false,
btnDisable: false,
@ -330,7 +319,7 @@ export default {
async mounted () {
this.customerId = localStorage.getItem("customerId");
this.initMap();
},
methods: {
@ -394,7 +383,7 @@ export default {
initMap (latitude, longitude) {
map = new daiMap(
document.getElementById("app_ggfw"),
document.getElementById("app_dqfwzx"),
{ latitude, longitude },
{
zoom: 16.2, //
@ -417,13 +406,13 @@ export default {
async handleMoveCenter () {
//
const { lat, lng } = map.getCenter();
this.formData.latitude = lat;
this.formData.longitude = lng;
this.dataForm.latitude = lat;
this.dataForm.longitude = lng;
map.setMarker(lat, lng);
let { msg, data } = await map.getAddress(lat, lng);
if (msg == "success") {
this.formData.address = data.address
this.dataForm.address = data.address
this.searchValue = data.address
this.searchOptions = []
@ -466,9 +455,9 @@ export default {
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
this.dataForm.latitude = lonlat[1];
this.dataForm.longitude = lonlat[0];
this.dataForm.address = selPosition.address + selPosition.name
},
@ -480,8 +469,22 @@ export default {
if (row) {
this.dataForm = { ...this.dataForm, ...row };
this.partyServiceCenterId = this.dataForm.partyServiceCenterId;
map.setCenter(new TMap.LatLng(row.latitude, row.longitude));
} else {
this.dataForm.latitude = latitude
this.dataForm.longitude = longitude
}
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);
}
})
},
async handleComfirm () {
@ -553,6 +556,10 @@ export default {
this.$emit("dialogCancle");
},
resetData () {
this.searchValue = ''
this.searchOptions = []
this.resultList = []
this.partyServiceCenterId = "";
this.dataForm = {
centerName: "",

Loading…
Cancel
Save