|
@@ -3,16 +3,29 @@
|
|
|
<div class="card table-search" style="overflow: hidden;display: flex;justify-content: space-between;">
|
|
|
<el-form ref="formRef" :model="searchParam" :inline="true" label-width="auto">
|
|
|
<el-form-item label="自动站:" prop="base">
|
|
|
- <el-select v-model="searchParam.base" placeholder="请选择" style="width: 200px">
|
|
|
- <el-option v-for="item in baseOptions" :key="item.value" :label="item.label"
|
|
|
- :value="item.value" />
|
|
|
+ <el-select v-model="pageable.as_code" filterable placeholder="请搜索自动站" remote reserve-keyword
|
|
|
+ clearable style="width: 200px" @change="changeStation">
|
|
|
+ <el-option v-for="item in platformList" :key="item.as_code"
|
|
|
+ :label="item.as_code + ' ' + item.as_name" :value="item.as_code" />
|
|
|
+ <template #prefix>
|
|
|
+ <el-icon class="el-input__icon">
|
|
|
+ <search />
|
|
|
+ </el-icon>
|
|
|
+ </template>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="自动站:" prop="base">
|
|
|
- <div><el-switch v-model="searchParam.switch" class="ml-2" inline-prompt active-text="正点"
|
|
|
+ <el-form-item label="观测时间:" prop="base">
|
|
|
+ <div>
|
|
|
+ <el-switch v-model="value1" @change="changetype" class="ml-2" inline-prompt active-text="正点"
|
|
|
inactive-text="分钟" style="margin-right: 10px;" />
|
|
|
- <el-date-picker v-model="searchParam.date" type="daterange" range-separator="至"
|
|
|
- start-placeholder="开始时间" end-placeholder="结束时间" style="width: 300px" />
|
|
|
+ <el-date-picker v-model="dateRange" value-format="YYYY-MM-DD HH:mm"
|
|
|
+ :format="value1 ? 'YYYY-MM-DD' : 'YYYY-MM-DD HH:mm'"
|
|
|
+ :type="value1 ? 'daterange' : 'datetimerange'" range-separator="-" start-placeholder="开始时间"
|
|
|
+ end-placeholder="结束时间" :disabled-date="disabledDate" :disabled-hours="disabledHours"
|
|
|
+ :disabled-minutes="disabledMinutes" @focus="handleFocus" @calendar-change="handleChange"
|
|
|
+ @change="handleDateChange"
|
|
|
+ :default-time="[new Date(2000, 1, 1, 0, 0), new Date(2000, 1, 1, new Date().getHours(), 0)]"
|
|
|
+ style="width: 300px;"></el-date-picker>
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
@@ -81,27 +94,139 @@
|
|
|
<el-tabs tab-position="left" class="demo-tabs" style="height: 100%">
|
|
|
<el-tab-pane label="风">
|
|
|
<div class="container-tag">
|
|
|
- <div class="item-tag">2分钟平均风速</div>
|
|
|
- <div class="item-tag-active">2分钟平均风向</div>
|
|
|
- <div class="item-tag">10分钟平均风速</div>
|
|
|
- <div class="item-tag">10分钟平均风向</div>
|
|
|
- <div class="item-tag">小时最大风速</div>
|
|
|
- <div class="item-tag-active">小时最大风速的风向</div>
|
|
|
- <div class="item-tag">小时极大风速出现时间</div>
|
|
|
+ <template v-for="item in elementList" :key="item.id">
|
|
|
+ <div v-if="item.data_type === '风'"
|
|
|
+ :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
|
|
|
+ @click="toggleSelection(item)">{{ item.data_name }}</div>
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="温湿度">
|
|
|
+ <div class="container-tag">
|
|
|
+ <template v-for="item in elementList" :key="item.id">
|
|
|
+ <div v-if="item.data_type === '温湿度'"
|
|
|
+ :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
|
|
|
+ @click="toggleSelection(item)">{{ item.data_name }}</div>
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="气压">
|
|
|
+ <div class="container-tag">
|
|
|
+ <template v-for="item in elementList" :key="item.id">
|
|
|
+ <div v-if="item.data_type === '气压'"
|
|
|
+ :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
|
|
|
+ @click="toggleSelection(item)">{{ item.data_name }}</div>
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="降水">
|
|
|
+ <div class="container-tag">
|
|
|
+ <template v-for="item in elementList" :key="item.id">
|
|
|
+ <div v-if="item.data_type === '降水'"
|
|
|
+ :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
|
|
|
+ @click="toggleSelection(item)">{{ item.data_name }}</div>
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="云">
|
|
|
+ <div class="container-tag">
|
|
|
+ <template v-for="item in elementList" :key="item.id">
|
|
|
+ <div v-if="item.data_type === '云'"
|
|
|
+ :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
|
|
|
+ @click="toggleSelection(item)">{{ item.data_name }}</div>
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="能见度">
|
|
|
+ <div class="container-tag">
|
|
|
+ <template v-for="item in elementList" :key="item.id">
|
|
|
+ <div v-if="item.data_type === '能见度'"
|
|
|
+ :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
|
|
|
+ @click="toggleSelection(item)">{{ item.data_name }}</div>
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="天气现象">
|
|
|
+ <div class="container-tag">
|
|
|
+ <template v-for="item in elementList" :key="item.id">
|
|
|
+ <div v-if="item.data_type === '天气现象'"
|
|
|
+ :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
|
|
|
+ @click="toggleSelection(item)">{{ item.data_name }}</div>
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="积雪">
|
|
|
+ <div class="container-tag">
|
|
|
+ <template v-for="item in elementList" :key="item.id">
|
|
|
+ <div v-if="item.data_type === '积雪'"
|
|
|
+ :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
|
|
|
+ @click="toggleSelection(item)">{{ item.data_name }}</div>
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="地面温度">
|
|
|
+ <div class="container-tag">
|
|
|
+ <template v-for="item in elementList" :key="item.id">
|
|
|
+ <div v-if="item.data_type === '地面温度'"
|
|
|
+ :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
|
|
|
+ @click="toggleSelection(item)">{{ item.data_name }}</div>
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="大气电场">
|
|
|
+ <div class="container-tag">
|
|
|
+ <template v-for="item in elementList" :key="item.id">
|
|
|
+ <div v-if="item.data_type === '大气电场'"
|
|
|
+ :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
|
|
|
+ @click="toggleSelection(item)">{{ item.data_name }}</div>
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="闪电">
|
|
|
+ <div class="container-tag">
|
|
|
+ <template v-for="item in elementList" :key="item.id">
|
|
|
+ <div v-if="item.data_type === '闪电'"
|
|
|
+ :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
|
|
|
+ @click="toggleSelection(item)">{{ item.data_name }}</div>
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="日照">
|
|
|
+ <div class="container-tag">
|
|
|
+ <template v-for="item in elementList" :key="item.id">
|
|
|
+ <div v-if="item.data_type === '日照'"
|
|
|
+ :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
|
|
|
+ @click="toggleSelection(item)">{{ item.data_name }}</div>
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="总辐射">
|
|
|
+ <div class="container-tag">
|
|
|
+ <template v-for="item in elementList" :key="item.id">
|
|
|
+ <div v-if="item.data_type === '总辐射'"
|
|
|
+ :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
|
|
|
+ @click="toggleSelection(item)">{{ item.data_name }}</div>
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="日照文">
|
|
|
+ <div class="container-tag">
|
|
|
+ <template v-for="item in elementList" :key="item.id">
|
|
|
+ <div v-if="item.data_type === '日照文'"
|
|
|
+ :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
|
|
|
+ @click="toggleSelection(item)">{{ item.data_name }}</div>
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="水文">
|
|
|
+ <div class="container-tag">
|
|
|
+ <template v-for="item in elementList" :key="item.id">
|
|
|
+ <div v-if="item.data_type === '水文'"
|
|
|
+ :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
|
|
|
+ @click="toggleSelection(item)">{{ item.data_name }}</div>
|
|
|
+ </template>
|
|
|
</div>
|
|
|
</el-tab-pane>
|
|
|
- <el-tab-pane label="温湿度">Config</el-tab-pane>
|
|
|
- <el-tab-pane label="气压">Role</el-tab-pane>
|
|
|
- <el-tab-pane label="降水">Task</el-tab-pane>
|
|
|
- <el-tab-pane label="云">Task</el-tab-pane>
|
|
|
- <el-tab-pane label="能见度">Task</el-tab-pane>
|
|
|
- <el-tab-pane label="天气现象">Task</el-tab-pane>
|
|
|
- <el-tab-pane label="积雪">Task</el-tab-pane>
|
|
|
- <el-tab-pane label="地面温度">Task</el-tab-pane>
|
|
|
- <el-tab-pane label="大气电场">Task</el-tab-pane>
|
|
|
- <el-tab-pane label="闪电">Task</el-tab-pane>
|
|
|
- <el-tab-pane label="日照">Task</el-tab-pane>
|
|
|
- <el-tab-pane label="总辐射">Task</el-tab-pane>
|
|
|
</el-tabs>
|
|
|
</div>
|
|
|
<template #footer>
|
|
@@ -116,9 +241,288 @@
|
|
|
|
|
|
<script setup lang="ts" name="dataSynthesis">
|
|
|
import * as echarts from 'echarts';
|
|
|
+import { ElMessage } from "element-plus";
|
|
|
+import { useGlobalStore } from "@/stores/modules/global";
|
|
|
+import { ref, computed, onMounted, reactive, watch, onDeactivated, onActivated } from "vue";
|
|
|
+import { getDataItemList, getPlatformList, getRgDataList, getTacRecordList } from "@/api/modules/allData";
|
|
|
+import { Platform } from "@/api/interface";
|
|
|
+import { parseTime } from '@/utils/index';
|
|
|
+import { isToday, isWithinThirtyMinutes, getTimeStamp, getStamp } from "@/utils/dateTime";
|
|
|
+const value1 = ref(true)
|
|
|
+const dateRange = ref<[any, any]>([parseTime(new Date(), '{y}-{m}-{d}') + ' 00:00', parseTime(new Date(), '{y}-{m}-{d} {h}:{i}')]);
|
|
|
+const changetype = (e) => {
|
|
|
+ if (!e) {
|
|
|
+ dateRange.value = [parseTime(getTimeStamp(1), '{y}-{m}-{d} {h}:{i}'), parseTime(new Date(), '{y}-{m}-{d} {h}:{i}')]
|
|
|
+ }
|
|
|
+}
|
|
|
+const handleDateRangeChange = (newVal) => {
|
|
|
+ const [startDate, endDate] = newVal;
|
|
|
+ if (endDate && isToday(endDate)) {
|
|
|
+ // 获取当前时间的整点
|
|
|
+ const currentHour = new Date().getHours();
|
|
|
+ const roundedEndDate = new Date(endDate);
|
|
|
+ roundedEndDate.setMinutes(0, 0, 0); // 设置分钟、秒、毫秒为0
|
|
|
+ const startZeroed = new Date(startDate);
|
|
|
+ startZeroed.setHours(0, 0, 0, 0);
|
|
|
+ dateRange.value = [parseTime(new Date(startZeroed)), parseTime(new Date(roundedEndDate))];
|
|
|
+ console.log(dateRange.value, '今天');
|
|
|
+ } else {
|
|
|
+ const noTodayStart = new Date(startDate).setMinutes(0, 0, 0);
|
|
|
+ const noTodayEnd = new Date(endDate).setHours(23, 0, 0, 0);
|
|
|
+ dateRange.value = [parseTime(new Date(noTodayStart)), parseTime(new Date(noTodayEnd))];
|
|
|
+ console.log(dateRange.value, '不是今天');
|
|
|
+ }
|
|
|
+};
|
|
|
+const handleDateChange = async (e) => {
|
|
|
+
|
|
|
+ if (!value1.value) {
|
|
|
+ if (isWithinThirtyMinutes(e[0], e[1])) {
|
|
|
+ // 获取参数
|
|
|
+ getHistoryList()
|
|
|
+
|
|
|
+ } else {
|
|
|
+ ElMessage.error("分钟模式下时间间隔不能大于3小时");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ await handleDateRangeChange(e)
|
|
|
+ getHistoryList()
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+}
|
|
|
+const pickDay = ref()
|
|
|
+const handleFocus = () => {
|
|
|
+ pickDay.value = null
|
|
|
+}
|
|
|
+const limitTime = 1000 * 60 * 60 * 24 * 6
|
|
|
+
|
|
|
+const disabledDate = (time: Date) => {
|
|
|
+ if (!value1.value) {
|
|
|
+ return time.getTime() > Date.now() - 8.64e6
|
|
|
+ } else {
|
|
|
+ if (pickDay.value) {
|
|
|
+ return (
|
|
|
+ time.getTime() < pickDay.value.getTime() - limitTime ||
|
|
|
+ time.getTime() > pickDay.value.getTime() + limitTime ||
|
|
|
+ time.getTime() > Date.now() - 8.64e6
|
|
|
+ )
|
|
|
+ } else {
|
|
|
+ return time.getTime() > Date.now() - 8.64e6
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+const handleChange = (val: Date[]) => {
|
|
|
+ const [pointDay] = val
|
|
|
+ pickDay.value = pointDay
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+const disabledHours = () => {
|
|
|
+ const a: number[] = [];
|
|
|
+ for (let i = 0; i < 24; i++) {
|
|
|
+ if (new Date().getHours() >= i) continue;
|
|
|
+ a.push(i);
|
|
|
+ }
|
|
|
+ return a;
|
|
|
+};
|
|
|
+
|
|
|
+const disabledMinutes = () => {
|
|
|
+ const a: number[] = [];
|
|
|
+ for (let i = 0; i < 60; i++) {
|
|
|
+ if (new Date().getMinutes() >= i) continue;
|
|
|
+ a.push(i);
|
|
|
+ }
|
|
|
+ return a;
|
|
|
+};
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+// 查询所有人工要素字典表
|
|
|
+const elementList = ref<any>([])
|
|
|
+//自定义部分表头
|
|
|
+let customizeColumns = ref<any>([
|
|
|
+ {
|
|
|
+ data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
|
|
|
+ data_id: 2,
|
|
|
+ data_type: "风",
|
|
|
+ data_item: "ER_FEN_ZHONG_PING_JUN_FENG_XIANG",
|
|
|
+ data_name: "2分钟风向",
|
|
|
+ data_unit: "°",
|
|
|
+ data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
|
|
|
+ data_value: "",
|
|
|
+ data_order: 0,
|
|
|
+ data_condition: 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ data_id: 1,
|
|
|
+ data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
|
|
|
+ data_type: "风",
|
|
|
+ data_name: "2分钟风速",
|
|
|
+ data_item: "ER_FEN_ZHONG_PING_JUN_FENG_SU",
|
|
|
+ data_unit: "m/s",
|
|
|
+ data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
|
|
|
+ data_value: "",
|
|
|
+ data_order: 0,
|
|
|
+ data_condition: 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ data_id: 4,
|
|
|
+ data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
|
|
|
+ data_type: "风",
|
|
|
+ data_name: "10分钟风向",
|
|
|
+ data_item: "SHI_FEN_ZHONG_PING_JUN_FENG_XIANG",
|
|
|
+ data_unit: "°",
|
|
|
+ data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
|
|
|
+ data_value: "",
|
|
|
+ data_order: 0,
|
|
|
+ data_condition: 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
|
|
|
+ data_id: 3,
|
|
|
+ data_type: "风",
|
|
|
+ data_item: "SHI_FEN_ZHONG_PING_JUN_FENG_SU",
|
|
|
+ data_name: "10分钟风速",
|
|
|
+ data_unit: "m/s",
|
|
|
+ data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
|
|
|
+ data_value: "",
|
|
|
+ data_order: 0,
|
|
|
+ data_condition: 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
|
|
|
+ data_id: 501,
|
|
|
+ data_type: "能见度",
|
|
|
+ data_item: "YI_FEN_ZHONG_PING_JUN_NENG_JIAN_DU",
|
|
|
+ data_name: "1分钟平均能见度",
|
|
|
+ data_unit: "m",
|
|
|
+ data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
|
|
|
+ data_value: "",
|
|
|
+ data_order: 0,
|
|
|
+ data_condition: 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
|
|
|
+ data_id: 101,
|
|
|
+ data_type: "温湿度",
|
|
|
+ data_item: "QI_WEN",
|
|
|
+ data_name: "气温",
|
|
|
+ data_unit: "℃",
|
|
|
+ data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
|
|
|
+ data_value: "",
|
|
|
+ data_order: 0,
|
|
|
+ data_condition: 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ data_id: 201,
|
|
|
+ data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
|
|
|
+ data_type: "气压",
|
|
|
+ data_name: "水汽压",
|
|
|
+ data_item: "SHUI_QI_YA",
|
|
|
+ data_unit: "hPa",
|
|
|
+ data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
|
|
|
+ data_value: "",
|
|
|
+ data_order: 0,
|
|
|
+ data_condition: 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
|
|
|
+ data_id: 109,
|
|
|
+ data_type: "温湿度",
|
|
|
+ data_item: "LU_DIAN_WEN_DU",
|
|
|
+ data_name: "露点温度",
|
|
|
+ data_unit: "℃",
|
|
|
+ data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
|
|
|
+ data_value: "",
|
|
|
+ data_order: 0,
|
|
|
+ data_condition: 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ data_id: 202,
|
|
|
+ data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
|
|
|
+ data_type: "气压",
|
|
|
+ data_name: "本站气压",
|
|
|
+ data_item: "BEN_ZHAN_QI_YA",
|
|
|
+ data_unit: "hPa",
|
|
|
+ data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
|
|
|
+ data_value: "",
|
|
|
+ data_order: 0,
|
|
|
+ data_condition: 0
|
|
|
+ }, {
|
|
|
+ data_id: 207,
|
|
|
+ data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
|
|
|
+ data_type: "气压",
|
|
|
+ data_name: "海平面气压",
|
|
|
+ data_item: "HAI_PING_MIAN_QI_YA",
|
|
|
+ data_unit: "hPa",
|
|
|
+ data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
|
|
|
+ data_value: "",
|
|
|
+ data_order: 0,
|
|
|
+ data_condition: 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
|
|
|
+ data_id: 312,
|
|
|
+ data_type: "降水",
|
|
|
+ data_item: "XIAO_SHI_LEI_JI_JIANG_SHUI_LIANG_CHENG_ZHONG",
|
|
|
+ data_name: "小时累计降水量(称重)",
|
|
|
+ data_unit: "mm",
|
|
|
+ data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
|
|
|
+ data_value: "",
|
|
|
+ data_order: 0,
|
|
|
+ data_condition: 0
|
|
|
+ }
|
|
|
+]);
|
|
|
+const copiedCustomizeColumns = ref<any>([...customizeColumns.value]);
|
|
|
+const getAllRgDataList = async () => {
|
|
|
+ const { data } = await getRgDataList();
|
|
|
+ elementList.value = data.list
|
|
|
+};
|
|
|
+// 要素的选中和取消
|
|
|
+const toggleSelection = (item) => {
|
|
|
+ item.isSelected = !item.isSelected
|
|
|
+ if (item.isSelected) {
|
|
|
+ //添加
|
|
|
+ copiedCustomizeColumns.value.push(item)
|
|
|
+ } else {
|
|
|
+ //删除
|
|
|
+ copiedCustomizeColumns.value = copiedCustomizeColumns.value.filter(column => column.data_id !== item.data_id);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+const handleSetting = () => {
|
|
|
+ copiedCustomizeColumns.value = [...customizeColumns.value]
|
|
|
+ elementList.value.forEach(element => {
|
|
|
+ const column = copiedCustomizeColumns.value.find(col => col.data_id === element.data_id);
|
|
|
+ if (column) {
|
|
|
+ element.isSelected = true;
|
|
|
+ } else {
|
|
|
+ element.isSelected = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ dialog.title = "列表字段设置"
|
|
|
+ dialog.visible = true;
|
|
|
+}
|
|
|
+const submitForm = () => {
|
|
|
+ dialog.visible = false;
|
|
|
+ customizeColumns.value = [...copiedCustomizeColumns.value]
|
|
|
+ // updateColumns()
|
|
|
+ // getList()
|
|
|
+ // weatherInfo()
|
|
|
+ // getHistoryList()
|
|
|
+ saveCustomizeColumns()
|
|
|
+}
|
|
|
+
|
|
|
+const cancel = () => {
|
|
|
+ dialog.visible = false;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
|
|
|
-import { ref, reactive, onMounted } from "vue";
|
|
|
-import { useRouter } from "vue-router";
|
|
|
|
|
|
const formRef = ref()
|
|
|
const wind = ref()
|
|
@@ -127,7 +531,6 @@ const radio = ref()
|
|
|
const radio2 = ref()
|
|
|
|
|
|
|
|
|
-const router = useRouter();
|
|
|
const searchParam = reactive({
|
|
|
base: undefined,
|
|
|
date: '',
|
|
@@ -147,19 +550,121 @@ const dialog = reactive<any>({
|
|
|
title: ''
|
|
|
});
|
|
|
|
|
|
-const handleSetting = () => {
|
|
|
- dialog.title = "列表字段设置"
|
|
|
- dialog.visible = true;
|
|
|
-}
|
|
|
|
|
|
-const submitForm = () => {
|
|
|
|
|
|
+const pageable = ref({
|
|
|
+ data_type: true,
|
|
|
+ time_order: 0,
|
|
|
+ as_code: undefined,
|
|
|
+ data_items: [],
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 20,
|
|
|
+ total: 0
|
|
|
+});
|
|
|
+let historyColumns = [
|
|
|
+ {
|
|
|
+ data_id: 202,
|
|
|
+ data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
|
|
|
+ data_type: "气压",
|
|
|
+ data_name: "本站气压",
|
|
|
+ data_item: "BEN_ZHAN_QI_YA",
|
|
|
+ data_unit: "hPa",
|
|
|
+ data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
|
|
|
+ data_value: "",
|
|
|
+ data_order: 0,
|
|
|
+ data_condition: 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
|
|
|
+ data_id: 101,
|
|
|
+ data_type: "温湿度",
|
|
|
+ data_item: "QI_WEN",
|
|
|
+ data_name: "气温",
|
|
|
+ data_unit: "℃",
|
|
|
+ data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
|
|
|
+ data_value: "",
|
|
|
+ data_order: 0,
|
|
|
+ data_condition: 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ data_r_table: "SHI_SHI_LIU_YAO_SU_SHU_JU",
|
|
|
+ data_id: 106,
|
|
|
+ data_type: "温湿度",
|
|
|
+ data_item: "XIANG_DUI_SHI_DU",
|
|
|
+ data_name: "相对湿度",
|
|
|
+ data_unit: "%",
|
|
|
+ data_h_table: "LI_SHI_LIU_YAO_SU_SHU_JU",
|
|
|
+ data_value: "",
|
|
|
+ data_order: 0,
|
|
|
+ data_condition: 0,
|
|
|
+ isSelected: true
|
|
|
+ },
|
|
|
+]
|
|
|
+
|
|
|
+// 查询自动站列表
|
|
|
+const queryas = ref<Platform>({
|
|
|
+ pageSize: 50,
|
|
|
+ pageNum: 1,
|
|
|
+ currentpage: 1
|
|
|
+})
|
|
|
+
|
|
|
+
|
|
|
+const platformList = ref<any>([])
|
|
|
+const selectPlatform = ref()
|
|
|
+
|
|
|
+const getPlatforms = async () => {
|
|
|
+ const { data } = await getPlatformList(queryas.value);
|
|
|
+ platformList.value = data.list
|
|
|
+ pageable.value.as_code = data.list[0].as_code
|
|
|
+ selectPlatform.value = data.list[0]
|
|
|
+ getHistoryList()
|
|
|
+
|
|
|
+};
|
|
|
+
|
|
|
+const changeStation = () => {
|
|
|
+ getHistoryList()
|
|
|
}
|
|
|
|
|
|
-const cancel = () => {
|
|
|
- dialog.visible = false;
|
|
|
+//时间戳转换为指定格式的日期字符串
|
|
|
+function formatDate(timestamp, type) {
|
|
|
+ const date = new Date(timestamp * 1000); // 将时间戳转换为毫秒
|
|
|
+ const year = date.getFullYear();
|
|
|
+ const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
|
+ const day = String(date.getDate()).padStart(2, '0');
|
|
|
+ const hours = String(date.getHours()).padStart(2, '0');
|
|
|
+ const minutes = String(date.getMinutes()).padStart(2, '0');
|
|
|
+ if (type === 1) {
|
|
|
+ return `${month}/${day} ${hours}:${minutes}`;
|
|
|
+ } else {
|
|
|
+ return `${year}-${month}-${day} ${hours}:${minutes}`;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+const timeArr = ref()
|
|
|
+const tempLineArr = ref()
|
|
|
+const humidityLineArr = ref()
|
|
|
+const pressureLineArr = ref()
|
|
|
+const getHistoryList = async () => {
|
|
|
+ const { data } = await getDataItemList({ ...pageable.value, pageSize: 99, as_code_list: [pageable.value.as_code], data_items: historyColumns, data_type: false, time_space: value1.value ? 60 : 1, end_time: getStamp(dateRange[1]), begin_time: getStamp(dateRange[0]) });
|
|
|
+ timeArr.value = data.list?.map(item => {
|
|
|
+ return formatDate(item.data_time_i, 1)
|
|
|
+ })
|
|
|
+ tempLineArr.value = data.list?.map(item => {
|
|
|
+ return item[101]
|
|
|
+ })
|
|
|
+ humidityLineArr.value = data.list?.map(item => {
|
|
|
+ return item[106]
|
|
|
+ })
|
|
|
+ pressureLineArr.value = data.list?.map(item => {
|
|
|
+ return item[202]
|
|
|
+ })
|
|
|
+ showWind()
|
|
|
+};
|
|
|
+
|
|
|
+const globalStore = useGlobalStore();
|
|
|
+const isDark = computed(() => globalStore.isDark);
|
|
|
+
|
|
|
// resetForm
|
|
|
const resetForm = (formEl) => {
|
|
|
if (!formEl) return;
|
|
@@ -589,13 +1094,41 @@ const showRadio2 = () => {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+// 保存customizeColumns数组到localStorage
|
|
|
+function saveCustomizeColumns() {
|
|
|
+ const jsonString = JSON.stringify(customizeColumns.value);
|
|
|
+ localStorage.setItem('customizeColumns', jsonString);
|
|
|
+}
|
|
|
+
|
|
|
+// 从localStorage中获取customizeColumns数组
|
|
|
+function loadCustomizeColumns() {
|
|
|
+ const jsonString = localStorage.getItem('customizeColumns');
|
|
|
+ if (jsonString) {
|
|
|
+ customizeColumns.value = JSON.parse(jsonString);
|
|
|
+ }
|
|
|
+}
|
|
|
+let intervalId;
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
+ loadCustomizeColumns()
|
|
|
+
|
|
|
+ getAllRgDataList()
|
|
|
+
|
|
|
+ getPlatforms()
|
|
|
showWind()
|
|
|
showPressureLine()
|
|
|
showRadio()
|
|
|
showRadio2()
|
|
|
|
|
|
})
|
|
|
+onActivated(() => {
|
|
|
+ intervalId = setInterval(() => {
|
|
|
+ // getList();
|
|
|
+ // weatherInfo()
|
|
|
+ getHistoryList()
|
|
|
+ }, 60 * 1000);
|
|
|
+});
|
|
|
|
|
|
</script>
|
|
|
<style scoped lang="scss">
|