daiht 3 тижнів тому
батько
коміт
f6ff3b1547

+ 32 - 0
src/utils/dateTime.ts

@@ -128,3 +128,35 @@ export function isDateRangeWithinDays(startDate, endDate, maxDays) {
     // 判断天数差是否大于给定的天数限制  
     return dayDifference <= maxDays;  
 }  
+
+// 判断基地
+export function groupByType(arr) {  
+    const result = [];  
+    const typeMap = {};  
+  
+    // 遍历输入数组  
+    arr.forEach(item => {  
+        const { as_base, as_code } = item;  
+  
+        // 如果typeMap中还没有这个type,则初始化一个新的对象  
+        if (!typeMap[as_base]) {  
+            typeMap[as_base] = {  
+                value: as_base,
+				label: as_base,  
+                children: []  
+            };  
+        }  
+  
+        // 将id添加到对应type的children数组中  
+        typeMap[as_base].children.push(as_code);  
+    });  
+  
+    // 将typeMap中的对象添加到结果数组中  
+    for (const key in typeMap) {  
+        if (typeMap.hasOwnProperty(key)) {  
+            result.push(typeMap[key]);  
+        }  
+    }  
+  
+    return result;  
+}  

+ 48 - 15
src/views/alarm/allDevice/index.vue

@@ -1,10 +1,10 @@
 <template>
 	<div class="table-box">
 		<div class="card table-search" style="overflow: hidden;">
-			<el-form ref="formRef" :model="searchParam" :inline="true" label-width="auto">
+			<el-form ref="formRef" :model="pageable" :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"
+					<el-select v-model="pageable.base" placeholder="请选择" style="width: 200px">
+						<el-option v-for="item in baseList" :key="item.value" :label="item.label"
 							:value="item.value" />
 					</el-select>
 				</el-form-item>
@@ -97,11 +97,50 @@
 
 <script setup lang="ts" name="allDevice">
 import * as echarts from 'echarts';
-
-import { ref, reactive, onMounted, computed, watch } from "vue";
-import { useRouter } from "vue-router";
+import { isToday, isWithinThirtyMinutes, getTimeStamp, getStamp, isDateFuture, isDateRangeWithinDays,groupByType } from "@/utils/dateTime";
+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';
+// 查询自动站列表
+const queryas = ref<Platform>({
+	pageSize: 5000,
+	pageNum: 1,
+	currentpage: 1
+})
+const pageable = ref({
+	data_type: true,
+	time_order: 1,
+	base: undefined,
+	as_code: undefined,
+	data_items: [],
+	pageNum: 1,
+	pageSize: 20,
+	total: 0
+});
+
+const platformList = ref<any>([])
+const baseList=ref<any>([])
+const selectPlatform = ref()
+
+const getPlatforms = async () => {
+	const { data } = await getPlatformList(queryas.value);
+	platformList.value = data.list
+	baseList.value=groupByType(data.list)
+
+	
 
+	pageable.value.base = baseList.value[1].value
+	selectPlatform.value = baseList.value[1]
+	// getHistoryList()
+
+};
+
+const changeStation = () => {
+	// getHistoryList()
+}
 
 const formRef = ref()
 const device = ref()
@@ -110,19 +149,12 @@ const weather = ref()
 const element = ref()
 const control = ref()
 
-const router = useRouter();
+
 const searchParam = reactive({
 	base: undefined,
 
 })
-const baseOptions = ref([{
-	value: 0,
-	label: '基地1',
-},
-{
-	value: 1,
-	label: '基地2',
-}])
+
 
 
 // resetForm
