yangyin
2024-03-12 f11806ecd3ab311eb89078702770a45fd59d6495
feat: 新增报警推送
已修改4个文件
已添加4个文件
403 ■■■■■ 文件已修改
app.json 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
mine/index/index.js 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
mine/index/index.wxml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
other/alarm/index.js 119 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
other/alarm/index.json 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
other/alarm/index.wxml 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
other/alarm/index.wxss 228 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
project.private.config.json 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app.json
@@ -53,7 +53,8 @@
    "reportForm/index/index",
    "reportForm/Detail/index",
    "video/station/index",
    "video/single/index"
    "video/single/index",
    "other/alarm/index"
  ],
  "requiredPrivateInfos": [
    "getLocation",
mine/index/index.js
@@ -50,6 +50,13 @@
    });
    return;
  },
  //报警推送
  alarmPush: function () {
    wx.navigateTo({
      url: '/other/alarm/index',
    });
    return;
  },
  removeStorage: function () { //清除所有缓存
    wx.clearStorage({
      success(res) {
mine/index/index.wxml
@@ -106,6 +106,12 @@
        <text class="text-grey">重新登录</text>
      </button>
    </view>
    <view class="cu-item arrow" bindtap="alarmPush">
      <button  class="cu-btn content" >
        <text class="cuIcon-notice text-red"></text>
        <text class="text-grey">报警推送</text>
      </button>
    </view>
    <view class="cu-item arrow" bindtap="removeStorage">
      <button class="cu-btn content" >
        <text class="cuIcon-deletefill text-cyan"></text>
other/alarm/index.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,119 @@
// other/alarm/index.js
import Request from "../../utils/api"
var Constant = require('../../utils/constant.js');
var util = require('../../utils/util.js');
Page({
  /**
   * é¡µé¢çš„初始数据
   */
  data: {
    alarmList:[],
    isLoading: false,
    startAlarmDate: util.formatDay(util.GetBeforeDate(7)),
    endAlarmDate: util.formatDay(new Date()),
  },
  /**
   * ç”Ÿå‘½å‘¨æœŸå‡½æ•°--监听页面加载
   */
  onLoad(options) {
    wx.setNavigationBarTitle({
      title: '报警列表',
    });
    this.getAlarmList()
  },
  /**
   * ç”Ÿå‘½å‘¨æœŸå‡½æ•°--监听页面初次渲染完成
   */
  onReady() {
  },
  /**
   * ç”Ÿå‘½å‘¨æœŸå‡½æ•°--监听页面显示
   */
  onShow() {
  },
  /**
   * ç”Ÿå‘½å‘¨æœŸå‡½æ•°--监听页面隐藏
   */
  onHide() {
  },
  getAlarmList(){
    this.isLoading = true
    Request({
      url: Constant.BASE_SERVER_URL + 'Monitor/Value/Alarm/Record/Std/GetLastList@V1.0',
      method: 'GET',
      data: {
        StartTime: this.data.startAlarmDate,
        EndTime: this.data.endAlarmDate,
        Number:10
      },
      success: (res) => {
        this.isLoading = false
        var result=res.data
         if (result.Code != 0) {
          wx.showModal({
            title: '提示',
            content: result.Message,
            showCancel: false,
          })
          return;
        }
        if(result.Data==null) {
          wx.showModal({
            title: '暂无报警数据',
          });
          return
        }
        this.setData({
          alarmList:result.Data
        })
      },
      fail: (err) => {
        if (res.errMsg == 'request:fail timeout') {
          wx.showToast({
            title: '请求超时,请检查您的网络',
            duration: 2000
          })
          return;
        }
      }
    })
  },
  /**
   * ç”Ÿå‘½å‘¨æœŸå‡½æ•°--监听页面卸载
   */
  onUnload() {
  },
  /**
   * é¡µé¢ç›¸å…³äº‹ä»¶å¤„理函数--监听用户下拉动作
   */
  onPullDownRefresh() {
  },
  /**
   * é¡µé¢ä¸Šæ‹‰è§¦åº•事件的处理函数
   */
  onReachBottom() {
  },
  /**
   * ç”¨æˆ·ç‚¹å‡»å³ä¸Šè§’分享
   */
  onShareAppMessage() {
  }
})
other/alarm/index.json
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,3 @@
{
  "usingComponents": {}
}
other/alarm/index.wxml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,30 @@
<!--other/alarm/index.wxml-->
<view class='tui-list-box-raduis'>
<view  class="tui-menu-list tui-youjiantou" wx:for="{{alarmList}}"
        wx:for-item="alarm_item" wx:for-index="node_index" wx:key="node_index">
        <view>
          <block>
            <view class="block_list" style="height:130rpx;"  data-meter-name="{{alarm_item.Name}}" data-meter_node_id="{{alarm_item.ID}}">
              <view class="block_list_center">
                <view class="beng_name" style="justify-content: space-between;">
                  <view>
                    <text>{{alarm_item.Name}}:{{alarm_item.SignalName}}</text>
                  </view>
                  <view class="text-blue light"
                    style="margin-right:20rpx;font-size:22rpx;">
                    æŠ¥è­¦æ—¶é—´ {{alarm_item.AlarmTime?alarm_item.AlarmTime:''}}
                  </view>
                </view>
                <view class="beng_dizi text-grey">
                  <view>于{{alarm_item.DataTime}}达到{{alarm_item.DataValue}},阈值为{{alarm_item.AlarmName }}{{alarm_item.ThresholdValue}}</view>
                <view style="color:{{alarm_item.AlarmLevelColor}}">[{{alarm_item.AlarmLevelName}}]</view>
          </view>
              </view>
            </view>
          </block>
        </view>
 </view>
    </view>
other/alarm/index.wxss
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,228 @@
@import '../../style/icon.wxss';
@import '../../style/main.wxss';
@import '../../style/animation.wxss';
.main {
  height: 100vh;
}
.hovers {
  background-color: 16b5cb;
}
.tab {
  background-color: #fff;
  height: 7vh;
  display: flex;
  line-height: 7vh;
}
.tab view {
  flex: 1 0 auto;
  font-size: 14px;
  color: #333;
  text-align: center;
}
.tab .active {
  color: #16b5cb;
  border-bottom: 1px solid #16b5cb;
  padding-bottom: 1.8vh;
}
.right_btn {
  top: 3rem;
}
/* 20191227 ywg */
.warp_scroll {
  width: 100%;
  border-radius: 50px;
  margin: 0px auto;
}
.list:nth-child(1) {
  border: 0;
}
.list:hover {
  background-color: #16b5cb;
}
.list {
  position: relative;
  min-height: 60px;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  border-top: 1px dashed #EFEFF4;
  background: #fff;
}
.list>i {
  position: absolute;
  padding: 5px;
  bottom: -5px;
  border-radius: 5px;
  background: #EFEFF4;
  z-index: 2;
}
.list>i:nth-child(3) {
  left: -5px;
}
.list>i:nth-child(4) {
  right: -5px;
}
.list:nth-last-child(1)>i {
  opacity: 0
}
.list>view {
  width: 100%;
  font-size: 27rpx;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.list>view>span {
  width: 50%;
}
/* 20200113 ywg */
.tui-menu-list {
  color: #555;
  font-size: 35rpx;
  position: relative;
  border-top: 1px solid rgba(0, 0, 0, 0.15);
}
.tui-list-head {
  background-color: #efeff4;
  line-height: 80rpx;
  color: #6d6d72;
  padding: 0 10px;
  font-size: 35rpx;
  border-bottom: 1px solid rgba(0, 0, 0, 0.15);
  justify-content: space-between;
}
.tui-list-box-raduis {
  /* border: 1px solid #c8c7cc; */
  width: 98vw;
  border-radius: 5px;
  margin: 5px 1vw 10px 1vw;
  overflow: hidden;
  background-color: #fff;
  box-shadow: 0 2px 6px 0 rgba(114, 124, 245, .5);
}
.block_list,
.tui-list-head,
.block_list_left,
.block_list_center>view,
.block_list_url>view,
.block_list_url,
.cover_view,
.map_search,
.map_search>view,
.block_list_url>view>icon {
  display: flex;
  align-items: center;
}
.block_list {
  position: relative;
  width: 100%;
  min-height: 20px;
  font-size: 25rpx;
  justify-content: space-between;
}
.block_list_left {
  display: block;
  width: 15%;
  padding: 10px;
  font-size: 40px;
  color: #16b5cb;
  justify-content: center;
}
.block_list_center {
  width: 100%;
}
.monitor_des{
  font-size: 26rpx;
}
.station_status {
  position: absolute;
  bottom: 10rpx;
  left: 10rpx;
  padding: 20rpx;
  color: #16b5cb;
}
.buzhengchang {
  color: red;
}
.block_list_center>view {
  padding: 5px 0px;
}
.block_list_center>view>span:nth-child(1) {
  display: block;
  height: 13px;
}
.block_list_url {
  width: 100%;
  justify-content: space-around;
  border-top: 1px dashed #EFEFF4;
}
.block_list_url>view {
  width: 30%;
  display: flex;
  align-items: center;
  margin: 5px 0;
  padding: 3px 5px;
  justify-content: center;
  font-size: 30rpx;
  color: #16b5cb;
  /* border-radius: 5px;
  border: 1px solid red; */
}
.block_list_url>view>icon {
  margin-right: 5rpx;
}
/* .block_list_url>view:nth-child(1){
  background-color: #16b5cb;
}
.block_list_url>view:nth-child(2){
  background-color: #2fc593;
}
.block_list_url>view:nth-child(3){
  background-color: #2fc598;
} */
project.private.config.json
@@ -36,6 +36,13 @@
          "query": "id=23&name=%E5%87%AF%E6%B3%89%E4%B8%80%E4%BD%93%E5%8C%96%E5%A2%9E%E5%8E%8B%E6%B3%B5%E7%AB%99",
          "launchMode": "default",
          "scene": null
        },
        {
          "name": "",
          "pathName": "other/alarm/index",
          "query": "",
          "launchMode": "default",
          "scene": null
        }
      ]
    }