Browse Source

勉强能看

feature/dev_worklog2
dai 3 years ago
parent
commit
58e335e1e0
  1. BIN
      src/assets/img/shuju/command/ico2/IS_DB.png
  2. BIN
      src/assets/img/shuju/command/ico2/IS_DBH.png
  3. BIN
      src/assets/img/shuju/command/ico2/IS_KC.png
  4. BIN
      src/assets/img/shuju/command/ico2/IS_MB.png
  5. BIN
      src/assets/img/shuju/command/ico2/IS_OLD_PEOPLE.png
  6. BIN
      src/assets/img/shuju/command/ico2/IS_UNEMPLOYED.png
  7. BIN
      src/assets/img/shuju/command/ico2/IS_YLFN.png
  8. BIN
      src/assets/img/shuju/command/ico2/anzhibangjiao.png
  9. BIN
      src/assets/img/shuju/command/ico2/buliangqingshaonian.png
  10. BIN
      src/assets/img/shuju/command/ico2/enterprise_patrol_unqualified.png
  11. BIN
      src/assets/img/shuju/command/ico2/event_tdnd.png
  12. BIN
      src/assets/img/shuju/command/ico2/resi.png
  13. BIN
      src/assets/img/shuju/command/ico2/resi_xfry.png
  14. BIN
      src/assets/img/shuju/command/ico2/shequjiaozheng.png
  15. BIN
      src/assets/img/shuju/command/ico2/xidurenyuan.png
  16. BIN
      src/assets/img/shuju/command/ico2/xiejiaorenyuan.png
  17. BIN
      src/assets/img/shuju/command/ico2/zhaoshizhaohuojingshenbing.png
  18. BIN
      src/assets/img/shuju/command/ico2/zhzl_rq.png
  19. BIN
      src/assets/img/shuju/command/ico3/IS_DB.png
  20. BIN
      src/assets/img/shuju/command/ico3/IS_DBH.png
  21. BIN
      src/assets/img/shuju/command/ico3/IS_KC.png
  22. BIN
      src/assets/img/shuju/command/ico3/IS_MB.png
  23. BIN
      src/assets/img/shuju/command/ico3/IS_OLD_PEOPLE.png
  24. BIN
      src/assets/img/shuju/command/ico3/IS_UNEMPLOYED.png
  25. BIN
      src/assets/img/shuju/command/ico3/anzhibangjiao.png
  26. BIN
      src/assets/img/shuju/command/ico3/buliangqingshaonian.png
  27. BIN
      src/assets/img/shuju/command/ico3/enterprise_patrol_unqualified.png
  28. BIN
      src/assets/img/shuju/command/ico3/event_tdnd.png
  29. BIN
      src/assets/img/shuju/command/ico3/resi_xfry.png
  30. BIN
      src/assets/img/shuju/command/ico3/shequjiaozheng.png
  31. BIN
      src/assets/img/shuju/command/ico3/xidurenyuan.png
  32. BIN
      src/assets/img/shuju/command/ico3/xiejiaorenyuan.png
  33. BIN
      src/assets/img/shuju/command/ico3/zhaoshizhaohuojingshenbing.png
  34. BIN
      src/assets/img/shuju/command/search.png
  35. 129
      src/assets/scss/modules/visual/command.scss
  36. 3
      src/assets/scss/shuju-card.scss
  37. 2
      src/views/modules/visual/basicinfo/basicInfoMain.vue
  38. 423
      src/views/modules/visual/basicinfo/cpts/grid-map.vue
  39. 248
      src/views/modules/visual/command/cpts/sidemenu-left.vue
  40. 105
      src/views/modules/visual/command/cpts/sidemenu.vue
  41. 341
      src/views/modules/visual/command/index.vue
  42. 679
      src/views/modules/visual/cpts/map/command.vue
  43. 617
      src/views/modules/visual/cpts/map/index.vue

BIN
src/assets/img/shuju/command/ico2/IS_DB.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 B

BIN
src/assets/img/shuju/command/ico2/IS_DBH.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 413 B

BIN
src/assets/img/shuju/command/ico2/IS_KC.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 B

BIN
src/assets/img/shuju/command/ico2/IS_MB.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

BIN
src/assets/img/shuju/command/ico2/IS_OLD_PEOPLE.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 303 B

BIN
src/assets/img/shuju/command/ico2/IS_UNEMPLOYED.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 376 B

BIN
src/assets/img/shuju/command/ico2/IS_YLFN.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 376 B

BIN
src/assets/img/shuju/command/ico2/anzhibangjiao.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 418 B

BIN
src/assets/img/shuju/command/ico2/buliangqingshaonian.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 B

BIN
src/assets/img/shuju/command/ico2/enterprise_patrol_unqualified.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 B

BIN
src/assets/img/shuju/command/ico2/event_tdnd.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 485 B

BIN
src/assets/img/shuju/command/ico2/resi.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 469 B

BIN
src/assets/img/shuju/command/ico2/resi_xfry.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 376 B

BIN
src/assets/img/shuju/command/ico2/shequjiaozheng.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 483 B

BIN
src/assets/img/shuju/command/ico2/xidurenyuan.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 375 B

BIN
src/assets/img/shuju/command/ico2/xiejiaorenyuan.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 464 B

BIN
src/assets/img/shuju/command/ico2/zhaoshizhaohuojingshenbing.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 B

BIN
src/assets/img/shuju/command/ico2/zhzl_rq.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

BIN
src/assets/img/shuju/command/ico3/IS_DB.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
src/assets/img/shuju/command/ico3/IS_DBH.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

BIN
src/assets/img/shuju/command/ico3/IS_KC.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
src/assets/img/shuju/command/ico3/IS_MB.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
src/assets/img/shuju/command/ico3/IS_OLD_PEOPLE.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
src/assets/img/shuju/command/ico3/IS_UNEMPLOYED.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
src/assets/img/shuju/command/ico3/anzhibangjiao.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
src/assets/img/shuju/command/ico3/buliangqingshaonian.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
src/assets/img/shuju/command/ico3/enterprise_patrol_unqualified.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
src/assets/img/shuju/command/ico3/event_tdnd.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
src/assets/img/shuju/command/ico3/resi_xfry.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
src/assets/img/shuju/command/ico3/shequjiaozheng.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
src/assets/img/shuju/command/ico3/xidurenyuan.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
src/assets/img/shuju/command/ico3/xiejiaorenyuan.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
src/assets/img/shuju/command/ico3/zhaoshizhaohuojingshenbing.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
src/assets/img/shuju/command/search.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 976 B

129
src/assets/scss/modules/visual/command.scss

