2 Revize 3388ebd3f1 ... cda94bd41c

Autor SHA1 Zpráva Datum
  lxh cda94bd41c Merge branch 'master' of http://182.92.126.35:3000/hrx/mky-vent-base před 1 týdnem
  lxh 5803e1aeda echarts图表最大值最小值修改 před 1 týdnem

+ 16 - 14
src/views/vent/home/clique/components/wind-road.vue

@@ -41,6 +41,7 @@ let roadDatas = reactive({
   value: '',
 });
 let maxY = ref<any>(0);
+let minY=ref<any>(0)
 
 // let xData = reactive(['宝德', '榆家梁', '锦界', '大柳塔', '哈拉沟']);
 let xData = ref<any[]>([]);
@@ -339,20 +340,21 @@ watch(
     if (JSON.stringify(newR) != '{}') {
       maxData.length = 0;
       roadDatas.value = newR.totallength;
-      maxY.value = roadDatas.value.indexOf('.') == -1 ? roadDatas.value : roadDatas.value.substring(0, roadDatas.value.indexOf('.'));
-      if (maxY.value.length < 2 && Number(maxY.value) < 1) {
-        maxY.value = 1
-      } else if (maxY.value.length < 2 && Number(maxY.value) >= 1) {
-        maxY.value = 10
-      } else if (maxY.value.length < 3) {
-        maxY.value = (Number(maxY.value[0]) + 1) * 10
-      } else if (maxY.value.length < 4) {
-        maxY.value = (Number(maxY.value[0]) + 1) * 100
-      } else if (maxY.value.length < 5) {
-        maxY.value = (Number(maxY.value[0]) + 1) * 1000
-      } else if (maxY.value.length < 6) {
-        maxY.value = (Number(maxY.value[0]) + 1) * 10000
-      }
+      maxY.value = (Number(roadDatas.value)*1.6).toFixed(0);
+      minY.value = (Number(roadDatas.value)*0.7).toFixed(0);
+      // if (maxY.value.length < 2 && Number(maxY.value) < 1) {
+      //   maxY.value = 1
+      // } else if (maxY.value.length < 2 && Number(maxY.value) >= 1) {
+      //   maxY.value = 10
+      // } else if (maxY.value.length < 3) {
+      //   maxY.value = (Number(maxY.value[0]) + 1) * 10
+      // } else if (maxY.value.length < 4) {
+      //   maxY.value = (Number(maxY.value[0]) + 1) * 100
+      // } else if (maxY.value.length < 5) {
+      //   maxY.value = (Number(maxY.value[0]) + 1) * 1000
+      // } else if (maxY.value.length < 6) {
+      //   maxY.value = (Number(maxY.value[0]) + 1) * 10000
+      // }
       xData.value = newR.data1;
       yData.value = newR.data;
       yData.value.forEach((el) => {

+ 37 - 0
src/views/vent/home/colliery/clique.data.ts

@@ -1,6 +1,43 @@
 import dayjs from 'dayjs';
 import { cloneDeep } from 'lodash-es';
 
+
+export const getMaxY = function (param) {
+  console.log(param,'999999')
+  let maxval=0
+  if (param.length == 1) {
+     maxval = Math.max(...param[0]);
+  } else if (param.length == 2) {
+    const max1 = Math.max(...param[0]);
+    const max2 = Math.max(...param[1]);
+    maxval = Math.max(max1,max2)
+  } else if (param.length == 3) {
+    const max1 = Math.max(...param[0]);
+    const max2 = Math.max(...param[1]);
+    const max3 = Math.max(...param[2]);
+    maxval=Math.max(max1,max2,max3)
+  }
+ let yMax = (maxval * 1.6).toFixed(0);
+  return yMax
+}
+
+export const getMinY = function (param) {
+  let minval=0
+  if (param.length == 1) {
+    minval = Math.min(...param[0]);
+  } else if (param.length == 2) {
+    const min1 = Math.min(...param[0]);
+    const min2 = Math.min(...param[1]);
+    minval=Math.min(min1,min2)
+  } else if (param.length == 3) {
+    const min1 = Math.min(...param[0]);
+    const min2 = Math.min(...param[1]);
+    const min3 = Math.min(...param[2]);
+    minval=Math.min(min1,min2,min3)
+  }
+  let yMin = (minval*0.7).toFixed(0);
+  return yMin
+}
 export const airVolumeMonitorKey = [
   {
     code: 'name',

+ 23 - 18
src/views/vent/home/colliery/components/wind-monitor.vue

@@ -10,6 +10,7 @@
 <script lang="ts" setup>
 import { ref, reactive, nextTick, onMounted, defineProps, watch } from 'vue';
 import * as echarts from 'echarts';
+import {getMaxY,getMinY} from '../clique.data'
 const emit = defineEmits(['goDetail']);
 
 let props = defineProps({
@@ -20,6 +21,7 @@ let props = defineProps({
 let windBar = ref<any>();
 //坐标轴最大值
 let maxY = ref<any>(0);
+let minY=ref<any>(0)
 //echart数据
 let echartData = reactive<any>({ ydata: [], xdata: [] });
 //跳转详情
@@ -118,6 +120,7 @@ function getOption() {
         type: 'value',
         name: '(m³/min)',
         // max: maxY.value,
+        // min:minY.value,
         axisLabel: {
           textStyle: {
             fontSize: 14,
@@ -257,24 +260,26 @@ watch(
         echartData.ydata.push(el.readData.m3);
       }
     });
-    maxY.value = echartData.ydata.reduce((acr, cur) => {
-      return parseFloat(acr) > parseFloat(cur) ? parseFloat(acr) : parseFloat(cur);
-    });
-    maxY.value =
-      maxY.value.toString().indexOf('.') == -1 ? maxY.value.toString() : maxY.value.toString().substring(0, maxY.value.toString().indexOf('.'));
-    if (maxY.value.length < 2 && Number(maxY.value) < 1) {
-      maxY.value = 1
-    } else if (maxY.value.length < 2 && Number(maxY.value) >= 1) {
-      maxY.value = 10
-    } else if (maxY.value.length < 3) {
-      maxY.value = (Number(maxY.value[0]) + 1) * 10
-    } else if (maxY.value.length < 4) {
-      maxY.value = (Number(maxY.value[0]) + 1) * 100
-    } else if (maxY.value.length < 5) {
-      maxY.value = (Number(maxY.value[0]) + 1) * 1000
-    } else if (maxY.value.length < 6) {
-      maxY.value = (Number(maxY.value[0]) + 1) * 10000
-    }
+    maxY.value = getMaxY( echartData.ydata)
+    minY.value = getMinY( echartData.ydata)
+    // maxY.value = echartData.ydata.reduce((acr, cur) => {
+    //   return parseFloat(acr) > parseFloat(cur) ? parseFloat(acr) : parseFloat(cur);
+    // });
+    // maxY.value =
+    //   maxY.value.toString().indexOf('.') == -1 ? maxY.value.toString() : maxY.value.toString().substring(0, maxY.value.toString().indexOf('.'));
+    // if (maxY.value.length < 2 && Number(maxY.value) < 1) {
+    //   maxY.value = 1
+    // } else if (maxY.value.length < 2 && Number(maxY.value) >= 1) {
+    //   maxY.value = 10
+    // } else if (maxY.value.length < 3) {
+    //   maxY.value = (Number(maxY.value[0]) + 1) * 10
+    // } else if (maxY.value.length < 4) {
+    //   maxY.value = (Number(maxY.value[0]) + 1) * 100
+    // } else if (maxY.value.length < 5) {
+    //   maxY.value = (Number(maxY.value[0]) + 1) * 1000
+    // } else if (maxY.value.length < 6) {
+    //   maxY.value = (Number(maxY.value[0]) + 1) * 10000
+    // }
     getOption();
   },
   {

+ 91 - 83
src/views/vent/monitorManager/alarmMonitor/common.data.ts

@@ -18,48 +18,55 @@ export const getMaxY = function (param) {
     const max3 = Math.max(...param[2]);
     maxval=Math.max(max1,max2,max3)
   }
-  const digitCount = maxval.toFixed(0).length;
-  console.log(digitCount,'digitCount')
-  let yMax = 0;
-  if (digitCount < 2) {
-    if (yMax < 0.5) {
-      yMax = 1;
-    } else if (yMax < 0.9) {
-      yMax = 1.5;
-    } else if (yMax < 5) {
-      yMax = 10;
-    } else {
-      yMax = 15;
-    }
-  } else if (digitCount < 3) {
-    const n = Number((Number(yMax.toFixed(0)) / 10).toFixed(0));
-    if (yMax < n * 10 + 5) {
-      yMax = (n + 1) * 10;
-    } else {
-      yMax = (n + 2) * 10;
-    }
-  } else if (digitCount < 4) {
-    const n = Number((Number(yMax.toFixed(0)) / 100).toFixed(0));
-    if (yMax < n * 100 + 50) {
-      yMax = (n + 1) * 100;
-    } else {
-      yMax = (n + 2) * 100;
-    }
-  } else if (digitCount < 5) {
-    const n = Number((Number(yMax.toFixed(0)) / 1000).toFixed(0));
-    if (yMax < n * 1000 + 500) {
-      yMax = (n + 1) * 1000;
-    } else {
-      yMax = (n + 1) * 1000 + 500;
-    }
-  } else if (digitCount < 6) {
-    const n = Number((Number(yMax.toFixed(0)) / 10000).toFixed(0));
-    if (yMax < n * 10000 + 5000) {
-      yMax = (n + 1) * 10000;
-    } else {
-      yMax = (n + 1) * 10000 + 5000;
-    }
-  }
+ let yMax = (maxval * 1.6).toFixed(0);
+// const digitCount = yMax.toFixed(0).length;
+// console.log(digitCount,'digitCount')
+// let digFirst=yMax.toString().substring(0,1)
+// console.log(digFirst,'digFirst')
+
+
+  // const digitCount = maxval.toFixed(0).length;
+  // console.log(digitCount,'digitCount')
+  // let yMax = 0;
+  // if (digitCount < 2) {
+  //   if (yMax < 0.5) {
+  //     yMax = 1;
+  //   } else if (yMax < 0.9) {
+  //     yMax = 1.5;
+  //   } else if (yMax < 5) {
+  //     yMax = 10;
+  //   } else {
+  //     yMax = 15;
+  //   }
+  // } else if (digitCount < 3) {
+  //   const n = Number((Number(yMax.toFixed(0)) / 10).toFixed(0));
+  //   if (yMax < n * 10 + 5) {
+  //     yMax = (n + 1) * 10;
+  //   } else {
+  //     yMax = (n + 2) * 10;
+  //   }
+  // } else if (digitCount < 4) {
+  //   const n = Number((Number(yMax.toFixed(0)) / 100).toFixed(0));
+  //   if (yMax < n * 100 + 50) {
+  //     yMax = (n + 1) * 100;
+  //   } else {
+  //     yMax = (n + 2) * 100;
+  //   }
+  // } else if (digitCount < 5) {
+  //   const n = Number((Number(yMax.toFixed(0)) / 1000).toFixed(0));
+  //   if (yMax < n * 1000 + 500) {
+  //     yMax = (n + 1) * 1000;
+  //   } else {
+  //     yMax = (n + 1) * 1000 + 500;
+  //   }
+  // } else if (digitCount < 6) {
+  //   const n = Number((Number(yMax.toFixed(0)) / 10000).toFixed(0));
+  //   if (yMax < n * 10000 + 5000) {
+  //     yMax = (n + 1) * 10000;
+  //   } else {
+  //     yMax = (n + 1) * 10000 + 5000;
+  //   }
+  // }
   return yMax
 }
 
@@ -77,47 +84,48 @@ export const getMinY = function (param) {
     const min3 = Math.min(...param[2]);
     minval=Math.min(min1,min2,min3)
   }
-  const minDigitCount = minval.toFixed(0).length;
-  let yMin = 0;
-  if (minDigitCount < 2) {
-    if (yMin> 0.5) {
-      yMin = 0.5;
-    } else if (yMin > 1.5) {
-      yMin = 1.0;
-    } else if (yMin > 10) {
-      yMin = 5;
-    } else {
-      yMin = 15;
-    }
-  } else if (minDigitCount < 3) {
-    const n = Number((Number(yMin.toFixed(0)) / 10).toFixed(0));
-    if (n > 1) {
-      yMin = (n - 1) * 10;
-    } else {
-      yMin = 10;
-    }
-  } else if (minDigitCount < 4) {
-    const n = Number((Number(yMin.toFixed(0)) / 100).toFixed(0));
-    if (n > 1) {
-      yMin = (n - 1) * 100;
-    } else {
-      yMin = 100;
-    }
-  } else if (minDigitCount < 5) {
-    const n = Number((Number(yMin.toFixed(0)) / 1000).toFixed(0));
-    if (n > 1) {
-      yMin = (n - 1) * 1000;
-    } else {
-      yMin = 1000;
-    }
-  } else if (minDigitCount < 6) {
-    const n = Number((Number(yMin.toFixed(0)) / 10000).toFixed(0));
-    if (n > 1) {
-      yMin = (n - 1) * 10000;
-    } else {
-      yMin = 10000;
-    }
-  }
+  let yMin = (minval*0.7).toFixed(0);
+  // const minDigitCount = minval.toFixed(0).length;
+  // let yMin = 0;
+  // if (minDigitCount < 2) {
+  //   if (yMin> 0.5) {
+  //     yMin = 0.5;
+  //   } else if (yMin > 1.5) {
+  //     yMin = 1.0;
+  //   } else if (yMin > 10) {
+  //     yMin = 5;
+  //   } else {
+  //     yMin = 15;
+  //   }
+  // } else if (minDigitCount < 3) {
+  //   const n = Number((Number(yMin.toFixed(0)) / 10).toFixed(0));
+  //   if (n > 1) {
+  //     yMin = (n - 1) * 10;
+  //   } else {
+  //     yMin = 10;
+  //   }
+  // } else if (minDigitCount < 4) {
+  //   const n = Number((Number(yMin.toFixed(0)) / 100).toFixed(0));
+  //   if (n > 1) {
+  //     yMin = (n - 1) * 100;
+  //   } else {
+  //     yMin = 100;
+  //   }
+  // } else if (minDigitCount < 5) {
+  //   const n = Number((Number(yMin.toFixed(0)) / 1000).toFixed(0));
+  //   if (n > 1) {
+  //     yMin = (n - 1) * 1000;
+  //   } else {
+  //     yMin = 1000;
+  //   }
+  // } else if (minDigitCount < 6) {
+  //   const n = Number((Number(yMin.toFixed(0)) / 10000).toFixed(0));
+  //   if (n > 1) {
+  //     yMin = (n - 1) * 10000;
+  //   } else {
+  //     yMin = 10000;
+  //   }
+  // }
   return yMin
 }
 

+ 31 - 27
src/views/vent/monitorManager/alarmMonitor/common/closeWall.vue

@@ -94,7 +94,7 @@
           </div>
           <div class="echarts-box">
             <PredictionCurve v-if="shownChart === 'default'" :chart="curveConfig" />
-            <echartLine1 v-if="shownChart === 'predict'" :echartDataSg="echartDataSg1" :lengedDataName="echartDataSg1.lengedDataName" :maxY="maxY" />
+            <echartLine1 v-if="shownChart === 'predict'" :echartDataSg="echartDataSg1" :lengedDataName="echartDataSg1.lengedDataName" :maxY="maxY" :minY="minY" />
           </div>
         </div>
         <div class="right-echartbox">
@@ -118,6 +118,7 @@
   import warnZb from './warnZb.vue';
   import PredictionCurve from './predictionCurve.vue';
   import { Modal, Input } from 'ant-design-vue';
+  import {getMaxY,getMinY} from '../common.data'
   // import { deviceControlApi } from '/@/api/vent/index';
 
   let props = defineProps({
@@ -127,6 +128,7 @@
   const globalConfig = inject('globalConfig');
   const shownChart = ref('default');
   let maxY = ref<any>(0);
+  let minY=ref<any>(0)
   let selectSj = ref<any[]>([]);
   let selectData = ref('');
   let selectList = reactive<any[]>([]);
@@ -222,25 +224,27 @@
   });
   let echartDataSgList = reactive<any[]>([]);
 
-  function getmaxY() {
-    maxY.value = echartDataSg1.yData.reduce((acr, cur) => {
-      return acr > cur ? acr : cur;
-    });
-    maxY.value =
-      maxY.value.toString().indexOf('.') == -1 ? maxY.value.toString() : maxY.value.toString().substring(0, maxY.value.toString().indexOf('.'));
-    if (maxY.value.length < 2 && Number(maxY.value) < 1) {
-      maxY.value = 1;
-    } else if (maxY.value.length < 2 && Number(maxY.value) >= 1) {
-      maxY.value = 10;
-    } else if (maxY.value.length < 3) {
-      maxY.value = (Number(maxY.value[0]) + 1) * 10;
-    } else if (maxY.value.length < 4) {
-      maxY.value = (Number(maxY.value[0]) + 1) * 100;
-    } else if (maxY.value.length < 5) {
-      maxY.value = (Number(maxY.value[0]) + 1) * 1000;
-    } else if (maxY.value.length < 6) {
-      maxY.value = (Number(maxY.value[0]) + 1) * 10000;
-    }
+  function getmax() {
+    getMaxY(echartDataSg1.yData)
+    getMinY(echartDataSg1.yData)
+    // maxY.value = echartDataSg1.yData.reduce((acr, cur) => {
+    //   return acr > cur ? acr : cur;
+    // });
+    // maxY.value =
+    //   maxY.value.toString().indexOf('.') == -1 ? maxY.value.toString() : maxY.value.toString().substring(0, maxY.value.toString().indexOf('.'));
+    // if (maxY.value.length < 2 && Number(maxY.value) < 1) {
+    //   maxY.value = 1;
+    // } else if (maxY.value.length < 2 && Number(maxY.value) >= 1) {
+    //   maxY.value = 10;
+    // } else if (maxY.value.length < 3) {
+    //   maxY.value = (Number(maxY.value[0]) + 1) * 10;
+    // } else if (maxY.value.length < 4) {
+    //   maxY.value = (Number(maxY.value[0]) + 1) * 100;
+    // } else if (maxY.value.length < 5) {
+    //   maxY.value = (Number(maxY.value[0]) + 1) * 1000;
+    // } else if (maxY.value.length < 6) {
+    //   maxY.value = (Number(maxY.value[0]) + 1) * 10000;
+    // }
   }
   //密闭参数选项切换
   function btnClick(item, ind) {
@@ -273,7 +277,7 @@
           ],
           monitorData: echartDataSg1.yData,
         };
-        getmaxY();
+        getmax();
         break;
       case 'C₂H₄':
         echartDataSgList.forEach((el) => {
@@ -293,7 +297,7 @@
           ],
           monitorData: echartDataSg1.yData,
         };
-        getmaxY();
+        getmax();
         break;
       case 'CO':
         echartDataSgList.forEach((el) => {
@@ -313,7 +317,7 @@
           ],
           monitorData: echartDataSg1.yData,
         };
-        getmaxY();
+        getmax();
         break;
       case 'CH₄':
         echartDataSgList.forEach((el) => {
@@ -333,7 +337,7 @@
           ],
           monitorData: echartDataSg1.yData,
         };
-        getmaxY();
+        getmax();
         break;
       case 'CO₂':
         echartDataSgList.forEach((el) => {
@@ -353,7 +357,7 @@
           ],
           monitorData: echartDataSg1.yData,
         };
-        getmaxY();
+        getmax();
         break;
       case 'C₂H₂':
         echartDataSgList.forEach((el) => {
@@ -373,7 +377,7 @@
           ],
           monitorData: echartDataSg1.yData,
         };
-        getmaxY();
+        getmax();
         break;
     }
   }
@@ -501,7 +505,7 @@
         //   }
         //   echartDataSgList.push(v);
         // });
-        getmaxY();
+        getmax();
       } else {
         topContent.temperature = 0;
         // topContent.position = '--';

+ 36 - 31
src/views/vent/monitorManager/alarmMonitor/common/echartLine.vue

@@ -15,6 +15,9 @@ let props = defineProps({
   maxY: {
     type: Number,
   },
+  minY:{
+    type: Number,
+  },
   echartDw: {
     type: String,
   },
@@ -160,6 +163,7 @@ function getOption() {
           boundaryGap: false,
           type: 'value',
           max: props.maxY,
+          min:props.minY,
           axisLabel: {
             textStyle: {
               color: '#b3b8cc',
@@ -189,37 +193,38 @@ function getOption() {
             show: false,
           },
         },
-        {
-          boundaryGap: false,
-          type: 'value',
-          max: props.maxY,
-          axisLabel: {
-            textStyle: {
-              color: '#b3b8cc',
-            },
-            formatter: '{value}',
-          },
-          name: props.echartDw1,
-          nameTextStyle: {
-            color: '#fff',
-            fontSize: 12,
-            lineHeight: 10,
-          },
-          splitLine: {
-            lineStyle: {
-              color: 'rgba(14, 53, 95)',
-            },
-          },
-          axisLine: {
-            show: true,
-            lineStyle: {
-              color: 'rgba(14, 53, 95)',
-            },
-          },
-          axisTick: {
-            show: false,
-          },
-        },
+        // {
+        //   boundaryGap: false,
+        //   type: 'value',
+        //   max: props.maxY,
+        //   min:props.minY,
+        //   axisLabel: {
+        //     textStyle: {
+        //       color: '#b3b8cc',
+        //     },
+        //     formatter: '{value}',
+        //   },
+        //   name: props.echartDw1,
+        //   nameTextStyle: {
+        //     color: '#fff',
+        //     fontSize: 12,
+        //     lineHeight: 10,
+        //   },
+        //   splitLine: {
+        //     lineStyle: {
+        //       color: 'rgba(14, 53, 95)',
+        //     },
+        //   },
+        //   axisLine: {
+        //     show: true,
+        //     lineStyle: {
+        //       color: 'rgba(14, 53, 95)',
+        //     },
+        //   },
+        //   axisTick: {
+        //     show: false,
+        //   },
+        // },
       ],
       series: [
         {

+ 4 - 0
src/views/vent/monitorManager/alarmMonitor/common/echartLine1.vue

@@ -17,6 +17,9 @@
     maxY: {
       type: Number,
     },
+    minY: {
+      type: Number,
+    },
   });
 
   //获取dom元素节点
@@ -138,6 +141,7 @@
             name: props.lengedDataName ? props.lengedDataName : '',
             type: 'value',
             max: props.maxY,
+            min:props.minY,
             axisLabel: {
               textStyle: {
                 color: '#b3b8cc',

+ 29 - 25
src/views/vent/monitorManager/alarmMonitor/common/faultDiagnose.vue

@@ -53,7 +53,8 @@
                     <div class="text-t">瓦斯抽采泵信息</div>
                 </div>
                 <div class="echart-area-box">
-                    <echartLine :echartDataGq="echartData" :maxY="maxY" :echartDw="echartDw" :gridV="gridV" />
+                    <echartLine :echartDataGq="echartData" :maxY="maxY" :minY="minY" :echartDw="echartDw"
+                        :gridV="gridV" />
                 </div>
             </div>
         </div>
@@ -67,6 +68,7 @@ import imgUrl from '/@/assets/images/fire/pie.png';
 import { SvgIcon } from '/@/components/Icon';
 import echartLine from './echartLine.vue';
 import BarAndLine from '/@/components/chart/BarAndLine.vue';
+import { getMaxY, getMinY } from '../common.data'
 let props = defineProps({
     timeData: {
         type: String,
@@ -104,6 +106,7 @@ let formState = reactive({
     ttime_end: ''
 })
 let maxY = ref<any>(0)
+let minY = ref<any>(0)
 let echartDw = ref('(m³/min)');
 let chartsColumnList = reactive([
     {
@@ -182,30 +185,31 @@ watch(() => props.topData, (newT, oldT) => {
 })
 watch(() => props.echartData, (newE, oldE) => {
     if (newE.maxData.data.length != 0 && newE.xData.length != 0) {
-        // pointHisWarnData.x = newE.xData[1]
-        // pointHisWarnData.y = newE.maxData.data[1]
-        let max1 = newE.maxData.data.reduce((acr, cur) => {
-            return acr > cur ? acr : cur;
-        });
-        let max2 = newE.minData.data.reduce((acr1, cur1) => {
-            return acr1 > cur1 ? acr1 : cur1;
-        });
-        maxY.value = max1 >= max2 ? max1 : max2;
-        maxY.value =
-            maxY.value.toString().indexOf('.') == -1 ? maxY.value.toString() : maxY.value.toString().substring(0, maxY.value.toString().indexOf('.'));
-        if (maxY.value.length < 2 && Number(maxY.value) < 1) {
-            maxY.value = 1;
-        } else if (maxY.value.length < 2 && Number(maxY.value) >= 1) {
-            maxY.value = 10;
-        } else if (maxY.value.length < 3) {
-            maxY.value = (Number(maxY.value[0]) + 1) * 10;
-        } else if (maxY.value.length < 4) {
-            maxY.value = (Number(maxY.value[0]) + 1) * 100;
-        } else if (maxY.value.length < 5) {
-            maxY.value = (Number(maxY.value[0]) + 1) * 1000;
-        } else if (maxY.value.length < 6) {
-            maxY.value = (Number(maxY.value[0]) + 1) * 10000;
-        }
+        let echartD = [newE.maxData.data, newE.minData.data]
+        maxY.value = getMaxY(echartD)
+        minY.value = getMinY(echartD)
+        // let max1 = newE.maxData.data.reduce((acr, cur) => {
+        //     return acr > cur ? acr : cur;
+        // });
+        // let max2 = newE.minData.data.reduce((acr1, cur1) => {
+        //     return acr1 > cur1 ? acr1 : cur1;
+        // });
+        // maxY.value = max1 >= max2 ? max1 : max2;
+        // maxY.value =
+        //     maxY.value.toString().indexOf('.') == -1 ? maxY.value.toString() : maxY.value.toString().substring(0, maxY.value.toString().indexOf('.'));
+        // if (maxY.value.length < 2 && Number(maxY.value) < 1) {
+        //     maxY.value = 1;
+        // } else if (maxY.value.length < 2 && Number(maxY.value) >= 1) {
+        //     maxY.value = 10;
+        // } else if (maxY.value.length < 3) {
+        //     maxY.value = (Number(maxY.value[0]) + 1) * 10;
+        // } else if (maxY.value.length < 4) {
+        //     maxY.value = (Number(maxY.value[0]) + 1) * 100;
+        // } else if (maxY.value.length < 5) {
+        //     maxY.value = (Number(maxY.value[0]) + 1) * 1000;
+        // } else if (maxY.value.length < 6) {
+        //     maxY.value = (Number(maxY.value[0]) + 1) * 10000;
+        // }
     }
 }, { immediate: true, deep: true })
 </script>

+ 41 - 35
src/views/vent/monitorManager/alarmMonitor/warn/dustWarn.vue

@@ -39,7 +39,7 @@
             <div class="text-t">粉尘信息状态监测</div>
           </div>
           <div class="echart-boxd">
-            <echartLine :echartDataGq="echartDataFc" :maxY="maxY" :echartDw="echartDw" :gridV="gridV" />
+            <echartLine :echartDataGq="echartDataFc" :maxY="maxY" :minY="minY" :echartDw="echartDw" :gridV="gridV" />
           </div>
         </div>
       </div>
@@ -62,6 +62,7 @@
   import { usePermission } from '/@/hooks/web/usePermission';
   import { useGlobSetting } from '/@/hooks/setting';
   import MeasurePoint from '../common/measurePoint.vue';
+  import {getMaxY,getMinY} from '../common.data'
 
   const glob = useGlobSetting();
   const { hasPermission } = usePermission();
@@ -92,6 +93,7 @@
     xData: [],
   });
   let maxY = ref<any>(0);
+  let minY=ref<any>(0)
   let echartDw = ref('(mg/m³)');
   let gridV = reactive({
     top: '12%',
@@ -224,24 +226,26 @@
             );
           }
         });
-        maxY.value = echartDataFc.maxData.data.reduce((acr, cur) => {
-          return acr > cur ? acr : cur;
-        });
-        maxY.value =
-          maxY.value.toString().indexOf('.') == -1 ? maxY.value.toString() : maxY.value.toString().substring(0, maxY.value.toString().indexOf('.'));
-        if (maxY.value.length < 2 && Number(maxY.value) < 1) {
-          maxY.value = 1;
-        } else if (maxY.value.length < 2 && Number(maxY.value) >= 1) {
-          maxY.value = 10;
-        } else if (maxY.value.length < 3) {
-          maxY.value = (Number(maxY.value[0]) + 1) * 10;
-        } else if (maxY.value.length < 4) {
-          maxY.value = (Number(maxY.value[0]) + 1) * 100;
-        } else if (maxY.value.length < 5) {
-          maxY.value = (Number(maxY.value[0]) + 1) * 1000;
-        } else if (maxY.value.length < 6) {
-          maxY.value = (Number(maxY.value[0]) + 1) * 10000;
-        }
+    maxY.value = getMaxY(echartDataFc.maxData.data)
+    minY.value = getMinY(echartDataFc.maxData.data)
+        // maxY.value = echartDataFc.maxData.data.reduce((acr, cur) => {
+        //   return acr > cur ? acr : cur;
+        // });
+        // maxY.value =
+        //   maxY.value.toString().indexOf('.') == -1 ? maxY.value.toString() : maxY.value.toString().substring(0, maxY.value.toString().indexOf('.'));
+        // if (maxY.value.length < 2 && Number(maxY.value) < 1) {
+        //   maxY.value = 1;
+        // } else if (maxY.value.length < 2 && Number(maxY.value) >= 1) {
+        //   maxY.value = 10;
+        // } else if (maxY.value.length < 3) {
+        //   maxY.value = (Number(maxY.value[0]) + 1) * 10;
+        // } else if (maxY.value.length < 4) {
+        //   maxY.value = (Number(maxY.value[0]) + 1) * 100;
+        // } else if (maxY.value.length < 5) {
+        //   maxY.value = (Number(maxY.value[0]) + 1) * 1000;
+        // } else if (maxY.value.length < 6) {
+        //   maxY.value = (Number(maxY.value[0]) + 1) * 10000;
+        // }
       } else {
         activeIndex.value = 0;
         if (flag.value) {
@@ -269,22 +273,24 @@
             );
           }
         });
-        maxY.value = echartDataFc.maxData.data.reduce((acr, cur) => {
-          return acr > cur ? acr : cur;
-        });
-        maxY.value =
-          maxY.value.toString().indexOf('.') == -1 ? maxY.value.toString() : maxY.value.toString().substring(0, maxY.value.toString().indexOf('.'));
-        if (maxY.value.length < 2) {
-          maxY.value = 10;
-        } else if (maxY.value.length < 3) {
-          maxY.value = (Number(maxY.value[0]) + 1) * 10;
-        } else if (maxY.value.length < 4) {
-          maxY.value = (Number(maxY.value[0]) + 1) * 100;
-        } else if (maxY.value.length < 5) {
-          maxY.value = (Number(maxY.value[0]) + 1) * 1000;
-        } else if (maxY.value.length < 6) {
-          maxY.value = (Number(maxY.value[0]) + 1) * 10000;
-        }
+        maxY.value = getMaxY(echartDataFc.maxData.data)
+        minY.value = getMinY(echartDataFc.maxData.data)
+        // maxY.value = echartDataFc.maxData.data.reduce((acr, cur) => {
+        //   return acr > cur ? acr : cur;
+        // });
+        // maxY.value =
+        //   maxY.value.toString().indexOf('.') == -1 ? maxY.value.toString() : maxY.value.toString().substring(0, maxY.value.toString().indexOf('.'));
+        // if (maxY.value.length < 2) {
+        //   maxY.value = 10;
+        // } else if (maxY.value.length < 3) {
+        //   maxY.value = (Number(maxY.value[0]) + 1) * 10;
+        // } else if (maxY.value.length < 4) {
+        //   maxY.value = (Number(maxY.value[0]) + 1) * 100;
+        // } else if (maxY.value.length < 5) {
+        //   maxY.value = (Number(maxY.value[0]) + 1) * 1000;
+        // } else if (maxY.value.length < 6) {
+        //   maxY.value = (Number(maxY.value[0]) + 1) * 10000;
+        // }
       }
     }
   }

+ 1 - 111
src/views/vent/monitorManager/alarmMonitor/warn/ventilateWarn.vue

@@ -61,7 +61,7 @@
                 <div class="text-t">通风信息状态监测</div>
               </div>
               <div class="echart-boxd">
-                <echartLine :echartDataGq="echartDataFc1" :maxY="maxY" :echartDw="echartDw" />
+                <echartLine :echartDataGq="echartDataFc1" :maxY="maxY" :minY="minY" :echartDw="echartDw" />
               </div>
             </div>
           </div>
@@ -303,116 +303,6 @@ function getDetailList(param) {
     minY.value = getMinY(echartD)
     console.log(maxY.value, 'yMax---')
     console.log(minY.value, 'yMin---')
-    // // let max1 = echartDataFc1.maxData.data.reduce((acr, cur) => {
-    // //   return acr > cur ? acr : cur;
-    // // });
-    // const max1 = Math.max(...echartDataFc1.maxData.data);
-    // const min1 = Math.min(...echartDataFc1.maxData.data);
-    // // let max2 = echartDataFc1.minData.data.reduce((acr1, cur1) => {
-    // //   return acr1 > cur1 ? acr1 : cur1;
-    // // });
-    // const max2 = Math.max(...echartDataFc1.minData.data);
-    // const min2 = Math.max(...echartDataFc1.minData.data);
-    // maxY.value = max1 >= max2 ? max1 : max2;
-    // minY.value = min1 >= min2 ? min1 : min2
-    // // maxY.value =
-    // //   maxY.value.toString().indexOf('.') == -1 ? maxY.value.toString() : maxY.value.toString().substring(0, maxY.value.toString().indexOf('.'));
-    // // if (maxY.value.length < 2 && Number(maxY.value) < 1) {
-    // //   maxY.value = 1;
-    // // } else if (maxY.value.length < 2 && Number(maxY.value) >= 1) {
-    // //   maxY.value = 10;
-    // // } else if (maxY.value.length < 3) {
-    // //   maxY.value = (Number(maxY.value[0]) + 1) * 10;
-    // // } else if (maxY.value.length < 4) {
-    // //   maxY.value = (Number(maxY.value[0]) + 1) * 100;
-    // // } else if (maxY.value.length < 5) {
-    // //   maxY.value = (Number(maxY.value[0]) + 1) * 1000;
-    // // } else if (maxY.value.length < 6) {
-    // //   maxY.value = (Number(maxY.value[0]) + 1) * 10000;
-    // // }
-    // const digitCount = maxY.value.toFixed(0).length;
-    // const minDigitCount = minY.value.toFixed(0).length;
-    // let yMax = 0, yMin = 0;
-    // if (digitCount < 2) {
-    //   if (maxY.value < 0.5) {
-    //     yMax = 1;
-    //   } else if (maxY.value < 0.9) {
-    //     yMax = 1.5;
-    //   } else if (maxY.value < 5) {
-    //     yMax = 10;
-    //   } else {
-    //     yMax = 15;
-    //   }
-    // } else if (digitCount < 3) {
-    //   const n = Number((Number(maxY.value.toFixed(0)) / 10).toFixed(0));
-    //   if (maxY.value < n * 10 + 5) {
-    //     yMax = (n + 1) * 10;
-    //   } else {
-    //     yMax = (n + 2) * 10;
-    //   }
-    // } else if (digitCount < 4) {
-    //   const n = Number((Number(maxY.value.toFixed(0)) / 100).toFixed(0));
-    //   if (maxY.value < n * 100 + 50) {
-    //     yMax = (n + 1) * 100;
-    //   } else {
-    //     yMax = (n + 2) * 100;
-    //   }
-    // } else if (digitCount < 5) {
-    //   const n = Number((Number(maxY.value.toFixed(0)) / 1000).toFixed(0));
-    //   if (maxY.value < n * 1000 + 500) {
-    //     yMax = (n + 1) * 1000;
-    //   } else {
-    //     yMax = (n + 1) * 1000 + 500;
-    //   }
-    // } else if (digitCount < 6) {
-    //   const n = Number((Number(maxY.value.toFixed(0)) / 10000).toFixed(0));
-    //   if (maxY.value < n * 10000 + 5000) {
-    //     yMax = (n + 1) * 10000;
-    //   } else {
-    //     yMax = (n + 1) * 10000 + 5000;
-    //   }
-    // }
-
-    // if (minDigitCount < 2) {
-    //   if (minY.value > 0.5) {
-    //     yMin = 0.5;
-    //   } else if (minY.value > 1.5) {
-    //     yMin = 1.0;
-    //   } else if (minY.value > 10) {
-    //     yMin = 5;
-    //   } else {
-    //     yMin = 15;
-    //   }
-    // } else if (minDigitCount < 3) {
-    //   const n = Number((Number(minY.value.toFixed(0)) / 10).toFixed(0));
-    //   if (n > 1) {
-    //     yMin = (n - 1) * 10;
-    //   } else {
-    //     yMin = 10;
-    //   }
-    // } else if (digitCount < 4) {
-    //   const n = Number((Number(minY.value.toFixed(0)) / 100).toFixed(0));
-    //   if (n > 1) {
-    //     yMin = (n - 1) * 100;
-    //   } else {
-    //     yMin = 100;
-    //   }
-    // } else if (digitCount < 5) {
-    //   const n = Number((Number(minY.value.toFixed(0)) / 1000).toFixed(0));
-    //   if (n > 1) {
-    //     yMin = (n - 1) * 1000;
-    //   } else {
-    //     yMin = 1000;
-    //   }
-    // } else if (digitCount < 6) {
-    //   const n = Number((Number(minY.value.toFixed(0)) / 10000).toFixed(0));
-    //   if (n > 1) {
-    //     yMin = (n - 1) * 10000;
-    //   } else {
-    //     yMin = 10000;
-    //   }
-    // }
-
   }
 }
 //获取通风监控测点信息