2 Commits 4488fe9254 ... e268dacb59

Autor SHA1 Mensaje Fecha
  lxh e268dacb59 Merge branch 'master' of http://39.97.59.228:8013/hrx/mky-vent-base hace 1 mes
  lxh 0f65a241c5 主风机,局部风机历史数据曲线修改-提交 hace 1 mes

+ 126 - 158
src/views/vent/monitorManager/fanLocalMonitor/components/deviceFaultDetailModal.vue

@@ -18,91 +18,53 @@
       <div class="basic-content">
         <div class="basic-title">风速监测曲线</div>
         <div class="echart-box">
-          <faultEchartLine
-            :selectData="selectData"
-            :warningMonitorRowIndex="warningMonitorRowIndex"
-            :deviceId="deviceID"
-            :deviceType="deviceType"
-            :Type="'windSpeed'"
-            :addData="windsValue"
-            :legendName="'风速'"
-            :echartColor="'#ff0000'"
-          />
+          <faultEchartLine :selectData="selectData" :warningMonitorRowIndex="warningMonitorRowIndex"
+            :deviceId="deviceID" :deviceType="deviceType" :Type="'windSpeed'" :legendName="'风速'"
+            :echartColor="'#ff0000'"></faultEchartLine>
         </div>
       </div>
       <div class="basic-content">
         <div class="basic-title">风量监测曲线</div>
         <div class="echart-box">
-          <faultEchartLine
-            :selectData="selectData"
-            :warningMonitorRowIndex="warningMonitorRowIndex"
-            :deviceId="deviceID"
-            :deviceType="deviceType"
-            :Type="'wind'"
-            :addData="windValue"
-            :legendName="'风量'"
-            :echartColor="'#2ec1dd'"
-          />
+          <faultEchartLine :selectData="selectData" :warningMonitorRowIndex="warningMonitorRowIndex"
+            :deviceId="deviceID" :deviceType="deviceType" :Type="'wind'"  :legendName="'风量'"
+            :echartColor="'#2ec1dd'"></faultEchartLine>
         </div>
       </div>
       <div class="basic-content">
         <div class="basic-title">电流监测曲线</div>
         <div class="echart-box">
-          <faultEchartLine
-            :selectData="selectData"
-            :warningMonitorRowIndex="warningMonitorRowIndex"
-            :deviceId="deviceID"
-            :deviceType="deviceType"
-            :Type="'Dl'"
-            :addData="dlValue"
-            :legendName="'电流'"
-            :echartColor="'#fbc21c'"
-          />
+          <faultEchartLine :selectData="selectData" :warningMonitorRowIndex="warningMonitorRowIndex"
+            :deviceId="deviceID" :deviceType="deviceType" :Type="'Dl'"  :legendName="'电流'"
+            :echartColor="'#fbc21c'">
+          </faultEchartLine>
         </div>
       </div>
       <div class="basic-content">
         <div class="basic-title">电压监测曲线</div>
         <div class="echart-box">
-          <faultEchartLine
-            :selectData="selectData"
-            :warningMonitorRowIndex="warningMonitorRowIndex"
-            :deviceId="deviceID"
-            :deviceType="deviceType"
-            :Type="'Dy'"
-            :addData="dyValue"
-            :legendName="'电压'"
-            :echartColor="'#259745'"
-          />
+          <faultEchartLine :selectData="selectData" :warningMonitorRowIndex="warningMonitorRowIndex"
+            :deviceId="deviceID" :deviceType="deviceType" :Type="'Dy'"  :legendName="'电压'"
+            :echartColor="'#259745'">
+          </faultEchartLine>
         </div>
       </div>
       <div class="basic-content">
         <div class="basic-title">瓦斯浓度监测曲线</div>
         <div class="echart-box">
-          <faultEchartLine
-            :selectData="selectData"
-            :warningMonitorRowIndex="warningMonitorRowIndex"
-            :deviceId="deviceID"
-            :deviceType="deviceType"
-            :Type="'wsnd'"
-            :addData="wsndValue"
-            :legendName="'瓦斯浓度'"
-            :echartColor="'#0fcb74'"
-          />
+          <faultEchartLine :selectData="selectData" :warningMonitorRowIndex="warningMonitorRowIndex"
+            :deviceId="deviceID" :deviceType="deviceType" :Type="'wsnd'"  :legendName="'瓦斯浓度'"
+            :echartColor="'#0fcb74'">
+          </faultEchartLine>
         </div>
       </div>
       <div class="basic-content">
         <div class="basic-title">振动监测曲线</div>
         <div class="echart-box">
-          <faultEchartLine
-            :selectData="selectData"
-            :warningMonitorRowIndex="warningMonitorRowIndex"
-            :deviceId="deviceID"
-            :deviceType="deviceType"
-            :Type="'Zd'"
-            :addData="zdValue"
-            :legendName="'振动'"
-            :echartColor="'#00a9ff'"
-          />
+          <faultEchartLine :selectData="selectData" :warningMonitorRowIndex="warningMonitorRowIndex"
+            :deviceId="deviceID" :deviceType="deviceType" :Type="'Zd'"  :legendName="'振动'"
+            :echartColor="'#00a9ff'">
+          </faultEchartLine>
         </div>
       </div>
     </div>
