Browse Source

烟台房屋管理 弹窗

dev-用户反馈
dai 3 years ago
parent
commit
f2a15698fb
  1. 1444
      src/views/modules/base/communityYantai/community.vue
  2. 176
      src/views/modules/base/communityYantai/cpts/agency-info.vue
  3. 176
      src/views/modules/base/communityYantai/cpts/grid-info.vue
  4. 535
      src/views/modules/base/communityYantai/cpts/map.vue

1444
src/views/modules/base/communityYantai/community.vue

File diff suppressed because it is too large

176
src/views/modules/base/communityYantai/cpts/agency-info.vue

@ -0,0 +1,176 @@
<template>
<div class="m-info">
<div class="btn-close" @click="off">
<svg class="icon-svg aui-navbar__icon-menu" aria-hidden="true">
<use xlink:href="#icon-close"></use>
</svg>
</div>
<div class="info">
<div class="title">{{ info.agencyName }}</div>
<div class="item">
<div class="field">组织区划</div>
<div class="value">{{ info.areaName }}</div>
</div>
<div class="item">
<div class="field">组织编码</div>
<div class="value">{{ info.areaCode }}</div>
</div>
<div class="item">
<div class="field">负责人</div>
<div class="value">{{ info.contacts }}</div>
</div>
<div class="item">
<div class="field">联系电话</div>
<div class="value">{{ info.mobile }}</div>
</div>
<div class="item" v-if="info.intro">
<div class="field">社区简介</div>
<div class="value">{{ info.intro }}</div>
</div>
<div class="item" v-if="mapData">
<div class="field">管辖范围</div>
<div class="value-map">
<grid-map ref="map" :srcGridData="mapData" :pitch="0" />
</div>
</div>
</div>
</div>
</template>
<script>
import { requestPost } from "@/js/dai/request";
import gridMap from "./map";
export default {
components: { gridMap },
props: {
agencyId: {
//
type: String,
default: "",
},
},
data() {
return {
info: {
agencyId: "", // ID
level: "",
agencyName: "",
areaCode: "",
areaName: "",
contacts: "",
mobile: "",
intro: "",
},
mapData: null,
displayed: false,
};
},
computed: {},
mounted() {
if (this.agencyId) {
this.getInfo();
this.getMapData();
}
},
watch: {
agencyId() {
this.mapData = null;
this.getInfo();
this.getMapData();
},
},
methods: {
off() {
this.$emit("close");
},
async getInfo() {
const url = "/gov/org/agency/agencydetail";
let params = {
agencyId: this.agencyId,
};
const { data, code, msg } = await requestPost(url, params);
if (code === 0) {
this.info = data;
} else {
this.$message.error(msg);
}
},
async getMapData() {
const url = "/gov/org/agency/maporg";
let params = {
level: "agency",
orgId: this.agencyId,
};
const { data, code, msg } = await requestPost(url, params);
if (code === 0) {
if (data.coordinates) {
this.mapData = data;
}
} else {
this.$message.error(msg);
}
},
},
};
</script>
<style lang="scss" scoped>
.m-info {
position: relative;
width: 300px;
background-color: #ffffff;
box-shadow: 0px 6px 16px 0px rgba(0, 0, 0, 0.08),
0px 3px 6px -4px rgba(0, 0, 0, 0.12);
padding: 15px;
.btn-close {
position: absolute;
top: 0;
right: 0;
font-size: 15px;
color: #aaaaaa;
padding: 15px;
cursor: pointer;
&:hover {
color: #666666;
}
}
.info {
.title {
font-size: 18px;
font-weight: bold;
line-height: 30px;
}
.item {
display: flex;
flex-wrap: wrap;
line-height: 24px;
.field {
width: 30%;
}
.value {
width: 70%;
}
.value-map {
width: 100%;
height: 200px;
}
}
}
}
</style>

176
src/views/modules/base/communityYantai/cpts/grid-info.vue