@@ -491,6 +523,7 @@ const showControl = () => {
 watch(isDark, () => { showDevice(), showPeriod(), showWeather(), showElement(), showControl() });
 
 onMounted(() => {
+	getPlatforms()
 	showDevice()
 	showPeriod()
 	showWeather()

+ 146 - 86
src/views/alarm/singleStationData/index.vue

@@ -26,7 +26,9 @@
 				}}</div>
 				<div class="top_item">经度:{{ selectPlatform?.as_lon }}</div>
 				<div class="top_item">纬度:{{ selectPlatform?.as_lat }}</div>
-				<div class="top_item">观测时间:{{dataItemInfo&&dataItemInfo.data_time_i? formatDate(dataItemInfo?.data_time_i, 2):'--' }}</div>
+				<div class="top_item">观测时间:{{ dataItemInfo && dataItemInfo.data_time_i ?
+					formatDate(dataItemInfo?.data_time_i, 2) : '--' }}
+				</div>
 			</div>
 			<div class="header-button-ri">
 				<slot name="toolButton">
@@ -90,10 +92,10 @@
 						<div style="font-weight: bold;">瞬时风 ( m/s )</div>
 						<div class="mt15 box1">
 							<div ref="windSpeed" class="ve-ring" style="height: 200px"></div>
-							<div class="icon icon1">{{ dataItemInfo&&dataItemInfo[9]?dataItemInfo[9]:'--' }}
+							<div class="icon icon1">{{ dataItemInfo && dataItemInfo[9] ? dataItemInfo[9] : '--' }}
 								<span>°</span>
 							</div>
-							<div class="icon icon2" >{{ dataItemInfo&&dataItemInfo[8]?dataItemInfo[8]:'--' }}
+							<div class="icon icon2">{{ dataItemInfo && dataItemInfo[8] ? dataItemInfo[8] : '--' }}
 								<span>m/s</span>
 							</div>
 						</div>
@@ -176,12 +178,13 @@
 			</el-row>
 
 			<el-row :gutter="15">
-				<el-col :xs="12" :sm="8" :md="8" :lg="4" :xl="4" v-for="item in selectElement.length>0?selectElement:customizeColumns" :key="item.data_id">
+				<el-col :xs="12" :sm="8" :md="8" :lg="4" :xl="4"
+					v-for="item in selectElement.length > 0 ? selectElement : customizeColumns" :key="item.data_id">
 					<div class="chart_item info_box zhuti">
 						<div class="info_title">{{ item.data_name }} ( {{ item.data_unit }} )</div>
 						<div class="mt15 ">
 							<div class="info_content">
-								{{ item.data_value?item.data_value: '--' }}
+								{{ item.data_value ? item.data_value : '--' }}
 							</div>
 						</div>
 					</div>
@@ -320,8 +323,8 @@
 								</el-option>
 							</el-select>
 						</div>
-						<div class="mt15"  >
-							<div ref="wind" class="ve-ring" style="height: 200px" ></div>
+						<div class="mt15">
+							<div ref="wind" class="ve-ring" style="height: 200px"></div>
 						</div>
 
 					</div>
@@ -337,8 +340,8 @@
 								</el-option>
 							</el-select>
 						</div>
-						<div class="mt15"  >
-							<div ref="tempLine" class="ve-ring" style="height: 200px" ></div>
+						<div class="mt15">
+							<div ref="tempLine" class="ve-ring" style="height: 200px"></div>
 						</div>
 					</div>
 				</el-col>
@@ -361,14 +364,13 @@
 			</el-row>
 		</div>
 		<!-- 添加或修改岗位对话框 -->
-		<el-dialog :title="dialog.title" v-model="dialog.visible" width="940px" append-to-body>
-			<div style="height: 500px">
+		<el-dialog :title="dialog.title" v-model="dialog.visible" width="1200px" append-to-body>
+			<div style="height: 500px;display: flex">
 				<el-tabs tab-position="left" class="demo-tabs" style="height: 100%">
 					<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'"
+								<div v-if="item.data_type === '风'" :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
 									@click="toggleSelection(item)">{{ item.data_name }}</div>
 							</template>
 						</div>
@@ -376,8 +378,7 @@
 					<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'"
+								<div v-if="item.data_type === '温湿度'" :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
 									@click="toggleSelection(item)">{{ item.data_name }}</div>
 							</template>
 						</div>
@@ -385,8 +386,7 @@
 					<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'"
+								<div v-if="item.data_type === '气压'" :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
 									@click="toggleSelection(item)">{{ item.data_name }}</div>
 							</template>
 						</div>
@@ -394,8 +394,7 @@
 					<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'"
+								<div v-if="item.data_type === '降水'" :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
 									@click="toggleSelection(item)">{{ item.data_name }}</div>
 							</template>
 						</div>
@@ -403,8 +402,7 @@
 					<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'"
+								<div v-if="item.data_type === '云'" :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
 									@click="toggleSelection(item)">{{ item.data_name }}</div>
 							</template>
 						</div>
@@ -412,8 +410,7 @@
 					<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'"
+								<div v-if="item.data_type === '能见度'" :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
 									@click="toggleSelection(item)">{{ item.data_name }}</div>
 							</template>
 						</div>
@@ -430,8 +427,7 @@
 					<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'"
+								<div v-if="item.data_type === '积雪'" :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
 									@click="toggleSelection(item)">{{ item.data_name }}</div>
 							</template>
 						</div>
@@ -457,8 +453,7 @@
 					<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'"
+								<div v-if="item.data_type === '闪电'" :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
 									@click="toggleSelection(item)">{{ item.data_name }}</div>
 							</template>
 						</div>
@@ -466,8 +461,7 @@
 					<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'"
+								<div v-if="item.data_type === '日照'" :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
 									@click="toggleSelection(item)">{{ item.data_name }}</div>
 							</template>
 						</div>
@@ -475,8 +469,7 @@
 					<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'"
+								<div v-if="item.data_type === '总辐射'" :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
 									@click="toggleSelection(item)">{{ item.data_name }}</div>
 							</template>
 						</div>
@@ -484,8 +477,7 @@
 					<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'"
+								<div v-if="item.data_type === '日照文'" :class="item.isSelected ? 'item-tag-active' : 'item-tag'"
 									@click="toggleSelection(item)">{{ item.data_name }}</div>
 							</template>
 						</div>
@@ -493,13 +485,27 @@
 					<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'"
+								<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-tabs>
+				<div class="selected-list-box">
+					<div class="disposition-title" style="margin-top: 0px">已选要素</div>
+					<div class="selected-list-c">
+						<template v-for="(item, index) in copiedCustomizeColumns" :key="item.id">
+							<div :class="selectedItemIndex === index ? 'selected-item-tag-active' : 'selected-item-tag'"
+								@click="changeSelected(index)">{{ item.data_name }}</div>
+						</template>
+					</div>
+					<div class="button-container">
+						<el-button type="primary" plain class="top-left" @click="changeMoveUp">上移</el-button>
+						<el-button type="primary" plain class="top-right" @click="changeMoveDown">下移</el-button>
+						<el-button type="primary" plain class="bottom-left" @click="changeRemove">移除</el-button>
+						<el-button type="primary" plain class="bottom-right" @click="changeCleared">清空</el-button>
+					</div>
+				</div>
 			</div>
 			<template #footer>
 				<div class="dialog-footer">
@@ -522,25 +528,25 @@ import { Platform } from "@/api/interface";
 import { ElLoading } from "element-plus";
 
 /* 全局请求 loading */
-const loading=ref()
+const loading = ref()
 
 /**
  * @description 开启 Loading
  * */
 const startFullLoading = () => {
-  loading.value = ElLoading.service({
-    fullscreen: true,
-    lock: true,
-    text: "Loading",
-    background: "rgba(0, 0, 0, 0.7)"
-  });
+	loading.value = ElLoading.service({
+		fullscreen: true,
+		lock: true,
+		text: "Loading",
+		background: "rgba(0, 0, 0, 0.7)"
+	});
 };
 
 /**
  * @description 结束 Loading
  * */
 const endFullLoading = () => {
-  loading.value.close();
+	loading.value.close();
 };
 const timeValue = ref(1);
 
@@ -944,7 +950,61 @@ let historyColumns = [
 		isSelected: true
 	},
 ]
