Browse Source

修改首页sockets

chenbaoxin 3 months ago
parent
commit
d019356e80
2 changed files with 21 additions and 14 deletions
  1. 8 2
      src/views/FileManagement/index.vue
  2. 13 12
      src/views/HealthStatusAnalysis/mock.vue

+ 8 - 2
src/views/FileManagement/index.vue

@@ -252,7 +252,7 @@
 </template>
 
 <script lang="ts" setup>
-import { ref, computed, getCurrentInstance, onMounted } from "vue";
+import { ref, computed, getCurrentInstance ,onUnmounted,onMounted } from "vue";
 import { ElMessage, ElMessageBox } from "element-plus";
 import sTitle from "@/components/StructTitle/index.vue";
 import cTree from "@/components/Tree/index.vue";
@@ -302,13 +302,19 @@ const getMockTotal = () => {
     };
   });
 };
+let interVal:any=null
 onMounted(() => {
   getMockTotal();
 
-  setInterval(()=>{
+ interVal= setInterval(()=>{
     fetchData()
   },3000)
 });
+onUnmounted(() => {
+  // debugger
+  clearInterval(interVal)
+  // interVal=undefined
+});
 const fetchDataFunction = async (
   page: number,
   pageSize: number

+ 13 - 12
src/views/HealthStatusAnalysis/mock.vue

@@ -30,7 +30,7 @@
             placeholder=""
           >
           </el-date-picker>
-          &emsp; &emsp; &emsp; &emsp; &emsp; 速度控制:&emsp;<el-input
+         &emsp; &emsp; &emsp; 速度控制:&emsp;<el-input
             style="width: 80px"
             max="60"
             min="1"
@@ -575,14 +575,14 @@ const queryParamsMock = ref({
   sDate: null,
   count: 1,
 });
-watch(
-  () => queryParamsMock.value.sDate,
-  (newSDate) => {
-    if (newSDate) {
-      queryParamsMock.value.eDate = moment(newSDate).add(1, "hour").toDate();
-    }
-  }
-);
+// watch(
+//   () => queryParamsMock.value.sDate,
+//   (newSDate) => {
+//     if (newSDate) {
+//       queryParamsMock.value.eDate = moment(newSDate).add(1, "hour").toDate();
+//     }
+//   }
+// );
 const { proxy } = getCurrentInstance()!;
 let gridData = ref(null);
 const getHStatus = async () => {
@@ -599,6 +599,7 @@ const getQueryDataRangeSpeed = async () => {
     count:Number(valueObj.batch_size),
     time:Number(valueObj.interval)
    }
+   mockStart()
 };
 onMounted(async () => {
   getcateData();
@@ -1352,7 +1353,7 @@ const healthColor = (status: string) => {
   align-items: center;
   white-space: nowrap;
   color: #fff;
-  padding-left: 50px;
+  /* padding-left: 50px; */
   margin-bottom: 16px;
 }
 .mockDiv .btn {
@@ -1368,7 +1369,7 @@ const healthColor = (status: string) => {
 }
 .all-page {
   display: grid;
-  grid-template-columns: 58% 1% 41%;
+  grid-template-columns: 56% 1% 41%;
   /* 左边宽度,间隔,右边宽度 */
   height: calc(100vh - 98px);
   /* 状态分析高度 */
@@ -1430,7 +1431,7 @@ const healthColor = (status: string) => {
 
 .right {
   display: grid;
-  grid-template-rows: 50%;
+  grid-template-rows: 49%;
   /* 默认情况下,子元素会自动分配空间 */
 }