Procházet zdrojové kódy

修改首次进入加入cache

chenbaoxin před 3 měsíci
rodič
revize
84e7270d04
1 změnil soubory, kde provedl 19 přidání a 4 odebrání
  1. 19 4
      src/views/HealthStatusAnalysis/mock.vue

+ 19 - 4
src/views/HealthStatusAnalysis/mock.vue

@@ -599,7 +599,7 @@ const getQueryDataRangeSpeed = async () => {
     count:Number(valueObj.batch_size),
     time:Number(valueObj.interval)
    }
-   mockStart()
+   mockStart(true)
 };
 onMounted(async () => {
   getcateData();
@@ -715,7 +715,7 @@ const setParamsHl = (start: string, end: string) => {
   ];
   setConditionTime({"min_time":hlQueryParams.value.eDate[0],"max_time":hlQueryParams.value.eDate[1]})
 };
-const mockStart = () => {
+const mockStart = async (state:boolean=false) => {
   if (queryParamsMock.value.time > 60) {
     ElMessage({
       message: `最大不超过60s`,
@@ -730,7 +730,19 @@ const mockStart = () => {
     });
     return false;
   }
-  lineParamsAllRef.value = [];
+  // mounted进来使用缓存接口数据
+  if (state) {
+    let resultCatch= await mockCacheData({})
+    lineParamsAllRef.value = resultCatch.data.map((its:any) => {
+      return {
+        data: its,
+      };
+    });
+    // debugger
+  }else{
+
+    lineParamsAllRef.value = [];
+  }
   seriesData.value = [
     {
       name: "趋势",
@@ -746,7 +758,8 @@ const mockStart = () => {
     start: queryParamsMock.value.sDate,
     end: queryParamsMock.value.eDate,
   });
-  updateDataRangeSpeed({
+  if (!state) {
+    updateDataRangeSpeed({
     start_time: moment(queryParamsMock.value.sDate).format(
       "YYYY-MM-DD HH:mm:ss"
     ),
@@ -759,6 +772,8 @@ const mockStart = () => {
       type: "success",
     });
   });
+  }
+  
 };
 let cateBigRef = ref([]);
 let cateSmallRef = ref([]);