cxs 3 долоо хоног өмнө
parent
commit
016e55792d

+ 6 - 0
src/api/modules/allData.ts

@@ -41,3 +41,9 @@ export const getYallSensorList = () => {
 export const getStaitemList = (params:{}) => {
   return http.post<ResPage<any>>(PORT1 + `/querystaitem`,params);
 };
+
+
+//查询所有自动站部件字典
+export const getQuerCertList = (params:{}) => {
+  return http.post<ResPage<any>>(PORT1 + `/queryascalinfolist`,params);
+};

+ 32 - 1
src/views/alarm/allData/index.vue

@@ -215,9 +215,40 @@ const cancel = () => {
 
 const handleSortChange = ({ column, prop, order }) =>{
   // 在这里发送请求到服务器端进行远程排序
+  // ORDER_DESC,desc排序0
+  // ORDER_ASC, //asc排序1
   console.log('column:', column)
   console.log('prop:', prop)
   console.log('order:', order)
+
+ if (order === null||order === 'descending') {
+    if (prop === 'data_time_i') {
+      pageable.value.time_order = 0; // 降序
+    }
+    if (pageable.value.data_items && pageable.value.data_items.length > 0) {
+      pageable.value.data_items.forEach(item => {
+        if (item.data_id === prop) {
+          item.data_order = 0; // 降序
+        } else {
+          item.data_order = 0; // 确保其他项为0
+        }
+      });
+    }
+  }else if (order === 'ascending') {
+   if (prop === 'data_time_i') {
+     pageable.value.time_order = 1; // 升序
+   }
+   if (pageable.value.data_items && pageable.value.data_items.length > 0) {
+     pageable.value.data_items.forEach(item => {
+       if (item.data_id === prop) {
+         item.data_order = 1; // 升序
+       } else {
+         item.data_order = 0; // 确保其他项为0
+       }
+     });
+   }
+ }
+  getList();
 }
 
 
@@ -468,7 +499,7 @@ const updateColumns = () => {
   const column = [
     { prop: "as_name", label: "站名", width: 100 },
     { prop: "as_code", label: "站号", width: 100 },
-    { prop: "data_time_i", label: "观测时间", width: 170 }
+    { prop: "data_time_i", label: "观测时间", width: 170, sortable: true }
   ];
 
   const newColumns = customizeColumns.value.map(item => ({

+ 24 - 0
src/views/alarm/allWeather/index.vue

@@ -169,6 +169,30 @@ const handleSortChange = ({ column, prop, order }) =>{
   console.log('column:', column)
   console.log('prop:', prop)
   console.log('order:', order)
+
+
+  if (order === null||order === 'descending') {
+    if (pageable.value.data_items && pageable.value.data_items.length > 0) {
+      pageable.value.data_items.forEach(item => {
+        if (item.data_id === prop) {
+          item.data_order = 0; // 降序
+        } else {
+          item.data_order = 0; // 确保其他项为0
+        }
+      });
+    }
+  }else if (order === 'ascending') {
+    if (pageable.value.data_items && pageable.value.data_items.length > 0) {
+      pageable.value.data_items.forEach(item => {
+        if (item.data_id === prop) {
+          item.data_order = 1; // 升序
+        } else {
+          item.data_order = 0; // 确保其他项为0
+        }
+      });
+    }
+  }
+  getList();
 }
 
 

+ 27 - 4
src/views/alarm/singleDevice/index.vue

@@ -129,7 +129,7 @@ import img1400 from "@/assets/images/single/1400.png"
 import img1500 from "@/assets/images/single/1500.png"
 import img1600 from "@/assets/images/single/1600.png"
 import img1700 from "@/assets/images/single/1700.png"
-import { getPlatformList, getStaitemList, getYallSensorList} from "@/api/modules/allData";
+import {getPlatformList, getQuerCertList, getStaitemList, getYallSensorList} from "@/api/modules/allData";
 import {onMounted, reactive, ref} from "vue";
 import {Platform} from "@/api/interface";
 const getCustomImg = (iconName: string) => {
@@ -178,9 +178,19 @@ const certData = ref([]);
 const findRemainingDays = (inputSeType) => {
   const selectedCert = certData.value.find(cert => cert.se_type === parseInt(inputSeType));
   if (selectedCert) {
-    const currentTime = Math.floor(Date.now() / 1000);
-    const remainingSeconds = selectedCert.cal_date_i - currentTime;
-    return Math.ceil(remainingSeconds / (60 * 60 * 24))+'天';
+    // 将 cal_date_i 转换为毫秒
+    const startTime = selectedCert.cal_date_i * 1000;
+    // 创建 Date 对象
+    const startDate = new Date(startTime);
+    // 计算结束日期
+    const endDate = new Date(startDate);
+    endDate.setMonth(endDate.getMonth() + selectedCert.cal_period);
+    // 获取当前时间
+    const currentDate = new Date();
+    // 计算剩余天数
+    const timeDifference = endDate - currentDate;
+    const daysRemaining = Math.ceil(timeDifference / (1000 * 60 * 60 * 24))+'天';
+    return daysRemaining;
   } else {
     return '--'
   }
@@ -299,6 +309,17 @@ const getSensorList = async () => {
   sensorList.value = data.list
 };
 
+const querCert = ref<any>({
+  pageSize: 1000,
+  pageNum: 1,
+  asCode: undefined
+})
+const getCertList= async ()=>{
+  const { data } = await getQuerCertList(querCert.value);
+  certData.value = data.list
+}
+
+
 const getLabelByValue = (value) => {
   const item = deviceType.find(device => device.value === value);
   return item ? item.label : '--';
@@ -354,7 +375,9 @@ const changeCodeList =(value)=>{
   if(value){
     selectedItem.value = platformList.value.find(item => item.as_code === value);
     pageable.value.as_code_list = [value]
+    querCert.value.asCode = value
     getList()
+    getCertList()
   }else {
     selectedItem.value= {}
     pageable.value.as_code_list= []

+ 2 - 1
src/views/query/deviceHealth/index.vue

@@ -323,7 +323,7 @@ const changeTime =(time)=> {
 
   const startTime2 = new Date(start).getTime();
   const endTime2= new Date(end).getTime();
-  if (points) {
+  if (points.value) {
     //0点
     const startTime = startTime2 + 60 * 1000; // 添加1分钟(60秒)
     const endTime = endTime2 + 24 * 60 * 60 * 1000; // 添加一天(24小时)
@@ -545,6 +545,7 @@ const handleSortChange = ({ column, prop, order }) =>{
   console.log('column:', column)
   console.log('prop:', prop)
   console.log('order:', order)
+
 }
 
 

+ 23 - 0
src/views/query/hazardousWeather/index.vue

@@ -204,6 +204,29 @@ const handleSortChange = ({ column, prop, order }) =>{
   console.log('column:', column)
   console.log('prop:', prop)
   console.log('order:', order)
+
+  if (order === null||order === 'descending') {
+    if (pageable.value.data_items && pageable.value.data_items.length > 0) {
+      pageable.value.data_items.forEach(item => {
+        if (item.data_id === prop) {
+          item.data_order = 0; // 降序
+        } else {
+          item.data_order = 0; // 确保其他项为0
+        }
+      });
+    }
+  }else if (order === 'ascending') {
+    if (pageable.value.data_items && pageable.value.data_items.length > 0) {
+      pageable.value.data_items.forEach(item => {
+        if (item.data_id === prop) {
+          item.data_order = 1; // 升序
+        } else {
+          item.data_order = 0; // 确保其他项为0
+        }
+      });
+    }
+  }
+  getList();
 }
 
 

+ 43 - 7
src/views/query/queryObservationData/index.vue

@@ -321,6 +321,36 @@ const handleSortChange = ({ column, prop, order }) =>{
   console.log('column:', column)
   console.log('prop:', prop)
   console.log('order:', order)
+
+
+  if (order === null||order === 'descending') {
+    if (prop === 'data_time_i') {
+      pageable.value.time_order = 0; // 降序
+    }
+    if (pageable.value.data_items && pageable.value.data_items.length > 0) {
+      pageable.value.data_items.forEach(item => {
+        if (item.data_id === prop) {
+          item.data_order = 0; // 降序
+        } else {
+          item.data_order = 0; // 确保其他项为0
+        }
+      });
+    }
+  }else if (order === 'ascending') {
+    if (prop === 'data_time_i') {
+      pageable.value.time_order = 1; // 升序
+    }
+    if (pageable.value.data_items && pageable.value.data_items.length > 0) {
+      pageable.value.data_items.forEach(item => {
+        if (item.data_id === prop) {
+          item.data_order = 1; // 升序
+        } else {
+          item.data_order = 0; // 确保其他项为0
+        }
+      });
+    }
+  }
+  getList();
 }
 
 const timeSpaceList= [
@@ -455,14 +485,20 @@ const changeTime =(time)=>{
     pageable.value.end_time = endTime/1000
   }else {
     //18点
-    const startTimeStamp = timeStamp + 18 * 60 * 60 * 1000 + 60 * 1000;// 添加18小时和1分钟(18*60*60秒+60秒)
+    // 前一天的18:01:00
+    const previousDay = new Date(time);
+    previousDay.setDate(previousDay.getDate() - 1); // 设置为前一天
+    previousDay.setHours(18, 1, 0, 0); // 设置时间为18:01:00
+    const startTimeStamp = previousDay.getTime(); // 获取前一天18:01:00的时间戳
+
+    // 当天的18:00:00
     const nextDay = new Date(time);
-    nextDay.setDate(nextDay.getDate() + 1); // 设置为第二天
     nextDay.setHours(18, 0, 0, 0); // 设置时间为18:00:00
-    const endTimeStamp = nextDay.getTime(); // 获取第二天18:00:00的时间戳
-    console.log(startTimeStamp)
-    pageable.value.begin_time = startTimeStamp/1000
-    pageable.value.end_time = endTimeStamp/1000
+    const endTimeStamp = nextDay.getTime(); // 获取当天18:00:00的时间戳
+
+    console.log(startTimeStamp);
+    pageable.value.begin_time = startTimeStamp / 1000;
+    pageable.value.end_time = endTimeStamp / 1000;
   }
 
 
@@ -692,7 +728,7 @@ const updateColumns = () => {
   const column = [
     { prop: "as_name", label: "站名", width: 100 },
     { prop: "as_code", label: "站号", width: 100 },
-    { prop: "data_time_i", label: "观测时间", width: 170 }
+    { prop: "data_time_i", label: "观测时间", width: 170,sortable: true }
   ];
 
   const newColumns = customizeColumns.value.map(item => ({