daiht 4 周之前
父節點
當前提交
a9af60003a

+ 100 - 0
src/utils/dateTime.ts

@@ -0,0 +1,100 @@
+// 判断传入时间是否是今天
+export const isToday = (date) => {
+	const today = new Date();
+	const startOfDay = new Date(today.getFullYear(), today.getMonth(), today.getDate());
+	const endOfDay = new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1, 0, 0, 0, -1);
+	return new Date(date) >= startOfDay &&  new Date(date) <= endOfDay;
+};
+
+// 判断传入的时间间隔是否小于30分
+export function isWithinThirtyMinutes(time1, time2) {
+	// 定义一个辅助函数来解析时间字符串为 Date 对象  
+	function parseTime(timeStr) {
+		const [dateStr, timeStrPart] = timeStr.split(' ');
+		const [year, month, day] = dateStr.split('-').map(Number);
+		const [hours, minutes] = timeStrPart.split(':').map(Number);
+		return new Date(year, month - 1, day, hours, minutes); // 注意月份是从0开始的  
+	}
+
+	// 解析输入的时间字符串  
+	const date1 = parseTime(time1);
+	const date2 = parseTime(time2);
+
+	// 计算时间差(毫秒)  
+	const timeDifference = Math.abs(date2.getTime() - date1.getTime());
+
+
+	// 将时间差转换为分钟并检查是否小于三小时 
+	return timeDifference <= (180 * 60 * 1000); // 30分钟 * 60秒/分钟 * 1000毫秒/秒  
+};
+export function isWithin24Hours(time1, time2) {  
+	function parseTime(timeStr) {
+		const [dateStr, timeStrPart] = timeStr.split(' ');
+		const [year, month, day] = dateStr.split('-').map(Number);
+		const [hours, minutes] = timeStrPart.split(':').map(Number);
+		return new Date(year, month - 1, day, hours, minutes); // 注意月份是从0开始的  
+	}
+    const date1 = parseTime(time1);  
+    const date2 = parseTime(time2);  
+      
+    // 计算时间差(毫秒)  
+    const timeDifference = Math.abs(date2.getTime() - date1.getTime());
+
+      
+    // 将时间差转换为小时  
+    const hoursDifference = timeDifference / (1000 * 60 * 60);  
+      
+    // 检查是否小于或等于24小时  
+    return hoursDifference <= 24;  
+} 
+
+
+// 获取指定时间之前的时间戳
+export function getTimeStamp(type) {
+	const now = new Date();
+	let timestamp;
+
+	switch (type) {
+		case 0:
+			// 获取当前时间的时间戳  
+			timestamp = Math.floor(now.getTime() );
+			break;
+		case 1:
+			// 获取30分钟之前的时间戳  
+			now.setMinutes(now.getMinutes() - 180);
+			timestamp = Math.floor(now.getTime());
+			break;
+		case 2:
+			// 获取24小时之前的整点时间戳  
+			now.setHours(now.getHours() - 24, 0, 0, 0);
+			timestamp = Math.floor(now.getTime());
+			break;
+		case 3:
+			// 获取48小时之前的整点时间戳  
+			now.setHours(now.getHours() - 48, 0, 0, 0);
+			timestamp = Math.floor(now.getTime() );
+			break;
+		case 4:
+			// 获取现在的整点时间戳  
+			now.setMinutes(0, 0, 0);
+			timestamp = Math.floor(now.getTime());
+			break;
+		case 5:
+			// 获取30天之前的整点时间戳  
+			now.setDate(now.getDate() - 30);
+			timestamp = Math.floor(now.getTime());
+			break;
+		default:
+			throw new Error('Invalid type');
+	}
+
+	return timestamp;
+}
+
+// 获取传入时间秒的时间戳
+export function getStamp(time) {
+	const date = new Date(time);
+	return Math.floor(date.getTime() / 1000);
+}
+
+

+ 52 - 0
src/utils/index.ts

@@ -309,3 +309,55 @@ export function findItemNested(enumData: any, callValue: any, value: string, chi
     if (current[children]) return findItemNested(current[children], callValue, value, children);
   }, null);
 }
