Browse Source

Merge branch 'dev-天地图' into dev

dev-用户反馈
jiangyy 3 years ago
parent
commit
039175e226
  1. 4
      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. 452
      src/views/modules/communityService/sqzzz/cpts/edit.vue
  7. 104
      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. 238
      src/views/modules/shequzhili/csgltc/csglForm.vue
  11. 177
      src/views/modules/shequzhili/event/cpts/add.vue
  12. 133
      src/views/modules/shequzhili/ggfwtc/ggfwDetail.vue
  13. 240
      src/views/modules/shequzhili/ggfwtc/ggfwForm.vue
  14. 72
      src/views/modules/visual/command/cpts/map.vue

4
package.json

@ -27,8 +27,8 @@
"babel-plugin-component": "^1.1.1", "babel-plugin-component": "^1.1.1",
"echarts": "^5.2.2", "echarts": "^5.2.2",
"echarts-gl": "^2.0.9", "echarts-gl": "^2.0.9",
"element-theme": "^2.0.1", "element-theme": "2.0.1",
"element-ui": "^2.13.0", "element-ui": "2.13.2",
"file-saver": "^2.0.5", "file-saver": "^2.0.5",
"gulp-autoprefixer": "^6.1.0", "gulp-autoprefixer": "^6.1.0",
"gulp-clean-css": "^4.2.0", "gulp-clean-css": "^4.2.0",

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" /> <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="shortcut icon" href="<%= BASE_URL %>favicon.ico" />
<link <!-- <script charset="utf-8" src="https://map.qq.com/api/gljs?v=1.exp&libraries=service&key=LWBBZ-TIGC3-VFP3L-YNMWH-FJB7T-JFBLO"></script>
rel="stylesheet" <script charset="utf-8" src="https://map.qq.com/api/gljs?v=1.exp&key=OB4BZ-D4W3U-B7VVO-4PJWW-6TKDJ-WPB77"></script> -->
href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" <script src="http://api.tianditu.gov.cn/api?v=4.0&tk=c4dc987b442bd141a887d8d4a5d07926" type="text/javascript"></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>
<!-- f2图表 --> <!-- f2图表 -->
<!-- <script src="https://gw.alipayobjects.com/os/lib/antv/f2/3.8.1/dist/f2.min.js"></script> --> <!-- <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 Vue from "vue";
import Element from "element-ui"; import Element from "element-ui";
import Mint from "mint-ui"; // import Mint from "mint-ui";
import "mint-ui/lib/style.css"; // import "mint-ui/lib/style.css";
import App from "@/App"; import App from "@/App";
import i18n from "@/i18n"; import i18n from "@/i18n";
@ -12,14 +12,14 @@ import "@/assets/scss/aui.scss";
//按钮 //按钮
import http from "@/utils/request"; import http from "@/utils/request";
import renRadioGroup from "@/components/ren-radio-group"; // import renRadioGroup from "@/components/ren-radio-group";
import renSelect from "@/components/ren-select"; // import renSelect from "@/components/ren-select";
import renProcessMultiple from "@/components/ren-process-multiple"; // import renProcessMultiple from "@/components/ren-process-multiple";
import renProcessStart from "@/components/ren-process-start"; // import renProcessStart from "@/components/ren-process-start";
import renProcessRunning from "@/components/ren-process-running"; // import renProcessRunning from "@/components/ren-process-running";
import renProcessDetail from "@/components/ren-process-detail"; // import renProcessDetail from "@/components/ren-process-detail";
import renDeptTree from "@/components/ren-dept-tree"; // import renDeptTree from "@/components/ren-dept-tree";
import renRegionTree from "@/components/ren-region-tree"; // import renRegionTree from "@/components/ren-region-tree";
import cloneDeep from "lodash/cloneDeep"; import cloneDeep from "lodash/cloneDeep";
// axios封装 // axios封装
@ -30,7 +30,7 @@ import service from "@/js/service";
import store from "@/js/store"; import store from "@/js/store";
//系统工具 //系统工具
import util from "@js/util"; import util from "@js/util";
import Cookies from "js-cookie"; // import Cookies from "js-cookie";
import getQueryPara from "dai-js/modules/getQueryPara"; import getQueryPara from "dai-js/modules/getQueryPara";
// 兼容token传参登录 // 兼容token传参登录
@ -51,16 +51,16 @@ window.app = Object.assign(
Vue.config.productionTip = false; Vue.config.productionTip = false;
Vue.use(renRadioGroup); // Vue.use(renRadioGroup);
Vue.use(renSelect); // Vue.use(renSelect);
Vue.use(renDeptTree); // Vue.use(renDeptTree);
Vue.use(renRegionTree); // Vue.use(renRegionTree);
Vue.use(renProcessMultiple); // Vue.use(renProcessMultiple);
Vue.use(renProcessStart); // Vue.use(renProcessStart);
Vue.use(renProcessRunning); // Vue.use(renProcessRunning);
Vue.use(renProcessDetail); // Vue.use(renProcessDetail);
Vue.use(Element); // Vue.use(Element);
Vue.use(Mint); // Vue.use(Mint);
Vue.use(Element, { Vue.use(Element, {
size: "default", 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 editForm from "./cpts/edit";
import orderForm from "./cpts/order"; import orderForm from "./cpts/order";
import orderList from "./cpts/orderList"; import orderList from "./cpts/orderList";
import daiMap from "@/utils/dai-map";
var map; var map;
var search;
var markers;
var infoWindowList;
let loading; //
export default { export default {
components: { editForm, orderForm, orderList }, components: { editForm, orderForm, orderList },
@ -207,49 +204,25 @@ export default {
methods: { methods: {
// init // init
initMap() { initMap() {
// let { latitude, longitude } = this.$store.state.user;
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, //
});
search = new window.TMap.service.Search({ pageSize: 10 });
//
markers = new TMap.MultiMarker({
map: map,
geometries: [],
});
infoWindowList = Array(10);
},
setMarker(lat, lng, centerName) { map = new daiMap(
markers.setGeometries([]); document.getElementById("centerIndexApp"),
markers.add([ { latitude, longitude },
{ {
id: "911", zoom: 16.2, //
styleId: "marker", pitch: 43.5, //
position: new TMap.LatLng(lat, lng), rotation: 45, //
properties: { }
title: centerName, );
},
},
]);
},
setCenter(lat, lng) {
map.setCenter(new window.TMap.LatLng(lat, lng));
}, },
setMap() { setMap() {
const { tableData, currentIndex } = this; const { tableData, currentIndex } = this;
let item = tableData[currentIndex]; let item = tableData[currentIndex];
if (item) { if (item) {
this.setCenter(item.latitude, item.longitude); map.setCenter(item.latitude, item.longitude);
this.setMarker(item.latitude, item.longitude, item.centerName); map.setMarker(item.latitude, item.longitude, item.centerName);
} }
}, },

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

@ -1,246 +1,192 @@
<template> <template>
<div> <div>
<div class="dialog-h-content scroll-h"> <div class="dialog-h-content scroll-h">
<el-form <el-form ref="ref_form"
ref="ref_form"
:inline="true" :inline="true"
:model="dataForm" :model="dataForm"
:rules="dataRule" :rules="dataRule"
:disabled="formType === 'detail'" :disabled="formType === 'detail'"
class="form" class="form">
> <el-form-item label="组织名称 "
<el-form-item
label="组织名称 "
prop="organizationName" prop="organizationName"
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="dataForm.organizationName" v-model="dataForm.organizationName">
>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item <el-form-item label="分类名称 "
label="分类名称 "
prop="categoryCode" prop="categoryCode"
label-width="150px" label-width="150px"
style="display: block" style="display: block">
> <el-select v-model="dataForm.categoryCode"
<el-select
v-model="dataForm.categoryCode"
placeholder="请选择" placeholder="请选择"
clearable clearable>
> <el-option v-for="item in categoryList"
<el-option
v-for="item in categoryList"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value">
>
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item <el-form-item label="组织人数 "
label="组织人数 "
prop="organizationPersonCount" prop="organizationPersonCount"
label-width="150px" label-width="150px"
style="display: block" style="display: block">
> <el-input class="item_width_1"
<el-input
class="item_width_1"
type="number" type="number"
maxlength="50" maxlength="50"
show-word-limit show-word-limit
placeholder="请输入组织人数 " placeholder="请输入组织人数 "
v-model="dataForm.organizationPersonCount" v-model="dataForm.organizationPersonCount">
>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item <el-form-item label="组织成员 "
label="组织成员 "
prop="organizationPersonnel" prop="organizationPersonnel"
label-width="150px" label-width="150px"
style="display: block" style="display: block">
>
<div class="m-staffs"> <div class="m-staffs">
<div <div class="item"
class="item"
:key="'staff' + index" :key="'staff' + index"
v-for="(item, index) in dataForm.organizationPersonnel" v-for="(item, index) in dataForm.organizationPersonnel">
> <el-autocomplete class="item_width_1"
<el-autocomplete
class="item_width_1"
v-model="item.personName" v-model="item.personName"
:fetch-suggestions="querySearchVolunteer" :fetch-suggestions="querySearchVolunteer"
placeholder="成员姓名" placeholder="成员姓名"
:maxlength="50" :maxlength="50"
show-word-limit show-word-limit
@select="(vItem) => handleSelectVolunteer(index, vItem)" @select="(vItem) => handleSelectVolunteer(index, vItem)"
:disabled="item.icResiUserId != ''" :disabled="item.icResiUserId != ''"></el-autocomplete>
></el-autocomplete>
<el-input <el-input style="margin-left: 10px"
style="margin-left: 10px"
class="item_width_1" class="item_width_1"
show-word-limit show-word-limit
placeholder="联系电话" placeholder="联系电话"
:disabled="item.icResiUserId != ''" :disabled="item.icResiUserId != ''"
v-model="item.personPhone" v-model="item.personPhone" />
/>
<el-button <el-button style="margin-left: 10px"
style="margin-left: 10px"
size="small" size="small"
@click="handleDelStaff(index)" @click="handleDelStaff(index)">删除</el-button>
>删除</el-button
>
</div> </div>
<div class="item-add"> <div class="item-add">
<el-button size="small" @click="handleAddStaff">添加</el-button> <el-button size="small"
@click="handleAddStaff">添加</el-button>
</div> </div>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item <el-form-item label="服务事项"
label="服务事项"
prop="serviceItem" prop="serviceItem"
label-width="150px" label-width="150px"
style="display: block" style="display: block">
> <el-input class="item_width_1"
<el-input
class="item_width_1"
type="textarea" type="textarea"
maxlength="1000" maxlength="1000"
show-word-limit show-word-limit
:rows="3" :rows="3"
placeholder="请输入服务事项,不超过1000字" placeholder="请输入服务事项,不超过1000字"
v-model="dataForm.serviceItem" v-model="dataForm.serviceItem"></el-input>
></el-input>
</el-form-item> </el-form-item>
<el-form-item <el-form-item label="负责人 "
label="负责人 "
prop="principalName" prop="principalName"
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="dataForm.principalName" v-model="dataForm.principalName">
>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item <el-form-item label="联系电话 "
label="联系电话 "
prop="principalPhone" prop="principalPhone"
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="dataForm.principalPhone" v-model="dataForm.principalPhone">
>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item <el-form-item label="创建时间"
label="创建时间"
prop="organizationCreatedTime" prop="organizationCreatedTime"
label-width="150px" label-width="150px"
style="display: block" style="display: block">
> <el-date-picker v-model="dataForm.organizationCreatedTime"
<el-date-picker
v-model="dataForm.organizationCreatedTime"
placeholder="创建时间" placeholder="创建时间"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd">
>
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item <el-form-item label="地图位置"
label="位置坐标"
prop="longitude" prop="longitude"
label-width="150px" label-width="150px"
style="display: block" style="display: block">
>
<div style="width: 500px"> <div style="width: 500px">
<el-input <el-select v-model="searchValue"
class="item_width_4" filterable
maxlength="50" style="width: 500px"
placeholder="请输入关键字" remote
v-model="dataForm.address" :reserve-keyword="true"
> placeholder="请输入关键词"
</el-input> :remote-method="remoteMethod"
<el-button :loading="loading">
style="margin-left: 10px" <el-option v-for="(item,index) in searchOptions"
type="default" @click.native="handleClickKey(index)"
size="small" :key="item.value"
@click="handleSearchMap" :label="item.label"
>查询</el-button :value="item.value">
> </el-option>
<div id="app" class="div_map"></div> </el-select>
<div style="margin-top: 10px" v-show="false"> <div id="app"
<span>经度</span> class="div_map"></div>
<el-input </div>
class="item_width_3" </el-form-item>
maxlength="50"
placeholder="请输入经度" <el-form-item label="所在位置 "
v-model="dataForm.longitude" prop="address"
> label-width="150px"
</el-input> style="display: block">
<span style="margin-left: 20px">纬度</span> <el-input class="item_width_1"
<el-input
class="item_width_3"
maxlength="50" maxlength="50"
placeholder="请输入纬度" show-word-limit
v-model="dataForm.latitude" placeholder="请输入位置 "
> v-model="dataForm.address">
</el-input> </el-input>
</div>
</div>
</el-form-item> </el-form-item>
<el-form-item <el-form-item label="备注"
label="备注"
prop="remark" prop="remark"
label-width="150px" label-width="150px"
style="display: block" style="display: block">
> <el-input class="item_width_1"
<el-input
class="item_width_1"
type="textarea" type="textarea"
maxlength="500" maxlength="500"
show-word-limit show-word-limit
:rows="3" :rows="3"
placeholder="请输入备注,不超过500字" placeholder="请输入备注,不超过500字"
v-model="dataForm.remark" v-model="dataForm.remark"></el-input>
></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<div class="div_btn resi-btns"> <div class="div_btn resi-btns">
<el-button size="small" @click="handleCancle"> </el-button> <el-button size="small"
<el-button @click="handleCancle"> </el-button>
v-if="formType != 'detail'" <el-button v-if="formType != 'detail'"
type="primary" type="primary"
size="small" size="small"
:disabled="btnDisable" :disabled="btnDisable"
@click="handleComfirm" @click="handleComfirm"> </el-button>
> </el-button
>
</div> </div>
</div> </div>
</template> </template>
@ -251,6 +197,7 @@ import { Loading } from "element-ui"; // 引入Loading服务
import { requestPost } from "@/js/dai/request"; import { requestPost } from "@/js/dai/request";
import formVltHelper from "dai-js/tools/formVltHelper"; import formVltHelper from "dai-js/tools/formVltHelper";
import nextTick from "dai-js/tools/nextTick"; import nextTick from "dai-js/tools/nextTick";
import daiMap from "@/utils/dai-map";
var map; var map;
var search; var search;
@ -262,10 +209,15 @@ var geocoder; // 新建一个正逆地址解析类
export default { export default {
components: {}, components: {},
props: {}, props: {},
data() { data () {
return { return {
formType: "add", // addeditdetail formType: "add", // addeditdetail
searchOptions: [],
searchValue: '',
resultList: [],
loading: false,
btnDisable: false, btnDisable: false,
orgId: "", orgId: "",
@ -288,7 +240,7 @@ export default {
}; };
}, },
computed: { computed: {
dataRule() { dataRule () {
return { return {
organizationName: [ organizationName: [
{ required: true, message: "组织名称 不能为空", trigger: "blur" }, { required: true, message: "组织名称 不能为空", trigger: "blur" },
@ -323,14 +275,56 @@ export default {
}, },
watch: {}, watch: {},
async mounted() { async mounted () {
this.getCategoryList(); this.getCategoryList();
this.getVolunteerList(); this.getVolunteerList();
this.initMap();
}, },
methods: { 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; const { volunteerList } = this;
var results = queryString var results = queryString
? volunteerList.filter((item) => { ? volunteerList.filter((item) => {
@ -341,7 +335,7 @@ export default {
cb(results); cb(results);
}, },
handleSelectVolunteer(index, vItem) { handleSelectVolunteer (index, vItem) {
this.dataForm.organizationPersonnel[index] = { this.dataForm.organizationPersonnel[index] = {
personName: vItem.name, personName: vItem.name,
personPhone: vItem.mobile, personPhone: vItem.mobile,
@ -349,7 +343,7 @@ export default {
}; };
}, },
async getVolunteerList() { async getVolunteerList () {
const url = "/epmetuser/icresiuser/volunteer-list"; const url = "/epmetuser/icresiuser/volunteer-list";
const params = {}; const params = {};
const { data, code, msg } = await requestPost(url, 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 url = "/sys/dict/data/dictlist";
const params = { const params = {
dictType: "self_org_category", dictType: "self_org_category",
@ -379,131 +373,83 @@ export default {
this.$message.error(msg); this.$message.error(msg);
} }
}, },
handleAddStaff() { handleAddStaff () {
this.dataForm.organizationPersonnel = [ this.dataForm.organizationPersonnel = [
...this.dataForm.organizationPersonnel, ...this.dataForm.organizationPersonnel,
{ personName: "", personPhone: "", icResiUserId: "" }, { personName: "", personPhone: "", icResiUserId: "" },
]; ];
}, },
handleDelStaff(index) { handleDelStaff (index) {
const { organizationPersonnel } = this.dataForm; const { organizationPersonnel } = this.dataForm;
organizationPersonnel.splice(index, 1); organizationPersonnel.splice(index, 1);
this.dataForm.organizationPersonnel = organizationPersonnel; 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; let { latitude, longitude } = this.$store.state.user;
if (!latitude || latitude == "" || latitude == "0") { if (row) {
latitude = 39.9088810666821; this.dataForm = { ...this.dataForm, ...row };
longitude = 116.39743841556731; 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, // // init
initMap (latitude, longitude) {
map = new daiMap(
document.getElementById("app"),
{ latitude, longitude },
{
zoom: 16.2, // zoom: 16.2, //
pitch: 43.5, // pitch: 43.5, //
rotation: 45, // rotation: 45, //
}); }
);
search = new window.TMap.service.Search({ pageSize: 10 });
//
markers = new TMap.MultiMarker({
map: map,
geometries: [],
});
infoWindowList = Array(10);
geocoder = new TMap.service.Geocoder(); //
// //
map.on("panend", (e) => { map.on("dragend", (e) => {
this.handleMoveCenter(e); this.handleMoveCenter(e);
}); });
// this.handleMoveCenter();
},
setMarker(lat, lng) { map.setCenter(latitude, longitude);
markers.setGeometries([]); map.setMarker(latitude, longitude);
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.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, lng } = map.getCenter();
const lat = center.getLat();
const lng = center.getLng();
this.dataForm.latitude = lat; this.dataForm.latitude = lat;
this.dataForm.longitude = lng; 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; this.btnDisable = true;
setTimeout(() => { setTimeout(() => {
this.btnDisable = false; this.btnDisable = false;
@ -536,7 +482,7 @@ export default {
}); });
}, },
async submit() { async submit () {
let url = ""; let url = "";
if (this.formType === "add") { if (this.formType === "add") {
url = "/heart/iccommunityselforganization/addcommunityselforganization"; url = "/heart/iccommunityselforganization/addcommunityselforganization";
@ -564,11 +510,16 @@ export default {
} }
}, },
handleCancle() { handleCancle () {
this.resetData(); this.resetData();
this.$emit("dialogCancle"); this.$emit("dialogCancle");
}, },
resetData() { resetData () {
this.searchValue = ''
this.searchOptions = []
this.resultList = []
this.orgId = ""; this.orgId = "";
this.dataForm = { this.dataForm = {
organizationName: "", organizationName: "",
@ -585,8 +536,23 @@ export default {
organizationPersonnel: [], 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({ loading = Loading.service({
lock: true, // lock: true, //
text: "正在加载……", // text: "正在加载……", //
@ -594,7 +560,7 @@ export default {
}); });
}, },
// //
endLoading() { endLoading () {
// clearTimeout(timer); // clearTimeout(timer);
if (loading) { if (loading) {
loading.close(); loading.close();

104
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 nextTick from "dai-js/tools/nextTick";
import Schema from "async-validator"; import Schema from "async-validator";
import Tinymce from "@c/tinymce2/index.vue"; import Tinymce from "@c/tinymce2/index.vue";
import daiMap from "@/utils/dai-map";
var map; var map;
var search;
var markers;
var infoWindowList;
var geocoder; //
export default { export default {
components: { Tinymce }, components: { Tinymce },
@ -626,101 +623,49 @@ export default {
// init // init
initMap(item) { initMap(item) {
let { latitude, longitude } = this.$store.state.user; let { latitude, longitude } = this.$store.state.user;
if (!latitude || latitude == "" || latitude == "0") {
latitude = 39.9088810666821; map = new daiMap(
longitude = 116.39743841556731; document.getElementById("app"),
} { latitude, 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, // zoom: 16.2, //
pitch: 43.5, // pitch: 43.5, //
rotation: 45, // rotation: 45, //
}); }
);
search = new window.TMap.service.Search({ pageSize: 10 });
//
markers = new TMap.MultiMarker({
map: map,
geometries: [],
});
infoWindowList = Array(10);
geocoder = new TMap.service.Geocoder(); //
// //
map.on("panend", (e) => { map.on("dragend", (e) => {
this.handleMoveCenter(item, e); this.handleMoveCenter(item, e);
}); });
// this.handleMoveCenter(item); // this.handleMoveCenter(item);
}, },
setMarker(lat, lng) { async handleSearchMap(item) {
markers.setGeometries([]); const { msg, data } = await map.searchNearby(this.fmData[item.keyName]);
markers.add([ if (msg == "success") {
{ const { lat, lng } = data;
id: "4", map.setCenter(lat, lng);
styleId: "marker", map.setMarker(lat, lng);
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[0]] = lng;
this.fmData[item.supKeys[1]] = lat; this.fmData[item.supKeys[1]] = lat;
} else { } else {
this.$message.error("未检索到相关位置坐标"); this.$message.error("未检索到相关位置坐标");
} }
});
}, },
handleMoveCenter(item, e) { async handleMoveCenter(item, e) {
console.log(e); console.log("handleMoveCenter", e);
// //
const center = map.getCenter(); const { lat, lng } = map.getCenter();
const lat = center.getLat();
const lng = center.getLng();
// item.supValues[0] = lng;
// item.supValues[1] = lat;
this.fmData[item.supKeys[0]] = lng; this.fmData[item.supKeys[0]] = lng;
this.fmData[item.supKeys[1]] = lat; this.fmData[item.supKeys[1]] = lat;
this.setMarker(lat, lng); map.setMarker(lat, lng);
if (e && e.originalEvent) { let { msg, data } = await map.getAddress(lat, lng);
geocoder if (msg == "success") {
.getAddress({ location: new TMap.LatLng(lat, lng) }) // this.fmData[item.keyName] = data.address;
.then((result) => {
this.fmData[item.keyName] = result.result.address;
});
} }
}, },
@ -752,7 +697,8 @@ export default {
await nextTick(600); await nextTick(600);
if (map) { if (map) {
if (data.latitude) { 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 { } else {
if (this.formType == "edit" && this.$refs && this.$refs.mapSearch) { if (this.formType == "edit" && this.$refs && this.$refs.mapSearch) {
this.$refs.mapSearch[0].handleClick(); this.$refs.mapSearch[0].handleClick();

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

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

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

@ -33,7 +33,7 @@
</div> </div>
<div class="info-prop"> <div class="info-prop">
<span class="info-title-2">地理位置</span> <span class="info-title-2">所在位置</span>
<span>{{ formData.address }}</span> <span>{{ formData.address }}</span>
</div> </div>
@ -41,7 +41,7 @@
<span class="info-title-2">地图位置</span> <span class="info-title-2">地图位置</span>
<div class="div_map"> <div class="div_map">
<div id="app_detail"></div> <div id="app_csgl_detail"></div>
</div> </div>
</div> </div>
@ -61,6 +61,7 @@
<script> <script>
import { Loading } from 'element-ui' // Loading import { Loading } from 'element-ui' // Loading
import daiMap from "@/utils/dai-map";
var map var map
var search var search
@ -85,14 +86,14 @@ export default {
methods: { methods: {
handleCancle () { handleCancle () {
this.diaDestroy() // this.diaDestroy()
this.$emit('diaDetailClose') this.$emit('diaDetailClose')
}, },
diaDestroy () { diaDestroy () {
if (map) { if (map) {
map.destroy() // map.destroy()
} }
}, },
@ -100,17 +101,7 @@ export default {
this.startLoading() this.startLoading()
this.formData = { ...row } this.formData = { ...row }
this.initLoading = true this.initLoading = true
this.$nextTick(() => {
this.initMap()
})
this.endLoading()
},
// init
initMap () {
//
let { latitude, longitude } = this.$store.state.user; let { latitude, longitude } = this.$store.state.user;
console.log('lat' + latitude + ',lon' + longitude) console.log('lat' + latitude + ',lon' + longitude)
if (this.formData.latitude && this.formData.longitude) { if (this.formData.latitude && this.formData.longitude) {
@ -121,115 +112,37 @@ export default {
latitude = 39.9088810666821; latitude = 39.9088810666821;
longitude = 116.39743841556731; longitude = 116.39743841556731;
} }
// this.$nextTick(() => {
var center = new window.TMap.LatLng(latitude, longitude); this.initMap(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: []
}) })
infoWindowList = Array(10) this.endLoading()
geocoder = new TMap.service.Geocoder(); //
//
map.on('panend', () => {
this.handleMoveCenter()
})
this.handleMoveCenter()
// this.convert()
}, },
setMarker (lat, lng) { // init
markers.setGeometries([]) initMap (latitude, longitude) {
markers.add([
{
id: '4',
styleId: 'marker',
position: new TMap.LatLng(lat, lng),
properties: {
title: 'marker4'
}
}
])
},
handleSearchMap () { map = new daiMap(
infoWindowList.forEach((infoWindow) => { document.getElementById("app_csgl_detail"),
infoWindow.close() { latitude, longitude },
}) {
infoWindowList.length = 0 zoom: 16.2, //
markers.setGeometries([]) pitch: 43.5, //
// rotation: 45, //
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 () { // //
// // map.on("dragend", (e) => {
const center = map.getCenter() // this.handleMoveCenter(e);
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) { map.setCenter(latitude, longitude);
markers.setGeometries([]); map.setMarker(latitude, longitude);
// var input = document.getElementById('location').value.split(',');
let location
if (lat && lng) {
location = new TMap.LatLng(lat, lng);
} else {
location = new TMap.LatLng(this.formData.latitude, this.formData.longitude);
}
// map.setCenter(location);
markers.updateGeometries([
{
id: 'main', //
position: location,
},
]);
geocoder
.getAddress({ location: location }) //
.then((result) => {
// this.formData.address = result.result.address
//
});
}, },
// //
startLoading () { startLoading () {
loading = Loading.service({ loading = Loading.service({

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

@ -96,22 +96,41 @@
placeholder="请输入联系电话"></el-input> placeholder="请输入联系电话"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="地址" <el-form-item label="地图位置"
prop="longitude"
label-width="150px"
style="display: block">
<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" prop="address"
label-width="150px" label-width="150px"
style="display: block"> style="display: block">
<div class="item_width_1"> <el-input class="item_width_1"
<el-input style="width:420px" maxlength="50"
:placeholder="'请输入所在地址'" show-word-limit
placeholder="请输入位置 "
v-model="formData.address"> v-model="formData.address">
</el-input> </el-input>
<el-button style="margin-left: 10px"
type="default"
size="small"
@click="handleSearchMap">查询</el-button>
<div id="app"
class="div_map"></div>
</div>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
@ -132,7 +151,7 @@
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import { Loading } from 'element-ui' // Loading import { Loading } from 'element-ui' // Loading
import { requestPost } from '@/js/dai/request' import { requestPost } from '@/js/dai/request'
import daiMap from "@/utils/dai-map";
var map var map
@ -146,6 +165,10 @@ export default {
data () { data () {
return { return {
formType: 'add', // addeditdetail formType: 'add', // addeditdetail
searchOptions: [],
searchValue: '',
resultList: [],
loading: false,
btnDisable: false, btnDisable: false,
serviceList: [], serviceList: [],
@ -169,7 +192,7 @@ export default {
}, },
components: {}, components: {},
mounted () { mounted () {
this.initMap()
}, },
methods: { methods: {
@ -177,7 +200,7 @@ export default {
async initForm (type, icCityManagementId) { async initForm (type, icCityManagementId) {
this.startLoading() this.startLoading()
this.$refs.ref_form.resetFields(); this.$refs.ref_form.resetFields();
let { latitude, longitude } = this.$store.state.user;
// //
await this.loadService() await this.loadService()
@ -187,10 +210,12 @@ export default {
this.formData.icCityManagementId = icCityManagementId this.formData.icCityManagementId = icCityManagementId
await this.loadFormData() await this.loadFormData()
} else { } else {
// map.setCenter(new TMap.LatLng(36.0722275, 120.38945519)) this.formData.latitude = latitude
// this.setMarker(36.0722275, 120.38945519) this.formData.longitude = longitude
} }
// if (!map) {
this.initMap(this.formData.latitude, this.formData.longitude);
// }
this.endLoading() this.endLoading()
}, },
@ -231,10 +256,10 @@ export default {
// let { latitude, longitude } = this.$store.state.user; // let { latitude, longitude } = this.$store.state.user;
// const lat = this.formData.latitude === null || this.formData.latitude === '' ? latitude : this.formData.latitude; // 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; // 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 !== '') { // 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)) // map.setCenter(new TMap.LatLng(this.formData.latitude, this.formData.longitude))
this.setMarker(this.formData.latitude, this.formData.longitude) // this.setMarker(this.formData.latitude, this.formData.longitude)
} // }
} else { } else {
this.$message.error(msg) this.$message.error(msg)
} }
@ -289,133 +314,90 @@ export default {
}, },
// init // init
initMap () { initMap (latitude, longitude) {
//
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 map = new daiMap(
this.formData.longitude = longitude document.getElementById("app_csgl"),
// { latitude, 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, // zoom: 16.2, //
pitch: 43.5, // pitch: 43.5, //
rotation: 45 // rotation: 45, //
}) }
);
search = new window.TMap.service.Search({ pageSize: 10 }) //
// map.on("dragend", (e) => {
markers = new TMap.MultiMarker({ this.handleMoveCenter(e);
map: map, });
geometries: []
})
infoWindowList = Array(10)
geocoder = new TMap.service.Geocoder(); // map.setCenter(latitude, longitude);
map.setMarker(latitude, longitude);
//
map.on('panend', () => {
this.handleMoveCenter()
})
this.handleMoveCenter()
// this.convert()
}, },
setMarker (lat, lng) {
markers.setGeometries([])
markers.add([
{
id: '4',
styleId: 'marker',
position: new TMap.LatLng(lat, lng),
properties: {
title: 'marker4'
}
}
])
},
handleSearchMap () { async handleMoveCenter () {
infoWindowList.forEach((infoWindow) => { //
infoWindow.close() const { lat, lng } = map.getCenter();
}) this.formData.latitude = lat;
infoWindowList.length = 0 this.formData.longitude = lng;
markers.setGeometries([]) map.setMarker(lat, lng);
//
search let { msg, data } = await map.getAddress(lat, lng);
.searchNearby({ if (msg == "success") {
keyword: this.formData.address, this.formData.address = data.address
radius: 1000, this.searchValue = data.address
autoExtend: true, this.searchOptions = []
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 remoteMethod (query) {
handleMoveCenter () { if (query !== '') {
// this.loading = true;
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) { const { msg, data } = await map.searchNearby(query);
markers.setGeometries([]); this.loading = false;
// var input = document.getElementById('location').value.split(','); this.resultList = []
let location
if (lat && lng) {
location = new TMap.LatLng(lat, lng);
} else {
location = new TMap.LatLng(this.formData.latitude, this.formData.longitude);
}
// map.setCenter(location); if (msg == "success" && data.resultList && data.resultList.length > 0) {
markers.updateGeometries([
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 = [
{ {
id: 'main', // value: '0',
position: location, label: '未检索到结果'
}
]
}
} else {
this.searchOptions = [];
}
}, },
]);
geocoder handleClickKey (index) {
.getAddress({ location: location }) // let selPosition = this.resultList[index]
.then((result) => { let lonlat = selPosition.lonlat.split(" ")
// this.formData.address = result.result.address === '' || result.result.address === null ? this.formData.address : result.result.address map.setCenter(lonlat[1], lonlat[0]);
this.formData.address = this.formData.address !== '' && this.formData.address !== null && (this.formData.longitude === '' || this.formData.longitude === null) ? this.formData.address : result.result.address map.setMarker(lonlat[1], lonlat[0]);
// this.formData.latitude = lonlat[1];
}); this.formData.longitude = lonlat[0];
this.formData.address = selPosition.address + selPosition.name
}, },
resetData () { resetData () {
this.searchValue = ''
this.searchOptions = []
this.resultList = []
this.unitId = '' this.unitId = ''
this.keyWords = '' this.keyWords = ''
this.formData = { this.formData = {

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

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

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

@ -42,7 +42,7 @@
<span class="info-title-2">地图位置</span> <span class="info-title-2">地图位置</span>
<div class="div_map"> <div class="div_map">
<div id="app_detail"></div> <div id="app_ggfw_detail"></div>
</div> </div>
</div> </div>
@ -62,6 +62,7 @@
<script> <script>
import { Loading } from 'element-ui' // Loading import { Loading } from 'element-ui' // Loading
import daiMap from "@/utils/dai-map";
var map var map
var search var search
@ -86,14 +87,14 @@ export default {
methods: { methods: {
handleCancle () { handleCancle () {
this.diaDestroy() // this.diaDestroy()
this.$emit('diaDetailClose') this.$emit('diaDetailClose')
}, },
diaDestroy () { diaDestroy () {
if (map) { if (map) {
map.destroy() // map.destroy()
} }
}, },
@ -101,15 +102,7 @@ export default {
this.startLoading() this.startLoading()
this.formData = { ...row } this.formData = { ...row }
this.initLoading = true this.initLoading = true
this.$nextTick(() => {
this.initMap()
})
this.endLoading()
},
// init
initMap () {
let { latitude, longitude } = this.$store.state.user; let { latitude, longitude } = this.$store.state.user;
console.log('lat' + latitude + ',lon' + longitude) console.log('lat' + latitude + ',lon' + longitude)
if (this.formData.latitude && this.formData.longitude) { if (this.formData.latitude && this.formData.longitude) {
@ -120,116 +113,38 @@ export default {
latitude = 39.9088810666821; latitude = 39.9088810666821;
longitude = 116.39743841556731; 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 }) this.$nextTick(() => {
// this.initMap(latitude, longitude)
markers = new TMap.MultiMarker({
map: map,
geometries: []
}) })
infoWindowList = Array(10) this.endLoading()
geocoder = new TMap.service.Geocoder(); //
//
map.on('panend', () => {
this.handleMoveCenter()
})
this.handleMoveCenter()
console.log('initMap')
// this.convert()
}, },
setMarker (lat, lng) { // init
markers.setGeometries([]) initMap (latitude, longitude) {
markers.add([
{
id: '4',
styleId: 'marker',
position: new TMap.LatLng(lat, lng),
properties: {
title: 'marker4'
}
}
])
},
handleSearchMap () { map = new daiMap(
infoWindowList.forEach((infoWindow) => { document.getElementById("app_ggfw_detail"),
infoWindow.close() { latitude, longitude },
}) {
infoWindowList.length = 0 zoom: 16.2, //
markers.setGeometries([]) pitch: 43.5, //
// rotation: 45, //
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 () { // //
// // map.on("dragend", (e) => {
const center = map.getCenter() // this.handleMoveCenter(e);
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) { map.setCenter(latitude, longitude);
markers.setGeometries([]); map.setMarker(latitude, longitude);
// var input = document.getElementById('location').value.split(',');
let location
if (lat && lng) {
location = new TMap.LatLng(lat, lng);
} else {
location = new TMap.LatLng(this.formData.latitude, this.formData.longitude);
}
// map.setCenter(location);
markers.updateGeometries([
{
id: 'main', //
position: location,
},
]);
geocoder
.getAddress({ location: location }) //
.then((result) => {
// this.formData.address = result.result.address
//
});
}, },
// //
startLoading () { startLoading () {
loading = Loading.service({ loading = Loading.service({

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

@ -77,22 +77,41 @@
class="item_width_1" class="item_width_1"
placeholder="请输入联系电话"></el-input> placeholder="请输入联系电话"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="地址" <el-form-item label="地图位置"
prop="longitude"
label-width="150px"
style="display: block">
<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" prop="address"
label-width="150px" label-width="150px"
style="display: block"> style="display: block">
<div class="item_width_1"> <el-input class="item_width_1"
<el-input style="width:420px" maxlength="50"
:placeholder="'请输入所在地址'" show-word-limit
placeholder="请输入位置 "
v-model="formData.address"> v-model="formData.address">
</el-input> </el-input>
<el-button style="margin-left: 10px"
type="default"
size="small"
@click="handleSearchMap">查询</el-button>
<div id="app"
class="div_map"></div>
</div>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
@ -113,7 +132,7 @@
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import { Loading } from 'element-ui' // Loading import { Loading } from 'element-ui' // Loading
import { requestPost } from '@/js/dai/request' import { requestPost } from '@/js/dai/request'
import daiMap from "@/utils/dai-map";
var map var map
@ -127,11 +146,15 @@ export default {
data () { data () {
return { return {
formType: 'add', // addeditdetail formType: 'add', // addeditdetail
searchOptions: [],
searchValue: '',
resultList: [],
loading: false,
btnDisable: false, btnDisable: false,
icPublicServiceId: '', icPublicServiceId: '',
keyWords: '',
formData: { formData: {
name: '',// name: '',//
category: '', category: '',
@ -149,7 +172,7 @@ export default {
}, },
components: {}, components: {},
mounted () { mounted () {
this.initMap()
}, },
methods: { methods: {
@ -157,7 +180,7 @@ export default {
async initForm (type, icPublicServiceId) { async initForm (type, icPublicServiceId) {
this.startLoading() this.startLoading()
this.$refs.ref_form.resetFields(); this.$refs.ref_form.resetFields();
let { latitude, longitude } = this.$store.state.user;
// //
await this.loadService() await this.loadService()
@ -167,10 +190,13 @@ export default {
this.formData.icPublicServiceId = icPublicServiceId this.formData.icPublicServiceId = icPublicServiceId
await this.loadFormData() await this.loadFormData()
} else { } else {
// map.setCenter(new TMap.LatLng(36.0722275, 120.38945519)) this.formData.latitude = latitude
// this.setMarker(36.0722275, 120.38945519) this.formData.longitude = longitude
} }
// if (!map) {
this.initMap(this.formData.latitude, this.formData.longitude);
// }
this.endLoading() this.endLoading()
}, },
@ -211,10 +237,10 @@ export default {
// let { latitude, longitude } = this.$store.state.user; // let { latitude, longitude } = this.$store.state.user;
// const lat = this.formData.latitude === null || this.formData.latitude === '' ? '' : this.formData.latitude; // const lat = this.formData.latitude === null || this.formData.latitude === '' ? '' : this.formData.latitude;
// const lon = this.formData.longitude === null || this.formData.longitude === '' ? '' : this.formData.longitude; // 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 !== '') { // 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)) // map.setCenter(new TMap.LatLng(this.formData.latitude, this.formData.longitude))
this.setMarker(this.formData.latitude, this.formData.longitude) // this.setMarker(this.formData.latitude, this.formData.longitude)
} // }
} else { } else {
this.$message.error(msg) this.$message.error(msg)
} }
@ -270,130 +296,90 @@ export default {
}, },
// init // init
initMap () { initMap (latitude, longitude) {
let { latitude, longitude } = this.$store.state.user;
console.log('lat' + latitude + ',lon' + longitude) map = new daiMap(
if (!latitude || latitude == "" || latitude == "0") { document.getElementById("app_ggfw"),
latitude = 39.9088810666821; { latitude, longitude },
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, // zoom: 16.2, //
pitch: 43.5, // pitch: 43.5, //
rotation: 45 // rotation: 45, //
}) }
);
search = new window.TMap.service.Search({ pageSize: 10 }) //
// map.on("dragend", (e) => {
markers = new TMap.MultiMarker({ this.handleMoveCenter(e);
map: map, });
geometries: []
})
infoWindowList = Array(10)
geocoder = new TMap.service.Geocoder(); // map.setCenter(latitude, longitude);
map.setMarker(latitude, longitude);
//
map.on('panend', () => {
this.handleMoveCenter()
})
this.handleMoveCenter()
// this.convert()
}, },
setMarker (lat, lng) {
markers.setGeometries([])
markers.add([
{
id: '4',
styleId: 'marker',
position: new TMap.LatLng(lat, lng),
properties: {
title: 'marker4'
}
}
])
},
handleSearchMap () { async handleMoveCenter () {
infoWindowList.forEach((infoWindow) => { //
infoWindow.close() const { lat, lng } = map.getCenter();
}) this.formData.latitude = lat;
infoWindowList.length = 0 this.formData.longitude = lng;
markers.setGeometries([]) map.setMarker(lat, lng);
//
search let { msg, data } = await map.getAddress(lat, lng);
.searchNearby({ if (msg == "success") {
keyword: this.formData.address, this.formData.address = data.address
radius: 1000, this.searchValue = data.address
autoExtend: true, this.searchOptions = []
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 remoteMethod (query) {
//
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) { if (query !== '') {
markers.setGeometries([]); this.loading = true;
// var input = document.getElementById('location').value.split(',');
let location const { msg, data } = await map.searchNearby(query);
if (lat && lng) { this.loading = false;
location = new TMap.LatLng(lat, lng); this.resultList = []
} else {
location = new TMap.LatLng(this.formData.latitude, this.formData.longitude); 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}` };
// 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
//
}); });
}
} 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.formData.address = selPosition.address + selPosition.name
},
resetData () { resetData () {
this.searchValue = ''
this.searchOptions = []
this.resultList = []
this.icPublicServiceId = '' this.icPublicServiceId = ''
this.keyWords = '' this.keyWords = ''
this.formData = { this.formData = {

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

@ -31,9 +31,11 @@ import {
PointLayer, PointLayer,
Marker, Marker,
Popup, Popup,
RasterLayer,
} from "@antv/l7"; } from "@antv/l7";
import { GaodeMap, Map } from "@antv/l7-maps"; import { GaodeMap, Map } from "@antv/l7-maps";
import { spliceIntoChunks } from "@/utils/index"; import { spliceIntoChunks } from "@/utils/index";
import { mapType, searchNearby } from "@/utils/dai-map";
let myMap; let myMap;
let scene; let scene;
@ -327,23 +329,32 @@ export default {
styleConfig = lightStyle; styleConfig = lightStyle;
} }
myMap = new GaodeMap({ const iniCenter = [
pitch: this.pitch,
style: styleConfig.style,
center: [
srcGridData.longitude || srcGridData.longitude ||
this.$store.state.user.longitude || this.$store.state.user.longitude ||
116.39743841556731, 116.39743841556731,
srcGridData.latitude || srcGridData.latitude ||
this.$store.state.user.latitude || this.$store.state.user.latitude ||
39.9088810666821, 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", token: "fc14b42e0ca18387866d68ebd4f150c1",
zoom: 18, zoom: 18,
isHotspot: false, isHotspot: false,
resizeEnable: true, resizeEnable: true,
doubleClickZoom: false, doubleClickZoom: false,
}); });
}
scene = new Scene({ scene = new Scene({
id: "map", id: "map",
@ -352,6 +363,10 @@ export default {
}); });
scene.on("loaded", async () => { scene.on("loaded", async () => {
if (mapType == "td") {
this.iniMapBase(scene);
}
this.iniMapGrid(scene); this.iniMapGrid(scene);
this.iniMapDot(scene); this.iniMapDot(scene);
this.iniMapDot2(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) { iniMapGrid(scene) {
const { darkStyle, lightStyle, polygonData, polygonDotData } = this; const { darkStyle, lightStyle, polygonData, polygonDotData } = this;
@ -806,7 +861,11 @@ export default {
}, },
searchPos(name) { searchPos(name) {
return new Promise((reslove) => { console.log("=----------------------=searchPos", name);
return new Promise(async (reslove) => {
if (mapType == "td") {
reslove([]);
} else {
window.AMap.plugin("AMap.PlaceSearch", () => { window.AMap.plugin("AMap.PlaceSearch", () => {
const city = this.$store.state.user.areaCodePath[1] || "全国"; const city = this.$store.state.user.areaCodePath[1] || "全国";
console.log("搜索区域", city); console.log("搜索区域", city);
@ -820,6 +879,7 @@ export default {
reslove(result); reslove(result);
}); });
}); });
}
}); });
}, },
}, },

Loading…
Cancel
Save