@@ -143,108 +105,114 @@
   let normalNum = ref(0); //正常测点数量
   let abnormalNum = ref(0); //
 
-  let windsValue = computed(() => {
-    return {
-      y:
-        props.warningMonitorRowIndex == 0
-          ? props.selectData['Fan1WindSpeed']
-          : props.warningMonitorRowIndex == 1
-            ? props.selectData['Fan2WindSpeed']
-            : '',
-      x: props.selectData['tTime'].substring(props.selectData['tTime'].lastIndexOf(' ')),
-    };
-  }); //实时风速
-  let windValue = computed(() => {
-    return {
-      y: props.warningMonitorRowIndex == 0 ? props.selectData['Fan1Wind'] : props.warningMonitorRowIndex == 1 ? props.selectData['Fan2Wind'] : '',
-      x: props.selectData['tTime'].substring(props.selectData['tTime'].lastIndexOf(' ')),
-    };
-  }); //实时风量
-  let dlValue = computed(() => {
-    return {
-      y: props.warningMonitorRowIndex == 0 ? props.selectData['Fan1Dl'] : props.warningMonitorRowIndex == 1 ? props.selectData['Fan2Dl'] : '',
-      x: props.selectData['tTime'].substring(props.selectData['tTime'].lastIndexOf(' ')),
-    };
-  }); //实时电流
-  let dyValue = computed(() => {
-    return {
-      y: props.warningMonitorRowIndex == 0 ? props.selectData['Fan1Dy'] : props.warningMonitorRowIndex == 1 ? props.selectData['Fan2Dy'] : '',
-      x: props.selectData['tTime'].substring(props.selectData['tTime'].lastIndexOf(' ')),
-    };
-  }); //实时电压
-  let wsndValue = computed(() => {
-    return {
-      y: props.warningMonitorRowIndex == 0 ? props.selectData['Fan1Wsnd'] : props.warningMonitorRowIndex == 1 ? props.selectData['Fan2Wsnd'] : '',
-      x: props.selectData['tTime'].substring(props.selectData['tTime'].lastIndexOf(' ')),
-    };
-  }); //实时瓦斯浓度
-  let zdValue = computed(() => {
-    return {
-      y: props.warningMonitorRowIndex == 0 ? props.selectData['Fan1Zd'] : props.warningMonitorRowIndex == 1 ? props.selectData['Fan2Zd'] : '',
-      x: props.selectData['tTime'].substring(props.selectData['tTime'].lastIndexOf(' ')),
-    };
-  }); //实时振动
+// let windsValue = computed(() => {
+//   return {
+//     y: props.warningMonitorRowIndex == 0 ? props.selectData['Fan1WindSpeed'] : props.warningMonitorRowIndex == 1 ? props.selectData['Fan2WindSpeed'] : '',
+//     x: props.selectData['tTime'].substring(props.selectData['tTime'].lastIndexOf(' '))
+//   }
+// }) //实时风速
+// let windValue = computed(() => {
+//   return {
+//     y: props.warningMonitorRowIndex == 0 ? props.selectData['Fan1Wind'] : props.warningMonitorRowIndex == 1 ? props.selectData['Fan2Wind'] : '',
+//     x: props.selectData['tTime'].substring(props.selectData['tTime'].lastIndexOf(' '))
+//   }
 
-  let $emit = defineEmits(['handlerClose']);
+// }) //实时风量
+// let dlValue = computed(() => {
+//   return {
+//     y: props.warningMonitorRowIndex == 0 ? props.selectData['Fan1Dl'] : props.warningMonitorRowIndex == 1 ? props.selectData['Fan2Dl'] : '',
+//     x: props.selectData['tTime'].substring(props.selectData['tTime'].lastIndexOf(' '))
+//   }
 
-  //弹窗关闭
-  function handleCancel() {
-    $emit('handlerClose', false);
-  }
+// }) //实时电流
+// let dyValue = computed(() => {
+//   return {
+//     y: props.warningMonitorRowIndex == 0 ? props.selectData['Fan1Dy'] : props.warningMonitorRowIndex == 1 ? props.selectData['Fan2Dy'] : '',
+//     x: props.selectData['tTime'].substring(props.selectData['tTime'].lastIndexOf(' '))
+//   }
 
-  watch(
-    () => props.isShowModal,
-    (newV, oldV) => {
-      visible.value = newV;
-    }
-  );
+// }) //实时电压
+// let wsndValue = computed(() => {
+//   return {
+//     y: props.warningMonitorRowIndex == 0 ? props.selectData['Fan1Wsnd'] : props.warningMonitorRowIndex == 1 ? props.selectData['Fan2Wsnd'] : '',
+//     x: props.selectData['tTime'].substring(props.selectData['tTime'].lastIndexOf(' '))
+//   }
 
