riku
2025-03-07 2592dc279ec82bf3649a4dbe644c6416263a10ef
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<template>
  <el-form
    :inline="true"
    :model="formObj"
    :rules="rules"
    ref="formRef"
    label-position="right"
    label-width="80px"
  >
    <!-- <div>选择初级产品</div> -->
    <SatelliteSearchBar
      v-show="false"
      ref="searchBarRef"
      label-width="80px"
      :loading="loading"
      @search="onSearchAOD"
    ></SatelliteSearchBar>
    <!-- <OptionPrimaryProduct
      ref="optionAODRef"
      v-model="aodData"
    ></OptionPrimaryProduct> -->
    <div>选择走航任务</div>
    <OptionMission v-model="mission"></OptionMission>
    <div>选择网格</div>
    <OptionGridGroup ref="gridGroupRef" v-model="gridGroup"></OptionGridGroup>
    <el-form-item label="产品记录">
      <el-text :type="fusionData ? 'warning' : 'success'">{{
        fusionData ? '已生成' : '未生成'
      }}</el-text>
    </el-form-item>
    <div></div>
    <el-form-item>
      <el-button
        type="primary"
        class="el-button-custom"
        size="small"
        @click="handleShowHistoryClick"
      >
        {{ '显示历史融合记录' }}
      </el-button>
      <el-button
        type="primary"
        class="el-button-custom"
        size="small"
        @click="handlePreviewClick"
      >
        {{ '拟合数据' }}
      </el-button>
      <!-- <el-button
        type="primary"
        class="el-button-custom"
        size="small"
        @click="handleSaveClick"
      >
        {{ '保存拟合结果' }}
      </el-button> -->
    </el-form-item>
  </el-form>
</template>
<script setup>
import { ref, watch, onUnmounted } from 'vue';
import moment from 'moment';
import gridApi from '@/api/gridApi';
import { SatelliteProxy } from '@/views/satellitetelemetry/SatelliteProxy';
import SatelliteSearchBar from '@/views/satellitetelemetry/component/SatelliteSearchBar.vue';
 
const satelliteProxy = new SatelliteProxy();
 
const searchBarRef = ref(null);
const optionAODRef = ref(null);
const gridGroupRef = ref(null);
 
const gridGroup = ref(null);
 
const mission = ref(undefined);
const fusionData = ref(undefined);
 
const gridDataDetailMap = new Map();
 
function onSearchAOD(options) {
  // gridGroup.value = options;
  // gridApi.fetchGridCell(options.id).then((res) => {
  //   satelliteProxy.gridPrepare(res.data);
  // });
  // optionAODRef.value.fetchAOD(options.id);
 
  gridGroupRef.value.fetchGridGroup(searchBarRef.value.area, 'sub');
}
 
// 检查走航数据是否和100米网格已融合
function checkUnderwayFusionResult() {
  const time = moment(mission.value.startTime).format('YYYY-MM-DD HH:mm:ss');
  gridApi.fetchGridData(gridGroup.value.id, time, 3).then((res) => {
    if (res.data.length > 0) {
      fusionData.value = res.data[0];
    } else {
      fusionData.value = undefined;
    }
  });
}
 
watch(mission, (nV, oV) => {
  if (nV != oV && gridGroup.value) {
    checkUnderwayFusionResult();
    // search(nV);
  }
});
 
watch(gridGroup, (nV, oV) => {
  if (nV != oV) {
    gridApi.fetchGridCell(gridGroup.value.id).then((res) => {
      // gridCellList.value = res.data;
      // prepareGrid(gridCellList.value);
      satelliteProxy.gridPrepare(res.data);
    });
    checkUnderwayFusionResult();
  }
});
 
let selectedGridDataDetail;
function handleShowHistoryClick() {
  // resetButton();
  const d = fusionData.value;
  if (gridDataDetailMap.has(d.id)) {
    selectedGridDataDetail = gridDataDetailMap.get(d.id);
    // selectedGridData = gridData;
    satelliteProxy.changeVisibility({ tag: d.id, showGridViews: true });
  } else {
    gridApi.fetchGridDataDetail(d.id, d.groupId).then((res) => {
      gridDataDetailMap.set(d.id, res.data);
      selectedGridDataDetail = res.data;
      // selectedGridData = gridData;
      satelliteProxy.drawTagGrid({
        tag: d.id,
        gridDataDetail: selectedGridDataDetail,
        opacity: 1,
        zIndex: 11
      });
    });
  }
}
 
function handlePreviewClick() {}
</script>