+
+// 日期格式化
+export function parseTime(time: any, pattern?: string, daysAgo?: number) {
+  if (arguments.length === 0 || !time) {
+    return null;
+  }
+  const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}';
+  let date;
+  if (typeof time === 'object') {
+    date = time;
+  } else {
+    if (typeof time === 'string' && /^[0-9]+$/.test(time)) {
+      time = parseInt(time);
+    } else if (typeof time === 'string') {
+      time = time
+        .replace(new RegExp(/-/gm), '/')
+        .replace('T', ' ')
+        .replace(new RegExp(/\.[\d]{3}/gm), '');
+    }
+    if (typeof time === 'number' && time.toString().length === 10) {
+      time = time * 1000;
+    }
+    date = new Date(time);
+  }
+
+  // 如果提供了 daysAgo 参数,则计算几天前的时间
+  if (daysAgo !== undefined && daysAgo !== null) {
+    const daysAgoDate = new Date(date.getTime() - daysAgo * 24 * 60 * 60 * 1000);
+    date = daysAgoDate;
+  }
+
+  const formatObj: { [key: string]: any } = {
+    y: date.getFullYear(),
+    m: date.getMonth() + 1,
+    d: date.getDate(),
+    h: date.getHours(),
+    i: date.getMinutes(),
+    s: date.getSeconds(),
+    a: date.getDay()
+  };
+  return format.replace(/{(y|m|d|h|i|s|a)+}/g, (result: string, key: string) => {
+    let value = formatObj[key];
+    // Note: getDay() returns 0 on Sunday
+    if (key === 'a') {
+      return ['日', '一', '二', '三', '四', '五', '六'][value];
+    }
+    if (result.length > 0 && value < 10) {
+      value = '0' + value;
+    }
+    return value || 0;
+  });
+};

+ 74 - 57
src/views/alarm/singleStationData/index.vue

@@ -43,15 +43,15 @@
 						<div class="mt15">
 							<div style="height: 200px;">
 
-								<div v-if="dataItemInfo && dataItemInfo[601] === '--' && dataItemInfo[602] === '--' && dataItemInfo[603] === '--' && dataItemInfo[604] === '--' && dataItemInfo[605] === '--'"
-									style="text-align: center;margin-bottom: 40px;padding-top: 10px;font-weight: bold;">
-									无明显天气现象</div>
-								<div class="wweatherBox" style="margin-bottom: 20px;padding-top: 10px;" v-else>
-									<div class="weatherItem" v-if="dataItemInfo && dataItemInfo[601] != '--'">{{
-										getYenSymbolLaterCharacters(dataItemInfo.data_list.find(item => item.data_id ==
-											601)?.remark) }}
+								<!-- <div v-if="dataItemInfo && dataItemInfo[601] === '--' && dataItemInfo[602] === '--' && dataItemInfo[603] === '--' && dataItemInfo[604] === '--' && dataItemInfo[605] === '--'" -->
+
+								<div class="wweatherBox" style="padding-top: 10px;"
+									v-if="dangerWeather && dangerWeather.length > 0"
+									:style="{ marginBottom: dangerWeather && dangerWeather.length <= 2 ? '40px' : '20px' }">
+									<div class="weatherItem" v-for="item in dangerWeather" :key="item.data_id">{{
+										getYenSymbolLaterCharacters(item.remark) }}
 									</div>
