From 8372d022614a1897120802cf1bac90d61651177f Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期五, 14 三月 2025 18:20:56 +0800 Subject: [PATCH] 2025.3.14 --- src/views/satellitetelemetry/component/SatelliteMixTool.vue | 266 +++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 187 insertions(+), 79 deletions(-) diff --git a/src/views/satellitetelemetry/component/SatelliteMixTool.vue b/src/views/satellitetelemetry/component/SatelliteMixTool.vue index 0086149..cae84db 100644 --- a/src/views/satellitetelemetry/component/SatelliteMixTool.vue +++ b/src/views/satellitetelemetry/component/SatelliteMixTool.vue @@ -11,25 +11,49 @@ title="璧拌埅铻嶅悎" draggable :modal="false" - width="400px" + width="420px" > <template #default> <el-row> - <OptionMission v-model="mission"></OptionMission> - <el-text size="small" :type="fusionData ? 'success' : 'warning'">{{ + <!-- <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-text> --> </el-row> - <el-row> - <el-button - type="primary" - class="el-button-custom" - size="small" - :disabled="!gridCellList || !fusionData" - @click="handleFusionClick" - > - {{ '鍙犲姞铻嶅悎' }} - </el-button> + <div class="m-t-8">缃戞牸瑕佺礌</div> + <el-row class="m-t-8"> <el-button type="primary" class="el-button-custom" @@ -38,17 +62,6 @@ > {{ 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" @@ -65,6 +78,17 @@ > {{ 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" @@ -73,13 +97,19 @@ > {{ 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" - @click="handleOpacityClick" + :loading="missionLoading || loading" + @click="handleUnderwayClick" > - {{ !isOpacity ? '閫忔槑鍖�' : '鍙栨秷閫忔槑鍖�' }} + {{ underwayVisible ? '闅愯棌璧拌埅璺嚎' : '鏄剧ず璧拌埅璺嚎' }} </el-button> </el-row> </template> @@ -112,6 +142,11 @@ 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); @@ -121,17 +156,31 @@ const isStandardColor = ref(true); const isOpacity = ref(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 timeFormatter(value) { + return moment(value).format('YYYY-MM-DD'); } + +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; @@ -146,17 +195,12 @@ satelliteProxy.gridPrepare(gridInfo); } -// 缁樺埗缃戞牸閬ユ劅鏁版嵁鍊煎拰缃戞牸棰滆壊 -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, @@ -166,6 +210,7 @@ gridCellList.value = res.data; prepareGrid(gridCellList.value); }); + fetchFusionData(); } }, { @@ -179,26 +224,30 @@ 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); - }); - } + satelliteProxy.changeVisibility({ showGridViews: false }); + selectedfusionData.value.forEach((i) => { + const d = fusionDataList.value[i]; + if (gridDataDetailMap.has(d.id)) { + 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() { @@ -223,11 +272,18 @@ function handleColorClick() { isStandardColor.value = !isStandardColor.value; - satelliteProxy.drawGrid({ - gridDataDetail: selectedGridData, - 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 + }); + } }); } @@ -243,29 +299,48 @@ 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); }); } @@ -275,7 +350,7 @@ // 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, @@ -283,15 +358,48 @@ 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> -- Gitblit v1.9.3