+const sensorList = ref<any>([])
+// 被选中当条数据下标
+const selectedItemIndex = ref(0)
+
+
+const changeMoveUp = () => {
+	//上移
+	if (selectedItemIndex.value > 0) {
+		const temp = copiedCustomizeColumns.value[selectedItemIndex.value - 1]
+		copiedCustomizeColumns.value[selectedItemIndex.value - 1] = copiedCustomizeColumns.value[selectedItemIndex.value]
+		copiedCustomizeColumns.value[selectedItemIndex.value] = temp
+		selectedItemIndex.value--
+	}
+}
 
+const changeMoveDown = () => {
+	//下移
+	if (selectedItemIndex.value < copiedCustomizeColumns.value.length - 1) {
+		const temp = copiedCustomizeColumns.value[selectedItemIndex.value + 1]
+		copiedCustomizeColumns.value[selectedItemIndex.value + 1] = copiedCustomizeColumns.value[selectedItemIndex.value]
+		copiedCustomizeColumns.value[selectedItemIndex.value] = temp
+		selectedItemIndex.value++
+	}
+}
+
+const changeRemove = () => {
+	//删除数据
+	if (copiedCustomizeColumns.value.length > 0) {
+		const custom = copiedCustomizeColumns.value[selectedItemIndex.value];
+		const se_type = custom.se_type
+		for (let i = 0; i < sensorList.value.length; i++) {
+			if (sensorList.value[i].se_type === se_type) {
+				sensorList.value[i].isSelected = false;
+			}
+		}
+		copiedCustomizeColumns.value.splice(selectedItemIndex.value, 1)
+		if (selectedItemIndex.value === copiedCustomizeColumns.value.length) {
+			selectedItemIndex.value--
+		}
+
+	}
+}
+
+const changeCleared = () => {
+	//清空所有数据
+	selectedItemIndex.value = 0
+	copiedCustomizeColumns.value = []
+	for (let i = 0; i < sensorList.value.length; i++) {
+		sensorList.value[i].isSelected = false;
+	}
+}
+
+const changeSelected = (index) => {
+	selectedItemIndex.value = index
+}
 
 const dataTypeList = [
 	{
@@ -1146,7 +1206,7 @@ const getList = async () => {
 		return acc;
 	}, []);
 	const res = await getDataItemList({ ...pageable.value, as_code_list: [pageable.value.as_code], data_items: arr });
-	
+
 
 
 	dataItemInfo.value = res.data.list ? (res.data.list.length === 0 ? {} : res.data.list[0]) : {};
@@ -1158,14 +1218,14 @@ const getList = async () => {
 	showWindSpeed()
 	currentValue.value = dataItemInfo.value[312] && dataItemInfo.value[312] != 0 && dataItemInfo.value[312] != '--' ? dataItemInfo.value[302] : dataItemInfo.value[302] && dataItemInfo.value[302] != 0 ? dataItemInfo.value[302] : 0
 	mincurrentValue.value = dataItemInfo.value[311] && dataItemInfo.value[311] != 0 && dataItemInfo.value[311] != '--' ? dataItemInfo.value[301] : dataItemInfo.value[301] && dataItemInfo.value[301] != 0 ? dataItemInfo.value[302] : 0
-	selectElement.value = res.data.list?dataItemInfo.value?.data_list.filter(itemB => customizeColumns.value.some(itemA => itemA.data_id === itemB.data_id)):[];
+	selectElement.value = res.data.list ? dataItemInfo.value?.data_list.filter(itemB => customizeColumns.value.some(itemA => itemA.data_id === itemB.data_id)) : [];
 	const ids = [601, 602, 603, 604, 605]
-	dangerWeather.value = res.data.list?dataItemInfo.value.data_list
-		.filter(item => ids.includes(item.data_id) && item.data_value !== '--'&&item.data_value !== '')
-		.map(item => item):[]
-console.log(dangerWeather.value, 666);
+	dangerWeather.value = res.data.list ? dataItemInfo.value.data_list
+		.filter(item => ids.includes(item.data_id) && item.data_value !== '--' && item.data_value !== '')
+		.map(item => item) : []
+	console.log(dangerWeather.value, 666);
 
-		// .filter(item => ids.includes(item.data_id) && getYenSymbolLaterCharacters(item.remark) !== '无明显天气现象')
+	// .filter(item => ids.includes(item.data_id) && getYenSymbolLaterCharacters(item.remark) !== '无明显天气现象')
 	getHistoryList()
 };
 
@@ -1179,21 +1239,21 @@ function adjustValue(value) {
 	}
 }
 