-									<div class="weatherItem" v-if="dataItemInfo && dataItemInfo[602] != '--'">{{
+									<!-- <div class="weatherItem" v-if="dataItemInfo && dataItemInfo[602] != '--'">{{
 										getYenSymbolLaterCharacters(dataItemInfo.data_list.find(item => item.data_id ==
 											602)?.remark) }}
 									</div>
@@ -66,9 +66,12 @@
 									<div class="weatherItem" v-if="dataItemInfo && dataItemInfo[605] != '--'">{{
 										getYenSymbolLaterCharacters(dataItemInfo.data_list.find(item => item.data_id ==
 											605)?.remark) }}
-									</div>
+									</div> -->
 
 								</div>
+								<div v-else
+									style="text-align: center;margin-bottom: 40px;padding-top: 10px;font-weight: bold;">
+									无明显天气现象</div>
 
 								<div style="font-weight: bold;">危险天气</div>
 								<div v-if="!weatherInfoArr || weatherInfoArr.length <= 0"
@@ -514,12 +517,13 @@ import { ref, computed, onMounted, reactive, watch, onDeactivated, onActivated }
 import { useGlobalStore } from "@/stores/modules/global";
 import { getDataItemList, getPlatformList, getRgDataList, getTacRecordList } from "@/api/modules/allData";
 import { Platform } from "@/api/interface";
+import { get } from 'sortablejs';
 const timeValue = ref(1);
 
 const queryInfo = ref(0)
 const pageable = ref({
 	data_type: true,
-	time_order: 0,
+	time_order: 1,
 	as_code: undefined,
 	data_items: [],
 	pageNum: 1,
@@ -916,28 +920,7 @@ let historyColumns = [
 		isSelected: true
 	},
 ]
-// 定义风级表  
-const windScale = [
-	{ start: 0.0, end: 0.2, level: 0 },
-	{ start: 0.3, end: 1.5, level: 1 },
-	{ start: 1.6, end: 3.3, level: 2 },
-	{ start: 3.4, end: 5.4, level: 3 },
-	{ start: 5.5, end: 7.9, level: 4 },
-	{ start: 8.0, end: 10.7, level: 5 },
-	{ start: 10.8, end: 13.8, level: 6 },
-	{ start: 13.9, end: 17.1, level: 7 },
-	{ start: 17.2, end: 20.7, level: 8 },
-	{ start: 20.8, end: 24.4, level: 9 },
-	{ start: 24.5, end: 28.4, level: 10 },
-	{ start: 28.5, end: 32.6, level: 11 },
-	{ start: 32.7, end: 36.9, level: 12 },
-	{ start: 37.0, end: 41.4, level: 13 },
-	{ start: 41.5, end: 46.1, level: 14 },
-	{ start: 46.2, end: 50.9, level: 15 },
-	{ start: 51.0, end: 56.0, level: 16 },
-	// 对于最后一个范围,我们可以使用Number.MAX_SAFE_INTEGER来表示DBL_MAX  
-	{ start: 56.1, end: Number.MAX_SAFE_INTEGER, level: 17 }
-];
+
 
 const dataTypeList = [
 	{
@@ -976,8 +959,30 @@ function findLabelByValue(noticeTypeList, value) {
 
 // 判断风级的方法  
 function getWindLevel(windSpeed) {
+	// 定义风级表  
+	const windScale = [
+		{ start: 0.0, end: 0.2, level: 0 },
+		{ start: 0.3, end: 1.5, level: 1 },
+		{ start: 1.6, end: 3.3, level: 2 },
+		{ start: 3.4, end: 5.4, level: 3 },
+		{ start: 5.5, end: 7.9, level: 4 },
+		{ start: 8.0, end: 10.7, level: 5 },
+		{ start: 10.8, end: 13.8, level: 6 },
+		{ start: 13.9, end: 17.1, level: 7 },
+		{ start: 17.2, end: 20.7, level: 8 },
+		{ start: 20.8, end: 24.4, level: 9 },
+		{ start: 24.5, end: 28.4, level: 10 },
+		{ start: 28.5, end: 32.6, level: 11 },
+		{ start: 32.7, end: 36.9, level: 12 },
+		{ start: 37.0, end: 41.4, level: 13 },
+		{ start: 41.5, end: 46.1, level: 14 },
+		{ start: 46.2, end: 50.9, level: 15 },
+		{ start: 51.0, end: 56.0, level: 16 },
+		// 对于最后一个范围,我们可以使用Number.MAX_SAFE_INTEGER来表示DBL_MAX  
+		{ start: 56.1, end: Number.MAX_SAFE_INTEGER, level: 17 }
+	];
 	for (let i = 0; i < windScale.length; i++) {
-		if (windSpeed >= windScale[i].start && (windSpeed < windScale[i].end || windSpeed === Number.MAX_SAFE_INTEGER)) {
+		if (Number(windSpeed) >= Number(windScale[i].start) && (Number(windSpeed) <= Number(windScale[i].end) || Number(windSpeed) === Number.MAX_SAFE_INTEGER)) {
 			return windScale[i].level;
 		}
 	}
@@ -1007,15 +1012,16 @@ const getPlatforms = async () => {
 	pageable.value.as_code = data.list[0].as_code
 	selectPlatform.value = data.list[0]
 	getList()
-	getHistoryList()
+	// getHistoryList()
 	weatherInfo()
 
 };
 
-const changeStation = () => {
+const changeStation = (e) => {
+	selectPlatform.value = platformList.value.find(item => item.as_code === e);
 	// pageable.value.as_code = selectPlatform.value.as_code
 	getList()
-	getHistoryList()
+	// getHistoryList()
 	weatherInfo()
 }
 const changeTime = () => {
@@ -1050,40 +1056,42 @@ function getYenSymbolLaterCharacters(inputString) {
 	}
 }
 // 获取指定时间戳之前的时间戳
-function getTimeStamp(type) {
-	const now = new Date();
-	let timestamp;
+function getTimeStamp(type, timestamp) {
+	let date = new Date(timestamp * 1000); // 将秒的时间戳转换为毫秒的时间戳
+	let now = date;
+
+	let timestampResult;
 
 	switch (type) {
 		case 0:
 			// 获取当前时间的时间戳  
-			timestamp = Math.floor(now.getTime() / 1000);
+			timestampResult = Math.floor(now.getTime() / 1000);
 			break;
 		case 1:
 			// 获取30分钟之前的时间戳  
 			now.setMinutes(now.getMinutes() - 30);
-			timestamp = Math.floor(now.getTime() / 1000);
+			timestampResult = Math.floor(now.getTime() / 1000);
 			break;
 		case 2:
 			// 获取24小时之前的整点时间戳  
 			now.setHours(now.getHours() - 24, 0, 0, 0);
-			timestamp = Math.floor(now.getTime() / 1000);
+			timestampResult = Math.floor(now.getTime() / 1000);
 			break;
 		case 3:
 			// 获取48小时之前的整点时间戳  
 			now.setHours(now.getHours() - 48, 0, 0, 0);
-			timestamp = Math.floor(now.getTime() / 1000);
+			timestampResult = Math.floor(now.getTime() / 1000);
 			break;
 		case 4:
 			// 获取现在的整点时间戳  
 			now.setMinutes(0, 0, 0);
-			timestamp = Math.floor(now.getTime() / 1000);
+			timestampResult = Math.floor(now.getTime() / 1000);
 			break;
 		default:
 			throw new Error('Invalid type');
 	}
 
-	return timestamp;
+	return timestampResult;
 }
 
 // 获取指定id的数组
@@ -1100,6 +1108,7 @@ const getAllRgDataList = async () => {
 };
 const dataItemInfo = ref()
 const selectElement = ref()
+const dangerWeather = ref()
 const getList = async () => {
 	const arr = [...customizeColumns.value, ...defaultColumns].reduce((acc, item) => {
 		if (!acc.some(existingItem => existingItem.data_id === item.data_id)) {
@@ -1108,7 +1117,10 @@ const getList = async () => {
 		return acc;
 	}, []);
 	const { data } = await getDataItemList({ ...pageable.value, as_code_list: [pageable.value.as_code], data_items: arr });
+	console.log(data, 555);
+
 	dataItemInfo.value = data.list[0]
+
 	showTemp()
 	showHumidity()
 	showPressure()
@@ -1116,7 +1128,13 @@ const getList = async () => {
 	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 = 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 = dataItemInfo.value.data_list
+		.filter(item => ids.includes(item.data_id) && item.data_value !== '--')
+		.map(item => item);
 
+		// .filter(item => ids.includes(item.data_id) && getYenSymbolLaterCharacters(item.remark) !== '无明显天气现象')
+	getHistoryList()
 };
 
 function adjustValue(value) {
@@ -1140,7 +1158,7 @@ const getHistoryList = async () => {
 		}
 		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), end_time: getTimeStamp(timeValue.value === 1 ? 0 : 4), 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)
 	})
@@ -1195,13 +1213,13 @@ const handleSetting = () => {
 	dialog.visible = true;
 }
 
-const submitForm = () => {
+const submitForm = async () => {
 	dialog.visible = false;
 	customizeColumns.value = [...copiedCustomizeColumns.value]
 	// updateColumns()
-	getList()
-	weatherInfo()
-	getHistoryList()
+	await getList()
+	await weatherInfo()
+	// await getHistoryList()
 	saveCustomizeColumns()
 }
 
@@ -1240,8 +1258,8 @@ const options = [{
 	value: 3,
 	label: '48小时'
 }]
-const currentValue = ref(20);
-const mincurrentValue = ref(2)
+const currentValue = ref(0);
+const mincurrentValue = ref(0)
 
 const gradientStyle = computed(() => {
 	return {
@@ -1682,16 +1700,15 @@ const showWindSpeed = () => {
 				detail: {
 					offsetCenter: [-12, 5],
 					valueAnimation: true,
-					formatter: getWindLevel(dataItemInfo.value[8]),
+					formatter: getWindLevel(dataItemInfo.value[8]).toString(),
 					// formatter:'2' ,
 					color: isDark.value ? '#fff' : "#000",
-
 					// 	fontSize: 10,
 				},
 				data: [
 					{
 						// value:270,
-						value: dataItemInfo.value[9] == 'C' ? 0 : dataItemInfo.value[9],
+						value: dataItemInfo.value[9] == 'C' ? 0 : Number(dataItemInfo.value[9]),
 						name: '级',
 						detail: {
 							fontSize: 40,
@@ -2306,7 +2323,7 @@ onMounted(() => {
 
 	// showTemp()
 	// showWind()
-	// showWindSpeed()
+	showWindSpeed()
 	// showHumidity()
 	// showPressure()
 	// showTempLine()
@@ -2333,7 +2350,7 @@ onActivated(() => {
 	intervalId = setInterval(() => {
 		getList();
 		weatherInfo()
-		getHistoryList()
+		// getHistoryList()
 	}, 60 * 1000);
 });
 

+ 128 - 53
src/views/analysis/dataSynthesis/index.vue

@@ -1,18 +1,31 @@
 <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"
-							: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="正点"
+					<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>
@@ -43,13 +56,106 @@
 <script setup lang="ts" name="dataSynthesis">
 import * as echarts from 'echarts';
 import { useRouter } from "vue-router";
+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}')]
+	}
+	getHistoryList()
+}
+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 pageable = ref({
 	data_type: true,
-	time_order: 0,
+	time_order: 1,
 	as_code: undefined,
 	data_items: [],
 	pageNum: 1,
@@ -119,9 +225,6 @@ const getPlatforms = async () => {
 const changeStation = () => {
 	getHistoryList()
 }
-const changeTime = () => {
-	getHistoryList()
-}
 
 //时间戳转换为指定格式的日期字符串
 function formatDate(timestamp, type) {
@@ -137,22 +240,16 @@ function formatDate(timestamp, type) {
 		return `${year}-${month}-${day} ${hours}:${minutes}`;
 	}
 }
-function adjustValue(value) {
-	if (value === 'C') {
-		return 0
-	} else if (value <= 180) {
-		return '-' + value;
-	} else {
-		return 360 - value;
-	}
-}
+
 
 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: searchParam.switch  ? 1 : 60 });
+	console.log( getStamp(dateRange.value[1]),555555);
+	
+	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]) });
 	timeArr.value = data.list?.map(item => {
 		return formatDate(item.data_time_i, 1)
 	})
@@ -165,32 +262,16 @@ const getHistoryList = async () => {
 	pressureLineArr.value = data.list?.map(item => {
 		return item[202]
 	})
-
 	showData()
-
 };
+
+
 const formRef = ref()
 const data = ref()
 
 const globalStore = useGlobalStore();
 const isDark = computed(() => globalStore.isDark);
 
-const router = useRouter();
-const searchParam = reactive({
-	base: undefined,
-	date: '',
-	switch: true
-
-})
-const baseOptions = ref([{
-	value: 0,
-	label: 'M1986',
-},
-{
-	value: 1,
-	label: 'M1987',
-}])
-
 // resetForm
 const resetForm = (formEl) => {
 	if (!formEl) return;
@@ -227,7 +308,7 @@ const showData = () => {
 					alignWithLabel: true
 				},
 				// prettier-ignore
-				data: ['06/11 16:00', '06/11 20:00', '06/12 00:00', '06/12 04:00', '06/12 08:00', '06/12 12:00', '06/12 16:00', '06/12 20:00', '06/13 00:00', '06/13 04:00', '06/13 08:00', '06/13 12:00']
+				data: timeArr.value
 			}
 		],
 		yAxis: [
@@ -266,7 +347,7 @@ const showData = () => {
 				type: 'value',
 				name: '本站气压',
 
-				min: 400,
+				min: 600,
 				max: 1080,
 				position: 'left',
 				axisLine: {
@@ -287,25 +368,21 @@ const showData = () => {
 				smooth: true, // 添加此行
 				type: 'line',
 
-				data: [
-					28, 29, 29, 29, 30, 31, 32, 33, 34, 33, 32, 30
-				]
+				data: tempLineArr.value
 			},
 			{
 				name: '相对湿度',
 				type: 'line',
 				smooth: true, // 添加此行
 				yAxisIndex: 1,
-				data: [
-					99, 79, 67, 69, 73, 75, 78, 79, 67, 69, 73, 75,
-				]
+				data: humidityLineArr.value
 			},
 			{
 				name: '本站气压',
 				type: 'line',
 				smooth: true, // 添加此行
 				yAxisIndex: 2,
-				data: [1001, 1003, 1002, 1001, 1004, 1005, 1001, 1003, 1002, 1001, 1004, 1005,]
+				data: pressureLineArr.value
 			}
 		]
 	};
@@ -320,16 +397,14 @@ watch(isDark, () => {
 
 
 });
-onMounted(() => {
-	showData()
-
 
+onMounted(() => {
+	getPlatforms()
+	// showData()
 })
 
 </script>
 <style scoped lang="scss">
-
-
 .main_list {
 	background: transparent !important;
 	box-shadow: none !important;

+ 569 - 36
src/views/analysis/featureCurves/index.vue

@@ -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">

+ 321 - 95
src/views/analysis/lightningArea/index.vue

@@ -1,16 +1,32 @@
 <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"
-							: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" >
-					<el-date-picker v-model="searchParam.date" type="daterange" range-separator="至"
-						start-placeholder="开始时间" end-placeholder="结束时间"  style="width: 300px" />
+				<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="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>
 					<div>
@@ -40,31 +56,220 @@
 <script setup lang="ts" name="dataSynthesis">
 import * as echarts from 'echarts';
 
-import { ref, reactive, onMounted,computed,watch } from "vue";
-import { useRouter } from "vue-router";
+import { ElMessage } from "element-plus";
 import { useGlobalStore } from "@/stores/modules/global";
-const globalStore = useGlobalStore();
-const isDark = computed(() => globalStore.isDark);
+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()
 
-const formRef = ref()
-const data = ref()
+		} else {
+			ElMessage.error("分钟模式下时间间隔不能大于3小时");
+		}
+	} else {
+		await handleDateRangeChange(e)
+		getHistoryList()
 
 
-const router = useRouter();
-const searchParam = reactive({
-	base: undefined,
-	date: ''
+	}
+}
+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 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 baseOptions = ref([{
-	value: 0,
-	label: 'M1986',
-},
-{
-	value: 1,
-	label: 'M1987',
-}])
+
+
+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()
+}
+
+//时间戳转换为指定格式的日期字符串
+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]
+	})
+	showData()
+};
+
+
+const formRef = ref()
+const data = ref()
+
+const globalStore = useGlobalStore();
+const isDark = computed(() => globalStore.isDark);
 
 // resetForm
 const resetForm = (formEl) => {
@@ -73,80 +278,101 @@ const resetForm = (formEl) => {
 };
 
 const showData = () => {
+	// 初始化一个空数组来存储生成的对象  
+	let resultArray = [];
+
+	// 初始化起始角度和结束角度  
+	let startAngle = 360;
+	let endAngle = 0; // 注意,这个值实际上是开区间 (0, 360] 的起点前一个值,所以设置为0 - 0.5的极限情况  
+	let step = -0.5;
+
+	// 循环生成对象  
+	for (let angle = startAngle; angle > endAngle; angle += step) {
+		let obj = {
+			name: (angle === 360 || angle % 45 === 0) ? angle.toFixed(1) + '°' : '',
+			max: 200,
+			axisLabel: angle === 360 ? {
+				show: angle === 360,
+				formatter: '{value}km', color: "#000", showMinLabel: false
+			} : {},
+			axisLine: {
+				show: angle === 360 || angle % 22.5 === 0
+			}
+		};
+		resultArray.push(obj);
+	}
 
 	let mychart = echarts.init(data.value);
 	let option = {
+		radar: {
+			shape: 'circle',
+			// radius: 320, // 大小
 
 
-  radar: {
-    shape: 'circle',
-	// radius: 320, // 大小
-    
-    
-    name: { // (圆外的标签)雷达图每个指示器名称的配置项。
-            formatter: '{value}',
-            textStyle: {
-                fontSize: 15,
-                color: isDark.value ? '#fff' : "#000"
-            }
-        },
-        nameGap: 5,
-        // 指示器名称和指示器轴的距离。[ default: 15 ]
-        splitNumber: 5,
-        splitLine: { // (这里是指所有圆环)坐标轴在 grid 区域中的分隔线。
-            lineStyle: {
-                color: '#bbbbbb',
-                // 分隔线颜色
-                width: 1,
-                // 分隔线线宽
-            }
-        },
-        splitArea: { // 坐标轴在 grid 区域中的分隔区域,默认不显示。
-            show: true,
-            areaStyle: { // 分隔区域的样式设置。
-                color: [isDark.value ? '#000' : "#fff",isDark.value ? '#000' : "#fff"],
-                // 分隔区域颜色。分隔区域会按数组中颜色的顺序依次循环设置颜色。默认是一个深浅的间隔色。
-            }
-        },
-    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: '',  },
-    ]
-  },
-  series: [
-    {
-      name: 'Budget vs spending',
-      type: 'radar',
-      
-      data: [
-        {
-          value: [20],
-          name: 'Allocated Budget',
-           itemStyle: { // 单个拐点标志的样式设置。
-                normal: {
-                    // color:'#d1d6dd'
-                }
-            },
-        },
-        
-      ]
-    }
-  ]
-};
+			name: { // (圆外的标签)雷达图每个指示器名称的配置项。
+				formatter: '{value}',
+				textStyle: {
+					fontSize: 15,
+					color: isDark.value ? '#fff' : "#000"
+				}
+			},
+			nameGap: 5,
+			// 指示器名称和指示器轴的距离。[ default: 15 ]
+			splitNumber: 5,
+			splitLine: { // (这里是指所有圆环)坐标轴在 grid 区域中的分隔线。
+				lineStyle: {
+					color: '#bbbbbb',
+					// 分隔线颜色
+					width: 1,
+					// 分隔线线宽
+				}
+			},
+			splitArea: { // 坐标轴在 grid 区域中的分隔区域,默认不显示。
+				show: true,
+				areaStyle: { // 分隔区域的样式设置。
+					color: [isDark.value ? '#000' : "#fff", isDark.value ? '#000' : "#fff"],
+					// 分隔区域颜色。分隔区域会按数组中颜色的顺序依次循环设置颜色。默认是一个深浅的间隔色。
+				}
+			},
+			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: '', },
+			]
+		},
+		series: [
+			{
+				name: 'Budget vs spending',
+				type: 'radar',
+
+				data: [
+					{
+						value: [20],
+						name: 'Allocated Budget',
+						itemStyle: { // 单个拐点标志的样式设置。
+							normal: {
+								// color:'#d1d6dd'
+							}
+						},
+					},
+
+				]
+			}
+		]
+	};
 	mychart.setOption(option)
 	window.addEventListener("resize", function () {
 		mychart.resize();
@@ -157,7 +383,7 @@ watch(isDark, () => {
 	showData()
 });
 onMounted(() => {
-	showData()
+	getPlatforms()
 })
 
 </script>

+ 246 - 33
src/views/analysis/rainfall/index.vue

@@ -1,20 +1,32 @@
 <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"
-							: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">
-					<el-switch v-model="searchParam.switch" class="ml-2" inline-prompt active-text="日"
-						inactive-text="小时" />
-				</el-form-item>
 				<el-form-item label="观测时间:" prop="base">
-					<el-date-picker v-model="searchParam.date" type="daterange" range-separator="至"
-						start-placeholder="开始时间" end-placeholder="结束时间" style="width: 300px" />
+					<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="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>
 					<div>
@@ -29,7 +41,7 @@
 				<el-col :span="24">
 					<div class="chart_item zhuti">
 						<div style="font-weight: bold;" class="item_title">
-							<span v-if="searchParam.switch">日降水量(mm)</span>
+							<span v-if="value1">日降水量(mm)</span>
 							<span v-else>小时累计降水量 (称重)(mm)</span>
 						</div>
 						<div class="mt5">
@@ -45,33 +57,232 @@
 <script setup lang="ts" name="dataSynthesis">
 import * as echarts from 'echarts';
 
-import { ref, reactive, onMounted,computed,watch } from "vue";
-import { useRouter } from "vue-router";
-// import { useGlobalStore } from "@/stores/modules/global";
-// const globalStore = useGlobalStore();
-// const isDark = computed(() => globalStore.isDark);
+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,isWithin24Hours } from "@/utils/dateTime";
+const value1 = ref(true)
+const dateRange = ref<[any, any]>([parseTime(new Date(getTimeStamp(5)), '{y}-{m}-{d}') + ' 00:00', parseTime(new Date(), '{y}-{m}-{d} {h}:{i}')]);
+const changetype = (e) => {
+	if (!e) {
+		dateRange.value = [parseTime(getTimeStamp(2), '{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 (isWithin24Hours(e[0], e[1])) {
+			// 获取参数
+			getHistoryList()
 
-const formRef = ref()
-const data = ref()
+		} else {
+			ElMessage.error("小时模式下时间间隔不能大于24小时");
+		}
+	} 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 router = useRouter();
-const searchParam = reactive({
-	base: undefined,
-	date: '',
-	switch: true,
+
+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 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
+	},
+	{
+		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 queryas = ref<Platform>({
+	pageSize: 50,
+	pageNum: 1,
+	currentpage: 1
 })
-const baseOptions = ref([{
-	value: 0,
-	label: 'M1986',
-},
-{
-	value: 1,
-	label: 'M1987',
-}])
+
+
+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()
+}
+
+//时间戳转换为指定格式的日期字符串
+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]
+	})
+	showData()
+};
+
+
+const formRef = ref()
+const data = ref()
+
+const globalStore = useGlobalStore();
+const isDark = computed(() => globalStore.isDark);
 
 // resetForm
 const resetForm = (formEl) => {
@@ -111,7 +322,8 @@ const showData = () => {
 		],
 		yAxis: [
 			{
-				type: 'value'
+				type: 'value',
+				boundaryGap: [0, '20%']
 			}
 		],
 		series: [
@@ -136,7 +348,8 @@ const showData = () => {
 
 // });
 onMounted(() => {
-	showData()
+	// showData()
+	getPlatforms()
 
 
 })

+ 133 - 23
src/views/analysis/windSpeed/index.vue

@@ -1,15 +1,21 @@
 <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"
-							: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">
-					<el-date-picker v-model="searchParam.date" type="daterange" range-separator="至"
+					<el-date-picker v-model="dateRange" type="daterange" range-separator="至"
 						start-placeholder="开始时间" end-placeholder="结束时间" style="width: 300px" />
 				</el-form-item>
 				<el-form-item>
@@ -40,31 +46,134 @@
 <script setup lang="ts" name="dataSynthesis">
 import * as echarts from 'echarts';
 
-import { ref, reactive, onMounted,computed,watch } from "vue";
-import { useRouter } from "vue-router";
+import { ElMessage } from "element-plus";
 import { useGlobalStore } from "@/stores/modules/global";
-const globalStore = useGlobalStore();
-const isDark = computed(() => globalStore.isDark);
+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 dateRange = ref<[any, any]>([parseTime(new Date(), '{y}-{m}-{d}') + ' 00:00', parseTime(new Date(), '{y}-{m}-{d} {h}:{i}')]);
 
-const formRef = ref()
-const data = ref()
 
 
-const router = useRouter();
-const searchParam = reactive({
-	base: undefined,
-	date: ''
+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 baseOptions = ref([{
-	value: 0,
-	label: 'M1986',
-},
-{
-	value: 1,
-	label: 'M1987',
-}])
+
+
+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()
+}
+
+//时间戳转换为指定格式的日期字符串
+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:60, 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]
+	})
+	showData()
+};
+
+
+const formRef = ref()
+const data = ref()
+
+const globalStore = useGlobalStore();
+const isDark = computed(() => globalStore.isDark);
 
 // resetForm
 const resetForm = (formEl) => {
@@ -162,6 +271,7 @@ watch(isDark, () => {
 	showData()
 });
 onMounted(() => {
+	getPlatforms()
 	showData()
 })