Просмотр исходного кода

处理数据分析时间选择区域

liujiejie 6 месяцев назад
Родитель
Сommit
f3848c280a
3 измененных файлов с 67 добавлено и 17 удалено
  1. 9 1
      src/api/performance.js
  2. 53 11
      src/views/performance/components/analysisEvent.vue
  3. 5 5
      vue.config.js

+ 9 - 1
src/api/performance.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2024-06-03 09:29:50
- * @LastEditTime: 2025-01-14 10:36:54
+ * @LastEditTime: 2025-01-20 18:58:23
  * @LastEditors: bogon
  * @Description: In User Settings Edit
  * @FilePath: /performance-test/src/api/performance。.js
@@ -15,6 +15,14 @@ export function queryAnalysisTypeConfig(data) {
     params: data,
   });
 }
+// // /dataTransfer/getTimeRange
+// export function getTimeRange(data) {
+//   return request({
+//     url: "/dataTransfer/getTimeRange",
+//     method: "post",
+//     data,
+//   });
+// }
 //转换数据时间
 export function queryDataTime(data) {
   return request({

+ 53 - 11
src/views/performance/components/analysisEvent.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2024-05-29 09:13:51
- * @LastEditTime: 2025-01-20 16:47:46
+ * @LastEditTime: 2025-01-21 09:10:16
  * @LastEditors: bogon
  * @Description: In User Settings Edit
  * @FilePath: /performance-test/src/views/performance/components/analysisEvent.vue
@@ -673,7 +673,7 @@ import {
   getWindEngineGroupRatedListByFieldCodePage,
 } from "@/api/ledger";
 import Map from "./map.vue";
-
+import axios from "axios";
 export default {
   components: {
     Map,
@@ -696,9 +696,9 @@ export default {
       picker: [],
       dataMinTime: null,
       dataMaxTime: null,
-      pickerOptions: {
-        disabledDate: this.disabledDate,
-      },
+      // pickerOptions: {
+      //   disabledDate: this.disabledDate,
+      // },
       loading: false,
       form: {
         configAnalysis: null, //分析类型
@@ -743,8 +743,21 @@ export default {
       windEngineGroupList: [],
       windDetail: {},
       transferTypeData: [],
+      // 时间范围数组
+      timeRanges: [
+        // { start: '2024-12-01 00:00:00', end: '2024-12-30 23:59:59' },
+        // { start: '2024-10-01 00:00:00', end: '2024-10-30 23:59:59' },
+        // { start: '2024-05-01 00:00:00', end: '2024-05-30 23:59:59' },
+      ],
     };
   },
+  computed: {
+    pickerOptions() {
+      return {
+        disabledDate: this.disabledDate,
+      };
+    },
+  },
   watch: {
     activeName: {
       handler(newVal, oldVal) {
@@ -759,9 +772,26 @@ export default {
     this.getFengjiList();
     queryAllTypeScada().then((res) => {
       this.transferTypeData = res.data;
+      this.getTimeList();
     });
   },
   methods: {
+    getTimeList() {
+      axios
+        .post("/transDataWeb/dataTransfer/getTimeRange", {
+          transferType: this.form.scada,
+          windFarmCode: this.$route.query.fieldEngineCode,
+        })
+        .then((res) => {
+          console.log(res, "jieguo ");
+          if (res.data.code === 200) {
+            this.timeRanges = res.data.datas;
+            console.log(this.timeRanges, "this.timeRanges");
+            // this.formData = { ...res.data.datas };
+          }
+        })
+        .catch((error) => {});
+    },
     getFengjiList() {
       getWindEngineGroupRatedListByFieldCodePage({
         fieldCode: this.$route.query.fieldEngineCode,
@@ -777,18 +807,30 @@ export default {
       this.formInline.pageNum = val;
       this.getFengjiList();
     },
+    // disabledDate(time) {
+    //   if (!this.dataMinTime || !this.dataMaxTime) {
+    //     return false;
+    //   }
+    //   const minTime = new Date(this.dataMinTime).getTime();
+    //   const maxTime = new Date(this.dataMaxTime).getTime();
+    //   return time.getTime() < minTime || time.getTime() > maxTime;
+    // },
+    // 禁用日期函数
     disabledDate(time) {
-      if (!this.dataMinTime || !this.dataMaxTime) {
-        return false;
-      }
-      const minTime = new Date(this.dataMinTime).getTime();
-      const maxTime = new Date(this.dataMaxTime).getTime();
-      return time.getTime() < minTime || time.getTime() > maxTime;
+      const timeInMs = time.getTime();
+      // 判断日期是否在任意一个时间范围内
+      const isDisabled = !this.timeRanges.some((range) => {
+        const start = new Date(range.startTime).getTime();
+        const end = new Date(range.endTime).getTime();
+        return timeInMs >= start && timeInMs <= end;
+      });
+      return isDisabled;
     },
     handleScada() {
       this.getQueryDataTime();
     },
     handleScada() {
+      this.getTimeList();
       this.getQueryDataTime();
     },
     async getQueryDataTime() {

+ 5 - 5
vue.config.js

@@ -66,8 +66,8 @@ module.exports = {
         // target: "http://192.168.5.4:16200", // 石月
         // target: "http://192.168.50.235:16200", // 内网
         // target: "http://192.168.5.15:16200",
-        // target: "http://192.168.50.235:16500", //演示环境
-        target: "http://106.120.102.238:26500", //外网演示环境
+        target: "http://192.168.50.235:16500", //演示环境
+        // target: "http://106.120.102.238:26500", //外网演示环境
         // target: "http://106.120.102.238:16700", // 外网16700  生产16600
         // target: "http://10.96.137.5",
         changeOrigin: true,
@@ -88,9 +88,8 @@ module.exports = {
         // target: "http://192.168.50.241:9001", // WZLapi 目标地址
         // target: "http://192.168.5.11:8001", // WZLapi 目标地址
         // target: "http://106.120.102.238:18080/ImportDataDev", //导数工具
-        // target: "http://106.120.102.238:18080/WindTransDev", //WTL外网目标地址  
+        // target: "http://106.120.102.238:18080/WindTransDev", //WTL外网目标地址
         target: "http://106.120.102.238:28999/transDataWeb", //WTL演示环境
-   
 
         changeOrigin: true,
         pathRewrite: {
@@ -117,7 +116,8 @@ module.exports = {
       // 数据转换亮亮
       "/transDataWeb": {
         // target: "http://192.168.50.241:9000/trans_data_web",//生产
-        target: "http://192.168.50.235/transDataWeb", //测试
+        // target: "http://192.168.50.235/transDataWeb", //测试
+        target: "http://192.168.50.235:8999/transDataWeb", //测试
         changeOrigin: true,
         pathRewrite: {
           "^/transDataWeb": "", // 去掉 /transDataWeb 前缀