| | |
| | | <template> |
| | | <CardDialog |
| | | v-model="dialogVisible" |
| | | title="走航融合" |
| | | draggable |
| | | :modal="false" |
| | | width="400px" |
| | | > |
| | | <template #default> |
| | | <el-row> |
| | | <OptionMission v-model="mission"></OptionMission> |
| | | <el-text size="small" :type="fusionData ? 'success' : 'warning'">{{ |
| | | fusionData ? '走航数据已融合' : '走航数据未融合' |
| | | }}</el-text> |
| | | </el-row> |
| | | <el-row> |
| | | <el-button |
| | | type="primary" |
| | | class="el-button-custom" |
| | | size="small" |
| | | :disabled="!gridCellList || !fusionData" |
| | | @click="handleFusionClick" |
| | | > |
| | | {{ '叠加融合' }} |
| | | </el-button> |
| | | <el-button |
| | | type="primary" |
| | | class="el-button-custom" |
| | | size="small" |
| | | @click="handleGridClick" |
| | | > |
| | | {{ gridVisible ? '隐藏融合' : '显示融合' }} |
| | | </el-button> |
| | | <el-button |
| | | type="primary" |
| | | class="el-button-custom" |
| | | size="small" |
| | | :loading="loading" |
| | | @click="handleUnderwayClick" |
| | | > |
| | | {{ underwayVisible ? '隐藏走航路线' : '显示走航路线' }} |
| | | </el-button> |
| | | </el-row> |
| | | <el-row class="m-t-8"> |
| | | <el-button |
| | | type="primary" |
| | | class="el-button-custom" |
| | | size="small" |
| | | @click="handleRankClick" |
| | | > |
| | | {{ rankVisible ? '隐藏排名' : '显示排名' }} |
| | | </el-button> |
| | | <el-button |
| | | type="primary" |
| | | class="el-button-custom" |
| | | size="small" |
| | | @click="handleDataClick" |
| | | > |
| | | {{ dataVisible ? '隐藏数据' : '显示数据' }} |
| | | </el-button> |
| | | <el-button |
| | | type="primary" |
| | | class="el-button-custom" |
| | | size="small" |
| | | @click="handleColorClick" |
| | | > |
| | | {{ isStandardColor ? '绘制对比色' : '绘制标准色' }} |
| | | </el-button> |
| | | <el-button |
| | | type="primary" |
| | | class="el-button-custom" |
| | | size="small" |
| | | @click="handleOpacityClick" |
| | | > |
| | | {{ !isOpacity ? '透明化' : '取消透明化' }} |
| | | </el-button> |
| | | </el-row> |
| | | </template> |
| | | <template #footer> |
| | | <el-row justify="start" align="middle" class="p-b-2 one-row"> |
| | | <!-- <el-text size="small" type="warning">搜索范围</el-text> --> |
| | | </el-row> |
| | | </template> |
| | | </CardDialog> |
| | | <div> |
| | | <el-button |
| | | @click="dialogVisible = !dialogVisible" |
| | | type="primary" |
| | | class="el-button-custom p-events-auto" |
| | | >走航融合</el-button |
| | | > |
| | | <CardDialog |
| | | v-model="dialogVisible" |
| | | title="走航融合" |
| | | draggable |
| | | :modal="false" |
| | | width="420px" |
| | | > |
| | | <template #default> |
| | | <el-row> |
| | | <!-- <OptionMission v-model="mission"></OptionMission> --> |
| | | <el-form :inline="true"> |
| | | <el-form-item label="走航融合"> |
| | | <el-select |
| | | v-model="selectedfusionData" |
| | | multiple |
| | | clearable |
| | | @change="handleChange" |
| | | placeholder="选择任务" |
| | | size="small" |
| | | class="w-200" |
| | | :loading="fusionLoading" |
| | | > |
| | | <el-option |
| | | v-for="(s, i) in fusionDataList" |
| | | :key="i" |
| | | :label="timeFormatter(s.dataTime)" |
| | | :value="i" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button |
| | | type="primary" |
| | | class="el-button-custom" |
| | | size="small" |
| | | :disabled="!gridCellList || selectedfusionData.length == 0" |
| | | @click="handleFusionClick" |
| | | > |
| | | {{ '叠加融合' }} |
| | | </el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | <!-- <el-text size="small" :type="fusionData ? 'success' : 'warning'">{{ |
| | | fusionData ? '走航数据已融合' : '走航数据未融合' |
| | | }}</el-text> --> |
| | | </el-row> |
| | | <div class="m-t-8">网格要素</div> |
| | | <el-row class="m-t-8"> |
| | | <el-button |
| | | type="primary" |
| | | class="el-button-custom" |
| | | size="small" |
| | | @click="handleGridClick" |
| | | > |
| | | {{ gridVisible ? '隐藏融合' : '显示融合' }} |
| | | </el-button> |
| | | <el-button |
| | | type="primary" |
| | | class="el-button-custom" |
| | | size="small" |
| | | @click="handleRankClick" |
| | | > |
| | | {{ rankVisible ? '隐藏排名' : '显示排名' }} |
| | | </el-button> |
| | | <el-button |
| | | type="primary" |
| | | class="el-button-custom" |
| | | size="small" |
| | | @click="handleDataClick" |
| | | > |
| | | {{ dataVisible ? '隐藏数据' : '显示数据' }} |
| | | </el-button> |
| | | </el-row> |
| | | <div class="m-t-8">网格样式</div> |
| | | <el-row class="m-t-8"> |
| | | <el-button |
| | | type="primary" |
| | | class="el-button-custom" |
| | | size="small" |
| | | @click="handleOpacityClick" |
| | | > |
| | | {{ !isOpacity ? '透明化' : '取消透明化' }} |
| | | </el-button> |
| | | <el-button |
| | | type="primary" |
| | | class="el-button-custom" |
| | | size="small" |
| | | @click="handleColorClick" |
| | | > |
| | | {{ isStandardColor ? '绘制对比色' : '绘制标准色' }} |
| | | </el-button> |
| | | </el-row> |
| | | <div class="m-t-8">走航要素</div> |
| | | <el-row class="m-t-8"> |
| | | <!-- <el-divider content-position="left"></el-divider> --> |
| | | |
| | | <el-button |
| | | type="primary" |
| | | class="el-button-custom" |
| | | size="small" |
| | | :loading="missionLoading || loading" |
| | | @click="handleUnderwayClick" |
| | | > |
| | | {{ underwayVisible ? '隐藏走航路线' : '显示走航路线' }} |
| | | </el-button> |
| | | </el-row> |
| | | </template> |
| | | <template #footer> |
| | | <el-row justify="start" align="middle" class="p-b-2 one-row"> |
| | | <!-- <el-text size="small" type="warning">搜索范围</el-text> --> |
| | | </el-row> |
| | | </template> |
| | | </CardDialog> |
| | | </div> |
| | | </template> |
| | | <script setup> |
| | | import { ref, onMounted, onUnmounted, watch } from 'vue'; |
| | | import moment from 'moment'; |
| | | import { map, onMapMounted } from '@/utils/map/index_old'; |
| | | import gridApi from '@/api/gridApi'; |
| | | import SatelliteProxy from '../SatelliteProxy'; |
| | | import { SatelliteProxy } from '../SatelliteProxy'; |
| | | |
| | | const satelliteProxy = new SatelliteProxy(); |
| | | |
| | | const props = defineProps({ |
| | | groupId: { |
| | |
| | | } |
| | | }); |
| | | |
| | | const dialogVisible = ref(true); |
| | | const dialogVisible = ref(false); |
| | | const mission = ref(undefined); |
| | | |
| | | const gridCellList = ref(undefined); |
| | | const fusionData = ref(undefined); |
| | | // 走航融合数据 |
| | | const fusionLoading = ref(false); |
| | | const fusionDataList = ref([]); |
| | | const selectedfusionData = ref([]); |
| | | |
| | | const gridDataDetailMap = new Map(); |
| | | |
| | | const gridVisible = ref(true); |
| | |
| | | const isStandardColor = ref(true); |
| | | const isOpacity = ref(false); |
| | | |
| | | // 地图网格相关对象 |
| | | let mapViews; |
| | | |
| | | // 检查走航数据是否和100米网格已融合 |
| | | function checkUnderwayFusionResult() { |
| | | const time = moment(mission.value.startTime).format('YYYY-MM-DD HH:mm:ss'); |
| | | gridApi.fetchGridData(props.groupId, time, 3).then((res) => { |
| | | if (res.data.length > 0) { |
| | | fusionData.value = res.data[0]; |
| | | } else { |
| | | fusionData.value = undefined; |
| | | } |
| | | }); |
| | | function timeFormatter(value) { |
| | | return moment(value).format('YYYY-MM-DD'); |
| | | } |
| | | |
| | | function drawGrid(gridInfo) { |
| | | SatelliteProxy.clearAll(mapViews); |
| | | mapViews = SatelliteProxy.drawPolyline(gridInfo); |
| | | function fetchFusionData() { |
| | | fusionLoading.value = true; |
| | | gridApi |
| | | .fetchGridData(props.groupId, undefined, 3) |
| | | .then((res) => { |
| | | fusionDataList.value = res.data; |
| | | }) |
| | | .finally(() => (fusionLoading.value = false)); |
| | | } |
| | | |
| | | // 检查走航数据是否和100米网格已融合 |
| | | // function checkUnderwayFusionResult() { |
| | | // const time = moment(mission.value.startTime).format('YYYY-MM-DD HH:mm:ss'); |
| | | // gridApi.fetchGridData(props.groupId, time, 3).then((res) => { |
| | | // if (res.data.length > 0) { |
| | | // fusionData.value = res.data[0]; |
| | | // } else { |
| | | // fusionData.value = undefined; |
| | | // } |
| | | // }); |
| | | // } |
| | | |
| | | function resetButton() { |
| | | gridVisible.value = true; |
| | | underwayVisible.value = false; |
| | | rankVisible.value = false; |
| | | dataVisible.value = false; |
| | | isStandardColor.value = true; |
| | | isOpacity.value = false; |
| | | } |
| | | |
| | | function prepareGrid(gridInfo) { |
| | | satelliteProxy.gridPrepare(gridInfo); |
| | | } |
| | | |
| | | // 绘制网格遥感数据值和网格颜色 |
| | | function drawTextAndColor(gridData) { |
| | | const { resGridViews, pointsRes } = SatelliteProxy.drawColor({ |
| | | gridViews: mapViews.gridViews, |
| | | points: mapViews.points, |
| | | gridDataDetail: gridData, |
| | | lastGridViews: mapViews.lastGridViews, |
| | | opacity: 1, |
| | | zIndex: 11 |
| | | }); |
| | | mapViews.lastGridViews = resGridViews; |
| | | mapViews.lastPoints = pointsRes; |
| | | // 文本标记 |
| | | const { textViews: dataTxt, labelsLayer: dataLayer } = |
| | | SatelliteProxy.drawDataText( |
| | | mapViews.lastPoints, |
| | | gridData, |
| | | mapViews.dataTxt, |
| | | mapViews.dataLayer |
| | | ); |
| | | mapViews.dataTxt = dataTxt; |
| | | mapViews.dataLayer = dataLayer; |
| | | const { textViews: rankTxt, labelsLayer: rankLayer } = |
| | | SatelliteProxy.drawRankText( |
| | | mapViews.lastPoints, |
| | | gridData, |
| | | mapViews.rankTxt, |
| | | mapViews.rankLayer |
| | | ); |
| | | mapViews.rankTxt = rankTxt; |
| | | mapViews.rankLayer = rankLayer; |
| | | function drawGrid(gridDataDetail) { |
| | | satelliteProxy.drawGrid({ gridDataDetail, opacity: 1, zIndex: 11 }); |
| | | } |
| | | |
| | | watch(mission, (nV, oV) => { |
| | | if (nV != oV) { |
| | | checkUnderwayFusionResult(); |
| | | search(nV); |
| | | } |
| | | }); |
| | | // watch(mission, (nV, oV) => { |
| | | // if (nV != oV) { |
| | | // checkUnderwayFusionResult(); |
| | | // search(nV); |
| | | // } |
| | | // }); |
| | | |
| | | watch( |
| | | () => props.groupId, |
| | | (nV, oV) => { |
| | | if (nV != oV) { |
| | | if (dialogVisible.value && nV != oV) { |
| | | gridApi.fetchGridCell(nV).then((res) => { |
| | | gridCellList.value = res.data; |
| | | drawGrid(gridCellList.value); |
| | | prepareGrid(gridCellList.value); |
| | | }); |
| | | fetchFusionData(); |
| | | } |
| | | }, |
| | | { |
| | |
| | | } |
| | | ); |
| | | |
| | | let selectedGridData; |
| | | // 叠加融合 |
| | | function handleFusionClick() { |
| | | const d = fusionData.value; |
| | | if (gridDataDetailMap.has(d.id)) { |
| | | const gridData = gridDataDetailMap.get(d.id); |
| | | selectedGridData = gridData; |
| | | drawTextAndColor(gridData); |
| | | } else { |
| | | gridApi.fetchGridDataDetail(d.id, d.groupId).then((res) => { |
| | | gridDataDetailMap.set(d.id, res.data); |
| | | const gridData = res.data; |
| | | selectedGridData = gridData; |
| | | drawTextAndColor(gridData); |
| | | watch(dialogVisible, (nV, oV) => { |
| | | if (nV != oV) { |
| | | gridApi.fetchGridCell(props.groupId).then((res) => { |
| | | gridCellList.value = res.data; |
| | | prepareGrid(gridCellList.value); |
| | | }); |
| | | fetchFusionData(); |
| | | } |
| | | }); |
| | | |
| | | let selectedGridDataDetail; |
| | | // 叠加融合 |
| | | // function handleFusionClick() { |
| | | // // resetButton(); |
| | | // const d = fusionData.value; |
| | | // if (gridDataDetailMap.has(d.id)) { |
| | | // selectedGridDataDetail = gridDataDetailMap.get(d.id); |
| | | // // selectedGridData = gridData; |
| | | // drawGrid(selectedGridDataDetail); |
| | | // } else { |
| | | // gridApi.fetchGridDataDetail(d.id, d.groupId).then((res) => { |
| | | // gridDataDetailMap.set(d.id, res.data); |
| | | // selectedGridDataDetail = res.data; |
| | | // // selectedGridData = gridData; |
| | | // drawGrid(selectedGridDataDetail); |
| | | // }); |
| | | // } |
| | | // } |
| | | function handleFusionClick() { |
| | | // resetButton(); |
| | | satelliteProxy.changeVisibility({ showGridViews: false }); |
| | | selectedfusionData.value.forEach((i) => { |
| | | const d = fusionDataList.value[i]; |
| | | if (gridDataDetailMap.has(d.id)) { |
| | | // const gdd = gridDataDetailMap.get(d.id); |
| | | // satelliteProxy.drawTagGrid({ |
| | | // tag: d.id, |
| | | // gridDataDetail: gdd, |
| | | // opacity: 1, |
| | | // zIndex: 11 |
| | | // }); |
| | | satelliteProxy.changeVisibility({ tag: d.id, showGridViews: true }); |
| | | } else { |
| | | gridApi.fetchGridDataDetail(d.id, d.groupId).then((res) => { |
| | | gridDataDetailMap.set(d.id, res.data); |
| | | const gdd = res.data; |
| | | satelliteProxy.drawTagGrid({ |
| | | tag: d.id, |
| | | gridDataDetail: gdd, |
| | | opacity: 1, |
| | | zIndex: 11 |
| | | }); |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | function handleGridClick() { |
| | | gridVisible.value = !gridVisible.value; |
| | | gridVisible.value |
| | | ? map.add(mapViews.lastGridViews) |
| | | : map.remove(mapViews.lastGridViews); |
| | | satelliteProxy.changeVisibility({ showGridViews: gridVisible.value }); |
| | | } |
| | | |
| | | function handleUnderwayClick() { |
| | |
| | | |
| | | function handleRankClick() { |
| | | rankVisible.value = !rankVisible.value; |
| | | rankVisible.value ? map.add(mapViews.rankTxt) : map.remove(mapViews.rankTxt); |
| | | satelliteProxy.changeVisibility({ showRankTxt: rankVisible.value }); |
| | | } |
| | | |
| | | function handleDataClick() { |
| | | dataVisible.value = !dataVisible.value; |
| | | dataVisible.value ? map.add(mapViews.dataTxt) : map.remove(mapViews.dataTxt); |
| | | satelliteProxy.changeVisibility({ showDataTxt: dataVisible.value }); |
| | | } |
| | | |
| | | function handleColorClick() { |
| | | isStandardColor.value = !isStandardColor.value; |
| | | const { resGridViews, pointsRes } = SatelliteProxy.drawColor({ |
| | | gridViews: mapViews.gridViews, |
| | | points: mapViews.points, |
| | | gridDataDetail: selectedGridData, |
| | | lastGridViews: mapViews.lastGridViews, |
| | | customColor: !isStandardColor.value, |
| | | opacity: 1, |
| | | zIndex: 11 |
| | | // satelliteProxy.drawGrid({ |
| | | // gridDataDetail: selectedGridDataDetail, |
| | | // useCustomColor: !isStandardColor.value, |
| | | // opacity: 1, |
| | | // zIndex: 11 |
| | | // }); |
| | | selectedfusionData.value.forEach((i) => { |
| | | const d = fusionDataList.value[i]; |
| | | if (gridDataDetailMap.has(d.id)) { |
| | | const gdd = gridDataDetailMap.get(d.id); |
| | | satelliteProxy.drawTagGrid({ |
| | | tag: d.id, |
| | | gridDataDetail: gdd, |
| | | useCustomColor: !isStandardColor.value, |
| | | opacity: 1, |
| | | zIndex: 11 |
| | | }); |
| | | } |
| | | }); |
| | | mapViews.lastGridViews = resGridViews; |
| | | mapViews.lastPoints = pointsRes; |
| | | } |
| | | |
| | | function handleOpacityClick() { |
| | | isOpacity.value = !isOpacity.value; |
| | | mapViews.lastGridViews.forEach((e) => { |
| | | e.setOptions({ |
| | | fillOpacity: isOpacity.value ? 0.1 : 1 |
| | | }); |
| | | }); |
| | | satelliteProxy.changeGridOpacity({ opacityValue: isOpacity.value ? 0.1 : 1 }); |
| | | } |
| | | |
| | | /**走航轨迹*******************************************************************/ |
| | |
| | | import mapUtil from '@/utils/map/util'; |
| | | import { fetchHistoryData } from '@/utils/factor/data'; |
| | | import { useFetchData } from '@/composables/fetchData'; |
| | | import { useMissionStore } from '@/stores/mission'; |
| | | |
| | | onMounted(() => (isUnmounted.value = false)); |
| | | onMounted(() => { |
| | | isUnmounted.value = false; |
| | | fetchMission(); |
| | | }); |
| | | onUnmounted(() => { |
| | | mapUtil.clearMap(); |
| | | isUnmounted.value = true; |
| | | }); |
| | | |
| | | const { loading, fetchData } = useFetchData(10000); |
| | | |
| | | const missionStore = useMissionStore(); |
| | | const missionLoading = ref(false); |
| | | |
| | | const isUnmounted = ref(false); |
| | | const deviceType = ref(undefined); |
| | | const drawMode = ref(0); |
| | | // 监测数据 |
| | | const factorDatas = ref(new FactorDatas()); |
| | | // const factorDatas = ref(new FactorDatas()); |
| | | const factorDataMap = new Map(); |
| | | // pm2.5 |
| | | const factorType = 6; |
| | | |
| | | function onFetchData(dType, data) { |
| | | function fetchMission() { |
| | | missionLoading.value = true; |
| | | missionStore |
| | | .fetchMission() |
| | | // .then((res) => { |
| | | // if (res.success && res.data.length > 0) { |
| | | |
| | | // } |
| | | // }) |
| | | .finally(() => (missionLoading.value = false)); |
| | | } |
| | | |
| | | function onFetchData(_factorDatas, dType, data) { |
| | | if (isUnmounted.value) return; |
| | | // todo 根据设备类型切换地图监测因子展示单选框、折线图复选框、数据表格复选框的因子类型 |
| | | deviceType.value = dType; |
| | | factorDatas.value.setData(data, drawMode.value, () => { |
| | | factorDatas.value.refreshHeight(factorType.value); |
| | | _factorDatas.value.setData(data, drawMode.value, () => { |
| | | _factorDatas.value.refreshHeight(factorType.value); |
| | | }); |
| | | } |
| | | |
| | |
| | | // deviceCode.value = deviceCode; |
| | | const _startTime = moment(startTime).format('YYYY-MM-DD HH:mm:ss'); |
| | | const _endTime = moment(endTime).format('YYYY-MM-DD HH:mm:ss'); |
| | | fetchData((page, pageSize) => { |
| | | return fetchData((page, pageSize) => { |
| | | return fetchHistoryData({ |
| | | deviceType, |
| | | deviceCode, |
| | |
| | | endTime: _endTime, |
| | | page, |
| | | perPage: pageSize |
| | | }).then((res) => onFetchData(deviceType, res.data)); |
| | | }); |
| | | // .then((res) => onFetchData(deviceType, res.data)); |
| | | }); |
| | | } |
| | | |
| | | function draw() { |
| | | if (isUnmounted.value) return; |
| | | |
| | | selectedfusionData.value.forEach((i) => { |
| | | const d = fusionDataList.value[i]; |
| | | |
| | | const mission = missionStore.missionList.find((v) => { |
| | | return v.missionCode == d.mixDataId; |
| | | }); |
| | | |
| | | if (factorDataMap.has(mission.missionCode)) { |
| | | const fd = factorDataMap.get(mission.missionCode); |
| | | drawLine(mission.missionCode, fd); |
| | | } else { |
| | | search(mission).then((res) => { |
| | | const fd = new FactorDatas(); |
| | | fd.setData(res.data, drawMode.value, () => { |
| | | fd.refreshHeight(factorType.value); |
| | | factorDataMap.set(mission.missionCode, fd); |
| | | drawLine(mission.missionCode, fd); |
| | | }); |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | function drawLine(missionCode, fd) { |
| | | // 刷新图例 |
| | | const factor = factorDatas.value.factor[factorType]; |
| | | const factor = fd.factor[factorType]; |
| | | sector.clearSector(); |
| | | factorDatas.value.refreshHeight(factorType); |
| | | mapLine.drawLine(factorDatas.value, factor); |
| | | fd.refreshHeight(factorType); |
| | | mapLine.drawTagLine(missionCode, fd, factor); |
| | | } |
| | | </script> |
| | | <style scoped> |
| | | /* ::v-deep .el-divider__text { |
| | | background: #122b54; |
| | | color: white; |
| | | } */ |
| | | </style> |