Kaynağa Gözat

优化历史数据单设备和保持力异常报警设置。

git-svn-id: https://202.107.226.68:8443/svn/Services/ResistanceMonitor@19 a05970a1-87b9-9d4f-9ee5-fa77e2ec115b
yinwei 1 yıl önce
ebeveyn
işleme
4b00a08793

+ 9 - 0
2.Web/src/chart/force-curve.js

@@ -20,11 +20,18 @@ function forceOption({
  refer_curve,
  start_value,
  end_value,
+ starttime,
+ endtime,
 }) {
  let series = []
  let legend_data = []
  let y_max = 0 // Y轴最大值
  let y_min = 0 // Y轴最小值
+ let max_min_time = {}
+ if (starttime && endtime) {
+  max_min_time.min = dayjs(starttime).valueOf()
+  max_min_time.max = dayjs(endtime).valueOf()
+ }
  // 阻力
  if (curve_data_list && curve_data_list.length) {
   legend_data = curve_data_list.map(item => item.name)
@@ -256,6 +263,8 @@ function forceOption({
   ],
   xAxis: {
    type: 'time',
+   ...max_min_time,
+   splitNumber: 8,
    axisLine: {
     show: true,
     symbol: ['none', 'none'], // 添加箭头

+ 29 - 16
2.Web/src/views/Force.vue

@@ -372,11 +372,11 @@
         <el-radio :label="101">反位</el-radio>
        </el-radio-group>
       </p>
-      <p><span class="mark">*</span>最低报警值</p>
+      <p><span class="mark">*</span>最低报警值(可为空)</p>
       <el-input style="width:100px" v-model="dw_alarm_low_drop" size="small"></el-input>
-      <p><span class="mark">*</span>下降超限百分比:(5≤值≤95)</p>
+      <p><span class="mark">*</span>下降超限百分比:(可为空或5≤值≤95)</p>
       <el-input style="width:100px" v-model="alarm_low_percent" size="small"></el-input>
-      <p><span class="mark">*</span>上升超限百分比:(5≤值≤95)</p>
+      <p><span class="mark">*</span>上升超限百分比:(可为空或5≤值≤95)</p>
       <el-input style="width:100px" v-model="alarm_high_percent" size="small"></el-input>
       <p><el-button size="small" type="primary" @click="submit_content">保 存</el-button></p>
      </el-tab-pane>
@@ -838,16 +838,28 @@ export default {
      ]
      break
     case 'dw_alarm_low_drop':
-     if (isNaN(this.dw_alarm_low_drop)) return this.$message.warning('请输入数字')
-     if (isNaN(this.alarm_low_percent)) return this.$message.warning('下降超限百分比请输入0~95数字')
-     if (isNaN(this.alarm_high_percent))
-      return this.$message.warning('上升超限百分比请输入0~95的数字')
-     let alarm_low_percent = Number(this.alarm_low_percent)
-     if (alarm_low_percent < 5 || alarm_low_percent > 95)
-      return this.$message.warning('下降超限百分比请输入0~95的数字')
-     let alarm_high_percent = Number(this.alarm_high_percent)
-     if (alarm_high_percent < 5 || alarm_high_percent > 95)
-      return this.$message.warning('上升超限百分比请输入0~95的数字')
+     let dw_alarm_low_drop = 0,
+      alarm_low_percent = 0,
+      alarm_high_percent = 0
+     if (isNaN(this.dw_alarm_low_drop) || !this.dw_alarm_low_drop) {
+      dw_alarm_low_drop = null
+     } else {
+      dw_alarm_low_drop = Number(this.dw_alarm_low_drop)
+     }
+     if (isNaN(this.alarm_low_percent) || !this.alarm_low_percent) {
+      alarm_low_percent = null
+     } else {
+      alarm_low_percent = Number(this.alarm_low_percent)
+      if (alarm_low_percent < 5 || alarm_low_percent > 95)
+       return this.$message.warning('下降超限百分比可为空或请输入5~95的数字')
+     }
+     if (isNaN(this.alarm_high_percent) || !this.alarm_high_percent) {
+      alarm_high_percent = null
+     } else {
+      alarm_high_percent = Number(this.alarm_high_percent)
+      if (alarm_high_percent < 5 || alarm_high_percent > 95)
+       return this.$message.warning('上升超限百分比可为空或请输入5~95的数字')
+     }
      let [mo, mp] = this.click_id.split('.')
      let send_data = {
       mo,
@@ -855,7 +867,7 @@ export default {
       posi: this.posi,
       conf: {
        enable: this.enable == 'true',
-       dw_alarm_low_drop: Number(this.dw_alarm_low_drop),
+       dw_alarm_low_drop,
        alarm_low_percent,
        alarm_high_percent,
       },
@@ -1200,6 +1212,8 @@ export default {
       this.show_label = false
       this.curve_data.show_label = false
      }
+     this.curve_data.starttime = starttime
+     this.curve_data.endtime = endtime
      console.log(`2.处理数据耗时:${+new Date() - date_num} ms`)
      this.draw_line_curve()
      if (res.has_more) {
@@ -1855,7 +1869,6 @@ export default {
   },
   // 获取默认时间
   get_time() {
-   console.log(1)
    let threshold_val = localStorage.getItem('threshold_val')
    if (threshold_val) this.threshold_val = Number(threshold_val)
    let start_times = this.$dayjs().format('YYYY-MM-DD 00:00:00')
@@ -1866,7 +1879,7 @@ export default {
    //  let unix_time = this.$dayjs(times).unix() * 1000
    //  this.times = [unix_time - 2 * 60 * 60 * 1000, unix_time]
    //  this.times = [1714764900000, 1714766100000] // 2024年5月4号有数据
-   //  this.times = [1716307200000, 1716393600000] // 2024年5月22~23号有数据
+   this.times = [1716307200000, 1716393600000] // 2024年5月22~23号有数据
    //  this.times = [1715961600000, 1716048000000] // 2024年5月18~19号有数据
    //  this.times = [1715988120000, 1715988540000] // 2024年5月18~19号7点数据
   },

+ 26 - 14
2.Web/src/views/SystemSetting.vue

@@ -192,11 +192,11 @@
        <el-radio :label="101">反位</el-radio>
       </el-radio-group>
      </p>
-     <p><span class="mark">*</span>最低报警值</p>
+     <p><span class="mark">*</span>最低报警值(可为空或)</p>
      <el-input style="width:180px" v-model="dw_alarm_low_drop" size="small"></el-input>
-     <p><span class="mark">*</span>下降超限百分比:(5≤值≤95)</p>
+     <p><span class="mark">*</span>下降超限百分比:(可为空或5≤值≤95)</p>
      <el-input style="width:180px" v-model="alarm_low_percent" size="small"></el-input>
-     <p><span class="mark">*</span>上升超限百分比:(5≤值≤95)</p>
+     <p><span class="mark">*</span>上升超限百分比:(可为空或5≤值≤95)</p>
      <el-input style="width:180px" v-model="alarm_high_percent" size="small"></el-input>
     </el-tab-pane>
     <el-tab-pane label="报警提醒间隔设置" name="alarm_interval">
@@ -659,16 +659,28 @@ export default {
      ]
      break
     case 'dw_alarm_low_drop':
-     if (isNaN(this.dw_alarm_low_drop)) return this.$message.warning('请输入数字')
-     if (isNaN(this.alarm_low_percent)) return this.$message.warning('下降超限百分比请输入0~95数字')
-     if (isNaN(this.alarm_high_percent))
-      return this.$message.warning('上升超限百分比请输入0~95的数字')
-     let alarm_low_percent = Number(this.alarm_low_percent)
-     if (alarm_low_percent < 5 || alarm_low_percent > 95)
-      return this.$message.warning('下降超限百分比请输入0~95的数字')
-     let alarm_high_percent = Number(this.alarm_high_percent)
-     if (alarm_high_percent < 5 || alarm_high_percent > 95)
-      return this.$message.warning('上升超限百分比请输入0~95的数字')
+     let dw_alarm_low_drop = 0,
+      alarm_low_percent = 0,
+      alarm_high_percent = 0
+     if (isNaN(this.dw_alarm_low_drop) || !this.dw_alarm_low_drop) {
+      dw_alarm_low_drop = null
+     } else {
+      dw_alarm_low_drop = Number(this.dw_alarm_low_drop)
+     }
+     if (isNaN(this.alarm_low_percent) || !this.alarm_low_percent) {
+      alarm_low_percent = null
+     } else {
+      alarm_low_percent = Number(this.alarm_low_percent)
+      if (alarm_low_percent < 5 || alarm_low_percent > 95)
+       return this.$message.warning('下降超限百分比可为空或请输入5~95的数字')
+     }
+     if (isNaN(this.alarm_high_percent) || !this.alarm_high_percent) {
+      alarm_high_percent = null
+     } else {
+      alarm_high_percent = Number(this.alarm_high_percent)
+      if (alarm_high_percent < 5 || alarm_high_percent > 95)
+       return this.$message.warning('上升超限百分比可为空或请输入5~95的数字')
+     }
      let [mo, mp] = this.click_id.split('.')
      console.log(this.enable)
      send_data = {
@@ -677,7 +689,7 @@ export default {
       posi: this.posi,
       conf: {
        enable: this.enable == 'true',
-       dw_alarm_low_drop: Number(this.dw_alarm_low_drop),
+       dw_alarm_low_drop,
        alarm_low_percent,
        alarm_high_percent,
       },