-  watch(
-    () => props.warningMonitorRowIndex,
-    (newV, oldV) => {
-      // if (props.rightColumns.length) {
-      //   let dataList: any[] = []
-      //   props.rightColumns.forEach((el) => {
-      //     if (el.dataIndex.startsWith('Fan')) {
-      //       if (newV == 0 && props.selectData[el.dataIndex.replace('Fan', 'Fan1')] != undefined) {
-      //         dataList.push({ label: el.title })
-      //       } else if (newV == 1 && props.selectData[el.dataIndex.replace('Fan', 'Fan2')] != undefined && props.selectData[el.dataIndex.replace('Fan', 'Fan2')] != '0') {
-      //         dataList.push({ label: el.title })
-      //       } else if (newV == 2 && props.selectData[el.dataIndex.replace('Fan', 'Fan3')] != undefined && props.selectData[el.dataIndex.replace('Fan', 'Fan3')] != '0') {
-      //         dataList.push({ label: el.title })
-      //       }
-      //     } else {
-      //       if (props.selectData[el.dataIndex] != undefined && props.selectData[el.dataIndex] != '0') {
-      //         dataList.push({ label: el.title })
-      //       }
-      //     }
-      //   })
-      //   faultList.value = dataList
-      //   abnormalNum.value = dataList.length
-      //   normalNum.value = props.rightColumns.length - dataList.length
-      //   console.log(dataList, 'dataList===')
-      // }
-      if (newV == 0) {
-        faultList.value = [
-          { label: '2025年9月11日  10:05:26   1#电机电流过载,可能风筒长度过长或者局部阻力异常' },
-          { label: '2025年9月15日  11:09:13   振动幅值超限,疑似转子轴承外圈损伤' },
-        ];
-      } else if (newV == 1) {
-        faultList.value = [
-          { label: '2025年9月11日  10:05:26   1#电机电流过载,可能风筒长度过长或者局部阻力异常' },
-          { label: '2025年9月15日  11:09:13   振动幅值超限,疑似转子轴承外圈损伤' },
-        ];
-      } else {
-        faultList.value = [
-          { label: '2025年9月11日  10:05:26   1#电机电流过载,可能风筒长度过长或者局部阻力异常' },
-          { label: '2025年9月15日  11:09:13   振动幅值超限,疑似转子轴承外圈损伤' },
-        ];
-      }
-      abnormalNum.value = faultList.value.length;
-      normalNum.value = 36;
-    },
-    { immediate: true }
-  );
+// }) //实时瓦斯浓度
+// let zdValue = computed(() => {
+//   return {
+//     y: props.warningMonitorRowIndex == 0 ? props.selectData['Fan1Zd'] : props.warningMonitorRowIndex == 1 ? props.selectData['Fan2Zd'] : '',
+//     x: props.selectData['tTime'].substring(props.selectData['tTime'].lastIndexOf(' '))
+//   }
+
+// }) //实时振动
+
+let $emit = defineEmits(['handlerClose'])
+
+
+//弹窗关闭
+function handleCancel() {
+  $emit('handlerClose', false)
+}
+
+watch(() => props.isShowModal, (newV, oldV) => {
+  visible.value = newV
+})
+
+watch(() => props.warningMonitorRowIndex, (newV, oldV) => {
+  // if (props.rightColumns.length) {
+  //   let dataList: any[] = []
+  //   props.rightColumns.forEach((el) => {
+  //     if (el.dataIndex.startsWith('Fan')) {
+  //       if (newV == 0 && props.selectData[el.dataIndex.replace('Fan', 'Fan1')] != undefined) {
+  //         dataList.push({ label: el.title })
+  //       } else if (newV == 1 && props.selectData[el.dataIndex.replace('Fan', 'Fan2')] != undefined && props.selectData[el.dataIndex.replace('Fan', 'Fan2')] != '0') {
+  //         dataList.push({ label: el.title })
+  //       } else if (newV == 2 && props.selectData[el.dataIndex.replace('Fan', 'Fan3')] != undefined && props.selectData[el.dataIndex.replace('Fan', 'Fan3')] != '0') {
+  //         dataList.push({ label: el.title })
+  //       }
+  //     } else {
+  //       if (props.selectData[el.dataIndex] != undefined && props.selectData[el.dataIndex] != '0') {
+  //         dataList.push({ label: el.title })
+  //       }
+  //     }
+  //   })
+  //   faultList.value = dataList
+  //   abnormalNum.value = dataList.length
+  //   normalNum.value = props.rightColumns.length - dataList.length
+  //   console.log(dataList, 'dataList===')
+  // }
+  if (newV == 0) {
+    faultList.value = [
+      { label: '2025年7月12日,风速超限' },
+      { label: '2025年7月21日,风量波动' },
+      { label: '2025年8月4日,轴温偏高' },
+      { label: '2025年8月17日,径向振动过大' },
+      { label: '2025年8月23日,油温高' },
+      { label: '2025年8月26日,电机故障' },
+    ]
+  } else if (newV == 1) {
+    faultList.value = [
+      { label: '2025年8月2日,风速超限' },
+      { label: '2025年8月11日,振动过高' },
+      { label: '2025年8月24日,轴温偏高' },
+      { label: '2025年9月17日,径向振动过大' },
+      { label: '2025年9月23日,油温高' },
+      { label: '2025年9月26日,蝶阀故障' },
+    ]
+  } else {
+    faultList.value = [
+      { label: '2025年8月2日,风门故障' },
+      { label: '2025年8月11日,风量波动' },
+      { label: '2025年8月24日,轴温偏高' },
+      { label: '2025年9月17日,径向振动过大' },
+      { label: '2025年9月23日,变频故障反馈' },
+      { label: '2025年9月26日,电机故障' },
+    ]
+  }
+  abnormalNum.value = faultList.value.length
+  normalNum.value = Math.ceil(Math.random() * 10)
+}, { immediate: true })
 </script>
 
 <style lang="less" scoped>

