| | |
| | | import cesiumOperation from '@/utils/cesium-tsa' |
| | | import { getDeviceRegion, getDeviceRegionCount, getEventDetails, getMapEvents } from '@/api/home/aggregation' |
| | | import { PolyGradientMaterial } from '@/utils/cesium/Material' |
| | | import { start } from 'nprogress' |
| | | /** |
| | | * 机巢聚合功能 |
| | | */ |
| | |
| | | const store = useStore() |
| | | const userAreaCode = computed(() => store.state.user.userInfo.detail.areaCode) |
| | | const selectedAreaCode = computed(() => store.state.user.selectedAreaCode) |
| | | let saveAreaCode = null; |
| | | let saveParams = { area_code: '',date_enum:'CURRENT_WEEK' }; |
| | | |
| | | |
| | | // 确定缩放比例 |
| | |
| | | // 事件散点 |
| | | let eventList = [] |
| | | function processChildren (childrens) { |
| | | // console.log(childrens, '事件点') |
| | | return (childrens || []).map(item => { |
| | | const arr = processChildren(item.childrens) |
| | | if (item.data) { |
| | |
| | | if (arr.length !== 0) { |
| | | returnObj.childrens = arr |
| | | } |
| | | console.log(returnObj, '111111') |
| | | return returnObj |
| | | }) |
| | | } |
| | | |
| | | // 获取事件聚合 |
| | | function getMapEventCount (area_code) { |
| | | return getMapEvents({ area_code,date_enum:'CURRENT_WEEK' }).then(res => { |
| | | function getMapEventCount (params) { |
| | | console.log(5555555) |
| | | return getMapEvents(params).then(res => { |
| | | const resData = res?.data?.data |
| | | if (resData?.data) { |
| | | eventList = resData?.data |
| | |
| | | const initMapData = async areaCode => { |
| | | eventList = [] |
| | | if (!areaCode) return |
| | | const list = type === 'device' ? await getDeviceCount(areaCode) : await getMapEventCount(areaCode) |
| | | saveAreaCode = areaCode; |
| | | saveParams.area_code = areaCode; |
| | | console.log(type, '444') |
| | | const list = type === 'device' ? await getDeviceCount(areaCode) : await getMapEventCount(saveParams) |
| | | const splashedList = type === 'device' |
| | | ? await getDeviceList(areaCode) |
| | | : eventList.map(i => ({ eventId: i.id, latitude: Number(i.latitude), longitude: Number(i.longitude), type: 'event' })) |
| | |
| | | { deep: true } |
| | | ) |
| | | |
| | | // 监听 日 周 月 年 |
| | | watch(() => store.state.home.eventTimeType, (newVal) => { |
| | | if (!saveAreaCode) return |
| | | if (newVal) { |
| | | saveParams = { area_code:saveAreaCode,date_enum: store.state.home.eventTimeParams } |
| | | initMapData(saveAreaCode); |
| | | } |
| | | }); |
| | | // 监听事件右侧日期范围 |
| | | watch(() => store.state.home.eventTimeRang, (newVal) => { |
| | | if (!saveAreaCode) return |
| | | if (newVal) { |
| | | saveParams = { area_code:saveAreaCode,start_date: newVal[0], end_date: newVal[1]} |
| | | initMapData(saveAreaCode); |
| | | } |
| | | }); |
| | | |
| | | //散点机巢 |
| | | function splashed (row) { |
| | | row.splashedList.forEach((item, index) => { |