@ -54,6 +54,133 @@
position: relative;
}
.m-mapmenu {
position: absolute;
z-index: 100;
left: 20px;
top: 20px;
}
.m-search {
position: absolute;
z-index: 200;
left: 0;
right: 0;
top: 30px;
width: 630px;
margin: 0 auto;
.input {
width: 100%;
background-color: #fff;
border-radius: 8px;
display: flex;
align-items: center;
overflow: hidden;
border: 1px solid #5aafff;
box-shadow: 0px 4px 8px 0px rgba(147, 147, 147, 0.26);
> input {
width: 420px;
border: none;
line-height: 45px;
font-size: 18px;
font-family: PingFang SC;
font-weight: 400;
color: #333333;
}
> img {
margin: 0 16px;
width: 30px;
height: 30px;
}
.btn {
margin-left: auto;
width: 120px;
height: 53px;
line-height: 53px;
background: #0082fb;
border-radius: 0px 8px 8px 0px;
color: #fff;
text-align: center;
font-size: 22px;
font-family: PingFang SC;
font-weight: 500;
color: #ffffff;
cursor: pointer;
}
}
.result {
position: relative;
box-sizing: border-box;
padding: 0 15px;
width: 509px;
background: rgba(#020340, 0.58);
border-radius: 8px;
.result-item {
position: relative;
padding: 12px 0;
border-bottom: 1px solid rgba(#fff, 0.2);
.result-panel {
position: absolute;
box-sizing: border-box;
padding: 15px;
left: 509px - 10px;
top: 0;
width: 500px;
background: rgba(#020340, 0.58);
border-radius: 8px;
}
.result-type {
margin-bottom: 10px;
font-size: 20px;
line-height: 30px;
font-family: PingFang SC;
font-weight: bold;
color: #00f0ff;
}
.result-more {
position: absolute;
right: 0;
top: 20px;
width: 50px;
height: 22px;
text-align: center;
line-height: 22px;
background: #dd8d02;
border-radius: 2px;
font-size: 14px;
font-family: PingFang SC;
font-weight: 400;
color: #ffffff;
cursor: pointer;
}
.result-li {
line-height: 28px;
font-size: 16px;
font-family: PingFang SC;
font-weight: 400;
color: #ffffff;
cursor: pointer;
@include toe;
i {
margin-right: 5px;
}
span {
width: 100%;
}
}
}
}
}
.m-sidemenu {
margin-left: 20px;
width: 360px;
@ -79,7 +206,7 @@
}
.list {
min-height: 800px;
min-height: 780px;
}
}

3
src/assets/scss/shuju-card.scss

@ -8,7 +8,7 @@
min-width: 200px;
width: 100%;
height: 100%;
padding: 22px 16px 22px 22px;
padding: 22px 22px 22px 22px;
.card-wrap {
height: 100%;
@ -82,6 +82,7 @@
background-repeat: repeat;
overflow-y: auto;
height: 100%;
margin-right: -8px;
@include scrollBar;
}
}

2
src/views/modules/visual/basicinfo/basicInfoMain.vue

@ -135,7 +135,7 @@ import BasicInfoCommunity from "./basicInfoCommunity";
import People from "./people";
import cptCard from "@/views/modules/visual/cpts/card";
import gridMap from "@/views/modules/visual/basicinfo/cpts/grid-map";
import gridMap from "@/views/modules/visual/cpts/map/index";
import ScreenLoading from "@/views/modules/visual/cpts/loading";
let loading; //

423
src/views/modules/visual/basicinfo/cpts/grid-map.vue

@ -1,423 +0,0 @@
<template>
<div class="m-map">
<div id="map"></div>
<div
class="btn"
v-if="mapStyleType == 'light'"
@click="shiftMapStyle('dark')"
>
切换深色模式
</div>
<div class="btn" v-else @click="shiftMapStyle('light')">切换浅色模式</div>
</div>
</template>
<script>
import { requestPost } from "@/js/dai/request";
import cptCard from "@/views/modules/visual/cpts/card";
import cptTb from "@/views/modules/visual/cpts/tb";
import nextTick from "dai-js/tools/nextTick";
import { Scene, PolygonLayer, LineLayer } from "@antv/l7";
import { GaodeMap, Map } from "@antv/l7-maps";
import { spliceIntoChunks } from "@/utils/index";
let scene;
let polygonLayer;
let lineLayer;
let textLayer;
let posLayer;
let circleLayer;
export default {
name: "l7",
inject: ["refresh"],
data() {
return {
mapStyleType: localStorage.getItem("mapStyle") || "dark",
// srcGridData: {},
darkStyle: {
style: "amap://styles/blue",
polygonColor: [
"rgba(255, 100, 60, 0.5)",
"rgba(43, 231, 253, 0.35)",
"rgba(255, 255, 50, 0.35)",
],
lineColor: [
"rgba(255, 180, 150, 0.9)",
"rgba(43, 231, 253, 0.7)",
"rgba(255, 255, 50, 0.7)",
],
circleColor: [
"rgba(255, 180, 150, 0.99)",
"rgba(43, 231, 253, 0.99)",
"rgba(255, 255, 50, 0.99)",
],
textColor: [
"rgba(255, 100, 60, 0.99)",
"rgba(43, 231, 253, 0.99)",
"rgba(255, 255, 50, 0.99)",
],
textStrokeColor: "#fff",
},
lightStyle: {
style: "amap://styles/whitesmoke",
polygonColor: [
"rgba(255, 100, 60, 0.3)",
"rgba(43, 231, 253, 0.3)",
"rgba(255, 255, 50, 0.3)",
],
lineColor: [
"rgba(220, 150, 120, 0.9)",
"rgba(33, 201, 223, 0.8)",
"rgba(200, 200, 50, 0.9)",
],
circleColor: [
"rgba(255, 180, 150, 0.99)",
"rgba(13, 181, 203, 0.8)",
"rgba(255, 255, 50, 0.99)",
],
textColor: [
"rgba(200, 50, 10, 0.99)",
"rgba(0, 130, 153, 0.99)",
"rgba(120, 120, 0, 0.99)",
],
textStrokeColor: "#666",
},
};
},
props: {
srcGridData: {
type: Object,
default: null,
},
},
computed: {},
components: {
cptCard,
cptTb,
},
watch: {},
async mounted() {
//
window._AMapSecurityConfig = {
securityJsCode: "92ea2c965c6cf1ba7ee3a8fe01449ef2",
};
// await this.getMapData();
this.iniMap();
},
computed: {
polygonData() {
const { srcGridData } = this;
if (
!srcGridData ||
!srcGridData.children ||
!Array.isArray(srcGridData.children)
) {
return { type: "FeatureCollection", features: [] };
}
const polygon = [
...srcGridData.children
.filter((item) => item.coordinates.length > 0)
.map((item) => ({
type: "Feature",
properties: {
// id: item.id,
// name: item.name,
// level: item.level,
center: [item.longitude, item.latitude],
...item,
},
geometry: {
type: "Polygon",
coordinates: [
spliceIntoChunks(
item.coordinates.split(",").map((item) => parseFloat(item)),
2
).filter((item) => item.length == 2),
],
},
})),
];
return { type: "FeatureCollection", features: polygon };
},
polygonDotData() {
const { srcGridData } = this;
if (
!srcGridData ||
!srcGridData.children ||
!Array.isArray(srcGridData.children)
) {
return { type: "FeatureCollection", features: [] };
}
const polygon = [
...srcGridData.children
.filter((item) => item.coordinates.length > 0)
.map((item) => ({
type: "Feature",
properties: {
// id: item.id,
// name: item.name,
// level: item.level,
center: [item.longitude, item.latitude],
...item,
},
geometry: {
type: "Polygon",
coordinates: [
item.latitude
? [[item.longitude, item.latitude]]
: spliceIntoChunks(
item.coordinates
.split(",")
.map((item) => parseFloat(item)),
2
).filter((item) => item.length == 2),
],
},
})),
];
return { type: "FeatureCollection", features: polygon };
},
},
watch: {
srcGridData(val, oldValue) {
if (oldValue == null) {
this.iniMap();
} else {
this.updateMap();
}
this.zoomInABit();
},
},
methods: {
iniMap() {
const { darkStyle, lightStyle, srcGridData, polygonData ,polygonDotData} = this;
if (!srcGridData) return false;
let styleConfig = darkStyle;
if (this.mapStyleType == "light") {
styleConfig = lightStyle;
}
console.log("地图初始化数据", polygonData);
scene = new Scene({
id: "map",
logoVisible: false,
map: new GaodeMap({
pitch: 60,
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,
minZoom: 10,
isHotspot: false,
resizeEnable: true,
doubleClickZoom: false,
}),
});
scene.on("loaded", async () => {
polygonLayer = new PolygonLayer({
autoFit: true,
})
// .size(0)
.source(polygonData)
.color("name", styleConfig.polygonColor)
// .shape("extrude")
.shape("fill")
.style({
opacityLinear: {
enable: true, // true - false
dir: "out", // in - out
},
opacity: 1,
// heightfixed: true,
// pickLight: true,
raisingHeight: 0,
// sourceColor: "#333",
// targetColor: "rgba(255,255,255, 0.5)",
});
scene.addLayer(polygonLayer);
lineLayer = new LineLayer({
zIndex: 2,
name: "line2",
})
.source(polygonData)
.shape("line")
.size(1)
.color("name", styleConfig.lineColor)
.style({
opacity: 1,
})
.animate({
interval: 1, //
duration: 2, //
trailLength: 2, // 线
});
scene.addLayer(lineLayer);
circleLayer = new PolygonLayer({
zIndex: 3,
})
.source(polygonDotData)
.color("name", styleConfig.circleColor)
.shape("circle")
.active(true)
.animate(true)
.size(50)
.style({
offsets: [0, -10], // [, ]
opacity: 1,
});
scene.addLayer(circleLayer);
scene.addImage(
"pos-red",
require("@/assets/img/shuju/grid/pos-red.png")
);
scene.addImage(
"pos-green",
require("@/assets/img/shuju/grid/pos-green.png")
);
scene.addImage(
"pos-yellow",
require("@/assets/img/shuju/grid/pos-yellow.png")
);
posLayer = new PolygonLayer({
zIndex: 4,
})
.source(polygonDotData)
.shape("name", ["pos-red", "pos-green", "pos-yellow"])
.size(12)
.style({
offsets: [0, 8], // [, ]
// rotation: 60,
layerType: "fillImage",
});
scene.addLayer(posLayer);
textLayer = new PolygonLayer({
zIndex: 20,
})
.source(polygonDotData)
.color("name", styleConfig.textColor)
.shape("name", "text")
.size(16)
.style({
textAnchor: "center", // center|left|right|top|bottom|top-left
textOffset: [0, 40], // [, ]
spacing: 2, //
padding: [2, 2], // padding []
stroke: styleConfig.textStrokeColor, //
strokeWidth: 0.1, //
strokeOpacity: 0.8,
textAllowOverlap: true,
})
.active(true);
scene.addLayer(textLayer);
polygonLayer.on("mousemove", (e) => {
polygonLayer.style({
raisingHeight: 0,
});
});
polygonLayer.on("click", (e) => {
console.log(e.feature.properties);
this.$emit("clickAgency", e.feature.properties);
});
polygonLayer.on("unmousemove", (e) => {
polygonLayer.style({
raisingHeight: 0,
});
});
await nextTick(0);
this.zoomInABit();
});
},
//
zoomInABit() {
let current = scene.getZoom();
scene.setZoomAndCenter(current + 0.5);
},
shiftMapStyle(type) {
this.mapStyleType = type;
localStorage.setItem("mapStyle", type);
this.refresh();
},
updateMap() {
const { polygonData } = this;
if (polygonLayer) {
polygonLayer.setData(polygonData);
lineLayer.setData(polygonData);
textLayer.setData(polygonData);
posLayer.setData(polygonData);
circleLayer.setData(polygonData);
}
},
async getMapData() {
const { data, code, msg } = await requestPost("/gov/org/agency/maporg", {
level: "",
orgId: "",
});
if (msg === "success" && code === 0) {
this.srcGridData = data;
}
},
},
};
</script>
<style lang="scss" scoped>
.m-map {
position: relative;
height: 100%;
border-radius: 10px;
overflow: hidden;
#app {
width: 100%;
height: 100%;
}
.btn {
position: absolute;
bottom: 0;
left: 0;
width: 100px;
line-height: 36px;
height: 36px;
text-align: center;
color: #ffffff;
font-size: 14px;
background-color: rgba(#000, 0.2);
cursor: pointer;
}
}
</style>

248
src/views/modules/visual/command/cpts/sidemenu-left.vue

@ -0,0 +1,248 @@
<template>
<div class="m-menu">
<div class="list">
<div
class="item"
:key="'menu1' + item.placeType + item.categoryKey"
v-for="item in menuList"
>
<div
class="info"
:class="{
'z-on': currentKey == item.categoryKey,
}"
@click="handleClickItem(item)"
>
<div class="i-ico">
<img :src="icoList[item.categoryKey || item.placeType]" />
</div>
<div class="name">
{{ item.categoryName || item.placeTypeName }}
<i v-if="item.quantity">({{ item.quantity }})</i>
</div>
<div
v-if="!item.categoryKey"
class="i-arrow"
:class="{ 'z-unfold': currentUnfolded == item.placeType }"
>
<img src="@/assets/img/shuju/command/arrow-right.png" />
</div>
</div>
<div
v-show="currentUnfolded == item.placeType"
class="granditem"
:key="'menu3' + granditem.categoryKey"
v-for="granditem in item.children"
>
<div
class="info"
:class="{ 'z-on': currentKey == granditem.categoryKey }"
@click="handleClickItem(granditem)"
>
<div class="i-ico">
<img
v-if="icoList[granditem.categoryKey]"
:src="icoList[granditem.categoryKey]"
/>
</div>
<div class="name">
{{ granditem.categoryName }}
<i v-if="granditem.quantity">({{ granditem.quantity }})</i>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import { requestPost } from "@/js/dai/request";
import nextTick from "dai-js/tools/nextTick";
export default {
name: "sidemenu",
props: {
orgId: {
type: String,
default: "",
},
},
data() {
return {
menuList: [],
currentKey: "",
currentUnfolded: "",
currentItem: {},
icoList: {
event_tdnd: require("@/assets/img/shuju/command/ico2/event_tdnd.png"),
enterprise_patrol_unqualified: require("@/assets/img/shuju/command/ico2/enterprise_patrol_unqualified.png"),
zhzl_rq: require("@/assets/img/shuju/command/ico2/zhzl_rq.png"),
resi: require("@/assets/img/shuju/command/ico2/resi.png"),
resi_xfry: require("@/assets/img/shuju/command/ico2/resi_xfry.png"),
xiejiaorenyuan: require("@/assets/img/shuju/command/ico2/xiejiaorenyuan.png"),
zhaoshizhaohuojingshenbing: require("@/assets/img/shuju/command/ico2/zhaoshizhaohuojingshenbing.png"),
buliangqingshaonian: require("@/assets/img/shuju/command/ico2/buliangqingshaonian.png"),
shequjiaozheng: require("@/assets/img/shuju/command/ico2/shequjiaozheng.png"),
xidurenyuan: require("@/assets/img/shuju/command/ico2/xidurenyuan.png"),
IS_DBH: require("@/assets/img/shuju/command/ico2/IS_DBH.png"),
// IS_YLFN: require("@/assets/img/shuju/command/ico2/IS_YLFN.png"),
IS_OLD_PEOPLE: require("@/assets/img/shuju/command/ico2/IS_OLD_PEOPLE.png"),
IS_UNEMPLOYED: require("@/assets/img/shuju/command/ico2/IS_UNEMPLOYED.png"),
IS_DB: require("@/assets/img/shuju/command/ico2/IS_DB.png"),
IS_MB: require("@/assets/img/shuju/command/ico2/IS_MB.png"),
anzhibangjiao: require("@/assets/img/shuju/command/ico2/anzhibangjiao.png"),
IS_KC: require("@/assets/img/shuju/command/ico2/IS_KC.png"),
},
};
},
computed: {},
watch: {
currentKey() {
this.emitChange();
},
orgId() {
this.requestList();
},
},
mounted() {
// this.requestList();
this.currentKey = "event_tdnd";
this.currentItem = {
categoryKey: "event_tdnd",
coverageType: "csgl",
placeType: "event",
};
},
methods: {
async emitChange() {
await nextTick();
this.$emit("change", { ...this.currentItem });
},
handleClickItem(item) {
if (item.categoryKey) {
this.currentKey = item.categoryKey;
this.currentItem = { ...item };
} else {
this.currentUnfolded =
this.currentUnfolded == item.placeType ? "" : item.placeType;
}
},
//
async requestList() {
const url = "/data/aggregator/coverage/analysis/governedTargetCategories";
let params = {
agencyId: this.orgId,
};
const { data, code, msg } = await requestPost(url, params);
if (code === 0) {
this.menuList = data.map((item) => {
item.selected = false;
item.folded = true;
item.children.forEach((subitem) => {
subitem.selected = false;
});
return item;
});
} else {
this.$message.error(msg);
}
},
},
};
</script>
<style lang="scss" scoped>
.m-menu {
width: 250px;
// height: 550px;
background: rgba(#020340, 0.58);
border-radius: 8px;
overflow: hidden;
.list {
.item {
position: relative;
z-index: 2;
line-height: 50px;
color: rgba(#fff, 0.8);
.z-on {
color: #ffffff;
background-color: #041267;
font-weight: bold;
}
.info {
position: relative;
font-size: 18px;
width: 100%;
padding-left: 10px;
display: flex;
align-items: center;
cursor: pointer;
.i-ico {
position: relative;
width: 35px;
height: 35px;
margin-right: 4px;
img {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 2px;
margin: auto;
}
}
.i-arrow {
margin-left: auto;
margin-right: 10px;
&.z-unfold {
transform: rotate(90deg);
}
}
&:hover {
background: rgba(16, 75, 164, 0.86);
}
}
.subitem,
.granditem {
> .info {
padding-left: 20px;
font-size: 16px;
}
.granditem {
> .info {
padding-left: 40px;
}
}
}
}
}
}
</style>

105
src/views/modules/visual/command/cpts/sidemenu.vue

@ -6,23 +6,36 @@
:key="'menu1' + item.coverageType"
v-for="item in menuList"
>
<div class="info">
<div
class="info"
:class="{ 'z-on': item.selected }"
@click="selectAll(item)"
>
<div class="name">
{{ item.coverageName }}
<i v-if="item.count">{{ item.count }}</i>
<i v-if="item.quantity">({{ item.quantity }})</i>
</div>
<div class="i-arrow">
<div
class="i-arrow"
:class="{ 'z-unfold': !item.folded }"
@click.stop="item.folded = !item.folded"
>
<img src="@/assets/img/shuju/command/arrow-right.png" />
</div>
</div>
<div
v-show="!item.folded"
class="granditem"
:key="'menu3' + granditem.categoryKey"
v-for="granditem in item.categories"
>
<div class="info">
<div
class="info"
:class="{ 'z-on': granditem.selected }"
@click="granditem.selected = !granditem.selected"
>
<div class="i-ico">
<img
v-if="grandIcoList[granditem.categoryKey]"
@ -32,17 +45,22 @@
<div class="name">
{{ granditem.categoryName }}
<i v-if="granditem.count">{{ granditem.count }}</i>
<i v-if="granditem.quantity">({{ granditem.quantity }})</i>
</div>
</div>
</div>
<div
v-show="!item.folded"
class="subitem"
:key="'menu2' + subitem.placeType"
v-for="subitem in item.placeTypesInAnalysis"
>
<div class="info">
<div
class="info"
:class="{ 'z-on': subitem.selected }"
@click="selectAll(subitem)"
>
<div class="i-ico">
<img
v-if="subitem.placeType == 'xxxxx'"
@ -80,20 +98,29 @@
<div class="name">
{{ subitem.placeTypeName }}
<i v-if="subitem.count">{{ subitem.count }}</i>
<i v-if="subitem.quantity">({{ subitem.quantity }})</i>
</div>
<div class="i-arrow">
<div
class="i-arrow"
:class="{ 'z-unfold': !subitem.folded }"
@click.stop="subitem.folded = !subitem.folded"
>
<img src="@/assets/img/shuju/command/arrow-right.png" />
</div>
</div>
<div
v-show="!subitem.folded"
class="granditem"
:key="'menu3' + granditem.categoryKey"
v-for="granditem in subitem.categories"
>
<div class="info">
<div
class="info"
:class="{ 'z-on': granditem.selected }"
@click="granditem.selected = !granditem.selected"
>
<div class="i-ico">
<img
v-if="grandIcoList[granditem.categoryKey]"
@ -103,7 +130,7 @@
<div class="name">
{{ granditem.categoryName }}
<i v-if="granditem.count">{{ granditem.count }}</i>
<i v-if="granditem.quantity">({{ granditem.quantity }})</i>
</div>
</div>
</div>
@ -120,15 +147,14 @@ export default {
name: "sidemenu",
props: {
isFullScreen: {
type: Boolean,
default: false,
},
grandIcoList: {
type: Object,
default: () => ({}),
},
orgId: {
type: String,
default: "",
},
},
data() {
@ -138,21 +164,66 @@ export default {
},
computed: {},
watch: {
menuList: {
handler(newValue, oldValue) {
// console.log("------------------------------------", newValue);
if (oldValue.length != 0) {
this.$emit("change", newValue);
}
},
deep: true,
// immediate: true
},
orgId() {
this.requestList();
},
},
mounted() {
this.requestList();
},
methods: {
selectAll(item) {
item.selected = !item.selected;
item.categories.forEach((subitem) => {
subitem.selected = item.selected;
});
if (item.placeTypesInAnalysis) {
item.placeTypesInAnalysis.forEach((subitem) => {
subitem.selected = item.selected;
subitem.categories.forEach((subitem2) => {
subitem2.selected = item.selected;
});
});
}
},
//
async requestList() {
const url = "/data/aggregator/coverage/analysis/resourceCategories";
let params = {};
let params = {
agencyId: this.orgId,
};
const { data, code, msg } = await requestPost(url, params);
if (code === 0) {
this.menuList = data;
this.menuList = data.map((item) => {
item.selected = false;
item.folded = true;
item.categories.forEach((subitem) => {
subitem.selected = false;
});
item.placeTypesInAnalysis.forEach((subitem) => {
subitem.selected = false;
subitem.folded = true;
subitem.categories.forEach((granditem) => {
granditem.selected = false;
});
});
return item;
});
} else {
this.$message.error(msg);
}

341
src/views/modules/visual/command/index.vue

@ -19,15 +19,101 @@
<people v-if="orgLevel === 'people'" :uid="selUserId" />
<div v-show="orgLevel !== 'people'" class="g-cnt">
<div class="m-map">
<div class="m-map" @click="handleClickMapBox">
<grid-map
ref="map"
v-if="orgData.id"
@clickAgency="clickAgencyItem"
:srcGridData="orgData"
:dotList="dotList"
:dotIcoList="dotIcoList"
:dotList2="dotList2"
:dotIcoList2="dotIcoList2"
:gridCountData="gridCountData"
:pitch="0"
/>
<div class="m-sidebar">
<div class="m-mapmenu">
<sidemenu-left
:orgId="orgId"
@change="handleChangeMenuLeft"
></sidemenu-left>
</div>
<div class="m-search">
<div class="input">
<img src="@/assets/img/shuju/command/search.png" />
<input
type="text"
placeholder="请输入"
@keyup.enter="handleSearch"
v-model="searchName"
/>
<div class="btn" @click="handleSearch">搜索</div>
</div>
<div class="result" v-if="showedSearchResult">
<template v-for="item in searchResult">
<div
:key="'searchResult' + item.type"
class="result-item"
v-show="item.list.length > 0"
>
<div class="result-type">{{ item.title }}</div>
<div
class="result-more"
@click.stop="handleClickSearchResultMore(item)"
v-show="item.allList.length > 2"
>
更多
</div>
<div class="result-ul">
<div
class="result-li z-toe"
:key="item.type + 'li' + index"
v-for="(li, index) in item.list"
@click.stop="handleClickSearchLi(li, item)"
>
<span v-if="item.type == 'position'">{{
li.name + " " + li.district
}}</span>
<span v-if="item.type == 'resi'">{{
li.name + "(" + li.idCard + ")"
}}</span>
<span v-if="item.type == 'event'">{{
li.eventContent
}}</span>
<span v-if="item.type == 'resource'">{{ li.name }}</span>
</div>
</div>
<div class="result-panel" v-show="item.showedMore">
<div class="result-type">{{ item.title }}</div>
<div class="result-ul">
<div
class="result-li z-toe"
:key="item.type + 'li2_' + index"
v-for="(li, index) in item.allList"
@click.stop="handleClickSearchLi(li, item)"
>
<span v-if="item.type == 'position'">{{
li.name + " " + li.district
}}</span>
<span v-if="item.type == 'resi'">{{
li.name + "(" + li.idCard + ")"
}}</span>
<span v-if="item.type == 'event'">{{
li.eventContent
}}</span>
<span v-if="item.type == 'resource'">{{ li.name }}</span>
</div>
</div>
</div>
</div>
</template>
</div>
</div>
<div class="m-sidebar" v-show="false">
<div class="wrap" :class="[{ 'wrap-hidden': !showAgencyList }]">
<div @click="hideAgencyList" class="arrow_tip">
<img src="@/assets/img/modules/visual/popup.png" alt />
@ -75,7 +161,11 @@
</div>
<div class="list">
<sidemenu :grandIcoList="dotIcoList"></sidemenu>
<sidemenu
:orgId="orgId"
@change="handleChangeMenu"
:grandIcoList="dotIcoList"
></sidemenu>
</div>
</cpt-card>
</div>
@ -90,16 +180,57 @@ import { Loading } from "element-ui"; //引入Loading服务
import { requestPost } from "@/js/dai/request";
import People from "@/views/modules/visual/basicinfo/people";
import cptCard from "@/views/modules/visual/cpts/card";
import gridMap from "@/views/modules/visual/basicinfo/cpts/grid-map";
import gridMap from "@/views/modules/visual/cpts/map/command";
import sidemenu from "@/views/modules/visual/command/cpts/sidemenu";
import sidemenuLeft from "@/views/modules/visual/command/cpts/sidemenu-left";
import ScreenLoading from "@/views/modules/visual/cpts/loading";
let loading; //
function iniSearchResult() {
return [
{
type: "position",
title: "地点",
showedMore: false,
list: [],
allList: [],
},
{
type: "resi",
title: "居民",
showedMore: false,
list: [],
allList: [],
},
{
type: "event",
title: "事件",
showedMore: false,
list: [],
allList: [],
},
{
type: "resource",
title: "资源",
showedMore: false,
list: [],
allList: [],
},
];
}
export default {
name: "HomeMap",
components: { People, cptCard, ScreenLoading, gridMap, sidemenu },
components: {
People,
cptCard,
ScreenLoading,
gridMap,
sidemenu,
sidemenuLeft,
},
props: {},
@ -124,6 +255,7 @@ export default {
dotList: [],
categoryKeys: [],
coverageTypes: [],
dotIcoList: {
anzhibangjiao: require("@/assets/img/shuju/command/ico/anzhibangjiao.png"),
@ -206,6 +338,33 @@ export default {
pu_6: require("@/assets/img/shuju/command/ico/pu_6.png"),
pu_7: require("@/assets/img/shuju/command/ico/pu_7.png"),
},
gridCountData: [],
dotList2: [],
categoryKeys2: [],
coverageTypes2: [],
dotIcoList2: {
event_tdnd: require("@/assets/img/shuju/command/ico3/event_tdnd.png"),
enterprise_patrol_unqualified: require("@/assets/img/shuju/command/ico3/enterprise_patrol_unqualified.png"),
resi_xfry: require("@/assets/img/shuju/command/ico3/resi_xfry.png"),
xiejiaorenyuan: require("@/assets/img/shuju/command/ico3/xiejiaorenyuan.png"),
zhaoshizhaohuojingshenbing: require("@/assets/img/shuju/command/ico3/zhaoshizhaohuojingshenbing.png"),
buliangqingshaonian: require("@/assets/img/shuju/command/ico3/buliangqingshaonian.png"),
shequjiaozheng: require("@/assets/img/shuju/command/ico3/shequjiaozheng.png"),
xidurenyuan: require("@/assets/img/shuju/command/ico3/xidurenyuan.png"),
IS_DBH: require("@/assets/img/shuju/command/ico3/IS_DBH.png"),
// IS_YLFN: require("@/assets/img/shuju/command/ico3/IS_YLFN.png"),
IS_OLD_PEOPLE: require("@/assets/img/shuju/command/ico3/IS_OLD_PEOPLE.png"),
IS_UNEMPLOYED: require("@/assets/img/shuju/command/ico3/IS_UNEMPLOYED.png"),
IS_DB: require("@/assets/img/shuju/command/ico3/IS_DB.png"),
IS_MB: require("@/assets/img/shuju/command/ico3/IS_MB.png"),
anzhibangjiao: require("@/assets/img/shuju/command/ico3/anzhibangjiao.png"),
IS_KC: require("@/assets/img/shuju/command/ico3/IS_KC.png"),
},
searchName: "",
showedSearchResult: false,
searchResult: iniSearchResult(),
};
},
@ -213,15 +372,27 @@ export default {
categoryKeys() {
this.requestMapDot();
},
categoryKeys2() {
this.requestMapDot2();
},
searchName() {
this.showedSearchResult = false;
this.searchResult = iniSearchResult();
},
},
async mounted() {
//
await this.loadOrgData();
await this.requestMapDot();
await this.requestMapDot2();
},
methods: {
handleClickMapBox() {
this.showedSearchResult = false;
},
handleTo(item) {
this.$router.push({
path: `/main-shuju/visual-basicinfo-people-list`,
@ -261,10 +432,46 @@ export default {
}
},
handleChangeMenuLeft(obj) {
this.coverageTypes2 = [obj.coverageType];
this.categoryKeys2 = [obj.categoryKey];
this.placeType2 = obj.placeType;
},
handleChangeMenu(list) {
let categoryKeys = [];
let coverageTypes = [];
list.forEach((item) => {
if (item.selected) {
coverageTypes.push(item.coverageType);
}
item.categories.forEach((subitem) => {
if (subitem.selected) {
coverageTypes.push(item.coverageType);
categoryKeys.push(subitem.categoryKey);
}
});
item.placeTypesInAnalysis.forEach((subitem) => {
subitem.categories.forEach((subitem2) => {
if (subitem2.selected) {
categoryKeys.push(subitem2.categoryKey);
}
});
});
});
this.categoryKeys = [...new Set(categoryKeys)];
this.coverageTypes = [...new Set(coverageTypes)];
this.requestMapDot();
},
async requestMapDot() {
if (!this.orgId) return;
const url = "/data/aggregator/coverage/dataList";
let params = {
coverageTypes: [],
orgId: this.orgId,
orgType: "agency",
coverageTypes: this.coverageTypes,
categoryKeys: this.categoryKeys,
isPage: false,
};
@ -278,6 +485,49 @@ export default {
}
},
async requestMapDot2() {
if (!this.orgId) return;
this.requestMapDot2Count();
const url = "/data/aggregator/coverage/dataList-left";
let params = {
orgId: this.orgId,
orgType: "agency",
coverageTypes: this.coverageTypes2,
categoryKeys: this.categoryKeys2,
isPage: false,
};
const { data, code, msg } = await requestPost(url, params);
if (code === 0) {
this.dotList2 = data.list.map((item) => {
item.categoryKey = this.categoryKeys2[0];
return item;
});
} else {
this.$message.error(msg);
}
},
async requestMapDot2Count() {
const url = "/data/aggregator/coverage/dataList-left-subtotal";
let params = {
orgId: this.orgId,
orgType: "agency",
coverageType: this.coverageTypes2[0],
categoryKey: this.categoryKeys2[0],
placeType: this.placeType2,
};
const { data, code, msg } = await requestPost(url, params);
if (code === 0) {
this.gridCountData = [...data];
} else {
this.$message.error(msg);
}
},
//list
refreshInfoList(selId, type) {
this.orgId = selId;
@ -318,15 +568,19 @@ export default {
//
clickAgencyItem(item, index) {
let e = {
selected: [],
};
let one = {
values_: item,
};
e.selected.push(one);
console.log(item);
if (item.level == "grid") {
} else {
let e = {
selected: [],
};
let one = {
values_: item,
};
e.selected.push(one);
this.toSubAgency("polygon", e);
this.toSubAgency("polygon", e);
}
},
// type:polygon / people
@ -383,8 +637,67 @@ export default {
await this.loadOrgData();
await this.requestMapDot();
await this.requestMapDot2();
},
async handleSearch() {
const { searchName } = this;
if (!searchName) {
return this.$message.error("请输入搜索内容");
}
await this.searchPos();
const url = "/data/aggregator/coverage/search";
let params = {
name: searchName,
pageSize: 10,
};
const { data, code, msg } = await requestPost(url, params);
if (code === 0) {
this.searchResult[1].list = data.userInfos.slice(0, 2);
this.searchResult[1].allList = data.userInfos;
this.searchResult[2].list = data.eventInfos.slice(0, 2);
this.searchResult[2].allList = data.eventInfos;
this.searchResult[3].list = data.resourceInfos.slice(0, 2);
this.searchResult[3].allList = data.resourceInfos;
console.log("检索", this.searchResult);
if (this.searchResult.every((item) => item.list.length == 0)) {
this.$message.error("未检索到相关内容");
} else {
this.showedSearchResult = true;
}
} else {
this.$message.error(msg);
}
},
async searchPos() {
let data = await this.$refs.map.searchPos(this.searchName);
console.log("检索位置", data);
if (data && Array.isArray(data.tips) && data.tips.length > 0) {
this.searchResult[0].list = data.tips.slice(0, 2);
this.searchResult[0].allList = data.tips;
}
},
handleClickSearchLi(li, item) {
console.log(li);
console.log(item);
},
handleClickSearchResultMore(item) {
console.log(item);
let res = !item.showedMore;
if (res) {
this.searchResult.forEach((item) => (item.showedMore = false));
}
item.showedMore = !item.showedMore;
},
//
startLoading() {
loading = Loading.service({

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

@ -0,0 +1,679 @@
<template>
<div class="m-map">
<div id="map"></div>
<div
class="btn"
v-if="mapStyleType == 'light'"
@click="shiftMapStyle('dark')"
>
切换深色模式
</div>
<div class="btn" v-else @click="shiftMapStyle('light')">切换浅色模式</div>
</div>
</template>
<script>
import { requestPost } from "@/js/dai/request";
import cptCard from "@/views/modules/visual/cpts/card";
import cptTb from "@/views/modules/visual/cpts/tb";
import nextTick from "dai-js/tools/nextTick";
import { Scene, PolygonLayer, LineLayer, PointLayer } from "@antv/l7";
import { GaodeMap, Map } from "@antv/l7-maps";
import { spliceIntoChunks } from "@/utils/index";
let myMap;
let scene;
let polygonLayer;
let lineLayer;
let textLayer;
let posLayer;
let circleLayer;
let dotLayer;
let dotBgLayer;
let dotLayer2;
let countTextLayer;
let countTextBgLayer;
export default {
name: "l7",
inject: ["refresh"],
data() {
return {
mapStyleType: localStorage.getItem("mapStyle") || "dark",
// srcGridData: {},
darkStyle: {
style: "amap://styles/blue",
polygonColor: [
"rgba(255, 100, 60, 0.5)",
"rgba(43, 231, 253, 0.35)",
"rgba(255, 255, 50, 0.35)",
],
lineColor: [
"rgba(255, 180, 150, 0.9)",
"rgba(43, 231, 253, 0.7)",
"rgba(255, 255, 50, 0.7)",
],
circleColor: [
"rgba(255, 180, 150, 0.99)",
"rgba(43, 231, 253, 0.99)",
"rgba(255, 255, 50, 0.99)",
],
textColor: [
"rgba(255, 100, 60, 0.99)",
"rgba(43, 231, 253, 0.99)",
"rgba(255, 255, 50, 0.99)",
],
textStrokeColor: "#fff",
},
lightStyle: {
style: "amap://styles/whitesmoke",
polygonColor: [
"rgba(255, 100, 60, 0.3)",
"rgba(43, 231, 253, 0.3)",
"rgba(255, 255, 50, 0.3)",
],
lineColor: [
"rgba(220, 150, 120, 0.9)",
"rgba(33, 201, 223, 0.8)",
"rgba(200, 200, 50, 0.9)",
],
circleColor: [
"rgba(255, 180, 150, 0.99)",
"rgba(13, 181, 203, 0.8)",
"rgba(255, 255, 50, 0.99)",
],
textColor: [
"rgba(200, 50, 10, 0.99)",
"rgba(0, 130, 153, 0.99)",
"rgba(120, 120, 0, 0.99)",
],
textStrokeColor: "#666",
},
};
},
props: {
pitch: {
type: Number,
default: 60,
},
srcGridData: {
type: Object,
default: null,
},
gridCountData: {
type: Array,
default: () => [],
},
dotList: {
type: Array,
default: () => [],
},
dotIcoList: {
type: Object,
default: () => ({}),
},
dotList2: {
type: Array,
default: () => [],
},
dotIcoList2: {
type: Object,
default: () => ({}),
},
},
computed: {},
components: {
cptCard,
cptTb,
},
watch: {},
async mounted() {
//
window._AMapSecurityConfig = {
securityJsCode: "92ea2c965c6cf1ba7ee3a8fe01449ef2",
};
this.iniMap();
},
computed: {
polygonData() {
const { srcGridData } = this;
if (
!srcGridData ||
!srcGridData.children ||
!Array.isArray(srcGridData.children)
) {
return { type: "FeatureCollection", features: [] };
}
const polygon = [
...srcGridData.children
.filter((item) => item.coordinates.length > 0)
.map((item) => ({
type: "Feature",
properties: {
// id: item.id,
// name: item.name,
// level: item.level,
center: [item.longitude, item.latitude],
...item,
},
geometry: {
type: "Polygon",
coordinates: [
spliceIntoChunks(
item.coordinates.split(",").map((item) => parseFloat(item)),
2
).filter((item) => item.length == 2),
],
},
})),
];
return { type: "FeatureCollection", features: polygon };
},
polygonDotData() {
const { srcGridData, gridCountData } = this;
if (
!srcGridData ||
!srcGridData.children ||
!Array.isArray(srcGridData.children)
) {
return { type: "FeatureCollection", features: [] };
}
const polygon = [
...srcGridData.children
.filter((item) => item.coordinates.length > 0)
.map((item) => ({
type: "Feature",
properties: {
// id: item.id,
// name: item.name,
// level: item.level,
center: [item.longitude, item.latitude],
...item,
dotCount2: 222,
dotCount: gridCountData.find((item2) => item2.id == item.orgId)
? gridCountData.find((item2) => item2.id == item.orgId).total
: "",
},
geometry: {
type: "Polygon",
coordinates: [
item.latitude
? [[item.longitude, item.latitude]]
: spliceIntoChunks(
item.coordinates
.split(",")
.map((item) => parseFloat(item)),
2
).filter((item) => item.length == 2),
],
},
})),
];
return { type: "FeatureCollection", features: polygon };
},
dotData() {
const { dotList } = this;
return {
type: "FeatureCollection",
features: [
...dotList
.filter((item) => item.latitude)
.map((item) => ({
type: "Feature",
properties: {
...item,
},
geometry: {
type: "Point",
coordinates: [
parseFloat(item.longitude),
parseFloat(item.latitude),
],
},
})),
],
};
},
dotData2() {
const { dotList2 } = this;
return {
type: "FeatureCollection",
features: [
...dotList2
.filter((item) => item.latitude)
.map((item) => ({
type: "Feature",
properties: {
...item,
},
geometry: {
type: "Point",
coordinates: [
parseFloat(item.longitude),
parseFloat(item.latitude),
],
},
})),
],
};
},
},
watch: {
srcGridData(val, oldValue) {
if (oldValue == null) {
this.iniMap();
} else {
this.updateGrid();
}
this.zoomInABit();
},
gridCountData() {
this.updateGridCount();
},
dotData(val, oldValue) {
this.updateDot();
},
dotData2(val, oldValue) {
this.updateDot2();
},
},
methods: {
iniMap() {
const { darkStyle, lightStyle, srcGridData } = this;
if (!srcGridData) return false;
let styleConfig = darkStyle;
if (this.mapStyleType == "light") {
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,
});
scene = new Scene({
id: "map",
logoVisible: false,
map: myMap,
});
scene.on("loaded", async () => {
this.iniMapGrid(scene);
this.iniMapDot(scene);
this.iniMapDot2(scene);
await nextTick(0);
this.zoomInABit();
});
},
iniMapGrid(scene) {
const { darkStyle, lightStyle, polygonData, polygonDotData } = this;
let styleConfig = darkStyle;
if (this.mapStyleType == "light") {
styleConfig = lightStyle;
}
console.log("地图初始化数据", polygonData);
console.log("地图初始化数据2222", polygonDotData);
polygonLayer = new PolygonLayer({
autoFit: true,
})
// .size(0)
.source(polygonData)
.color("name", styleConfig.polygonColor)
// .shape("extrude")
.shape("fill")
.style({
opacityLinear: {
enable: true, // true - false
dir: "out", // in - out
},
opacity: 1,
// heightfixed: true,
// pickLight: true,
raisingHeight: 0,
// sourceColor: "#333",
// targetColor: "rgba(255,255,255, 0.5)",
});
scene.addLayer(polygonLayer);
lineLayer = new LineLayer({
zIndex: 2,
name: "line2",
})
.source(polygonData)
.shape("line")
.size(1)
.color("name", styleConfig.lineColor)
.style({
opacity: 1,
})
.animate({
interval: 1, //
duration: 2, //
trailLength: 2, // 线
});
scene.addLayer(lineLayer);
circleLayer = new PolygonLayer({
zIndex: 3,
})
.source(polygonDotData)
.color("name", styleConfig.circleColor)
.shape("circle")
.active(true)
.animate(true)
.size(50)
.style({
offsets: [0, -10], // [, ]
opacity: 1,
});
scene.addLayer(circleLayer);
scene.addImage("pos-red", require("@/assets/img/shuju/grid/pos-red.png"));
scene.addImage(
"pos-green",
require("@/assets/img/shuju/grid/pos-green.png")
);
scene.addImage(
"pos-yellow",
require("@/assets/img/shuju/grid/pos-yellow.png")
);
posLayer = new PolygonLayer({
zIndex: 4,
})
.source(polygonDotData)
.shape("name", ["pos-red", "pos-green", "pos-yellow"])
.size(12)
.style({
offsets: [0, 8], // [, ]
// rotation: 60,
layerType: "fillImage",
});
scene.addLayer(posLayer);
textLayer = new PolygonLayer({
zIndex: 20,
})
.source(polygonDotData)
.color("name", styleConfig.textColor)
.shape("name", "text")
.size(16)
.style({
textAnchor: "center", // center|left|right|top|bottom|top-left
textOffset: [0, 40], // [, ]
spacing: 2, //
padding: [2, 2], // padding []
stroke: styleConfig.textStrokeColor, //
strokeWidth: 0.1, //
strokeOpacity: 0.8,
textAllowOverlap: true,
})
.active(true);
scene.addLayer(textLayer);
polygonLayer.on("mousemove", (e) => {
polygonLayer.style({
raisingHeight: 0,
});
});
polygonLayer.on("click", (e) => {
console.log(e.feature.properties);
this.$emit("clickAgency", e.feature.properties);
});
polygonLayer.on("unmousemove", (e) => {
polygonLayer.style({
raisingHeight: 0,
});
});
countTextLayer = new PolygonLayer({
zIndex: 20,
})
.source(polygonDotData)
.color("name", styleConfig.textColor)
.shape("dotCount", "text")
.size(16)
.style({
textAnchor: "center", // center|left|right|top|bottom|top-left
textOffset: [0, -80], // [, ]
spacing: 2, //
padding: [2, 2], // padding []
stroke: styleConfig.textStrokeColor, //
strokeWidth: 0.1, //
strokeOpacity: 0.8,
textAllowOverlap: true,
})
.active(true);
scene.addLayer(countTextLayer);
},
iniMapDot(scene) {
const { darkStyle, lightStyle, dotIcoList, dotData } = this;
Object.keys(dotIcoList).forEach((k) => {
scene.addImage(k, dotIcoList[k]);
});
dotBgLayer = new PointLayer({
zIndex: 20,
})
.source(dotData)
.shape("circle")
.color("rgba(255,255,255,0.8)")
.size(20)
.style({
strokeWidth: 3,
strokeOpacity: 0.1,
stroke: "#000",
});
scene.addLayer(dotBgLayer);
dotLayer = new PointLayer({
zIndex: 21,
})
.source(dotData)
.shape("categoryKey", (k) => k)
.size(10)
.style({
offsets: [0, 0],
layerType: "fillImage",
});
scene.addLayer(dotLayer);
dotBgLayer.on("click", (e) => {
console.log(e.feature.properties);
this.$emit("clickDot", e.feature.properties);
});
dotBgLayer.on("mousemove", (e) => {
// console.log(e);
if (e.feature.properties.content) {
const popup = new Popup({
offsets: [0, -0],
closeButton: false,
})
.setLnglat(e.feature.geometry.coordinates)
.setHTML(`<span>${e.feature.properties.content}</span>`);
scene.addPopup(popup);
}
});
dotBgLayer.on("unmousemove", (e) => {});
},
iniMapDot2(scene) {
const { dotIcoList2: dotIcoList, dotData2: dotData } = this;
Object.keys(dotIcoList).forEach((k) => {
scene.addImage(k + "2", dotIcoList[k]);
});
dotLayer2 = new PointLayer({
zIndex: 31,
})
.source(dotData)
.shape("categoryKey", (k) => k + "2")
.size(30)
.style({
offsets: [0, 0],
layerType: "fillImage",
});
scene.addLayer(dotLayer2);
dotLayer2.on("click", (e) => {
console.log(e.feature.properties);
this.$emit("clickDot", e.feature.properties);
});
dotLayer2.on("mousemove", (e) => {
// console.log(e);
if (e.feature.properties.content) {
const popup = new Popup({
offsets: [0, -0],
closeButton: false,
})
.setLnglat(e.feature.geometry.coordinates)
.setHTML(`<span>${e.feature.properties.content}</span>`);
scene.addPopup(popup);
}
});
dotLayer2.on("unmousemove", (e) => {});
},
//
zoomInABit() {
// let current = scene.getZoom();
// scene.setZoomAndCenter(current + 0.5);
},
shiftMapStyle(type) {
this.mapStyleType = type;
localStorage.setItem("mapStyle", type);
this.refresh();
},
updateMap() {
this.updateGrid();
this.updateGridCount();
this.updateDot();
this.updateDot2();
},
updateGrid() {
const { polygonData, polygonDotData } = this;
if (polygonLayer) {
polygonLayer.setData(polygonData);
lineLayer.setData(polygonData);
textLayer.setData(polygonDotData);
posLayer.setData(polygonDotData);
circleLayer.setData(polygonDotData);
}
},
updateGridCount() {
const { polygonDotData } = this;
if (countTextLayer) {
countTextLayer.setData(polygonDotData);
}
},
updateDot() {
const { dotData } = this;
if (dotLayer) {
console.log(dotData);
dotLayer.setData(dotData);
dotBgLayer.setData(dotData);
}
},
updateDot2() {
const { dotData2: dotData } = this;
if (dotLayer2) {
console.log(dotData);
dotLayer2.setData(dotData);
}
},
searchPos(name) {
return new Promise((reslove) => {
window.AMap.plugin("AMap.Autocomplete", function () {
// Autocomplete
var autoOptions = {
//city
city: "全国",
};
var autoComplete = new window.AMap.Autocomplete(autoOptions);
autoComplete.search(name, function (status, result) {
reslove(result);
});
});
});
},
},
};
</script>
<style lang="scss" scoped>
.m-map {
position: relative;
height: 100%;
border-radius: 10px;
overflow: hidden;
#app {
width: 100%;
height: 100%;
}
.btn {
position: absolute;
bottom: 0;
left: 0;
width: 100px;
line-height: 36px;
height: 36px;
text-align: center;
color: #ffffff;
font-size: 14px;
background-color: rgba(#000, 0.2);
cursor: pointer;
}
}
</style>

617
src/views/modules/visual/cpts/map/index.vue

@ -0,0 +1,617 @@
<template>
<div class="m-map">
<div id="map"></div>
<div
class="btn"
v-if="mapStyleType == 'light'"
@click="shiftMapStyle('dark')"
>
切换深色模式
</div>
<div class="btn" v-else @click="shiftMapStyle('light')">切换浅色模式</div>
</div>
</template>
<script>
import { requestPost } from "@/js/dai/request";
import cptCard from "@/views/modules/visual/cpts/card";
import cptTb from "@/views/modules/visual/cpts/tb";
import nextTick from "dai-js/tools/nextTick";
import { Scene, PolygonLayer, LineLayer, PointLayer } from "@antv/l7";
import { GaodeMap, Map } from "@antv/l7-maps";
import { spliceIntoChunks } from "@/utils/index";
let scene;
let polygonLayer;
let lineLayer;
let textLayer;
let posLayer;
let circleLayer;
let dotLayer;
let dotBgLayer;
export default {
name: "l7",
inject: ["refresh"],
data() {
return {
mapStyleType: localStorage.getItem("mapStyle") || "dark",
// srcGridData: {},
darkStyle: {
style: "amap://styles/blue",
polygonColor: [
"rgba(255, 100, 60, 0.5)",
"rgba(43, 231, 253, 0.35)",
"rgba(255, 255, 50, 0.35)",
],
lineColor: [
"rgba(255, 180, 150, 0.9)",
"rgba(43, 231, 253, 0.7)",
"rgba(255, 255, 50, 0.7)",
],
circleColor: [
"rgba(255, 180, 150, 0.99)",
"rgba(43, 231, 253, 0.99)",
"rgba(255, 255, 50, 0.99)",
],
textColor: [
"rgba(255, 100, 60, 0.99)",
"rgba(43, 231, 253, 0.99)",
"rgba(255, 255, 50, 0.99)",
],
textStrokeColor: "#fff",
},
lightStyle: {
style: "amap://styles/whitesmoke",
polygonColor: [
"rgba(255, 100, 60, 0.3)",
"rgba(43, 231, 253, 0.3)",
"rgba(255, 255, 50, 0.3)",
],
lineColor: [
"rgba(220, 150, 120, 0.9)",
"rgba(33, 201, 223, 0.8)",
"rgba(200, 200, 50, 0.9)",
],
circleColor: [
"rgba(255, 180, 150, 0.99)",
"rgba(13, 181, 203, 0.8)",
"rgba(255, 255, 50, 0.99)",
],
textColor: [
"rgba(200, 50, 10, 0.99)",
"rgba(0, 130, 153, 0.99)",
"rgba(120, 120, 0, 0.99)",
],
textStrokeColor: "#666",
},
};
},
props: {
pitch: {
type: Number,
default: 60,
},
srcGridData: {
type: Object,
default: null,
},
dotList: {
type: Array,
default: () => [],
},
dotIcoList: {
type: Object,
default: () => ({}),
},
dotList2: {
type: Array,
default: () => [],
},
dotIcoList2: {
type: Object,
default: () => ({}),
},
},
computed: {},
components: {
cptCard,
cptTb,
},
watch: {},
async mounted() {
//
window._AMapSecurityConfig = {
securityJsCode: "92ea2c965c6cf1ba7ee3a8fe01449ef2",
};
this.iniMap();
},
computed: {
polygonData() {
const { srcGridData } = this;
if (
!srcGridData ||
!srcGridData.children ||
!Array.isArray(srcGridData.children)
) {
return { type: "FeatureCollection", features: [] };
}
const polygon = [
...srcGridData.children
.filter((item) => item.coordinates.length > 0)
.map((item) => ({
type: "Feature",
properties: {
// id: item.id,
// name: item.name,
// level: item.level,
center: [item.longitude, item.latitude],
...item,
},
geometry: {
type: "Polygon",
coordinates: [
spliceIntoChunks(
item.coordinates.split(",").map((item) => parseFloat(item)),
2
).filter((item) => item.length == 2),
],
},
})),
];
return { type: "FeatureCollection", features: polygon };
},
polygonDotData() {
const { srcGridData } = this;
if (
!srcGridData ||
!srcGridData.children ||
!Array.isArray(srcGridData.children)
) {
return { type: "FeatureCollection", features: [] };
}
const polygon = [
...srcGridData.children
.filter((item) => item.coordinates.length > 0)
.map((item) => ({
type: "Feature",
properties: {
// id: item.id,
// name: item.name,
// level: item.level,
center: [item.longitude, item.latitude],
...item,
},
geometry: {
type: "Polygon",
coordinates: [
item.latitude
? [[item.longitude, item.latitude]]
: spliceIntoChunks(
item.coordinates
.split(",")
.map((item) => parseFloat(item)),
2
).filter((item) => item.length == 2),
],
},
})),
];
return { type: "FeatureCollection", features: polygon };
},
dotData() {
const { dotList } = this;
return {
type: "FeatureCollection",
features: [
...dotList
.filter((item) => item.latitude)
.map((item) => ({
type: "Feature",
properties: {
...item,
},
geometry: {
type: "Point",
coordinates: [
parseFloat(item.longitude),
parseFloat(item.latitude),
],
},
})),
],
};
},
dotData2() {
const { dotList2 } = this;
return {
type: "FeatureCollection",
features: [
...dotList2
.filter((item) => item.latitude)
.map((item) => ({
type: "Feature",
properties: {
...item,
},
geometry: {
type: "Point",
coordinates: [
parseFloat(item.longitude),
parseFloat(item.latitude),
],
},
})),
],
};
},
},
watch: {
srcGridData(val, oldValue) {
if (oldValue == null) {
this.iniMap();
} else {
this.updateGrid();
}
this.zoomInABit();
},
dotList(val, oldValue) {
this.updateDot();
},
dotList2(val, oldValue) {
this.updateDot();
},
},
methods: {
iniMap() {
const { darkStyle, lightStyle, srcGridData } = this;
if (!srcGridData) return false;
let styleConfig = darkStyle;
if (this.mapStyleType == "light") {
styleConfig = lightStyle;
}
scene = new Scene({
id: "map",
logoVisible: false,
map: 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,
}),
});
scene.on("loaded", async () => {
this.iniMapGrid(scene);
this.iniMapDot(scene);
this.iniMapDot2(scene);
await nextTick(0);
this.zoomInABit();
});
},
iniMapGrid(scene) {
const { darkStyle, lightStyle, polygonData, polygonDotData } = this;
let styleConfig = darkStyle;
if (this.mapStyleType == "light") {
styleConfig = lightStyle;
}
console.log("地图初始化数据", polygonData);
polygonLayer = new PolygonLayer({
autoFit: true,
})
// .size(0)
.source(polygonData)
.color("name", styleConfig.polygonColor)
// .shape("extrude")
.shape("fill")
.style({
opacityLinear: {
enable: true, // true - false
dir: "out", // in - out
},
opacity: 1,
// heightfixed: true,
// pickLight: true,
raisingHeight: 0,
// sourceColor: "#333",
// targetColor: "rgba(255,255,255, 0.5)",
});
scene.addLayer(polygonLayer);
lineLayer = new LineLayer({
zIndex: 2,
name: "line2",
})
.source(polygonData)
.shape("line")
.size(1)
.color("name", styleConfig.lineColor)
.style({
opacity: 1,
})
.animate({
interval: 1, //
duration: 2, //
trailLength: 2, // 线
});
scene.addLayer(lineLayer);
circleLayer = new PolygonLayer({
zIndex: 3,
})
.source(polygonDotData)
.color("name", styleConfig.circleColor)
.shape("circle")
.active(true)
.animate(true)
.size(50)
.style({
offsets: [0, -10], // [, ]
opacity: 1,
});
scene.addLayer(circleLayer);
scene.addImage("pos-red", require("@/assets/img/shuju/grid/pos-red.png"));
scene.addImage(
"pos-green",
require("@/assets/img/shuju/grid/pos-green.png")
);
scene.addImage(
"pos-yellow",
require("@/assets/img/shuju/grid/pos-yellow.png")
);
posLayer = new PolygonLayer({
zIndex: 4,
})
.source(polygonDotData)
.shape("name", ["pos-red", "pos-green", "pos-yellow"])
.size(12)
.style({
offsets: [0, 8], // [, ]
// rotation: 60,
layerType: "fillImage",
});
scene.addLayer(posLayer);
textLayer = new PolygonLayer({
zIndex: 20,
})
.source(polygonDotData)
.color("name", styleConfig.textColor)
.shape("name", "text")
.size(16)
.style({
textAnchor: "center", // center|left|right|top|bottom|top-left
textOffset: [0, 40], // [, ]
spacing: 2, //
padding: [2, 2], // padding []
stroke: styleConfig.textStrokeColor, //
strokeWidth: 0.1, //
strokeOpacity: 0.8,
textAllowOverlap: true,
})
.active(true);
scene.addLayer(textLayer);
polygonLayer.on("mousemove", (e) => {
polygonLayer.style({
raisingHeight: 0,
});
});
polygonLayer.on("click", (e) => {
console.log(e.feature.properties);
this.$emit("clickAgency", e.feature.properties);
});
polygonLayer.on("unmousemove", (e) => {
polygonLayer.style({
raisingHeight: 0,
});
});
},
iniMapDot(scene) {
const { darkStyle, lightStyle, dotIcoList, dotData } = this;
Object.keys(dotIcoList).forEach((k) => {
scene.addImage(k, dotIcoList[k]);
});
dotBgLayer = new PointLayer({
zIndex: 20,
})
.source(dotData)
.shape("circle")
.color("rgba(255,255,255,0.8)")
.size(20)
.style({
strokeWidth: 3,
strokeOpacity: 0.1,
stroke: "#000",
});
scene.addLayer(dotBgLayer);
dotLayer = new PointLayer({
zIndex: 21,
})
.source(dotData)
.shape("categoryKey", (k) => k)
.size(10)
.style({
offsets: [0, 0],
layerType: "fillImage",
});
scene.addLayer(dotLayer);
dotBgLayer.on("click", (e) => {
console.log(e.feature.properties);
this.$emit("clickDot", e.feature.properties);
});
dotBgLayer.on("mousemove", (e) => {
// console.log(e);
if (e.feature.properties.content) {
const popup = new Popup({
offsets: [0, -0],
closeButton: false,
})
.setLnglat(e.feature.geometry.coordinates)
.setHTML(`<span>${e.feature.properties.content}</span>`);
scene.addPopup(popup);
}
});
dotBgLayer.on("unmousemove", (e) => {});
},
iniMapDot2(scene) {
const { dotIcoList2: dotIcoList, dotData2: dotData } = this;
Object.keys(dotIcoList).forEach((k) => {
scene.addImage(k, dotIcoList[k]);
});
dotLayer2 = new PointLayer({
zIndex: 21,
})
.source(dotData)
.shape("categoryKey", (k) => k)
.size(20)
.style({
offsets: [0, 0],
layerType: "fillImage",
});
scene.addLayer(dotLayer2);
dotLayer2.on("click", (e) => {
console.log(e.feature.properties);
this.$emit("clickDot", e.feature.properties);
});
dotLayer2.on("mousemove", (e) => {
// console.log(e);
if (e.feature.properties.content) {
const popup = new Popup({
offsets: [0, -0],
closeButton: false,
})
.setLnglat(e.feature.geometry.coordinates)
.setHTML(`<span>${e.feature.properties.content}</span>`);
scene.addPopup(popup);
}
});
dotLayer2.on("unmousemove", (e) => {});
},
//
zoomInABit() {
let current = scene.getZoom();
scene.setZoomAndCenter(current + 0.5);
},
shiftMapStyle(type) {
this.mapStyleType = type;
localStorage.setItem("mapStyle", type);
this.refresh();
},
updateMap() {
this.updateGrid();
this.updateDot();
this.updateDot2();
},
updateGrid() {
const { polygonData } = this;
if (polygonLayer) {
polygonLayer.setData(polygonData);
lineLayer.setData(polygonData);
textLayer.setData(polygonData);
posLayer.setData(polygonData);
circleLayer.setData(polygonData);
}
},
updateDot() {
const { dotData } = this;
if (dotLayer) {
console.log(dotData);
dotLayer.setData(dotData);
dotBgLayer.setData(dotData);
}
},
updateDot2() {
const { dotData2: dotData } = this;
if (dotLayer2) {
console.log(dotData);
dotLayer2.setData(dotData);
}
},
},
};
</script>
<style lang="scss" scoped>
.m-map {
position: relative;
height: 100%;
border-radius: 10px;
overflow: hidden;
#app {
width: 100%;
height: 100%;
}
.btn {
position: absolute;
bottom: 0;
left: 0;
width: 100px;
line-height: 36px;
height: 36px;
text-align: center;
color: #ffffff;
font-size: 14px;
background-color: rgba(#000, 0.2);
cursor: pointer;
}
}
</style>
Loading…
Cancel
Save