+ 48 - 22
src/views/vent/monitorManager/fanLocalMonitor/components/faultEchartLine.vue

@@ -7,8 +7,8 @@
       <a-date-picker v-model:value="historyParams.endTime" valueFormat="YYYY-MM-DD HH:mm:ss" placeholder="结束时间"
         size="small" :showTime="true" style="position: absolute; z-index: 99; left: 175px; width: 170px; top: 2px"
         @change="changeEnd" />
-      <a-select ref="select" v-model:value="historyParams.interval" placeholder="请选择间隔时间" size="small"
-        style="position: absolute; z-index: 99; top: 2px; left: 350px; width: 150px">
+      <a-select ref="select" v-model:value="historyParams.skip" placeholder="请选择间隔时间" size="small"
+        style="position: absolute; z-index: 99; top: 2px; left: 350px; width: 150px" @change="changeSelect">
         <a-select-option v-for="(item, index) in skipOption" :key="index" :value="item.value">{{ item.label
         }}</a-select-option>
       </a-select>
@@ -19,7 +19,7 @@
 
 <script setup lang="ts">
 import dayjs from 'dayjs';
-import { ref, reactive, onMounted, nextTick, watch } from 'vue'
+import { ref, reactive, onMounted, nextTick, watch, onUnmounted } from 'vue'
 import * as echarts from 'echarts';
 import { listdays, getHistoryData } from '../fanLocal.api'
 
