Commit f134acb8 authored by zhangzhaohui's avatar zhangzhaohui

增加地图交互

parent 6e0ef467
...@@ -28,3 +28,19 @@ export function getOwnerList(data) { ...@@ -28,3 +28,19 @@ export function getOwnerList(data) {
data data
}) })
} }
// 获取事件列表
export function getEventList(data) {
return request({
url: '/wcwy/large/event/list',
method: 'post',
data
})
}
// 获取事件统计数量
export function getEventCount(data) {
return request({
url: '/wcwy/large/event/colour',
method: 'post',
data
})
}
\ No newline at end of file
...@@ -20,6 +20,16 @@ export function cesiumInit(id) { ...@@ -20,6 +20,16 @@ export function cesiumInit(id) {
// requestVertexNormals: true, // required for terrain lighting // requestVertexNormals: true, // required for terrain lighting
// }), // }),
}); });
const token = "789e558be762ff832392a0393fd8a4f1";
const tdtUrl = "https://t{s}.tianditu.gov.cn/";
const subdomains = ["0", "1", "2", "3", "4", "5", "6", "7"];
const imgMap = new Cesium.UrlTemplateImageryProvider({
url: tdtUrl + "DataServer?T=img_w&x={x}&y={y}&l={z}&tk=" + token,
subdomains: subdomains,
tilingScheme: new Cesium.WebMercatorTilingScheme(),
maximumLevel: 18,
});
const imageryLayer = viewer.imageryLayers.addImageryProvider(imgMap);
viewer.scene.screenSpaceCameraController.inertiaTranslate = 0; viewer.scene.screenSpaceCameraController.inertiaTranslate = 0;
viewer._cesiumWidget._creditContainer.style.display = "none"; // 隐藏版权信息 viewer._cesiumWidget._creditContainer.style.display = "none"; // 隐藏版权信息
viewer.scene.postProcessStages.fxaa.enabled = true; //开启抗锯齿 viewer.scene.postProcessStages.fxaa.enabled = true; //开启抗锯齿
......
...@@ -2,38 +2,31 @@ import * as Cesium from "cesium"; ...@@ -2,38 +2,31 @@ import * as Cesium from "cesium";
import { viewer } from "./cesium.js"; import { viewer } from "./cesium.js";
//绘制图标 //绘制图标
export function drawIcon(position, type) { export function drawIcon(position, imgName, data = {}) {
const iconSize = 23;
return viewer.entities.add({ return viewer.entities.add({
position: position, position: position,
data: {}, data,
billboard: { billboard: {
image: new URL( image: new URL(
`../assets/imgs/blue_dw_icon.png`, `../assets/imgs/${imgName}.png`,
import.meta.url import.meta.url
).href, // 图标图片的路径 ).href, // 图标图片的路径
width: 40, width: 40,
height: 50 , height: 50 ,
// pixelOffset: new Cesium.Cartesian2(
// idx * iconSize - iconOffset,
// -10
// // -iconSize * 2
// ),
disableDepthTestDistance: Number.POSITIVE_INFINITY, disableDepthTestDistance: Number.POSITIVE_INFINITY,
}, },
}) })
} }
export function drawLabel(position, text, data = {}, labelOptions = {}) { export function drawLabel(position, text, backgroundColor, data = {}, labelOptions = {}) {
return viewer.entities.add({ return viewer.entities.add({
position: position, position: position,
data: data, data,
label: { label: {
text, text,
fillColor: Cesium.Color.WHITE, fillColor: Cesium.Color.WHITE,
style: Cesium.LabelStyle.FILL_AND_OUTLINE, style: Cesium.LabelStyle.FILL_AND_OUTLINE,
showBackground: true, showBackground: true,
backgroundColor: Cesium.Color.fromCssColorString('#003860'), backgroundColor: Cesium.Color.fromCssColorString(backgroundColor),
backgroundPadding: new Cesium.Cartesian2(10, 8), backgroundPadding: new Cesium.Cartesian2(10, 8),
font: "18px sans-serif", font: "18px sans-serif",
pixelOffset: new Cesium.Cartesian2( 0, -50), pixelOffset: new Cesium.Cartesian2( 0, -50),
......
...@@ -16,16 +16,11 @@ ...@@ -16,16 +16,11 @@
</template> </template>
<script setup> <script setup>
import { ref, defineEmits, watch } from "vue"; import { ref, defineEmits, watch, onMounted } from "vue";
const props = defineProps(['communityList']) const props = defineProps(['communityList'])
const emit = defineEmits(['communityChange']) const emit = defineEmits(['communityChange'])
let showList = ref(false) let showList = ref(false)
let selectIndex = ref(-1) let selectIndex = ref(-1)
watch(() => props.communityList, (val) => {
if (val.length) {
itemClick(val[0], 0)
}
})
function getAssetImg(imgName) { function getAssetImg(imgName) {
return new URL(`../../assets/imgs/${imgName}.png`, import.meta.url).href; return new URL(`../../assets/imgs/${imgName}.png`, import.meta.url).href;
} }
...@@ -33,9 +28,13 @@ function showToggle() { ...@@ -33,9 +28,13 @@ function showToggle() {
showList.value = !showList.value showList.value = !showList.value
} }
function itemClick(item, index) { function itemClick(item, index) {
console.log('itemClick', item, index)
selectIndex.value = index selectIndex.value = index
emit('communityChange', selectIndex.value) emit('communityChange', selectIndex.value)
} }
onMounted(() => {
itemClick(props.communityList[0], 0)
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -81,12 +81,12 @@ ...@@ -81,12 +81,12 @@
<div class="legend-item line-y"> <div class="legend-item line-y">
<div class="color" style="background: #1894EE"></div> <div class="color" style="background: #1894EE"></div>
<div class="label">公共停车位数量</div> <div class="label">公共停车位数量</div>
<div class="value">197</div> <div class="value">{{currentHouseInfo.publicParkingTotal}}</div>
</div> </div>
<div class="legend-item line-y"> <div class="legend-item line-y">
<div class="color" style="background: #05EA81"></div> <div class="color" style="background: #05EA81"></div>
<div class="label">产权车位数量</div> <div class="label">产权车位数量</div>
<div class="value">20</div> <div class="value">{{currentHouseInfo.personalParkingTotal}}</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -100,12 +100,12 @@ ...@@ -100,12 +100,12 @@
<div class="legend-item line-y"> <div class="legend-item line-y">
<div class="color" style="background: #39CAD1"></div> <div class="color" style="background: #39CAD1"></div>
<div class="label">业主入住率</div> <div class="label">业主入住率</div>
<div class="value">80%</div> <div class="value">{{currentHouseInfo.occupancyRate}}</div>
</div> </div>
<div class="legend-item line-y"> <div class="legend-item line-y">
<div class="color" style="background: #009AFF"></div> <div class="color" style="background: #009AFF"></div>
<div class="label">业主出租率</div> <div class="label">业主出租率</div>
<div class="value">20%</div> <div class="value">{{currentHouseInfo.rentalRate}}</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -139,6 +139,9 @@ let overviewData = ref([ ...@@ -139,6 +139,9 @@ let overviewData = ref([
{ label: "物业一级收费标准", valueKey: "propertyFees", color: "#FABB24", unit: "元/月" }, { label: "物业一级收费标准", valueKey: "propertyFees", color: "#FABB24", unit: "元/月" },
]); ]);
watch(() => props.currentHouseInfo, (val) => { watch(() => props.currentHouseInfo, (val) => {
pieChartInit()
carportChartInit()
checkinChartInit()
}) })
function itemHover(index) { function itemHover(index) {
if (index === 5) { if (index === 5) {
...@@ -151,6 +154,14 @@ function itemLeave(index) { ...@@ -151,6 +154,14 @@ function itemLeave(index) {
} }
} }
function pieChartInit() { function pieChartInit() {
let data = [
{name: '高层', value: props.currentHouseInfo.houseHighTotal},
{name: '小高层', value: props.currentHouseInfo.houseSmallHighTotal},
{name: '多层', value: props.currentHouseInfo.houseManyTotal},
{name: '别墅', value: props.currentHouseInfo.houseVillaTotal},
{name: '商铺', value: props.currentHouseInfo.houseBusinessTotal},
{name: '公寓', value: props.currentHouseInfo.houseApartmentTotal},
]
pieChart = echarts.init(document.getElementById("pieChart")); pieChart = echarts.init(document.getElementById("pieChart"));
pieChart.setOption({ pieChart.setOption({
grid: { grid: {
...@@ -165,7 +176,7 @@ function pieChartInit() { ...@@ -165,7 +176,7 @@ function pieChartInit() {
}, },
series: [ series: [
{ {
name: "Nightingale Chart", name: "房屋类型统计",
type: "pie", type: "pie",
radius: [10, 80], radius: [10, 80],
center: ["50%", "50%"], center: ["50%", "50%"],
...@@ -173,19 +184,19 @@ function pieChartInit() { ...@@ -173,19 +184,19 @@ function pieChartInit() {
itemStyle: { itemStyle: {
borderRadius: 8, borderRadius: 8,
}, },
data: [ data,
{ value: 40, name: "rose 1" },
{ value: 38, name: "rose 2" },
{ value: 32, name: "rose 3" },
{ value: 30, name: "rose 4" },
{ value: 28, name: "rose 5" },
{ value: 26, name: "rose 6" },
],
}, },
], ],
}); });
} }
function carportChartInit() { function carportChartInit() {
let sum = Number(props.currentHouseInfo.personalParkingTotal) + Number(props.currentHouseInfo.publicParkingTotal)
let color = [
[Number(props.currentHouseInfo.publicParkingTotal) / sum, "#1894EE"],
]
if (Number(props.currentHouseInfo.personalParkingTotal) > 0) {
color.push([1, "#05EA81"])
}
carportChart = echarts.init(document.getElementById("carportChart")); carportChart = echarts.init(document.getElementById("carportChart"));
carportChart.setOption({ carportChart.setOption({
series: [ series: [
...@@ -215,10 +226,7 @@ function carportChartInit() { ...@@ -215,10 +226,7 @@ function carportChartInit() {
roundCap: true, roundCap: true,
lineStyle: { lineStyle: {
width: 10, width: 10,
color: [ color,
[0.8, "#1894EE"],
[1, "#05EA81"],
],
}, },
}, },
axisTick: { axisTick: {
...@@ -249,6 +257,13 @@ function carportChartInit() { ...@@ -249,6 +257,13 @@ function carportChartInit() {
}) })
} }
function checkinChartInit() { function checkinChartInit() {
var percentIndex = props.currentHouseInfo.occupancyRate.indexOf("%");
var numStr = props.currentHouseInfo.occupancyRate.substring(0, percentIndex).replace(/[^0-9.]/g, '');
var occupancyRateNumber = parseFloat(numStr) / 100;
let color = [
[occupancyRateNumber, "#39CAD1"],
[1, "#009AFF"],
]
checkinChart = echarts.init(document.getElementById("checkinChart")); checkinChart = echarts.init(document.getElementById("checkinChart"));
checkinChart.setOption({ checkinChart.setOption({
series: [ series: [
...@@ -278,10 +293,7 @@ function checkinChartInit() { ...@@ -278,10 +293,7 @@ function checkinChartInit() {
roundCap: true, roundCap: true,
lineStyle: { lineStyle: {
width: 10, width: 10,
color: [ color,
[0.8, "#39CAD1"],
[1, "#009AFF"],
],
}, },
}, },
axisTick: { axisTick: {
...@@ -311,11 +323,6 @@ function checkinChartInit() { ...@@ -311,11 +323,6 @@ function checkinChartInit() {
], ],
}) })
} }
onMounted(() => {
pieChartInit();
carportChartInit();
checkinChartInit()
});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -31,10 +31,10 @@ ...@@ -31,10 +31,10 @@
<img src="../../assets/imgs/rypz_icon.png" style="width: 28px; height: 29px;" /> <img src="../../assets/imgs/rypz_icon.png" style="width: 28px; height: 29px;" />
<div class="label fs-12">人员配置</div> <div class="label fs-12">人员配置</div>
</div> </div>
<div class="info-content"> <div class="info-content line-y staffing">
<div class="info-item"> <div class="info-item" v-for="item in staffingList">
<div class="value">8</div> <div class="value">{{ currentHouseInfo[item.valueKey] }}</div>
<div class="label">保安人数</div> <div class="label">{{ item.label }}人数</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -43,11 +43,9 @@ ...@@ -43,11 +43,9 @@
<img src="../../assets/imgs/glkh_icon.png" style="width: 27px; height: 26px;" /> <img src="../../assets/imgs/glkh_icon.png" style="width: 27px; height: 26px;" />
<div class="label fs-12">管理考核</div> <div class="label fs-12">管理考核</div>
</div> </div>
<div class="info-content"> <div class="info-content examine">
<div class="info-item"> <p v-if="currentHouseInfo.propertyAssessmentStatus === '是'">{{ currentHouseInfo.propertyAssessment }}</p>
<div class="value">每周</div> <p v-else></p>
<div class="label">楼道清理</div>
</div>
</div> </div>
</div> </div>
<div class="company-info line-y"> <div class="company-info line-y">
...@@ -125,12 +123,18 @@ ...@@ -125,12 +123,18 @@
<script setup> <script setup>
import { onMounted, ref, reactive, watch} from "vue"; import { onMounted, ref, reactive, watch} from "vue";
import { getOwnerList } from '../../api/index.js' import { getOwnerList, getEventList, getEventCount } from '../../api/index.js'
import memberTable from "./memberTable.vue"; import memberTable from "./memberTable.vue";
const props = defineProps(["currentHouseInfo"]); const props = defineProps(["currentHouseInfo"]);
let ownerTitle = ref('') let ownerTitle = ref('')
let ownerList = ref('') let ownerList = ref('')
let tableShow = ref(false) let tableShow = ref(false)
let staffingList = ref([
{ label: '保安', valueKey: 'propertySafeTotal'},
{ label: '保洁', valueKey: 'propertyCleanTotal'},
{ label: '工程', valueKey: 'propertyProjectTotal'},
{ label: '客服', valueKey: 'propertyCustomTotal'},
])
let countData = ref([ let countData = ref([
{ label: '红色', value: '12', color: '#F3232D'}, { label: '红色', value: '12', color: '#F3232D'},
{ label: '黄色', value: '2', color: '#FFEC56'}, { label: '黄色', value: '2', color: '#FFEC56'},
...@@ -146,6 +150,9 @@ let tableData = ref([ ...@@ -146,6 +150,9 @@ let tableData = ref([
let keyword = ref('') let keyword = ref('')
watch(() => props.currentHouseInfo, (val) => { watch(() => props.currentHouseInfo, (val) => {
getOwnerListFunc(val.communityId, val.id) getOwnerListFunc(val.communityId, val.id)
getEventListFunc(val.id)
console.log('start', new Date(val.propertyStartTime))
console.log('end', new Date(val.propertyEndTime))
}) })
function getOwnerListFunc(communityId, houseId) { function getOwnerListFunc(communityId, houseId) {
getOwnerList({ getOwnerList({
...@@ -158,6 +165,18 @@ function getOwnerListFunc(communityId, houseId) { ...@@ -158,6 +165,18 @@ function getOwnerListFunc(communityId, houseId) {
} }
}) })
} }
function getEventListFunc(houseId) {
getEventCount({
houseId
}).then(res => {
console.log('getEventCount', res)
})
getEventList({
houseId
}).then(res => {
console.log('getEventList', res)
})
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
...@@ -222,6 +241,13 @@ function getOwnerListFunc(communityId, houseId) { ...@@ -222,6 +241,13 @@ function getOwnerListFunc(communityId, houseId) {
} }
} }
} }
.staffing{
flex: 1;
justify-content: space-between;
}
.examine{
color: #fff;
}
} }
} }
.member{ .member{
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
<screen-header></screen-header> <screen-header></screen-header>
<screen-left :currentHouseInfo="currentHouseInfo"></screen-left> <screen-left :currentHouseInfo="currentHouseInfo"></screen-left>
<screen-right :currentHouseInfo="currentHouseInfo"></screen-right> <screen-right :currentHouseInfo="currentHouseInfo"></screen-right>
<community-select :communityList="communityList" @communityChange="communityChangeHandle"></community-select> <community-select ref="communitySelectRef" v-if="userTypeInfo.type === 6" :communityList="communityList" @communityChange="communityChangeHandle"></community-select>
</div> </div>
</template> </template>
<script setup> <script setup>
import { onMounted, ref, watch } from 'vue' import { onMounted, ref, watch, nextTick } from 'vue'
import { cesiumInit } from '../utils/cesium.js' import { cesiumInit } from '../utils/cesium.js'
import * as Cesium from "cesium"; import * as Cesium from "cesium";
import screenHeader from './components/screenHeader.vue'; import screenHeader from './components/screenHeader.vue';
...@@ -18,25 +18,33 @@ import communitySelect from './components/communitySelect.vue'; ...@@ -18,25 +18,33 @@ import communitySelect from './components/communitySelect.vue';
import { drawIcon, drawLabel } from '../utils/cesiumTools' import { drawIcon, drawLabel } from '../utils/cesiumTools'
import { getCommunityList, getHouseList, getHouseInfo } from '../api/index.js' import { getCommunityList, getHouseList, getHouseInfo } from '../api/index.js'
import { getUserType } from '../api/user' import { getUserType } from '../api/user'
const communitySelectRef = ref(null)
let viewer = null let viewer = null
let communityList = ref([]) let communityList = ref([])
let userTypeInfo = ref({}) let userTypeInfo = ref({})
let currentCommunityId = ref('') let currentCommunityInfo = ref({})
let currentHouseInfo = ref({}) let currentHouseInfo = ref({})
watch(currentCommunityId, (val) => { watch(currentCommunityInfo, (val) => {
getHouseListFunc(val) console.log('currentCommunityInfo', val)
let position = JSON.parse(val.solid)
flyTo({longitude: position.x, latitude: position.y})
getHouseListFunc(val.id)
}) })
function communityChangeHandle(index) { function communityChangeHandle(index) {
currentCommunityId.value = communityList.value[index].id currentCommunityInfo.value = communityList.value[index]
} }
// 获取登录用户信息
function getUserTypeInfo() { function getUserTypeInfo() {
getUserType().then(res => { getUserType().then(res => {
userTypeInfo.value = res.data userTypeInfo.value = res.data
if (userTypeInfo.value.type === 3) { if (userTypeInfo.value.type === 6) {
// 街道管理员 // 街道管理员
drawCommunityMarker(communityList.value)
} else if (userTypeInfo.value.type === 4) { } else if (userTypeInfo.value.type === 4) {
// 社区管理员 // 社区管理员
let communityInfo = communityList.value.find(item => item.id === userTypeInfo.value.communityId)
console.log('communityInfo', communityInfo)
drawCommunityMarker([communityInfo])
getHouseListFunc(userTypeInfo.value.communityId) getHouseListFunc(userTypeInfo.value.communityId)
} else if (userTypeInfo.value.type === 5) { } else if (userTypeInfo.value.type === 5) {
...@@ -46,39 +54,89 @@ function getUserTypeInfo() { ...@@ -46,39 +54,89 @@ function getUserTypeInfo() {
}) })
} }
// 获取小区列表
function getHouseListFunc(communityId) { function getHouseListFunc(communityId) {
getHouseList(communityId).then(res => { getHouseList(communityId).then(res => {
console.log(res) drawHouseMarker(res.data)
getHouseInfoFunc(res.data[0].id)
})
}
// 绘制社区标记
function drawCommunityMarker(arr) {
arr.forEach(item => {
let position = degreesToCartesian(JSON.parse(item.solid))
drawLabel(position, item.name, '#0B6832', {...item, type: 'community'})
drawIcon(position, 'green_dw_icon', {...item, type: 'community'})
}) })
} }
// 绘制小区标记
function drawHouseMarker(arr) {
arr.forEach(item => {
let position = JSON.parse(item.solid)
drawLabel(position, item.name, '#003860', {...item, type: 'house'})
drawIcon(position, 'blue_dw_icon', {...item, type: 'house'})
})
}
// 获取小区信息
function getHouseInfoFunc(houseId) { function getHouseInfoFunc(houseId) {
getHouseInfo(houseId).then(res => { getHouseInfo(houseId).then(res => {
currentHouseInfo.value = res.data currentHouseInfo.value = res.data
let position = JSON.parse(currentHouseInfo.value.solid)
drawIcon(position, 'blue_dw_icon')
drawLabel(position, currentHouseInfo.value.name, '#003860')
flyTo(cartesianToDegrees(position))
}) })
} }
// cesium笛卡尔坐标转成经纬度坐标
function cartesianToDegrees(cartesian) {
let cartographic = Cesium.Cartographic.fromCartesian(cartesian);
let longitude = Cesium.Math.toDegrees(cartographic.longitude);
let latitude = Cesium.Math.toDegrees(cartographic.latitude);
return {
longitude,
latitude,
};
}
// cesium 经纬度转笛卡尔坐标
function degreesToCartesian(position) {
let cartesian3 = Cesium.Cartesian3.fromDegrees(position.x, position.y);
return cartesian3;
}
// 镜头飞到某个位置
function flyTo(position) {
viewer.camera.flyTo({
destination: Cesium.Cartesian3.fromDegrees(
position.longitude,
position.latitude,
1200 // 最后一个参数是高度(单位:米)
),
orientation: {
heading: Cesium.Math.toRadians(0),
pitch: Cesium.Math.toRadians(-90),
roll: 0.0,
},
duration: 0.5, // 飞行时间(单位:秒)
});
}
onMounted(async () => { onMounted(async () => {
getCommunityList().then(res => { let communityRes = await getCommunityList()
communityList.value = res.data
})
getUserTypeInfo() getUserTypeInfo()
// viewer = cesiumInit('cesiumContainer') communityList.value = communityRes.data
// viewer.camera.flyTo({ viewer = cesiumInit('cesiumContainer')
// destination: Cesium.Cartesian3.fromDegrees( const handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
// 121.51073873593016, handler.setInputAction((click) => {
// 29.881809534805857, let pickObj = viewer.scene.pick(click.position)
// 800 // 最后一个参数是高度(单位:米) if (pickObj) {
// ), console.log('pickObj', pickObj)
// duration: 0, // 飞行时间(单位:秒) let type = pickObj.id._data.type
// }); if (type === 'community') {
// const handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas); // 社区
// handler.setInputAction((click) => { } else if (type === 'house') {
// const ray = viewer.camera.getPickRay(click.position); // 小区
// let position = viewer.scene.globe.pick(ray, viewer.scene); getHouseInfoFunc(pickObj.id._data.id)
// if (position) { }
// drawIcon(position) }
// drawLabel(position, '程博华庭') }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
// }
// }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
}) })
</script> </script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment