Explorar el Código

不告警配置增加查询和校验功能

tl hace 6 meses
padre
commit
c07c4ad411

+ 5 - 5
cpp-admin/src/main/java/com/cpp/web/service/alarm/AlarmLog.java

@@ -40,17 +40,17 @@ public class AlarmLog {
      * 告警日志打印+存储
      *
      * @param alarmSource 数据来源
-     * @param alarmType 告警类型
-     * @param info  告警信息
-     * @param stationCode   场站编号
+     * @param alarmType   告警类型
+     * @param info        告警信息
+     * @param stationCode 场站编号
      */
     public void info(DataSourcesEnum alarmSource, AlarmEnum alarmType, String info, String stationCode) {
         List<AlarmConf> alarmConfs = new ArrayList<>();
 
-        if(stationAlarmConfListMap.containsKey(stationCode)){
+        if (stationAlarmConfListMap.containsKey(stationCode)) {
             alarmConfs.addAll(stationAlarmConfListMap.get(stationCode));
         }
-        if (stationAlarmConfListMap.containsKey("all")){
+        if (stationAlarmConfListMap.containsKey("all")) {
             alarmConfs.addAll(stationAlarmConfListMap.get("all"));
         }
         Integer status = 0;

+ 8 - 8
cpp-admin/src/main/java/com/cpp/web/utils/LogUtil.java

@@ -12,15 +12,15 @@ import com.cpp.web.service.alarm.AlarmLog;
  */
 public class LogUtil {
 
-  public static String format(String message, Object... args) {
-    for (Object arg : args) {
-      message = message.replaceFirst("\\{\\}", arg.toString());
+    public static String format(String message, Object... args) {
+        for (Object arg : args) {
+            message = message.replaceFirst("\\{\\}", arg.toString());
+        }
+        return message;
     }
-    return message;
-  }
 
-  public static void info(DataSourcesEnum dataSources,AlarmEnum alarmEnum,String info,String stationCode){
-    AlarmLog.getInstance().info(dataSources, alarmEnum,info,stationCode);
-  }
+    public static void info(DataSourcesEnum dataSources, AlarmEnum alarmEnum, String info, String stationCode) {
+        AlarmLog.getInstance().info(dataSources, alarmEnum, info, stationCode);
+    }
 
 }

+ 15 - 8
cpp-ui/src/views/abnormalAlarm/index.vue

@@ -42,9 +42,15 @@
           </el-button>
         </el-form-item>
         <el-form-item>
-          <el-button type="primary" style="margin-left: 500px" @click="acknowledgeByStationCode">全部确认
-            <span v-loading="loading"><svg-icon slot="prefix" icon-class="alarm2"
-                                                class="el-input__icon input-icon"/> {{ this.alarmNum }}</span>
+          <div class="top-badge">
+            <el-badge v-loading="loading" style="margin-left: 600px" :value="this.alarmNum">
+              <img src="../../assets/images/svg/remind.svg" width="30px"/>
+            </el-badge>
+          </div>
+        </el-form-item>
+        <br>
+        <el-form-item>
+          <el-button type="primary" @click="acknowledgeByStationCode">全部确认
           </el-button>
         </el-form-item>
       </el-form>
@@ -75,7 +81,8 @@
         <vxe-table-column field="" title="操作">
           <template v-slot="{ row }">
             <svg-icon v-if="row.status !== 0" slot="prefix" h icon-class="alarm1" class="el-input__icon input-icon"/>
-            <svg-icon v-if="row.status === 0" slot="prefix" viewBox="0 0 5 5" icon-class="alarm2" class="el-input__icon input-icon"
+            <svg-icon v-if="row.status === 0" slot="prefix" viewBox="0 0 5 5" icon-class="alarm2"
+                      class="el-input__icon input-icon"
                       @click="acknowledge(row)"/>
           </template>
         </vxe-table-column>
@@ -206,7 +213,7 @@ export default {
       })
     },
     acknowledgeByStationCode() {
-      this.$confirm('是否确认对 【场站:'+this.formatStation(this.stationCode)+'】 进行"全部确认"操作?', '提示', {
+      this.$confirm('是否确认对 【场站:' + this.formatStation(this.stationCode) + '】 进行"全部确认"操作?', '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
@@ -240,9 +247,9 @@ export default {
       })
     },
     formatStation(stationCode) {
-      let name= '未知场站名称'
-      this.stationList.forEach(s=>{
-        if(stationCode == s.value){
+      let name = '未知场站名称'
+      this.stationList.forEach(s => {
+        if (stationCode == s.value) {
           name = s.label
           return
         }

+ 49 - 3
cpp-ui/src/views/largeScreen/index.vue

@@ -194,6 +194,27 @@
                     >删除
                     </el-button>
                   </el-col>
+                  <el-col :span="1.5">
+                    <el-button
+                      type="danger"
+                      plain
+                      icon="el-icon-select"
+                      size="mini"
+                      popper-class="cpp-popper"
+                      @click="getAlarmConfs"
+                    >查询
+                    </el-button>
+                  </el-col>
+                  <el-col :span="1.5">
+                    <el-date-picker
+                      :clearable="false"
+                      v-model="expireTime"
+                      type="datetime"
+                      value-format="timestamp"
+                      placeholder="选择失效时间"
+                      popper-class="cpp-popper">
+                    </el-date-picker>
+                  </el-col>
                 </el-row>
                 <div style="padding-top: 10px">
                   <vxe-table
@@ -207,7 +228,8 @@
                     highlight-current-row
                     show-overflow
                     :data="tableDataAlarmConf"
-                    :radio-config="{trigger: 'row'}">
+                    :radio-config="{trigger: 'row',checkMethod: checkRadioMethod}"
+                  >
                     <vxe-column type="radio" width="60"/>
                     <vxe-table-column field="stationCode" title="场站编号"
                                       :formatter="alarmConfTypeStationFormat"></vxe-table-column>
@@ -276,6 +298,7 @@
                             type="datetime"
                             value-format="yyyy-MM-dd HH:mm:ss"
                             placeholder="选择失效时间"
+                            :picker-options="pickerOptions"
                             popper-class="cpp-popper">
                           </el-date-picker>
                         </el-form-item>
@@ -305,6 +328,17 @@ export default {
   name: 'largeScreen',
   components: {echartsMap},
   data() {
+    const checkExpireTime = (rule, value, callback) => {
+      console.log(value)
+      if (value == null || value === '') {
+        callback(new Error('失效时间不能为空'))
+      }
+      if (value < formatToDateTime(new Date().getTime())) {
+        callback(new Error('失效不能在当前时间之前'))
+      }
+      callback()
+    }
+
     return {
       xdbl:0,
       // 限电场站数
@@ -391,7 +425,7 @@ export default {
           {required: true, message: "类型不能为空", trigger: "blur"}
         ],
         expireTime: [
-          {required: true, message: "失效时间不能为空", trigger: "blur"}
+          {required: true, validator: checkExpireTime}
         ],
       },
       title: '',
@@ -405,7 +439,16 @@ export default {
           label: "包含",
           value: 0
         }
-      ]
+      ],
+      //当前日期之前日期不可选
+      pickerOptions: {
+        disabledDate(time) {
+          return time.getTime() < Date.now() - 8.64e7;
+          // return time.getTime() <= Date.now();
+        }
+      },
+      expireTime: new Date().getTime(),
+
     }
   },
   mounted() {
@@ -801,6 +844,9 @@ export default {
         }
       })
       return result
+    },
+    checkRadioMethod ({ row }) {
+      return row.expireTime > formatToDateTime(new Date().getTime())
     }
 
   }