@@ -37,9 +37,9 @@ let props = defineProps({
   Type: {
     type: String
   },
-  addData: {
-    type: Object as any
-  },
+  // addData: {
+  //   type: Object as any
+  // },
   legendName: {
     type: String
   },
@@ -63,15 +63,32 @@ let skipOption = ref<any[]>([
   { label: '1天', value: '9' },
 ])
 let historyParams = reactive({
-  skip: '8',
-  startTime: dayjs().startOf('date').subtract(1, 'day').format('YYYY-MM-DD HH:mm:ss'),
+  skip: '3',
+  startTime: dayjs().startOf('date').format('YYYY-MM-DD HH:mm:ss'),
   endTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
-  interval: '1h',
 })
 let echartline = ref(null)
 let xData = ref<any[]>([])
 let yData = ref<any[]>([])
 
+// https获取监测数据
+let timer: null | NodeJS.Timeout = null;
+function getMonitor() {
+  timer = setTimeout(
+    async () => {
+      await getData()
+      if (timer) {
+        timer = null;
+      }
+      getMonitor();
+    },
+    10000
+  );
+}
+function changeSelect(val) {
+  historyParams.skip = val
+  getData()
+}
 function changeStart(val) {
   historyParams.startTime = val
   getData()
@@ -209,7 +226,7 @@ function getOption() {
 async function getData() {
   if (props.selectData.stationtype && props.selectData.stationtype != 'redis') {
     let deviceNum = props.warningMonitorRowIndex == 0 ? 'Fan1' : 'Fan2'
-    let res = await listdays({ deviceNum: deviceNum, ttime_begin: historyParams.startTime, ttime_end: historyParams.endTime, strtype: props.deviceType, gdeviceid: props.deviceId, skip: historyParams.skip, pageSize: 100, pageNo: 1 })
+    let res = await listdays({ deviceNum: deviceNum, ttime_begin: historyParams.startTime, ttime_end: historyParams.endTime, strtype: props.deviceType, gdeviceids: props.deviceId, skip: historyParams.skip, pageSize: 100, pageNo: 1 })
     let data = res.datalist.records
     xData.value = res.xlist
     if (props.Type == 'windSpeed') {
@@ -248,21 +265,30 @@ async function getData() {
 
 }
 
-watch(() => props.addData, (newV, oldV) => {
-  if (yData.value.length >= 20) {
-    yData.value.push(newV.y)
-    yData.value.shift()
-    xData.value.push(newV.x)
-    xData.value.shift()
-  } else {
-    yData.value.push(newV.y)
-    xData.value.push(newV.x)
-  }
-  getOption()
-}, { immediate: true })
+// watch(() => props.addData, (newV, oldV) => {
+//   if (yData.value.length >= 20) {
+//     yData.value.push(newV.y)
+//     yData.value.shift()
+//     xData.value.push(newV.x)
+//     xData.value.shift()
+//   } else {
+//     yData.value.push(newV.y)
+//     xData.value.push(newV.x)
+//   }
+//   getOption()
+// }, { immediate: true })
+
 onMounted(() => {
   getData()
+  getMonitor()
 })
+onUnmounted(() => {
+  if (timer) {
+    clearTimeout(timer);
+    timer = undefined;
+  }
+
+});
 
 </script>
 

+ 123 - 153
src/views/vent/monitorManager/mainFanMonitor/components/deviceFaultDetailModal.vue

@@ -18,91 +18,49 @@
       <div class="basic-content">
         <div class="basic-title">轴温监测曲线</div>
         <div class="echart-box">
-          <faultEchartLine
-            :selectData="selectData"
-            :warningMonitorRowIndex="warningMonitorRowIndex"
-            :deviceId="deviceID"
-            :deviceType="deviceType"
-            :Type="'tempZw'"
-            :addData="tempzwValue"
-            :legendName="'轴温'"
-            :echartColor="'#ff0000'"
-          />
+          <faultEchartLine :selectData="selectData" :warningMonitorRowIndex="warningMonitorRowIndex"
+            :deviceId="deviceID" :deviceType="deviceType" :Type="'tempZw'" :legendName="'轴温'" :echartColor="'#ff0000'">
+          </faultEchartLine>
         </div>
       </div>
       <div class="basic-content">
         <div class="basic-title">电机温度监测曲线</div>
         <div class="echart-box">
-          <faultEchartLine
-            :selectData="selectData"
-            :warningMonitorRowIndex="warningMonitorRowIndex"
-            :deviceId="deviceID"
-            :deviceType="deviceType"
-            :Type="'tempDj'"
-            :addData="tempdjValue"
-            :legendName="'电机温度'"
-            :echartColor="'#2ec1dd'"
-          />
+          <faultEchartLine :selectData="selectData" :warningMonitorRowIndex="warningMonitorRowIndex"
+            :deviceId="deviceID" :deviceType="deviceType" :Type="'tempDj'" :legendName="'电机温度'"
+            :echartColor="'#2ec1dd'"></faultEchartLine>
         </div>
       </div>
       <div class="basic-content">
         <div class="basic-title">电流监测曲线</div>
         <div class="echart-box">
-          <faultEchartLine
-            :selectData="selectData"
-            :warningMonitorRowIndex="warningMonitorRowIndex"
-            :deviceId="deviceID"
-            :deviceType="deviceType"
-            :Type="'Dl'"
-            :addData="dlValue"
-            :legendName="'电流'"
-            :echartColor="'#fbc21c'"
-          />
+          <faultEchartLine :selectData="selectData" :warningMonitorRowIndex="warningMonitorRowIndex"
+            :deviceId="deviceID" :deviceType="deviceType" :Type="'Dl'" :legendName="'电流'" :echartColor="'#fbc21c'">
+          </faultEchartLine>
         </div>
       </div>
       <div class="basic-content">
         <div class="basic-title">电压监测曲线</div>
         <div class="echart-box">
-          <faultEchartLine
-            :selectData="selectData"
-            :warningMonitorRowIndex="warningMonitorRowIndex"
-            :deviceId="deviceID"
-            :deviceType="deviceType"
-            :Type="'Dy'"
-            :addData="dyValue"
-            :legendName="'电压'"
-            :echartColor="'#259745'"
-          />
+          <faultEchartLine :selectData="selectData" :warningMonitorRowIndex="warningMonitorRowIndex"
+            :deviceId="deviceID" :deviceType="deviceType" :Type="'Dy'" :legendName="'电压'" :echartColor="'#259745'">
+          </faultEchartLine>
         </div>
       </div>
       <div class="basic-content">
         <div class="basic-title">径向振动监测曲线</div>
         <div class="echart-box">
-          <faultEchartLine
-            :selectData="selectData"
-            :warningMonitorRowIndex="warningMonitorRowIndex"
-            :deviceId="deviceID"
-            :deviceType="deviceType"
-            :Type="'jxzd'"
-            :addData="jxzdValue"
-            :legendName="'径向振动'"
-            :echartColor="'#0fcb74'"
-          />
+          <faultEchartLine :selectData="selectData" :warningMonitorRowIndex="warningMonitorRowIndex"
+            :deviceId="deviceID" :deviceType="deviceType" :Type="'jxzd'" :legendName="'径向振动'" :echartColor="'#0fcb74'">
+          </faultEchartLine>
         </div>
       </div>
       <div class="basic-content">
         <div class="basic-title">垂直振动监测曲线</div>
         <div class="echart-box">
-          <faultEchartLine
-            :selectData="selectData"
-            :warningMonitorRowIndex="warningMonitorRowIndex"
-            :deviceId="deviceID"
-            :deviceType="deviceType"
-            :Type="'czzd'"
-            :addData="czzdValue"
-            :legendName="'垂直振动'"
-            :echartColor="'#00a9ff'"
-          />
+          <faultEchartLine :selectData="selectData" :warningMonitorRowIndex="warningMonitorRowIndex"
+            :deviceId="deviceID" :deviceType="deviceType" :Type="'czzd'" :legendName="'垂直振动'" :echartColor="'#00a9ff'">
+          </faultEchartLine>
         </div>
       </div>
     </div>
@@ -143,103 +101,115 @@
   let normalNum = ref(0); //正常测点数量
   let abnormalNum = ref(0); //
 
-  let tempzwValue = computed(() => {
-    return {
-      y: props.warningMonitorRowIndex == 0 ? props.selectData['Fan1Tempzw'] : props.warningMonitorRowIndex == 1 ? props.selectData['Fan2Tempzw'] : '',
-      x: props.selectData['tTime'].substring(props.selectData['tTime'].lastIndexOf(' ')),
-    };
-  }); //实时轴温
-  let tempdjValue = computed(() => {
-    return {
-      y: props.warningMonitorRowIndex == 0 ? props.selectData['Fan1Tempdj'] : props.warningMonitorRowIndex == 1 ? props.selectData['Fan2Tempdj'] : '',
-      x: props.selectData['tTime'].substring(props.selectData['tTime'].lastIndexOf(' ')),
-    };
-  }); //实时电机温度
-  let dlValue = computed(() => {
-    return {
-      y: props.warningMonitorRowIndex == 0 ? props.selectData['Fan1Dl'] : props.warningMonitorRowIndex == 1 ? props.selectData['Fan2Dl'] : '',
-      x: props.selectData['tTime'].substring(props.selectData['tTime'].lastIndexOf(' ')),
-    };
-  }); //实时电流
-  let dyValue = computed(() => {
-    return {
-      y: props.warningMonitorRowIndex == 0 ? props.selectData['Fan1Dy'] : props.warningMonitorRowIndex == 1 ? props.selectData['Fan2Dy'] : '',
-      x: props.selectData['tTime'].substring(props.selectData['tTime'].lastIndexOf(' ')),
-    };
-  }); //实时电压
-  let jxzdValue = computed(() => {
-    return {
-      y: props.warningMonitorRowIndex == 0 ? props.selectData['Fan1Jxzd'] : props.warningMonitorRowIndex == 1 ? props.selectData['Fan2Jxzd'] : '',
-      x: props.selectData['tTime'].substring(props.selectData['tTime'].lastIndexOf(' ')),
-    };
-  }); //实时径向振动
-  let czzdValue = computed(() => {
-    return {
-      y: props.warningMonitorRowIndex == 0 ? props.selectData['Fan1Czzd'] : props.warningMonitorRowIndex == 1 ? props.selectData['Fan2Czzd'] : '',
-      x: props.selectData['tTime'].substring(props.selectData['tTime'].lastIndexOf(' ')),
-    };
-  }); //实时垂直振动
+// let tempzwValue = computed(() => {
+//   return {
+//     y: props.warningMonitorRowIndex == 0 ? props.selectData['Fan1Tempzw'] : props.warningMonitorRowIndex == 1 ? props.selectData['Fan2Tempzw'] : '',
+//     x: props.selectData['tTime'].substring(props.selectData['tTime'].lastIndexOf(' '))
+//   }
 
-  let $emit = defineEmits(['handlerClose']);
+// }) //实时轴温
+// let tempdjValue = computed(() => {
+//   return {
+//     y: props.warningMonitorRowIndex == 0 ? props.selectData['Fan1Tempdj'] : props.warningMonitorRowIndex == 1 ? props.selectData['Fan2Tempdj'] : '',
+//     x: props.selectData['tTime'].substring(props.selectData['tTime'].lastIndexOf(' '))
+//   }
 
-  //弹窗关闭
-  function handleCancel() {
-    $emit('handlerClose', false);
-  }
+// }) //实时电机温度
+// let dlValue = computed(() => {
+//   return {
+//     y: props.warningMonitorRowIndex == 0 ? props.selectData['Fan1Dl'] : props.warningMonitorRowIndex == 1 ? props.selectData['Fan2Dl'] : '',
+//     x: props.selectData['tTime'].substring(props.selectData['tTime'].lastIndexOf(' '))
+//   }
 
-  watch(
-    () => props.isShowModal,
-    (newV, oldV) => {
-      visible.value = newV;
-    }
-  );
+// }) //实时电流
+// let dyValue = computed(() => {
+//   return {
+//     y: props.warningMonitorRowIndex == 0 ? props.selectData['Fan1Dy'] : props.warningMonitorRowIndex == 1 ? props.selectData['Fan2Dy'] : '',
+//     x: props.selectData['tTime'].substring(props.selectData['tTime'].lastIndexOf(' '))
+//   }
 
-  watch(
-    () => props.warningMonitorRowIndex,
-    (newV, oldV) => {
-      // if (props.rightColumns.length) {
-      //   let dataList: any[] = []
-      //   props.rightColumns.forEach((el) => {
-      //     if (el.dataIndex.startsWith('Fan')) {
-      //       if (newV == 0 && props.selectData[el.dataIndex.replace('Fan', 'Fan1')] != undefined) {
-      //         dataList.push({ label: el.title })
-      //       } else if (newV == 1 && props.selectData[el.dataIndex.replace('Fan', 'Fan2')] != undefined && props.selectData[el.dataIndex.replace('Fan', 'Fan2')] != '0') {
-      //         dataList.push({ label: el.title })
-      //       } else if (newV == 2 && props.selectData[el.dataIndex.replace('Fan', 'Fan3')] != undefined && props.selectData[el.dataIndex.replace('Fan', 'Fan3')] != '0') {
-      //         dataList.push({ label: el.title })
-      //       }
-      //     } else {
-      //       if (props.selectData[el.dataIndex] != undefined && props.selectData[el.dataIndex] != '0') {
-      //         dataList.push({ label: el.title })
-      //       }
-      //     }
-      //   })
-      //   faultList.value = dataList
-      //   abnormalNum.value = dataList.length
-      //   normalNum.value = props.rightColumns.length - dataList.length
-      //   console.log(dataList, 'dataList===')
-      // }
-      if (newV == 0) {
-        faultList.value = [
-          { label: '2025年8月13日  14:25:37   供风不足,疑似矿井阻力异常' },
-          { label: '2025年8月13日  15:05:30  径向振动幅度增大,疑似轴承故障' },
-        ];
-      } else if (newV == 1) {
-        faultList.value = [
-          { label: '2025年8月13日  14:25:37   供风不足,疑似矿井阻力异常' },
-          { label: '2025年8月13日  15:05:30  径向振动幅度增大,疑似轴承故障' },
-        ];
-      } else {
-        faultList.value = [
-          { label: '2025年8月13日  14:25:37   供风不足,疑似矿井阻力异常' },
-          { label: '2025年8月13日  15:05:30  径向振动幅度增大,疑似轴承故障' },
-        ];
-      }
-      abnormalNum.value = faultList.value.length;
-      normalNum.value = 45;
-    },
-    { immediate: true }
-  );
+// }) //实时电压
+// let jxzdValue = computed(() => {
+//   return {
+//     y: props.warningMonitorRowIndex == 0 ? props.selectData['Fan1Jxzd'] : props.warningMonitorRowIndex == 1 ? props.selectData['Fan2Jxzd'] : '',
+//     x: props.selectData['tTime'].substring(props.selectData['tTime'].lastIndexOf(' '))
+//   }
+
+// }) //实时径向振动
+// let czzdValue = computed(() => {
+//   return {
+//     y: props.warningMonitorRowIndex == 0 ? props.selectData['Fan1Czzd'] : props.warningMonitorRowIndex == 1 ? props.selectData['Fan2Czzd'] : '',
+//     x: props.selectData['tTime'].substring(props.selectData['tTime'].lastIndexOf(' '))
+//   }
+
+// }) //实时垂直振动
+
+let $emit = defineEmits(['handlerClose'])
+
+
+//弹窗关闭
+function handleCancel() {
+  $emit('handlerClose', false)
+}
+
+watch(() => props.isShowModal, (newV, oldV) => {
+  visible.value = newV
+})
+
+watch(() => props.warningMonitorRowIndex, (newV, oldV) => {
+  // if (props.rightColumns.length) {
+  //   let dataList: any[] = []
+  //   props.rightColumns.forEach((el) => {
+  //     if (el.dataIndex.startsWith('Fan')) {
+  //       if (newV == 0 && props.selectData[el.dataIndex.replace('Fan', 'Fan1')] != undefined) {
+  //         dataList.push({ label: el.title })
+  //       } else if (newV == 1 && props.selectData[el.dataIndex.replace('Fan', 'Fan2')] != undefined && props.selectData[el.dataIndex.replace('Fan', 'Fan2')] != '0') {
+  //         dataList.push({ label: el.title })
+  //       } else if (newV == 2 && props.selectData[el.dataIndex.replace('Fan', 'Fan3')] != undefined && props.selectData[el.dataIndex.replace('Fan', 'Fan3')] != '0') {
+  //         dataList.push({ label: el.title })
+  //       }
+  //     } else {
+  //       if (props.selectData[el.dataIndex] != undefined && props.selectData[el.dataIndex] != '0') {
+  //         dataList.push({ label: el.title })
+  //       }
+  //     }
+  //   })
+  //   faultList.value = dataList
+  //   abnormalNum.value = dataList.length
+  //   normalNum.value = props.rightColumns.length - dataList.length
+  //   console.log(dataList, 'dataList===')
+  // }
+  if (newV == 0) {
+    faultList.value = [
+      { label: '2025年7月12日,风速超限' },
+      { label: '2025年7月21日,风量波动' },
+      { label: '2025年8月4日,轴温偏高' },
+      { label: '2025年8月17日,径向振动过大' },
+      { label: '2025年8月23日,油温高' },
+      { label: '2025年8月26日,电机故障' },
+    ]
+  } else if (newV == 1) {
+    faultList.value = [
+      { label: '2025年8月2日,风速超限' },
+      { label: '2025年8月11日,振动过高' },
+      { label: '2025年8月24日,轴温偏高' },
+      { label: '2025年9月17日,径向振动过大' },
+      { label: '2025年9月23日,油温高' },
+      { label: '2025年9月26日,蝶阀故障' },
+    ]
+  } else {
+    faultList.value = [
+      { label: '2025年8月2日,风门故障' },
+      { label: '2025年8月11日,风量波动' },
+      { label: '2025年8月24日,轴温偏高' },
+      { label: '2025年9月17日,径向振动过大' },
+      { label: '2025年9月23日,变频故障反馈' },
+      { label: '2025年9月26日,电机故障' },
+    ]
+  }
+  abnormalNum.value = faultList.value.length
+  normalNum.value = Math.ceil(Math.random() * 10)
+}, { immediate: true })
 </script>
 
 <style lang="less" scoped>

+ 49 - 23
src/views/vent/monitorManager/mainFanMonitor/components/faultEchartLine.vue

@@ -7,8 +7,8 @@
       <a-date-picker v-model:value="historyParams.endTime" valueFormat="YYYY-MM-DD HH:mm:ss" placeholder="结束时间"
         size="small" :showTime="true" style="position: absolute; z-index: 99; left: 175px; width: 170px; top: 2px"
         @change="changeEnd" />
-      <a-select ref="select" v-model:value="historyParams.interval" placeholder="请选择间隔时间" size="small"
-        style="position: absolute; z-index: 99; top: 2px; left: 350px; width: 150px">
+      <a-select ref="select" v-model:value="historyParams.skip" placeholder="请选择间隔时间" size="small"
+        style="position: absolute; z-index: 99; top: 2px; left: 350px; width: 150px" @change="changeSelect">
         <a-select-option v-for="(item, index) in skipOption" :key="index" :value="item.value">{{ item.label
           }}</a-select-option>
       </a-select>
@@ -19,7 +19,7 @@
 
 <script setup lang="ts">
 import dayjs from 'dayjs';
-import { ref, reactive, onMounted, nextTick, watch } from 'vue'
+import { ref, reactive, onMounted, nextTick, watch, onUnmounted } from 'vue'
 import * as echarts from 'echarts';
 import { listdays, getHistoryData } from '../main.api'
 
@@ -37,9 +37,9 @@ let props = defineProps({
   Type: {
     type: String
   },
-  addData: {
-    type: Object as any
-  },
+  // addData: {
+  //   type: Object as any
+  // },
   legendName: {
     type: String
   },
@@ -63,15 +63,29 @@ let skipOption = ref<any[]>([
   { label: '1天', value: '9' },
 ])
 let historyParams = reactive({
-  skip: '8',
-  startTime: dayjs().startOf('date').subtract(1, 'day').format('YYYY-MM-DD HH:mm:ss'),
+  skip: '3',
+  startTime: dayjs().startOf('date').format('YYYY-MM-DD HH:mm:ss'),
   endTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
-  interval: '1h',
 })
 let echartline = ref(null)
 let xData = ref<any[]>([])
 let yData = ref<any[]>([])
 
+
+// https获取监测数据
+let timer: null | NodeJS.Timeout = null;
+function getMonitor() {
+  timer = setTimeout(
+    async () => {
+      await getData()
+      if (timer) {
+        timer = null;
+      }
+      getMonitor();
+    },
+    10000
+  );
+}
 function changeStart(val) {
   historyParams.startTime = val
   getData()
@@ -80,6 +94,10 @@ function changeEnd(val) {
   historyParams.endTime = val
   getData()
 }
+function changeSelect(val) {
+  historyParams.skip = val
+  getData()
+}
 function getOption() {
   nextTick(() => {
     let myChart = echarts.init(echartline.value);
@@ -208,8 +226,8 @@ function getOption() {
 
 async function getData() {
   if (props.selectData.stationtype && props.selectData.stationtype != 'redis') {
-    let deviceNum=props.warningMonitorRowIndex==0 ? 'Fan1' : 'Fan2'
-    let res = await listdays({deviceNum:deviceNum, ttime_begin: historyParams.startTime, ttime_end: historyParams.endTime, strtype: props.deviceType, gdeviceid: props.deviceId, skip: historyParams.skip, pageSize: 100, pageNo: 1 })
+    let deviceNum = props.warningMonitorRowIndex == 0 ? 'Fan1' : 'Fan2'
+    let res = await listdays({ deviceNum: deviceNum, ttime_begin: historyParams.startTime, ttime_end: historyParams.endTime, strtype: props.deviceType, gdeviceid: props.deviceId, skip: historyParams.skip, pageSize: 100, pageNo: 1 })
     let data = res.datalist.records
     xData.value = res.xlist
     if (props.Type == 'tempZw') {
@@ -248,21 +266,29 @@ async function getData() {
 
 }
 
-watch(() => props.addData, (newV, oldV) => {
-  if (yData.value.length >= 20) {
-    yData.value.push(newV.y)
-    yData.value.shift()
-    xData.value.push(newV.x)
-    xData.value.shift()
-  } else {
-    yData.value.push(newV.y)
-    xData.value.push(newV.x)
-  }
-  getOption()
-}, { immediate: true })
+// watch(() => props.addData, (newV, oldV) => {
+//   if (yData.value.length >= 20) {
+//     yData.value.push(newV.y)
+//     yData.value.shift()
+//     xData.value.push(newV.x)
+//     xData.value.shift()
+//   } else {
+//     yData.value.push(newV.y)
+//     xData.value.push(newV.x)
+//   }
+//   getOption()
+// }, { immediate: true })
 onMounted(() => {
   getData()
+  getMonitor()
 })
+onUnmounted(() => {
+  if (timer) {
+    clearTimeout(timer);
+    timer = undefined;
+  }
+
+});
 
 </script>