-const showChart=ref(false)
+const showChart = ref(false)
 const timeArr = ref()
 const tempLineArr = ref()
 const humidityLineArr = ref()
 const pressureLineArr = ref()
 const windLineArr = ref()
 const getHistoryList = async () => {
-	showChart.value=false
+	showChart.value = false
 	const arr = [...customizeColumns.value, ...defaultColumns].reduce((acc, item) => {
 		if (!acc.some(existingItem => existingItem.data_id === item.data_id)) {
 			acc.push(item);
 		}
 		return acc;
 	}, []);
-	const { data } = await getDataItemList({ ...pageable.value, pageSize: 99, as_code_list: [pageable.value.as_code], data_items: historyColumns, data_type: false, begin_time: getTimeStamp(timeValue.value,dataItemInfo.value.data_time_i), end_time: getTimeStamp(timeValue.value == 1 ? 0 : 4,dataItemInfo.value.data_time_i), time_space: timeValue.value == 1 ? 1 : 60 });
+	const { data } = await getDataItemList({ ...pageable.value, pageSize: 99, as_code_list: [pageable.value.as_code], data_items: historyColumns, data_type: false, begin_time: getTimeStamp(timeValue.value, dataItemInfo.value.data_time_i), end_time: getTimeStamp(timeValue.value == 1 ? 0 : 4, dataItemInfo.value.data_time_i), time_space: timeValue.value == 1 ? 1 : 60 });
 	timeArr.value = data.list?.map(item => {
 		return formatDate(item.data_time_i, 1)
 	})
@@ -1217,7 +1277,7 @@ const getHistoryList = async () => {
 	showTempLine()
 	showPressureLine()
 	showWind()
-	showChart.value=true
+	showChart.value = true
 
 
 };
@@ -1452,7 +1512,7 @@ const showPressure = () => {
 				},
 				data: [
 					{
-						value: dataItemInfo.value&&dataItemInfo.value[202]?dataItemInfo.value[202]:'--'
+						value: dataItemInfo.value && dataItemInfo.value[202] ? dataItemInfo.value[202] : '--'
 					}
 				]
 			}
@@ -1591,7 +1651,7 @@ const showHumidity = () => {
 				},
 				data: [
 					{
-						value: dataItemInfo.value&&dataItemInfo.value[106]?dataItemInfo.value[106]:'--'
+						value: dataItemInfo.value && dataItemInfo.value[106] ? dataItemInfo.value[106] : '--'
 					}
 				]
 			}
@@ -1736,7 +1796,7 @@ const showWindSpeed = () => {
 				detail: {
 					offsetCenter: [-12, 5],
 					valueAnimation: true,
-					formatter: getWindLevel(dataItemInfo.value&&dataItemInfo.value[8]?dataItemInfo.value[8]:-1).toString(),
+					formatter: getWindLevel(dataItemInfo.value && dataItemInfo.value[8] ? dataItemInfo.value[8] : -1).toString(),
 					// formatter:'2' ,
 					color: isDark.value ? '#fff' : "#000",
 					// 	fontSize: 10,
@@ -1744,7 +1804,7 @@ const showWindSpeed = () => {
 				data: [
 					{
 						// value:270,
-						value: dataItemInfo.value&&dataItemInfo.value[9] == 'C' ? 0 : Number(dataItemInfo.value[9]),
+						value: dataItemInfo.value && dataItemInfo.value[9] == 'C' ? 0 : Number(dataItemInfo.value[9]),
 						name: '级',
 						detail: {
 							fontSize: 40,
@@ -1884,15 +1944,15 @@ const showWind = () => {
 	let mychart = echarts.init(wind.value);
 	let option = {
 		title: {
-                text: '暂无数据',
-				show:!timeArr.value?true:false,
-                x: 'center',
-                y: 'center',
-                textStyle: {
-                  fontSize: 14,
-                  fontWeight: 'normal',
-                }
-              },
+			text: '暂无数据',
+			show: !timeArr.value ? true : false,
+			x: 'center',
+			y: 'center',
+			textStyle: {
+				fontSize: 14,
+				fontWeight: 'normal',
+			}
+		},
 
 		grid: {
 			left: '10',
@@ -2099,7 +2159,7 @@ const showTemp = () => {
 
 				data: [
 					{
-						value: dataItemInfo.value&&dataItemInfo.value[101]?dataItemInfo.value[101]:0,
+						value: dataItemInfo.value && dataItemInfo.value[101] ? dataItemInfo.value[101] : 0,
 					}
 				]
 			}
@@ -2135,15 +2195,15 @@ const showTempLine = () => {
 	let mychart = echarts.init(tempLine.value);
 	let option = {
 		title: {
-                text: '暂无数据',
-				show:!timeArr.value?true:false,
-                x: 'center',
-                y: 'center',
-                textStyle: {
-                  fontSize: 14,
-                  fontWeight: 'normal',
-                }
-              },
+			text: '暂无数据',
+			show: !timeArr.value ? true : false,
+			x: 'center',
+			y: 'center',
+			textStyle: {
+				fontSize: 14,
+				fontWeight: 'normal',
+			}
+		},
 		// 直角坐标系内绘图网格
 		// grid: {
 		//     show: true,
@@ -2286,15 +2346,15 @@ const showPressureLine = () => {
 	let mychart = echarts.init(pressureLine.value);
 	let option = {
 		title: {
-                text: '暂无数据',
-				show:!timeArr.value?true:false,
-                x: 'center',
-                y: 'center',
-                textStyle: {
-                  fontSize: 14,
-                  fontWeight: 'normal',
-                }
-              },
+			text: '暂无数据',
+			show: !timeArr.value ? true : false,
+			x: 'center',
+			y: 'center',
+			textStyle: {
+				fontSize: 14,
+				fontWeight: 'normal',
+			}
+		},
 
 		grid: {
 			left: '10',

+ 19 - 3
src/views/analysis/dataSynthesis/index.vue

@@ -30,7 +30,7 @@
 				</el-form-item>
 				<el-form-item>
 					<div>
-						<el-button type="primary">查询</el-button>
+						<el-button type="primary" @click="getHistoryList">查询</el-button>
 						<el-button plain @click="resetForm(formRef)">重置</el-button>
 					</div>
 				</el-form-item>
@@ -44,7 +44,7 @@
 							<span>气温 ( ℃ ) / 相对湿度 ( % ) / 本站气压 ( hPa )</span>
 						</div>
 						<div class="mt5">
-							<div ref="data" class="data_box"></div>
+							<div ref="data" id="data" class="data_box"></div>
 						</div>
 					</div>
 				</el-col>
@@ -339,9 +339,21 @@ const showData = () => {
 	}
 
 	const colors = ['#5470C6', '#59A073', '#FFB652'];
-	let mychart = echarts.init(data.value);
+	var dom = document.getElementById("data");
+    // var myChart = echarts.init(dom);
+	let mychart = echarts.init(dom);
 	let option = {
 		color: colors,
+		title: {
+			text: '暂无数据',
+			show: !timeArr.value ? true : false,
+			x: 'center',
+			y: 'center',
+			textStyle: {
+				fontSize: 14,
+				fontWeight: 'normal',
+			}
+		},
 		tooltip: {
 			trigger: 'axis',
 			axisPointer: {
@@ -445,6 +457,10 @@ const showData = () => {
 			}
 		]
 	};
+	 //单击后执行操作
+	 mychart.on('click',(param) => {
+        console.log(param)
+    });
 	mychart.setOption(option)
 	window.addEventListener("resize", function () {
 		mychart.resize();

+ 123 - 97
src/views/analysis/lightningArea/index.vue

@@ -21,16 +21,15 @@
 						<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-minutes="disabledMinutes" @focus="handleFocus" @calendar-change="handleChange"
-							@change="handleDateChange"
+							end-placeholder="结束时间" :disabled-date="disabledDate" :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>
 					<div>
-						<el-button type="primary">查询</el-button>
+						<el-button type="primary" @click="getHistoryList">查询</el-button>
 						<el-button plain @click="resetForm(formRef)">重置</el-button>
 					</div>
 				</el-form-item>
@@ -89,17 +88,17 @@ const handleDateRangeChange = (newVal) => {
 	}
 };
 const handleDateChange = async (e) => {
-	if (isDateFuture(e[0]) ||isDateFuture(e[1])) {
+	if (isDateFuture(e[0]) || isDateFuture(e[1])) {
 		ElMessage.error("不得选择未来的时间");
 	} else {
 		if (!value1.value) {
 			if (isWithinThirtyMinutes(e[0], e[1])) {
-			// 获取参数
-			getHistoryList()
+				// 获取参数
+				getHistoryList()
 
-		} else {
-			ElMessage.error("分钟模式下时间间隔不能大于3小时");
-		}
+			} else {
+				ElMessage.error("分钟模式下时间间隔不能大于3小时");
+			}
 		} else {
 			if (isDateRangeWithinDays(e[0], e[1], 7)) {
 				await handleDateRangeChange(e)
@@ -171,42 +170,42 @@ const pageable = ref({
 	total: 0
 });
 let historyColumns = [
-{
-    data_id: 1003,
-    data_r_table: "SHI_SHI_DA_QI_DIAN_CHANG_SHAN_DIAN_SHU_JU",
-    data_type: "闪电",
-    data_name: "1分钟最强闪电的强度",
-    data_item: "YI_FEN_ZHONG_ZUI_QIANG_SHAN_DIAN_DE_QIANG_DU",
-    data_unit: "V/m",
-    data_h_table: "LI_SHI_DA_QI_DIAN_CHANG_SHAN_DIAN_SHU_JU",
-    data_value: "",
-    data_order: 0,
-    data_condition: 0
-},
-{
-    data_id: 1010,
-    data_r_table: "SHI_SHI_DA_QI_DIAN_CHANG_SHAN_DIAN_SHU_JU",
-    data_type: "闪电",
-    data_name: "1分钟最强闪电的距离",
-    data_item: "YI_FEN_ZHONG_ZUI_QIANG_SHAN_DIAN_DE_JU_LI",
-    data_unit: "km",
-    data_h_table: "LI_SHI_DA_QI_DIAN_CHANG_SHAN_DIAN_SHU_JU",
-    data_value: "",
-    data_order: 0,
-    data_condition: 0
-},
-{
-    data_id: 1011,
-    data_r_table: "SHI_SHI_DA_QI_DIAN_CHANG_SHAN_DIAN_SHU_JU",
-    data_type: "闪电",
-    data_name: "1分钟最强闪电的方位角",
-    data_item: "YI_FEN_ZHONG_ZUI_QIANG_SHAN_DIAN_DE_FANG_WEI_JIAO",
-    data_unit: "°",
-    data_h_table: "LI_SHI_DA_QI_DIAN_CHANG_SHAN_DIAN_SHU_JU",
-    data_value: "",
-    data_order: 0,
-    data_condition: 0
-},
+	{
+		data_id: 1003,
+		data_r_table: "SHI_SHI_DA_QI_DIAN_CHANG_SHAN_DIAN_SHU_JU",
+		data_type: "闪电",
+		data_name: "1分钟最强闪电的强度",
+		data_item: "YI_FEN_ZHONG_ZUI_QIANG_SHAN_DIAN_DE_QIANG_DU",
+		data_unit: "V/m",
+		data_h_table: "LI_SHI_DA_QI_DIAN_CHANG_SHAN_DIAN_SHU_JU",
+		data_value: "",
+		data_order: 0,
+		data_condition: 0
+	},
+	{
+		data_id: 1010,
+		data_r_table: "SHI_SHI_DA_QI_DIAN_CHANG_SHAN_DIAN_SHU_JU",
+		data_type: "闪电",
+		data_name: "1分钟最强闪电的距离",
+		data_item: "YI_FEN_ZHONG_ZUI_QIANG_SHAN_DIAN_DE_JU_LI",
+		data_unit: "km",
+		data_h_table: "LI_SHI_DA_QI_DIAN_CHANG_SHAN_DIAN_SHU_JU",
+		data_value: "",
+		data_order: 0,
+		data_condition: 0
+	},
+	{
+		data_id: 1011,
+		data_r_table: "SHI_SHI_DA_QI_DIAN_CHANG_SHAN_DIAN_SHU_JU",
+		data_type: "闪电",
+		data_name: "1分钟最强闪电的方位角",
+		data_item: "YI_FEN_ZHONG_ZUI_QIANG_SHAN_DIAN_DE_FANG_WEI_JIAO",
+		data_unit: "°",
+		data_h_table: "LI_SHI_DA_QI_DIAN_CHANG_SHAN_DIAN_SHU_JU",
+		data_value: "",
+		data_order: 0,
+		data_condition: 0
+	},
 ]
 
 // 查询自动站列表
@@ -250,22 +249,56 @@ function formatDate(timestamp, type) {
 
 
 const timeArr = ref()
+const series = ref<any>([])
 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.value[1]), begin_time: getStamp(dateRange.value[0]) });
+	const { data } = await getDataItemList({ ...pageable.value, pageSize: 9999, as_code_list: [pageable.value.as_code], data_items: historyColumns, data_type: false, time_space: value1.value ? 60 : 1, end_time: getStamp(dateRange.value[1]), begin_time: getStamp(dateRange.value[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]
+
+	data.list?.forEach((item, index) => {
+		// 初始化一个空数组来存储生成的对象  
+		let resultArray =<any> [];
+
+		// 初始化起始角度和结束角度  
+		let startAngle = 359.50;
+		let endAngle = 0.00; // 注意,这个值实际上是开区间 (0, 360] 的起点前一个值,所以设置为0 - 0.5的极限情况  
+		let step = -0.50;
+
+		// 循环生成对象  
+		for (let angle = startAngle; angle >= endAngle; angle += step) {
+			if (item[1011] != '--'&&Number(item[1011])==angle) {
+				resultArray.push(Number(item[1010]))
+				console.log(resultArray,'resultArray');
+				
+			} else {
+				resultArray.push(0)
+			}
+			// resultArray.push(obj);
+		}
+		series.value.push({
+			name: 'No.' + index,
+			type: 'radar',
+			data: [
+				{
+					value: resultArray,
+					name: item.data_time,
+					lineStyle: {
+						normal: {
+							color: 'transparent'
+						}
+					},
+					itemStyle: { // 单个拐点标志的样式设置。
+						normal: {
+							// color:'#d1d6dd'
+						}
+					},
+				},
+
+			]
+		})
 	})
 	showData()
 };
@@ -285,7 +318,7 @@ const resetForm = (formEl) => {
 
 const showData = () => {
 	// 初始化一个空数组来存储生成的对象  
-	let resultArray = [];
+	let resultArray =<any> [];
 
 	// 初始化起始角度和结束角度  
 	let startAngle = 360;
@@ -296,8 +329,9 @@ const showData = () => {
 	for (let angle = startAngle; angle > endAngle; angle += step) {
 		let obj = {
 			name: (angle === 360 || angle % 45 === 0) ? angle.toFixed(1) + '°' : '',
+			min: 0,
 			max: 200,
-			color:isDark.value ? '#fff' : "#000",
+			color: isDark.value ? '#fff' : "#000",
 			axisLabel: angle === 360 ? {
 				show: angle === 360,
 				formatter: '{value}km', color: "#000", showMinLabel: false
@@ -311,6 +345,13 @@ const showData = () => {
 
 	let mychart = echarts.init(data.value);
 	let option = {
+		tooltip: {
+			show: false,
+			triggerOn: 'mousemove',
+			formatter: function () {
+				return '';
+			}
+		},
 		radar: {
 			shape: 'circle',
 			// radius: 320, // 大小
@@ -341,46 +382,31 @@ const showData = () => {
 					// 分隔区域颜色。分隔区域会按数组中颜色的顺序依次循环设置颜色。默认是一个深浅的间隔色。
 				}
 			},
-			indicator: [
-				{ name: '360°', max: 200, axisLabel: { show: true, formatter: '{value}km', color: isDark.value ? '#fff' : "#000", showMinLabel: false, }, },
-				{ name: '', max: 200 },
-				{ name: '315°', },
-				{ name: '', },
-				{ name: '270°', },
-				{ name: '', },
-				{ name: '225°', },
-				{ name: '', },
-				{ name: '180°', },
-				{ name: '', },
-				{ name: '135°', },
-				{ name: '', },
-				{ name: '90°', },
-				{ name: '', },
-				{ name: '45°', },
-				{ name: '', },
-			]
+			indicator: resultArray
 		},
-		series: [
-			{
-				name: 'Budget vs spending',
-				type: 'radar',
-
-				data: [
-					{
-						value: [20],
-						name: 'Allocated Budget',
-						itemStyle: { // 单个拐点标志的样式设置。
-							normal: {
-								// color:'#d1d6dd'
-							}
-						},
-					},
-
-				]
-			}
-		]
+		series: series.value
 	};
-	mychart.setOption(option)
+	// mychart.on('mousemove', (params) => {
+	// 	let num = params.event.topTarget.__dimIdx;
+	// 	if (num === undefined) {
+	// 		option.tooltip.show = false;
+	// 		option.tooltip.formatter = function () {
+	// 			return '';
+	// 		};
+	// 	} else {
+	// 		option.tooltip.show = true;
+	// 		option.tooltip.formatter = function (params) {
+	// 			console.log(params)
+	// 			return (
+	// 				option.radar.indicator[num].name +
+	// 				':' +
+	// 				params.data.value[num]
+	// 			);
+	// 		};
+	// 	}
+	// 	mychart.setOption(option);
+	// });
+	mychart.setOption(option);
 	window.addEventListener("resize", function () {
 		mychart.resize();
 	});

+ 17 - 5
src/views/analysis/rainfall/index.vue

@@ -29,7 +29,7 @@
 				</el-form-item>
 				<el-form-item>
 					<div>
-						<el-button type="primary">查询</el-button>
+						<el-button type="primary" @click="getHistoryList">查询</el-button>
 						<el-button plain @click="resetForm(formRef)">重置</el-button>
 					</div>
 				</el-form-item>
@@ -166,7 +166,7 @@ const disabledMinutes = () => {
 
 const pageable = ref({
 	data_type: false,
-	time_order: 0,
+	time_order: 1,
 	as_code: undefined,
 	data_items: [],
 	pageNum: 1,
@@ -261,7 +261,7 @@ const show = ref(false)
 const getHistoryList = async () => {
 	console.log(dateRange.value, 111);
 
-	const { data } = await getDataItemList({ ...pageable.value, pageSize: 99, as_code_list: [pageable.value.as_code], data_items: historyColumns, time_space: value1.value ? 1440 : 60, end_time: getStamp(dateRange.value[1]), begin_time: getStamp(dateRange.value[0]) });
+	const { data } = await getDataItemList({ ...pageable.value, pageSize: 9999, as_code_list: [pageable.value.as_code], data_items: historyColumns, time_space: value1.value ? 1440 : 60, end_time: getStamp(dateRange.value[1]), begin_time: getStamp(dateRange.value[0]) });
 	timeArr.value = data.list?.map(item => {
 		return formatDate(item.data_time_i, 1)
 	})
@@ -269,6 +269,13 @@ const getHistoryList = async () => {
 		return item[309]
 	})
 	hourArr1.value = data.list?.map(item => {
+		if (item[312]!=='0.0'&&item[312]!=='/') {
+			return item[312]
+		} else if (item[302]!=='0.0'&&item[302]!=='/') {
+			return item[302]
+		} else {
+			return '0.0'
+		}
 		return item[312]
 	})
 	hourArr2.value = data.list?.map(item => {
@@ -313,7 +320,12 @@ const showData = () => {
 			trigger: 'axis',
 			axisPointer: {
 				type: 'shadow'
-			}
+			},
+			formatter: function (params) {
+            return [
+              "降水:" + [Number(params[0].value) ? Number(params[0].value) : "/"],
+            ].join("<br/>");
+          },
 		},
 		grid: {
 			left: '20',
@@ -348,7 +360,7 @@ const showData = () => {
 				type: 'bar',
 				barWidth: '50%',
 				color: '#88c1ff',
-				data: dayArr.value
+				data:value1.value? dayArr.value:hourArr1.value
 			}
 		]
 	};