Browse Source

社区党建

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

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

@ -113,13 +113,13 @@
<div class="info-prop"> <div class="info-prop">
<span class="info-title-3">活动地图位置</span> <span class="info-title-3">活动地图位置</span>
<div class="div_map2"> <div class="div_map2">
<div id="map_act_id"></div> <div id="app_heart_detail_act"></div>
</div> </div>
</div> </div>
<div class="info-prop"> <div class="info-prop">
<span class="info-title-3">签到地图位置</span> <span class="info-title-3">签到地图位置</span>
<div class="div_map2"> <div class="div_map2">
<div id="map_signin_id"></div> <div id="app_heart_detail_signin"></div>
</div> </div>
</div> </div>
@ -227,10 +227,10 @@ export default {
methods: { methods: {
diaDestroy () { diaDestroy () {
if (map_act) { if (map_act) {
map_act.destroy() // map_act.destroy()
} }
if (map_signin) { if (map_signin) {
map_signin.destroy() // map_signin.destroy()
} }
}, },
@ -242,9 +242,27 @@ export default {
await this.loadFormData() await this.loadFormData()
this.initLoading = true 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.$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() this.endLoading()
@ -292,150 +310,44 @@ export default {
return c || content return c || content
}, },
// init // init
initMap () { initMap (latitude1, longitude1, latitude2, longitude2) {
//
var centerAct = new window.TMap.LatLng(this.formData.actLatitude, this.formData.actLongitude); map_act = new daiMap(
var centerSign = new window.TMap.LatLng(this.formData.signInLatitude, this.formData.signInLongitude); document.getElementById("app_heart_detail_act"),
// map TMap.Map() { latitude1, longitude1 },
map_act = new window.TMap.Map(document.getElementById("map_act_id"), { {
center: centerAct, // zoom: 16.2, //
zoom: 17.2, //
pitch: 43.5, // pitch: 43.5, //
rotation: 45, // rotation: 45, //
}); }
map_signin = new window.TMap.Map(document.getElementById("map_signin_id"), { );
center: centerSign, // map_signin = new daiMap(
zoom: 17.2, // document.getElementById("app_heart_detail_signin"),
{ latitude2, longitude2 },
{
zoom: 16.2, //
pitch: 43.5, // pitch: 43.5, //
rotation: 45, // 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();
},
setMarkerAct (lat, lng) {
markers_act.setGeometries([]);
markers_act.add([
{
id: "4",
styleId: "marker",
position: new TMap.LatLng(lat, lng),
properties: {
title: "marker4",
},
},
]);
},
// //
// map_act.on("dragend", (e) => {
// this.handleMoveCenterAct(e);
// });
map_act.setCenter(latitude1, longitude1);
map_act.setMarker(latitude1, longitude1);
handleMoveCenterAct (e) { // //
// // map_signin.on("dragend", (e) => {
const center = map_act.getCenter(); // this.handleMoveCenterSignin(e);
const lat = center.getLat(); // });
const lng = center.getLng();
this.formData.actLatitude = lat;
this.formData.actLongitude = lng;
this.setMarkerAct(lat, lng);
if (e && e.originalEvent) { map_signin.setCenter(latitude2, longitude2);
geocoder_act map_signin.setMarker(latitude2, longitude2);
.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",
},
},
]);
},
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("未检索到相关位置坐标");
}
});
},
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 () { handleCancle () {

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

@ -183,7 +183,7 @@
<el-form-item label="签到有效范围(米)" <el-form-item label="签到有效范围(米)"
prop="signInRadius" prop="signInRadius"
style="display: block" style="display: block"
label-width="150px"> label-width="160px">
<el-input-number class="item_width_2" <el-input-number class="item_width_2"
:min="0" :min="0"
v-model="formData.signInRadius" v-model="formData.signInRadius"
@ -205,7 +205,7 @@
:reserve-keyword="true" :reserve-keyword="true"
placeholder="请输入关键词" placeholder="请输入关键词"
:remote-method="remoteMethodAct" :remote-method="remoteMethodAct"
:loading="loading"> :loading="loadingAct">
<el-option v-for="(item,index) in searchOptionsAct" <el-option v-for="(item,index) in searchOptionsAct"
@click.native="handleClickKeyAct(index)" @click.native="handleClickKeyAct(index)"
:key="item.value" :key="item.value"
@ -243,7 +243,7 @@
:reserve-keyword="true" :reserve-keyword="true"
placeholder="请输入关键词" placeholder="请输入关键词"
:remote-method="remoteMethodSignin" :remote-method="remoteMethodSignin"
:loading="loading"> :loading="loadingSignin">
<el-option v-for="(item,index) in searchOptionsSignin" <el-option v-for="(item,index) in searchOptionsSignin"
@click.native="handleClickKeySignin(index)" @click.native="handleClickKeySignin(index)"
:key="item.value" :key="item.value"
@ -345,16 +345,7 @@ import daiMap from "@/utils/dai-map";
let loading; // let loading; //
var map_act; var map_act;
var search_act;
var markers_act;
var infoWindowList_act;
var geocoder_act; //
var map_signin; var map_signin;
var search_signin;
var markers_signin;
var infoWindowList_signin;
var geocoder_signin; //
export default { export default {
data () { data () {
@ -396,9 +387,13 @@ export default {
searchOptionsAct: [], searchOptionsAct: [],
searchValueAct: '', searchValueAct: '',
resultListAct: [], resultListAct: [],
loadingAct: false,
searchOptionsSignin: [], searchOptionsSignin: [],
searchValueSignin: '', searchValueSignin: '',
resultListSignin: [], resultListSignin: [],
loadingSignin: false,
btnDisable: false, btnDisable: false,
customerId: "", customerId: "",
actId: "", actId: "",
@ -481,9 +476,7 @@ export default {
mounted () { mounted () {
this.customerId = localStorage.getItem("customerId"); this.customerId = localStorage.getItem("customerId");
this.loadSponsorlist(); this.loadSponsorlist();
// this.initMap();
// this.replayImgList.push()
}, },
methods: { methods: {
@ -509,7 +502,16 @@ export default {
} }
this.$nextTick(() => { this.$nextTick(() => {
if (!map_act) {
this.initMap(this.formData.actLatitude, this.formData.actLongitude, this.formData.signInLatitude, this.formData.signInLongitude) 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) { async remoteMethodAct (query) {
if (query !== '') { if (query !== '') {
this.loading = true; this.loadingAct = true;
const { msg, data } = await map_act.searchNearby(query); const { msg, data } = await map_act.searchNearby(query);
this.loading = false; this.loadingAct = false;
this.resultListAct = [] this.resultListAct = []
if (msg == "success" && data.resultList && data.resultList.length > 0) { if (msg == "success" && data.resultList && data.resultList.length > 0) {
@ -814,10 +816,10 @@ export default {
async remoteMethodSignin (query) { async remoteMethodSignin (query) {
if (query !== '') { if (query !== '') {
this.loading = true; this.loadingSign = true;
const { msg, data } = await map.searchNearby(query); const { msg, data } = await map.searchNearby(query);
this.loading = false; this.loadingSign = false;
this.resultListSignin = [] this.resultListSignin = []
if (msg == "success" && data.resultList && data.resultList.length > 0) { 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-input>
</el-form-item> </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="办公时间" <el-form-item label="办公时间"
prop="amStartTime" prop="amStartTime"
label-width="150px" label-width="150px"
@ -119,15 +107,15 @@
class="div_map"></div> class="div_map"></div>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="详细地址 " <el-form-item label="社区地址"
prop="address" prop="address"
label-width="150px" label-width="150px"
style="display: block"> style="display: block">
<el-input class="item_width_1" <el-input class="item_width_1"
maxlength="50" maxlength="50"
show-word-limit show-word-limit
placeholder="请输入位置 " placeholder="请输入社区地址 "
v-model="formData.address"> v-model="dataForm.address">
</el-input> </el-input>
</el-form-item> </el-form-item>
@ -254,6 +242,7 @@ export default {
searchOptions: [], searchOptions: [],
searchValue: '', searchValue: '',
resultList: [], resultList: [],
loading: false,
btnDisable: false, btnDisable: false,
@ -330,7 +319,7 @@ export default {
async mounted () { async mounted () {
this.customerId = localStorage.getItem("customerId"); this.customerId = localStorage.getItem("customerId");
this.initMap();
}, },
methods: { methods: {
@ -394,7 +383,7 @@ export default {
initMap (latitude, longitude) { initMap (latitude, longitude) {
map = new daiMap( map = new daiMap(
document.getElementById("app_ggfw"), document.getElementById("app_dqfwzx"),
{ latitude, longitude }, { latitude, longitude },
{ {
zoom: 16.2, // zoom: 16.2, //
@ -417,13 +406,13 @@ export default {
async handleMoveCenter () { async handleMoveCenter () {
// //
const { lat, lng } = map.getCenter(); const { lat, lng } = map.getCenter();
this.formData.latitude = lat; this.dataForm.latitude = lat;
this.formData.longitude = lng; this.dataForm.longitude = lng;
map.setMarker(lat, lng); map.setMarker(lat, lng);
let { msg, data } = await map.getAddress(lat, lng); let { msg, data } = await map.getAddress(lat, lng);
if (msg == "success") { if (msg == "success") {
this.formData.address = data.address this.dataForm.address = data.address
this.searchValue = data.address this.searchValue = data.address
this.searchOptions = [] this.searchOptions = []
@ -466,9 +455,9 @@ export default {
let lonlat = selPosition.lonlat.split(" ") let lonlat = selPosition.lonlat.split(" ")
map.setCenter(lonlat[1], lonlat[0]); map.setCenter(lonlat[1], lonlat[0]);
map.setMarker(lonlat[1], lonlat[0]); map.setMarker(lonlat[1], lonlat[0]);
this.formData.latitude = lonlat[1]; this.dataForm.latitude = lonlat[1];
this.formData.longitude = lonlat[0]; this.dataForm.longitude = lonlat[0];
this.formData.address = selPosition.address + selPosition.name this.dataForm.address = selPosition.address + selPosition.name
}, },
@ -480,8 +469,22 @@ export default {
if (row) { if (row) {
this.dataForm = { ...this.dataForm, ...row }; this.dataForm = { ...this.dataForm, ...row };
this.partyServiceCenterId = this.dataForm.partyServiceCenterId; 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 () { async handleComfirm () {
@ -553,6 +556,10 @@ export default {
this.$emit("dialogCancle"); this.$emit("dialogCancle");
}, },
resetData () { resetData () {
this.searchValue = ''
this.searchOptions = []
this.resultList = []
this.partyServiceCenterId = ""; this.partyServiceCenterId = "";
this.dataForm = { this.dataForm = {
centerName: "", centerName: "",

Loading…
Cancel
Save