Browse Source

Merge branch 'dev-天地图' into dev

dev-用户反馈
jiangyy 3 years ago
parent
commit
039175e226
  1. 6
      package.json
  2. 9
      public/index.html
  3. 42
      src/main.js
  4. 259
      src/utils/dai-map.js
  5. 51
      src/views/modules/communityService/dqfwzx/index.vue
  6. 596
      src/views/modules/communityService/sqzzz/cpts/edit.vue
  7. 118
      src/views/modules/cpts/base/cpts/edit.vue
  8. 5
      src/views/modules/shequzhili/csgltc/csgl.vue
  9. 137
      src/views/modules/shequzhili/csgltc/csglDetail.vue
  10. 246
      src/views/modules/shequzhili/csgltc/csglForm.vue
  11. 219
      src/views/modules/shequzhili/event/cpts/add.vue
  12. 133
      src/views/modules/shequzhili/ggfwtc/ggfwDetail.vue
  13. 246
      src/views/modules/shequzhili/ggfwtc/ggfwForm.vue
  14. 120
      src/views/modules/visual/command/cpts/map.vue

6
package.json

@ -27,8 +27,8 @@
"babel-plugin-component": "^1.1.1",
"echarts": "^5.2.2",
"echarts-gl": "^2.0.9",
"element-theme": "^2.0.1",
"element-ui": "^2.13.0",
"element-theme": "2.0.1",
"element-ui": "2.13.2",
"file-saver": "^2.0.5",
"gulp-autoprefixer": "^6.1.0",
"gulp-clean-css": "^4.2.0",
@ -112,4 +112,4 @@
"not ie <= 10"
]
}
}
}

9
public/index.html

@ -7,12 +7,9 @@
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,viewport-fit=cover" />
<link rel="shortcut icon" href="<%= BASE_URL %>favicon.ico" />
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"
/>
<script charset="utf-8" src="https://map.qq.com/api/gljs?v=1.exp&libraries=service&key=LWBBZ-TIGC3-VFP3L-YNMWH-FJB7T-JFBLO"></script>
<script charset="utf-8" src="https://map.qq.com/api/gljs?v=1.exp&key=OB4BZ-D4W3U-B7VVO-4PJWW-6TKDJ-WPB77"></script>
<!-- <script charset="utf-8" src="https://map.qq.com/api/gljs?v=1.exp&libraries=service&key=LWBBZ-TIGC3-VFP3L-YNMWH-FJB7T-JFBLO"></script>
<script charset="utf-8" src="https://map.qq.com/api/gljs?v=1.exp&key=OB4BZ-D4W3U-B7VVO-4PJWW-6TKDJ-WPB77"></script> -->
<script src="http://api.tianditu.gov.cn/api?v=4.0&tk=c4dc987b442bd141a887d8d4a5d07926" type="text/javascript"></script>
<!-- f2图表 -->
<!-- <script src="https://gw.alipayobjects.com/os/lib/antv/f2/3.8.1/dist/f2.min.js"></script> -->

42
src/main.js