@ -0,0 +1,176 @@
<template>
<div class="m-info">
<div class="btn-close" @click="off">
<svg class="icon-svg aui-navbar__icon-menu" aria-hidden="true">
<use xlink:href="#icon-close"></use>
</svg>
</div>
<div class="info">
<div class="title">{{ info.gridName }}</div>
<div class="item">
<div class="field">组织区划</div>
<div class="value">{{ info.areaName }}</div>
</div>
<div class="item">
<div class="field">组织编码</div>
<div class="value">{{ info.areaCode }}</div>
</div>
<div class="item">
<div class="field">负责人</div>
<div class="value">{{ info.contacts }}</div>
</div>
<div class="item">
<div class="field">联系电话</div>
<div class="value">{{ info.mobile }}</div>
</div>
<div class="item" v-if="info.intro">
<div class="field">社区简介</div>
<div class="value">{{ info.intro }}</div>
</div>
<div class="item" v-if="mapData">
<div class="field">管辖范围</div>
<div class="value-map">
<grid-map ref="map" :srcGridData="mapData" :pitch="0" />
</div>
</div>
</div>
</div>
</template>
<script>
import { requestPost } from "@/js/dai/request";
import gridMap from "./map";
export default {
components: { gridMap },
props: {
gridId: {
//
type: String,
default: "",
},
},
data() {
return {
info: {
gridId: "", // ID
level: "",
gridName: "",
areaCode: "",
areaName: "",
contacts: "",
mobile: "",
intro: "",
},
mapData: null,
displayed: false,
};
},
computed: {},
mounted() {
if (this.gridId) {
this.getInfo();
this.getMapData();
}
},
watch: {
gridId() {
this.mapData = null;
this.getInfo();
this.getMapData();
},
},
methods: {
off() {
this.$emit("close");
},
async getInfo() {
const url = "/gov/org/grid/griddetail";
let params = {
gridId: this.gridId,
};
const { data, code, msg } = await requestPost(url, params);
if (code === 0) {
this.info = data;
} else {
this.$message.error(msg);
}
},
async getMapData() {
const url = "/gov/org/agency/maporg";
let params = {
level: "grid",
orgId: this.gridId,
};
const { data, code, msg } = await requestPost(url, params);
if (code === 0) {
if (data.coordinates) {
this.mapData = data;
}
} else {
this.$message.error(msg);
}
},
},
};
</script>
<style lang="scss" scoped>
.m-info {
position: relative;
width: 300px;
background-color: #ffffff;
box-shadow: 0px 6px 16px 0px rgba(0, 0, 0, 0.08),
0px 3px 6px -4px rgba(0, 0, 0, 0.12);
padding: 15px;
.btn-close {
position: absolute;
top: 0;
right: 0;
font-size: 15px;
color: #aaaaaa;
padding: 15px;
cursor: pointer;
&:hover {
color: #666666;
}
}
.info {
.title {
font-size: 18px;
font-weight: bold;
line-height: 30px;
}
.item {
display: flex;
flex-wrap: wrap;
line-height: 24px;
.field {
width: 30%;
}
.value {
width: 70%;
}
.value-map {
width: 100%;
height: 200px;
}
}
}
}
</style>

535
src/views/modules/base/communityYantai/cpts/map.vue

