-
-
-
+
+
+
-
-
-
+
+
+
-
-
+
+
-
+
-
-
handleSelectVolunteer(index, vItem)"
- :disabled="item.icResiUserId != ''"
- >
-
-
-
-
删除
+
+ handleSelectVolunteer(index, vItem)"
+ :disabled="item.icResiUserId != ''">
+
+
+
+ 删除
- 添加
+ 添加
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
-
-
-
查询
-
-
- 经度
-
-
- 纬度
-
-
-
+
+
+
+
+
-
-
+
+
+
+
+
+
+
- 取 消
- 确 定
+ 取 消
+ 确 定
@@ -251,6 +197,7 @@ import { Loading } from "element-ui"; // 引入Loading服务
import { requestPost } from "@/js/dai/request";
import formVltHelper from "dai-js/tools/formVltHelper";
import nextTick from "dai-js/tools/nextTick";
+import daiMap from "@/utils/dai-map";
var map;
var search;
@@ -262,10 +209,15 @@ var geocoder; // 新建一个正逆地址解析类
export default {
components: {},
props: {},
- data() {
+ data () {
return {
formType: "add", //表单操作类型 add新增,edit编辑,detail详情
+ searchOptions: [],
+ searchValue: '',
+ resultList: [],
+ loading: false,
+
btnDisable: false,
orgId: "",
@@ -288,7 +240,7 @@ export default {
};
},
computed: {
- dataRule() {
+ dataRule () {
return {
organizationName: [
{ required: true, message: "组织名称 不能为空", trigger: "blur" },
@@ -323,25 +275,67 @@ export default {
},
watch: {},
- async mounted() {
+ async mounted () {
this.getCategoryList();
this.getVolunteerList();
- this.initMap();
+
},
methods: {
- querySearchVolunteer(queryString, cb) {
+
+ 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 {
+ this.searchOptions = [];
+ }
+ },
+
+ 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.dataForm.address = selPosition.address + selPosition.name
+ },
+
+ querySearchVolunteer (queryString, cb) {
const { volunteerList } = this;
var results = queryString
? volunteerList.filter((item) => {
- return item.value.indexOf(queryString) !== -1;
- })
+ return item.value.indexOf(queryString) !== -1;
+ })
: volunteerList;
// 调用 callback 返回建议列表的数据
cb(results);
},
- handleSelectVolunteer(index, vItem) {
+ handleSelectVolunteer (index, vItem) {
this.dataForm.organizationPersonnel[index] = {
personName: vItem.name,
personPhone: vItem.mobile,
@@ -349,7 +343,7 @@ export default {
};
},
- async getVolunteerList() {
+ async getVolunteerList () {
const url = "/epmetuser/icresiuser/volunteer-list";
const params = {};
const { data, code, msg } = await requestPost(url, params);
@@ -367,7 +361,7 @@ export default {
}
},
- async getCategoryList() {
+ async getCategoryList () {
const url = "/sys/dict/data/dictlist";
const params = {
dictType: "self_org_category",
@@ -379,131 +373,83 @@ export default {
this.$message.error(msg);
}
},
- handleAddStaff() {
+ handleAddStaff () {
this.dataForm.organizationPersonnel = [
...this.dataForm.organizationPersonnel,
{ personName: "", personPhone: "", icResiUserId: "" },
];
},
- handleDelStaff(index) {
+ handleDelStaff (index) {
const { organizationPersonnel } = this.dataForm;
organizationPersonnel.splice(index, 1);
this.dataForm.organizationPersonnel = organizationPersonnel;
},
- // 地图初始化函数,本例取名为init,开发者可根据实际情况定义
- initMap() {
+
+ async initForm (type, row) {
+ this.$refs.ref_form.resetFields();
+
+ this.formType = type;
+ console.log(row);
+
let { latitude, longitude } = this.$store.state.user;
- if (!latitude || latitude == "" || latitude == "0") {
- latitude = 39.9088810666821;
- longitude = 116.39743841556731;
+ if (row) {
+ this.dataForm = { ...this.dataForm, ...row };
+ this.orgId = this.dataForm.orgId;
+
+ } else {
+ this.dataForm.latitude = latitude
+ this.dataForm.longitude = longitude
+ }
+ if (!map) {
+ this.initMap(this.dataForm.latitude, this.dataForm.longitude);
}
- // 定义地图中心点坐标
- var center = new window.TMap.LatLng(latitude, 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);
- geocoder = new TMap.service.Geocoder(); // 新建一个正逆地址解析类
+ },
+
+ // 地图初始化函数,本例取名为init,开发者可根据实际情况定义
+ initMap (latitude, longitude) {
+
+ map = new daiMap(
+ document.getElementById("app"),
+ { latitude, longitude },
+ {
+ zoom: 16.2, // 设置地图缩放级别
+ pitch: 43.5, // 设置俯仰角
+ rotation: 45, // 设置地图旋转角度
+ }
+ );
// 监听地图平移结束
- map.on("panend", (e) => {
+ map.on("dragend", (e) => {
this.handleMoveCenter(e);
});
- // this.handleMoveCenter();
- },
- 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.dataForm.address,
- 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;
- } else {
- this.$message.error("未检索到相关位置坐标");
- }
- });
},
- handleMoveCenter(e) {
- console.log(e);
+
+ async handleMoveCenter () {
//修改地图中心点
- const center = map.getCenter();
- const lat = center.getLat();
- const lng = center.getLng();
+ const { lat, lng } = map.getCenter();
this.dataForm.latitude = lat;
this.dataForm.longitude = lng;
- this.setMarker(lat, 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 = []
- if (e && e.originalEvent) {
- geocoder
- .getAddress({ location: new TMap.LatLng(lat, lng) }) // 将给定的坐标位置转换为地址
- .then((result) => {
- this.dataForm.address = result.result.address;
- });
}
},
- async initForm(type, row) {
- this.$refs.ref_form.resetFields();
- this.formType = type;
- console.log(row);
- if (row) {
- this.dataForm = { ...this.dataForm, ...row };
- this.orgId = this.dataForm.orgId;
- await nextTick(800);
- if (map) {
- map.setCenter(new TMap.LatLng(row.latitude, row.longitude));
- }
- }
- },
-
- async handleComfirm() {
+ async handleComfirm () {
this.btnDisable = true;
setTimeout(() => {
this.btnDisable = false;
@@ -536,7 +482,7 @@ export default {
});
},
- async submit() {
+ async submit () {
let url = "";
if (this.formType === "add") {
url = "/heart/iccommunityselforganization/addcommunityselforganization";
@@ -564,11 +510,16 @@ export default {
}
},
- handleCancle() {
+ handleCancle () {
this.resetData();
this.$emit("dialogCancle");
},
- resetData() {
+ resetData () {
+
+ this.searchValue = ''
+ this.searchOptions = []
+ this.resultList = []
+
this.orgId = "";
this.dataForm = {
organizationName: "",
@@ -585,8 +536,23 @@ export default {
organizationPersonnel: [],
};
},
+
+ // async handleSearchMap () {
+ // const { msg, data } = await map.searchNearby(this.keyWords);
+ // if (msg == "success") {
+ // const { lat, lng } = data;
+ // map.setCenter(lat, lng);
+ // map.setMarker(lat, lng);
+ // this.dataForm.latitude = lat;
+ // this.dataForm.longitude = lng;
+ // this.handleMoveCenter()
+ // } else {
+ // this.$message.error("未检索到相关位置坐标");
+ // }
+ // },
+
// 开启加载动画
- startLoading() {
+ startLoading () {
loading = Loading.service({
lock: true, // 是否锁定
text: "正在加载……", // 加载中需要显示的文字
@@ -594,7 +560,7 @@ export default {
});
},
// 结束加载动画
- endLoading() {
+ endLoading () {
// clearTimeout(timer);
if (loading) {
loading.close();
diff --git a/src/views/modules/cpts/base/cpts/edit.vue b/src/views/modules/cpts/base/cpts/edit.vue
index f3989e228..972d079d4 100644
--- a/src/views/modules/cpts/base/cpts/edit.vue
+++ b/src/views/modules/cpts/base/cpts/edit.vue
@@ -331,12 +331,9 @@ import { requestPost } from "@/js/dai/request";
import nextTick from "dai-js/tools/nextTick";
import Schema from "async-validator";
import Tinymce from "@c/tinymce2/index.vue";
+import daiMap from "@/utils/dai-map";
var map;
-var search;
-var markers;
-var infoWindowList;
-var geocoder; // 新建一个正逆地址解析类
export default {
components: { Tinymce },
@@ -626,101 +623,49 @@ export default {
// 地图初始化函数,本例取名为init,开发者可根据实际情况定义
initMap(item) {
let { latitude, longitude } = this.$store.state.user;
- if (!latitude || latitude == "" || latitude == "0") {
- latitude = 39.9088810666821;
- longitude = 116.39743841556731;
- }
- // 定义地图中心点坐标
- var center = new window.TMap.LatLng(latitude, 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);
-
- geocoder = new TMap.service.Geocoder(); // 新建一个正逆地址解析类
+ map = new daiMap(
+ document.getElementById("app"),
+ { latitude, longitude },
+ {
+ zoom: 16.2, // 设置地图缩放级别
+ pitch: 43.5, // 设置俯仰角
+ rotation: 45, // 设置地图旋转角度
+ }
+ );
// 监听地图平移结束
- map.on("panend", (e) => {
+ map.on("dragend", (e) => {
this.handleMoveCenter(item, e);
});
// this.handleMoveCenter(item);
},
- setMarker(lat, lng) {
- markers.setGeometries([]);
- markers.add([
- {
- id: "4",
- styleId: "marker",
- position: new TMap.LatLng(lat, lng),
- properties: {
- title: "marker4",
- },
- },
- ]);
- },
-
- handleSearchMap(item) {
- infoWindowList.forEach((infoWindow) => {
- infoWindow.close();
- });
- infoWindowList.length = 0;
- markers.setGeometries([]);
- // 在地图显示范围内以给定的关键字搜索地点
- search
- .searchNearby({
- keyword: this.fmData[item.keyName],
- 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);
- // item.supValues[0] = lng;
- // item.supValues[1] = lat;
- this.fmData[item.supKeys[0]] = lng;
- this.fmData[item.supKeys[1]] = lat;
- } else {
- this.$message.error("未检索到相关位置坐标");
- }
- });
+ async handleSearchMap(item) {
+ const { msg, data } = await map.searchNearby(this.fmData[item.keyName]);
+ if (msg == "success") {
+ const { lat, lng } = data;
+ map.setCenter(lat, lng);
+ map.setMarker(lat, lng);
+ this.fmData[item.supKeys[0]] = lng;
+ this.fmData[item.supKeys[1]] = lat;
+ } else {
+ this.$message.error("未检索到相关位置坐标");
+ }
},
- handleMoveCenter(item, e) {
- console.log(e);
+ async handleMoveCenter(item, e) {
+ console.log("handleMoveCenter", e);
//修改地图中心点
- const center = map.getCenter();
- const lat = center.getLat();
- const lng = center.getLng();
- // item.supValues[0] = lng;
- // item.supValues[1] = lat;
+ const { lat, lng } = map.getCenter();
+
this.fmData[item.supKeys[0]] = lng;
this.fmData[item.supKeys[1]] = lat;
- this.setMarker(lat, lng);
+ map.setMarker(lat, lng);
- if (e && e.originalEvent) {
- geocoder
- .getAddress({ location: new TMap.LatLng(lat, lng) }) // 将给定的坐标位置转换为地址
- .then((result) => {
- this.fmData[item.keyName] = result.result.address;
- });
+ let { msg, data } = await map.getAddress(lat, lng);
+ if (msg == "success") {
+ this.fmData[item.keyName] = data.address;
}
},
@@ -752,7 +697,8 @@ export default {
await nextTick(600);
if (map) {
if (data.latitude) {
- map.setCenter(new TMap.LatLng(data.latitude, data.longitude));
+ map.setCenter(data.latitude, data.longitude);
+ map.setMarker(data.latitude, data.longitude);
} else {
if (this.formType == "edit" && this.$refs && this.$refs.mapSearch) {
this.$refs.mapSearch[0].handleClick();
diff --git a/src/views/modules/shequzhili/csgltc/csgl.vue b/src/views/modules/shequzhili/csgltc/csgl.vue
index 8eacbd0ed..e29f1c93a 100644
--- a/src/views/modules/shequzhili/csgltc/csgl.vue
+++ b/src/views/modules/shequzhili/csgltc/csgl.vue
@@ -52,7 +52,8 @@
style="margin-left:10px"
size="small"
@click="handleExportModule('room')">下载模板
-
- 地理位置:
+ 所在位置:
{{ formData.address }}
@@ -41,7 +41,7 @@
地图位置:
@@ -61,6 +61,7 @@
-
+