@ -1,7 +1,7 @@
import Vue from "vue";
import Element from "element-ui";
import Mint from "mint-ui";
import "mint-ui/lib/style.css";
// import Mint from "mint-ui";
// import "mint-ui/lib/style.css";
import App from "@/App";
import i18n from "@/i18n";
@ -12,14 +12,14 @@ import "@/assets/scss/aui.scss";
//按钮
import http from "@/utils/request";
import renRadioGroup from "@/components/ren-radio-group";
import renSelect from "@/components/ren-select";
import renProcessMultiple from "@/components/ren-process-multiple";
import renProcessStart from "@/components/ren-process-start";
import renProcessRunning from "@/components/ren-process-running";
import renProcessDetail from "@/components/ren-process-detail";
import renDeptTree from "@/components/ren-dept-tree";
import renRegionTree from "@/components/ren-region-tree";
// import renRadioGroup from "@/components/ren-radio-group";
// import renSelect from "@/components/ren-select";
// import renProcessMultiple from "@/components/ren-process-multiple";
// import renProcessStart from "@/components/ren-process-start";
// import renProcessRunning from "@/components/ren-process-running";
// import renProcessDetail from "@/components/ren-process-detail";
// import renDeptTree from "@/components/ren-dept-tree";
// import renRegionTree from "@/components/ren-region-tree";
import cloneDeep from "lodash/cloneDeep";
// axios封装
@ -30,7 +30,7 @@ import service from "@/js/service";
import store from "@/js/store";
//系统工具
import util from "@js/util";
import Cookies from "js-cookie";
// import Cookies from "js-cookie";
import getQueryPara from "dai-js/modules/getQueryPara";
// 兼容token传参登录
@ -51,16 +51,16 @@ window.app = Object.assign(
Vue.config.productionTip = false;
Vue.use(renRadioGroup);
Vue.use(renSelect);
Vue.use(renDeptTree);
Vue.use(renRegionTree);
Vue.use(renProcessMultiple);
Vue.use(renProcessStart);
Vue.use(renProcessRunning);
Vue.use(renProcessDetail);
Vue.use(Element);
Vue.use(Mint);
// Vue.use(renRadioGroup);
// Vue.use(renSelect);
// Vue.use(renDeptTree);
// Vue.use(renRegionTree);
// Vue.use(renProcessMultiple);
// Vue.use(renProcessStart);
// Vue.use(renProcessRunning);
// Vue.use(renProcessDetail);
// Vue.use(Element);
// Vue.use(Mint);
Vue.use(Element, {
size: "default",

259
src/utils/dai-map.js

@ -0,0 +1,259 @@
import nextTick from "dai-js/tools/nextTick";
export const mapType = typeof window.TMap !== "undefined" ? "qq" : "td";
export const QQMap = window.TMap;
export const TDMap = window.T;
export function searchNearby(map, keyword) {
if (mapType == "qq") {
return new Promise((reslove) => {
const search = new QQMap.service.Search(map, { pageSize: 10 });
search
.searchNearby({
keyword,
radius: 1000,
autoExtend: true,
center: map.getCenter(),
})
.then((result) => {
let { data } = result;
if (Array.isArray(data) && data.length > 0) {
const {
location: { lat, lng, address },
} = data[0];
reslove({
msg: "success",
data: {
lng,
lat,
address,
resultList: data,
},
});
} else {
reslove({
msg: "failed",
error: "未检索到相关位置坐标",
});
}
})
.catch((error) => {
reslove({
msg: "failed",
error,
});
});
});
} else {
return new Promise(async (reslove) => {
const search = new TDMap.LocalSearch(map, { pageCapacity: 10 });
search.setQueryType(1);
search.searchNearby(keyword, map.getCenter(), 1000000000);
await nextTick(1000);
const result = search.getResults();
const data = result ? result.getPois() : null;
console.log("检索结果", data);
if (Array.isArray(data) && data.length > 0) {
const { lonlat, address, name } = data[0];
const lng = lonlat.split(" ")[0];
const lat = lonlat.split(" ")[1];
reslove({
msg: "success",
data: {
lng,
lat,
address: address + name,
resultList: data,
},
});
} else {
reslove({
msg: "failed",
error: "未检索到相关位置坐标",
});
}
});
}
}
// 封装了地图相关函数,兼容天地图、腾讯地图常用api
export default function init(ele, position, params) {
this.mapType = mapType;
this.map = null;
this.marker = null;
this.markers = null;
this.getCenter = function () {
return {
lat: 0,
lng: 0,
};
};
this.setCenter = function (lat, lng) {};
this.setMarker = function (lat, lng, title) {};
this.getAddress = async function (lat, lng) {};
this.on = function (eventType, fn) {};
let { latitude, longitude } = position;
if (!latitude || latitude == "" || latitude == "0") {
latitude = 39.9088810666821;
longitude = 116.39743841556731;
}
if (mapType == "qq") {
let center = new QQMap.LatLng(latitude, longitude);
this.map = new QQMap.Map(ele, {
center,
...params,
});
this.markers = new QQMap.MultiMarker({
map: this.map,
geometries: [],
});
this.getCenter = function () {
const center = this.map.getCenter();
const lat = center.getLat();
const lng = center.getLng();
return { lat, lng };
};
this.setCenter = function (lat, lng) {
this.map.setCenter(new QQMap.LatLng(lat, lng));
};
this.setMarker = function (lat, lng, title = "位置") {
this.markers.setGeometries([]);
this.markers.add([
{
id: "4",
styleId: "marker",
position: new QQMap.LatLng(lat, lng),
properties: {
title,
},
},
]);
};
this.geocoder = new QQMap.service.Geocoder(); // 新建一个正逆地址解析类
this.getAddress = async function (lat, lng) {
return new Promise((reslove) => {
this.geocoder
.getAddress({ location: new QQMap.LatLng(lat, lng) }) // 将给定的坐标位置转换为地址
.then((result) => {
reslove({
msg: "success",
data: {
address: result.result.address,
},
});
})
.catch((error) => {
reslove({
msg: "failed",
error,
});
});
});
};
this.on = function (eventType, fn) {
if (eventType == "dragend") {
this.map.on("moveend", (e) => {
console.log("dragend", e);
if (e && e.originalEvent) {
fn(e);
}
});
} else {
this.map.on(eventType, fn);
}
};
} else {
if (typeof ele == "string") {
ele = document.getElementById("app");
}
let width = ele.offsetWidth;
let height = ele.offsetHeight;
if (height == 0) {
ele.style.height = width * 0.5 + "px";
}
let center = new TDMap.LngLat(longitude, latitude);
this.map = new TDMap.Map(ele, {
center,
...params,
});
this.getCenter = function () {
const center = this.map.getCenter();
const lat = center.getLat();
const lng = center.getLng();
return { lat, lng };
};
this.setCenter = function (lat, lng) {
this.map.panTo(new TDMap.LngLat(lng, lat));
};
this.setMarker = function (lat, lng, title = "位置") {
let lnglat = new TDMap.LngLat(lng, lat);
if (!this.marker) {
this.marker = new TDMap.Marker(lnglat, {
title,
});
this.map.addOverLay(this.marker);
} else {
this.marker.setLngLat(lnglat);
}
};
this.geocoder = new TDMap.Geocoder(); // 新建一个正逆地址解析类
this.getAddress = async function (lat, lng) {
return new Promise((reslove) => {
this.geocoder.getLocation(new TDMap.LngLat(lng, lat), (result) => {
if (result) {
console.log("this.geocoder.getLocation", result);
let status = result.getStatus();
reslove({
msg: "success",
data: {
address: result.getAddress(),
},
});
} else {
reslove({
msg: "failed",
error: "解析失败",
});
}
});
});
};
this.on = function (eventType, fn) {
if (eventType == "dragend") {
this.map.on("dragend", (e) => {
console.log("dragend", e);
fn(e);
});
} else {
this.map.on(eventType, fn);
}
};
}
this.searchNearby = async function (keyword) {
const ret = await searchNearby(this.map, keyword);
return ret;
};
return this;
}

51
src/views/modules/communityService/dqfwzx/index.vue

@ -162,12 +162,9 @@ import { mapGetters } from "vuex";
import editForm from "./cpts/edit";
import orderForm from "./cpts/order";
import orderList from "./cpts/orderList";
import daiMap from "@/utils/dai-map";
var map;
var search;
var markers;
var infoWindowList;
let loading; //
export default {
components: { editForm, orderForm, orderList },
@ -207,49 +204,25 @@ export default {
methods: {
// init
initMap() {
//
var center = new window.TMap.LatLng(36.0722275, 120.38945519);
// map TMap.Map()
map = new window.TMap.Map(document.getElementById("centerIndexApp"), {
center: center, //
zoom: 17.2, //
pitch: 43.5, //
rotation: 45, //
});
let { latitude, longitude } = this.$store.state.user;
search = new window.TMap.service.Search({ pageSize: 10 });
//
markers = new TMap.MultiMarker({
map: map,
geometries: [],
});
infoWindowList = Array(10);
},
setMarker(lat, lng, centerName) {
markers.setGeometries([]);
markers.add([
map = new daiMap(
document.getElementById("centerIndexApp"),
{ latitude, longitude },
{
id: "911",
styleId: "marker",
position: new TMap.LatLng(lat, lng),
properties: {
title: centerName,
},
},
]);
},
setCenter(lat, lng) {
map.setCenter(new window.TMap.LatLng(lat, lng));
zoom: 16.2, //
pitch: 43.5, //
rotation: 45, //
}
);
},
setMap() {
const { tableData, currentIndex } = this;
let item = tableData[currentIndex];
if (item) {
this.setCenter(item.latitude, item.longitude);
this.setMarker(item.latitude, item.longitude, item.centerName);
map.setCenter(item.latitude, item.longitude);
map.setMarker(item.latitude, item.longitude, item.centerName);
}
},

596
src/views/modules/communityService/sqzzz/cpts/edit.vue

@ -1,246 +1,192 @@
<template>
<div>
<div class="dialog-h-content scroll-h">
<el-form
ref="ref_form"
:inline="true"
:model="dataForm"
:rules="dataRule"
:disabled="formType === 'detail'"
class="form"
>
<el-form-item
label="组织名称 "
prop="organizationName"
label-width="150px"
style="display: block"
>
<el-input
class="item_width_1"
maxlength="50"
show-word-limit
placeholder="请输入组织名称 "
v-model="dataForm.organizationName"
>
<el-form ref="ref_form"
:inline="true"
:model="dataForm"
:rules="dataRule"
:disabled="formType === 'detail'"
class="form">
<el-form-item label="组织名称 "
prop="organizationName"
label-width="150px"
style="display: block">
<el-input class="item_width_1"
maxlength="50"
show-word-limit
placeholder="请输入组织名称 "
v-model="dataForm.organizationName">
</el-input>
</el-form-item>
<el-form-item
label="分类名称 "
prop="categoryCode"
label-width="150px"
style="display: block"
>
<el-select
v-model="dataForm.categoryCode"
placeholder="请选择"
clearable
>
<el-option
v-for="item in categoryList"
:key="item.value"
:label="item.label"
:value="item.value"
>
<el-form-item label="分类名称 "
prop="categoryCode"
label-width="150px"
style="display: block">
<el-select v-model="dataForm.categoryCode"
placeholder="请选择"
clearable>
<el-option v-for="item in categoryList"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item
label="组织人数 "
prop="organizationPersonCount"
label-width="150px"
style="display: block"
>
<el-input
class="item_width_1"
type="number"
maxlength="50"
show-word-limit
placeholder="请输入组织人数 "
v-model="dataForm.organizationPersonCount"
>
<el-form-item label="组织人数 "
prop="organizationPersonCount"
label-width="150px"
style="display: block">
<el-input class="item_width_1"
type="number"
maxlength="50"
show-word-limit
placeholder="请输入组织人数 "
v-model="dataForm.organizationPersonCount">
</el-input>
</el-form-item>
<el-form-item
label="组织成员 "
prop="organizationPersonnel"
label-width="150px"
style="display: block"
>
<el-form-item label="组织成员 "
prop="organizationPersonnel"
label-width="150px"
style="display: block">
<div class="m-staffs">
<div
class="item"
:key="'staff' + index"
v-for="(item, index) in dataForm.organizationPersonnel"
>
<el-autocomplete
class="item_width_1"
v-model="item.personName"
:fetch-suggestions="querySearchVolunteer"
placeholder="成员姓名"
:maxlength="50"
show-word-limit
@select="(vItem) => handleSelectVolunteer(index, vItem)"
:disabled="item.icResiUserId != ''"
></el-autocomplete>
<el-input
style="margin-left: 10px"
class="item_width_1"
show-word-limit
placeholder="联系电话"
:disabled="item.icResiUserId != ''"
v-model="item.personPhone"
/>
<el-button
style="margin-left: 10px"
size="small"
@click="handleDelStaff(index)"
>删除</el-button
>
<div class="item"
:key="'staff' + index"
v-for="(item, index) in dataForm.organizationPersonnel">
<el-autocomplete class="item_width_1"
v-model="item.personName"
:fetch-suggestions="querySearchVolunteer"
placeholder="成员姓名"
:maxlength="50"
show-word-limit
@select="(vItem) => handleSelectVolunteer(index, vItem)"
:disabled="item.icResiUserId != ''"></el-autocomplete>
<el-input style="margin-left: 10px"
class="item_width_1"
show-word-limit
placeholder="联系电话"
:disabled="item.icResiUserId != ''"
v-model="item.personPhone" />
<el-button style="margin-left: 10px"
size="small"
@click="handleDelStaff(index)">删除</el-button>
</div>
<div class="item-add">
<el-button size="small" @click="handleAddStaff">添加</el-button>
<el-button size="small"
@click="handleAddStaff">添加</el-button>
</div>
</div>
</el-form-item>
<el-form-item
label="服务事项"
prop="serviceItem"
label-width="150px"
style="display: block"
>
<el-input
class="item_width_1"
type="textarea"
maxlength="1000"
show-word-limit
:rows="3"
placeholder="请输入服务事项,不超过1000字"
v-model="dataForm.serviceItem"
></el-input>
<el-form-item label="服务事项"
prop="serviceItem"
label-width="150px"
style="display: block">
<el-input class="item_width_1"
type="textarea"
maxlength="1000"
show-word-limit
:rows="3"
placeholder="请输入服务事项,不超过1000字"
v-model="dataForm.serviceItem"></el-input>
</el-form-item>
<el-form-item
label="负责人 "
prop="principalName"
label-width="150px"
style="display: block"
>
<el-input
class="item_width_1"
maxlength="50"
show-word-limit
placeholder="请输入负责人 "
v-model="dataForm.principalName"
>
<el-form-item label="负责人 "
prop="principalName"
label-width="150px"
style="display: block">
<el-input class="item_width_1"
maxlength="50"
show-word-limit
placeholder="请输入负责人 "
v-model="dataForm.principalName">
</el-input>
</el-form-item>
<el-form-item
label="联系电话 "
prop="principalPhone"
label-width="150px"
style="display: block"
>
<el-input
class="item_width_1"
maxlength="50"
show-word-limit
placeholder="请输入联系电话 "
v-model="dataForm.principalPhone"
>
<el-form-item label="联系电话 "
prop="principalPhone"
label-width="150px"
style="display: block">
<el-input class="item_width_1"
maxlength="50"
show-word-limit
placeholder="请输入联系电话 "
v-model="dataForm.principalPhone">
</el-input>
</el-form-item>
<el-form-item
label="创建时间"
prop="organizationCreatedTime"
label-width="150px"
style="display: block"
>
<el-date-picker
v-model="dataForm.organizationCreatedTime"
placeholder="创建时间"
value-format="yyyy-MM-dd"
>
<el-form-item label="创建时间"
prop="organizationCreatedTime"
label-width="150px"
style="display: block">
<el-date-picker v-model="dataForm.organizationCreatedTime"
placeholder="创建时间"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
<el-form-item
label="位置坐标"
prop="longitude"
label-width="150px"
style="display: block"
>
<el-form-item label="地图位置"
prop="longitude"
label-width="150px"
style="display: block">
<div style="width: 500px">
<el-input
class="item_width_4"
maxlength="50"
placeholder="请输入关键字"
v-model="dataForm.address"
>
</el-input>
<el-button
style="margin-left: 10px"
type="default"
size="small"
@click="handleSearchMap"
>查询</el-button
>
<div id="app" class="div_map"></div>
<div style="margin-top: 10px" v-show="false">
<span>经度</span>
<el-input
class="item_width_3"
maxlength="50"
placeholder="请输入经度"
v-model="dataForm.longitude"
>
</el-input>
<span style="margin-left: 20px">纬度</span>
<el-input
class="item_width_3"
maxlength="50"
placeholder="请输入纬度"
v-model="dataForm.latitude"
>
</el-input>
</div>
<el-select v-model="searchValue"
filterable
style="width: 500px"
remote
:reserve-keyword="true"
placeholder="请输入关键词"
:remote-method="remoteMethod"
:loading="loading">
<el-option v-for="(item,index) in searchOptions"
@click.native="handleClickKey(index)"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<div id="app"
class="div_map"></div>
</div>
</el-form-item>
<el-form-item
label="备注"
prop="remark"
label-width="150px"
style="display: block"
>
<el-input
class="item_width_1"
type="textarea"
maxlength="500"
show-word-limit
:rows="3"
placeholder="请输入备注,不超过500字"
v-model="dataForm.remark"
></el-input>
<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="remark"
label-width="150px"
style="display: block">
<el-input class="item_width_1"
type="textarea"
maxlength="500"
show-word-limit
:rows="3"
placeholder="请输入备注,不超过500字"
v-model="dataForm.remark"></el-input>
</el-form-item>
</el-form>
</div>
<div class="div_btn resi-btns">
<el-button size="small" @click="handleCancle"> </el-button>
<el-button
v-if="formType != 'detail'"
type="primary"
size="small"
:disabled="btnDisable"
@click="handleComfirm"
> </el-button
>
<el-button size="small"
@click="handleCancle"> </el-button>
<el-button v-if="formType != 'detail'"
type="primary"
size="small"
:disabled="btnDisable"
@click="handleComfirm"> </el-button>
</div>
</div>
</template>
@ -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", // addeditdetail
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();

118
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();

5
src/views/modules/shequzhili/csgltc/csgl.vue

@ -52,7 +52,8 @@
style="margin-left:10px"
size="small"
@click="handleExportModule('room')">下载模板</el-button>
<el-upload :headers="$getElUploadHeaders()" ref="upload"
<el-upload :headers="$getElUploadHeaders()"
ref="upload"
:multiple='false'
:show-file-list='false'
:before-upload="beforeUpload"
@ -361,7 +362,7 @@ export default {
this.formShow = false
},
diaDetailClose () {
this.$refs.ref_detail.diaDestroy()
// this.$refs.ref_detail.diaDestroy()
this.detailShow = false
},

137
src/views/modules/shequzhili/csgltc/csglDetail.vue

@ -33,7 +33,7 @@
</div>
<div class="info-prop">
<span class="info-title-2">地理位置</span>
<span class="info-title-2">所在位置</span>
<span>{{ formData.address }}</span>
</div>
@ -41,7 +41,7 @@
<span class="info-title-2">地图位置</span>
<div class="div_map">
<div id="app_detail"></div>
<div id="app_csgl_detail"></div>
</div>
</div>
@ -61,6 +61,7 @@
<script>
import { Loading } from 'element-ui' // Loading
import daiMap from "@/utils/dai-map";
var map
var search
@ -85,14 +86,14 @@ export default {
methods: {
handleCancle () {
this.diaDestroy()
// this.diaDestroy()
this.$emit('diaDetailClose')
},
diaDestroy () {
if (map) {
map.destroy()
// map.destroy()
}
},
@ -100,17 +101,7 @@ export default {
this.startLoading()
this.formData = { ...row }
this.initLoading = true
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) {
@ -121,115 +112,37 @@ export default {
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_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: []
this.$nextTick(() => {
this.initMap(latitude, longitude)
})
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_csgl_detail"),
{ 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)
},
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(latitude, longitude);
map.setMarker(latitude, 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({

246
src/views/modules/shequzhili/csgltc/csglForm.vue

@ -96,23 +96,42 @@
placeholder="请输入联系电话"></el-input>
</el-form-item>
<el-form-item label="地"
prop="address"
<el-form-item label="地图位置"
prop="longitude"
label-width="150px"
style="display: block">
<div class="item_width_1">
<el-input style="width:420px"
:placeholder="'请输入所在地址'"
v-model="formData.address">
</el-input>
<el-button style="margin-left: 10px"
type="default"
size="small"
@click="handleSearchMap">查询</el-button>
<div id="app"
<div style="width: 500px">
<el-select v-model="searchValue"
filterable
style="width: 500px"
remote
:reserve-keyword="true"
placeholder="请输入关键词"
:remote-method="remoteMethod"
:loading="loading">
<el-option v-for="(item,index) in searchOptions"
@click.native="handleClickKey(index)"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<div id="app_csgl"
class="div_map"></div>
</div>
</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="formData.address">
</el-input>
</el-form-item>
</el-form>
</div>
@ -132,7 +151,7 @@
import { mapGetters } from 'vuex'
import { Loading } from 'element-ui' // Loading
import { requestPost } from '@/js/dai/request'
import daiMap from "@/utils/dai-map";
var map
@ -146,6 +165,10 @@ export default {
data () {
return {
formType: 'add', // addeditdetail
searchOptions: [],
searchValue: '',
resultList: [],
loading: false,
btnDisable: false,
serviceList: [],
@ -169,7 +192,7 @@ export default {
},
components: {},
mounted () {
this.initMap()
},
methods: {
@ -177,7 +200,7 @@ export default {
async initForm (type, icCityManagementId) {
this.startLoading()
this.$refs.ref_form.resetFields();
let { latitude, longitude } = this.$store.state.user;
//
await this.loadService()
@ -187,10 +210,12 @@ export default {
this.formData.icCityManagementId = icCityManagementId
await this.loadFormData()
} else {
// map.setCenter(new TMap.LatLng(36.0722275, 120.38945519))
// this.setMarker(36.0722275, 120.38945519)
this.formData.latitude = latitude
this.formData.longitude = longitude
}
// if (!map) {
this.initMap(this.formData.latitude, this.formData.longitude);
// }
this.endLoading()
},
@ -231,10 +256,10 @@ export default {
// let { latitude, longitude } = this.$store.state.user;
// const lat = this.formData.latitude === null || this.formData.latitude === '' ? latitude : this.formData.latitude;
// const lon = this.formData.longitude === null || this.formData.longitude === '' ? longitude : this.formData.longitude;
if (this.formData.latitude !== null && this.formData.latitude !== '' && this.formData.longitude !== null && this.formData.longitude !== '') {
map.setCenter(new TMap.LatLng(this.formData.latitude, this.formData.longitude))
this.setMarker(this.formData.latitude, this.formData.longitude)
}
// if (this.formData.latitude !== null && this.formData.latitude !== '' && this.formData.longitude !== null && this.formData.longitude !== '') {
// map.setCenter(new TMap.LatLng(this.formData.latitude, this.formData.longitude))
// this.setMarker(this.formData.latitude, this.formData.longitude)
// }
} else {
this.$message.error(msg)
}
@ -289,133 +314,90 @@ export default {
},
// init
initMap () {
//
let { latitude, longitude } = this.$store.state.user;
console.log('lat' + latitude + ',lon' + longitude)
if (!latitude || latitude == "" || latitude == "0") {
latitude = 39.9088810666821;
longitude = 116.39743841556731;
}
this.formData.latitude = latitude
this.formData.longitude = longitude
//
var center = new window.TMap.LatLng(latitude, longitude);
// var center = new window.TMap.LatLng(36.52799, 120.7553)
// 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_csgl"),
{ 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.formData.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.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 = []
}
},
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) {
convert (lat, lng) {
markers.setGeometries([]);
// var input = document.getElementById('location').value.split(',');
let location
if (lat && lng) {
location = new TMap.LatLng(lat, lng);
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 === '' || result.result.address === null ? this.formData.address : result.result.address
this.formData.address = this.formData.address !== '' && this.formData.address !== null && (this.formData.longitude === '' || this.formData.longitude === null) ? 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.unitId = ''
this.keyWords = ''
this.formData = {

219
src/views/modules/shequzhili/event/cpts/add.vue

@ -143,36 +143,35 @@
label-width="150px"
style="display: block">
<div style="width: 500px">
<div class="div_map">
<div id="app"></div>
<div class="div_searchmap">
<el-input class="cell-width-map"
maxlength="50"
size="mini"
placeholder="请输入关键字"
v-model="keyWords">
</el-input>
<el-button style="margin-left: 10px"
type="primary"
size="mini"
@click="handleSearchMap">查询</el-button>
</div>
</div>
<!-- <div style="margin-top: 10px">
<span>经度</span>
<el-input class="item_width_3"
maxlength="50"
placeholder="请输入经度"
v-model="formData.longitude">
</el-input>
<span style="margin-left: 20px">纬度</span>
<el-input class="item_width_3"
maxlength="50"
placeholder="请输入纬度"
v-model="formData.latitude">
</el-input>
</div> -->
<el-input class="item_width_4"
maxlength="50"
placeholder="请输入关键字"
v-model="formData.address">
</el-input>
<el-button style="margin-left: 10px"
type="default"
size="small"
@click="handleSearchMap">查询</el-button>
<div id="map_event"
class="div_map"></div>
<!-- <div style="margin-top: 10px" v-show="false">
<span>经度</span>
<el-input
class="item_width_3"
maxlength="50"
placeholder="请输入经度"
v-model="formData.longitude"
>
</el-input>
<span style="margin-left: 20px">纬度</span>
<el-input
class="item_width_3"
maxlength="50"
placeholder="请输入纬度"
v-model="formData.latitude"
>
</el-input>
</div> -->
</div>
</el-form-item>
</el-form>
@ -238,7 +237,7 @@
import { Loading } from "element-ui"; // Loading
import { requestPost } from "@/js/dai/request";
import formVltHelper from "dai-js/tools/formVltHelper";
import daiMap from "@/utils/dai-map";
import { isCard } from "@/utils/validate";
let loading; //
@ -388,6 +387,7 @@ export default {
async mounted () {
const { user } = this.$store.state;
this.agencyId = user.agencyId;
let { latitude, longitude } = this.$store.state.user;
if (!latitude || latitude == "" || latitude == "0") {
latitude = 39.9088810666821;
@ -398,6 +398,10 @@ export default {
this.formData.longitude = longitude;
this.initMap();
map.setCenter(this.formData.latitude, this.formData.longitude);
map.setMarker(this.formData.latitude, this.formData.longitude);
this.handleMoveCenter()
this.loadGrid();
this.getCategoryList();
},
@ -567,126 +571,47 @@ 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);
let { latitude, longitude } = this.$store.state.user;
geocoder = new TMap.service.Geocoder(); //
map = new daiMap(
document.getElementById("map_event"),
{ latitude, longitude },
{
zoom: 16.2, //
pitch: 43.5, //
rotation: 45, //
}
);
//
map.on("panend", () => {
this.handleMoveCenter();
map.on("dragend", (e) => {
this.handleMoveCenter(e);
});
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.formData.latitude = lat;
this.formData.longitude = lng;
this.convert();
} else {
this.$message.error("未检索到相关位置坐标");
}
});
async handleSearchMap () {
const { msg, data } = await map.searchNearby(this.formData.address);
if (msg == "success") {
const { lat, lng } = data;
map.setCenter(lat, lng);
map.setMarker(lat, lng);
this.formData.latitude = lat;
this.formData.longitude = lng;
} else {
this.$message.error("未检索到相关位置坐标");
}
},
handleMoveCenter () {
async handleMoveCenter (e) {
//
const center = map.getCenter();
const lat = center.getLat();
const lng = center.getLng();
const { lat, lng } = map.getCenter();
this.formData.latitude = lat;
this.formData.longitude = lng;
this.setMarker(lat, lng);
this.convert(lat, lng);
},
map.setMarker(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);
} else {
location = new TMap.LatLng(
this.formData.latitude,
this.formData.longitude
);
let { msg, data } = await map.getAddress(lat, lng);
if (msg == "success") {
this.formData.address = data.address;
}
// map.setCenter(location);
markers.updateGeometries([
{
id: "main", //
position: location,
},
]);
geocoder
.getAddress({ location: location }) //
.then((result) => {
if (!this.isFirst) {
//
this.formData.address = result.result.address;
}
if (this.isFirst) {
this.isFirst = false;
}
});
},
resetData () {
@ -711,11 +636,17 @@ export default {
},
};
</script>
<style
lang="scss"
src="@/assets/scss/modules/shequzhili/event-info.scss"
scoped
></style>
<style lang="scss" scoped>
@import "@/assets/scss/modules/shequzhili/event-info.scss";
.item_width_4 {
width: 350px;
}
.div_map {
margin-top: 10px;
}
</style>
<style lang="scss">
.el-dialog__body {

133
src/views/modules/shequzhili/ggfwtc/ggfwDetail.vue

@ -42,7 +42,7 @@
<span class="info-title-2">地图位置</span>
<div class="div_map">
<div id="app_detail"></div>
<div id="app_ggfw_detail"></div>
</div>
</div>
@ -62,6 +62,7 @@
<script>
import { Loading } from 'element-ui' // Loading
import daiMap from "@/utils/dai-map";
var map
var search
@ -86,14 +87,14 @@ export default {
methods: {
handleCancle () {
this.diaDestroy()
// this.diaDestroy()
this.$emit('diaDetailClose')
},
diaDestroy () {
if (map) {
map.destroy()
// map.destroy()
}
},
@ -101,15 +102,7 @@ export default {
this.startLoading()
this.formData = { ...row }
this.initLoading = true
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) {
@ -120,116 +113,38 @@ export default {
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_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: []
this.$nextTick(() => {
this.initMap(latitude, longitude)
})
infoWindowList = Array(10)
geocoder = new TMap.service.Geocoder(); //
this.endLoading()
//
map.on('panend', () => {
this.handleMoveCenter()
})
this.handleMoveCenter()
console.log('initMap')
// this.convert()
},
setMarker (lat, lng) {
markers.setGeometries([])
markers.add([
// init
initMap (latitude, longitude) {
map = new daiMap(
document.getElementById("app_ggfw_detail"),
{ 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('未检索到相关位置坐标')
}
})
},
);
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.on("dragend", (e) => {
// this.handleMoveCenter(e);
// });
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(latitude, longitude);
map.setMarker(latitude, 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({

246
src/views/modules/shequzhili/ggfwtc/ggfwForm.vue

@ -77,23 +77,42 @@
class="item_width_1"
placeholder="请输入联系电话"></el-input>
</el-form-item>
<el-form-item label="地"
prop="address"
<el-form-item label="地图位置"
prop="longitude"
label-width="150px"
style="display: block">
<div class="item_width_1">
<el-input style="width:420px"
:placeholder="'请输入所在地址'"
v-model="formData.address">
</el-input>
<el-button style="margin-left: 10px"
type="default"
size="small"
@click="handleSearchMap">查询</el-button>
<div id="app"
<div style="width: 500px">
<el-select v-model="searchValue"
filterable
style="width: 500px"
remote
:reserve-keyword="true"
placeholder="请输入关键词"
:remote-method="remoteMethod"
:loading="loading">
<el-option v-for="(item,index) in searchOptions"
@click.native="handleClickKey(index)"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<div id="app_ggfw"
class="div_map"></div>
</div>
</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="formData.address">
</el-input>
</el-form-item>
</el-form>
</div>
@ -113,7 +132,7 @@
import { mapGetters } from 'vuex'
import { Loading } from 'element-ui' // Loading
import { requestPost } from '@/js/dai/request'
import daiMap from "@/utils/dai-map";
var map
@ -127,11 +146,15 @@ export default {
data () {
return {
formType: 'add', // addeditdetail
searchOptions: [],
searchValue: '',
resultList: [],
loading: false,
btnDisable: false,
icPublicServiceId: '',
keyWords: '',
formData: {
name: '',//
category: '',
@ -149,7 +172,7 @@ export default {
},
components: {},
mounted () {
this.initMap()
},
methods: {
@ -157,7 +180,7 @@ export default {
async initForm (type, icPublicServiceId) {
this.startLoading()
this.$refs.ref_form.resetFields();
let { latitude, longitude } = this.$store.state.user;
//
await this.loadService()
@ -167,10 +190,13 @@ export default {
this.formData.icPublicServiceId = icPublicServiceId
await this.loadFormData()
} else {
// map.setCenter(new TMap.LatLng(36.0722275, 120.38945519))
// this.setMarker(36.0722275, 120.38945519)
this.formData.latitude = latitude
this.formData.longitude = longitude
}
// if (!map) {
this.initMap(this.formData.latitude, this.formData.longitude);
// }
this.endLoading()
},
@ -211,10 +237,10 @@ export default {
// let { latitude, longitude } = this.$store.state.user;
// const lat = this.formData.latitude === null || this.formData.latitude === '' ? '' : this.formData.latitude;
// const lon = this.formData.longitude === null || this.formData.longitude === '' ? '' : this.formData.longitude;
if (this.formData.latitude !== null && this.formData.latitude !== '' && this.formData.longitude !== null && this.formData.longitude !== '') {
map.setCenter(new TMap.LatLng(this.formData.latitude, this.formData.longitude))
this.setMarker(this.formData.latitude, this.formData.longitude)
}
// if (this.formData.latitude !== null && this.formData.latitude !== '' && this.formData.longitude !== null && this.formData.longitude !== '') {
// map.setCenter(new TMap.LatLng(this.formData.latitude, this.formData.longitude))
// this.setMarker(this.formData.latitude, this.formData.longitude)
// }
} else {
this.$message.error(msg)
}
@ -270,130 +296,90 @@ export default {
},
// init
initMap () {
let { latitude, longitude } = this.$store.state.user;
console.log('lat' + latitude + ',lon' + longitude)
if (!latitude || latitude == "" || latitude == "0") {
latitude = 39.9088810666821;
longitude = 116.39743841556731;
}
this.formData.latitude = latitude
this.formData.longitude = 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)
initMap (latitude, longitude) {
geocoder = new TMap.service.Geocoder(); //
map = new daiMap(
document.getElementById("app_ggfw"),
{ 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.formData.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.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) => {
console.log(this.formData)
// this.formData.address = result.result.address === '' || result.result.address === null ? this.formData.address : result.result.address
this.formData.address = this.formData.address !== '' && this.formData.address !== null && (this.formData.longitude === '' || this.formData.longitude === null) ? 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.icPublicServiceId = ''
this.keyWords = ''
this.formData = {

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

@ -31,9 +31,11 @@ import {
PointLayer,
Marker,
Popup,
RasterLayer,
} 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;
@ -327,23 +329,32 @@ export default {
styleConfig = lightStyle;
}
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,
],
token: "fc14b42e0ca18387866d68ebd4f150c1",
zoom: 18,
isHotspot: false,
resizeEnable: true,
doubleClickZoom: false,
});
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: iniCenter,
token: "fc14b42e0ca18387866d68ebd4f150c1",
zoom: 18,
isHotspot: false,
resizeEnable: true,
doubleClickZoom: false,
});
}
scene = new Scene({
id: "map",
@ -352,6 +363,10 @@ export default {
});
scene.on("loaded", async () => {
if (mapType == "td") {
this.iniMapBase(scene);
}
this.iniMapGrid(scene);
this.iniMapDot(scene);
this.iniMapDot2(scene);
@ -360,6 +375,46 @@ export default {
});
},
//
iniMapBase(scene) {
//
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,
},
}
);
//
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,
},
}
);
scene.addLayer(baseLayer);
scene.addLayer(annotionLayer);
},
iniMapGrid(scene) {
const { darkStyle, lightStyle, polygonData, polygonDotData } = this;
@ -806,20 +861,25 @@ export default {
},
searchPos(name) {
return new Promise((reslove) => {
window.AMap.plugin("AMap.PlaceSearch", () => {
const city = this.$store.state.user.areaCodePath[1] || "全国";
console.log("搜索区域", city);
// Autocomplete
let autoOptions = {
//city
city,
};
let autoComplete = new window.AMap.PlaceSearch(autoOptions);
autoComplete.search(name, function (status, result) {
reslove(result);
console.log("=----------------------=searchPos", name);
return new Promise(async (reslove) => {
if (mapType == "td") {
reslove([]);
} else {
window.AMap.plugin("AMap.PlaceSearch", () => {
const city = this.$store.state.user.areaCodePath[1] || "全国";
console.log("搜索区域", city);
// Autocomplete
let autoOptions = {
//city
city,
};
let autoComplete = new window.AMap.PlaceSearch(autoOptions);
autoComplete.search(name, function (status, result) {
reslove(result);
});
});
});
}
});
},
},

Loading…
Cancel
Save