@ -0,0 +1,535 @@
<template>
<div class="m-map" :class="{ 'z-td': mapType == 'td' }">
<div id="map"></div>
</div>
</template>
<script>
import nextTick from "dai-js/tools/nextTick";
import {
Scene,
PolygonLayer,
LineLayer,
RasterLayer,
PointLayer,
} from "@antv/l7";
import { GaodeMap, Map } from "@antv/l7-maps";
import { spliceIntoChunks } from "@/utils/index";
import { mapType, searchNearby } from "@/utils/dai-map";
import tdtWp from "@/utils/tdt-wp";
import tdtWpZw from "@/utils/tdt-wp-zw";
let myMap;
let scene;
let polygonLayer;
let lineLayer;
let textLayer;
let posLayer;
let circleLayer;
export default {
name: "l7",
inject: ["refresh"],
data() {
return {
mapType,
mapStyleType: "light",
// 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,
},
},
components: {},
async mounted() {
//
window._AMapSecurityConfig = {
securityJsCode: "92ea2c965c6cf1ba7ee3a8fe01449ef2",
};
this.iniMap();
},
computed: {
polygonData() {
const { srcGridData } = this;
if (srcGridData.coordinates == "") {
return { type: "FeatureCollection", features: [] };
}
const polygon = [
...[srcGridData]
.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.coordinates == "") {
return { type: "FeatureCollection", features: [] };
}
const polygon = [
...[srcGridData]
.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.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;
}
const iniCenter = [
srcGridData.longitude ||
this.$store.state.user.longitude ||
116.39743841556731,
srcGridData.latitude ||
this.$store.state.user.latitude ||
39.9088810666821,
];
if (mapType != "qq") {
myMap = new Map({
center: iniCenter,
zoom: 18,
});
} else {
myMap = new GaodeMap({
pitch: this.pitch,
style: styleConfig.style,
center: iniCenter,
token: "fc14b42e0ca18387866d68ebd4f150c1",
zoom: 18,
isHotspot: false,
resizeEnable: true,
doubleClickZoom: false,
});
}
scene = new Scene({
id: "map",
logoVisible: false,
map: myMap,
});
scene.on("loaded", async () => {
if (mapType == "td") {
this.iniMapBase(scene);
} else if (mapType == "tdzw") {
this.iniMapBase2(scene);
}
this.iniMapGrid(scene);
await nextTick(0);
this.zoomInABit();
});
},
//
iniMapBase(scene) {
console.log("-----------------iniMapBase");
//
const baseLayer = new RasterLayer({
zIndex: 1,
});
baseLayer
.source(
"http://t7.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,
},
}
)
.style({
opacity: 0.7,
});
//
const annotionLayer = new RasterLayer({
zIndex: 2,
});
annotionLayer
.source(
"http://t7.tianditu.com/DataServer?T=cva_w&tk=8a08c117ab9ee45d508686b01cc8d397&x={x}&y={y}&l={z}",
{
parser: {
type: "rasterTile",
tileSize: 256,
// minZoom: 6,
// maxZoom: 15,
zoomOffset: 0,
},
}
)
.style({
opacity: 0.5,
});
scene.addLayer(baseLayer);
scene.addLayer(annotionLayer);
},
//
iniMapBase2(scene) {
console.log("-----------------iniMapBase");
//
const baseLayer = new RasterLayer({
zIndex: 1,
});
baseLayer
.source(tdtWpZw.vec, {
parser: {
type: "rasterTile",
tileSize: 256,
zoomOffset: 0,
},
})
.style({
opacity: 0.7,
});
scene.addLayer(baseLayer);
},
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,
});
});
},
//
zoomInABit() {
let current = scene.getZoom();
scene.setZoomAndCenter(current + 0.5);
},
shiftMapStyle(type) {
this.mapStyleType = type;
localStorage.setItem("mapStyle", type);
this.refresh();
},
updateMap() {
this.updateGrid();
},
updateGrid() {
const { polygonData, polygonDotData } = this;
if (polygonLayer) {
polygonLayer.setData(polygonData);
lineLayer.setData(polygonData);
textLayer.setData(polygonDotData);
posLayer.setData(polygonDotData);
circleLayer.setData(polygonDotData);
}
},
},
};
</script>
<style lang="scss" scoped>
.m-map {
position: relative;
height: 100%;
border-radius: 10px;
overflow: hidden;
&.z-td {
#app {
/deep/ .l7-scene {
canvas {
background-color: rgba(43, 51, 73, 0.82);
background-image: radial-gradient(
rgba(0, 0, 0, 0),
rgba(0, 0, 0, 0.3),
#000
);
}
.gray {
-webkit-filter: grayscale(100%);
filter: grayscale(100%);
opacity: 0.7;
}
}
}
}
#map {
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