tanghaolin
2022-10-24 37c0c345edae57c878ac0dafff27763603f4ca64
添加开关机测试接口对接
已修改2个文件
131 ■■■■ 文件已修改
monitor/station/index.js 127 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
monitor/station/index.wxml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
monitor/station/index.js
@@ -1059,11 +1059,41 @@
      isInOperationByEdit:true,
      "m_currentEditSingleObj.modelVisible":false,
    })
    setTimeout(() => {
      this.setData({
        isInOperationByEdit:false
      })
    }, 10000);
    this.testChangeFrequencyValue(frequencyValue)
  },
  //测试频率值修改
  testChangeFrequencyValue(value){
    let _this = this
    Request({
      url: Constant.BASE_SERVER_URL + "Monitor/Control/NT/TestChange@V1.0",
      method: 'POST',
      data: {HZ:value},
      header: {
        'content-type': 'application/json'
      },
      fail: function (err) {
        console.log(err,"修改失败")
            // 测试使用-----------
            setTimeout(() => {
              wx.showToast({
                title: '修改频率失败',
                icon:"error",
                duration:2000
              })
            }, 5000);
            // 测试结束-----------
      }, //请求失败
      success: function (res) {
        console.log(res,"修改成功")
            // 测试使用-----------
            setTimeout(() => {
              _this.setData({
                isInOperationByEdit:false
              })
            }, 5000);
            // 测试结束-----------
      }
    })
  },
  //监听开机密码的输入
  handleInputPwd(e) {
@@ -1080,7 +1110,7 @@
      })
    }
  },
  //确定按钮
  //确定开/关机按钮
  defindBtn() {
    let _this = this
    if (_this.data.openPwd.length == 0) {
@@ -1094,15 +1124,13 @@
      isInOperationByOpenOrClose:true,
      dialogModalVisible: false
    })
    // 测试使用-----------
    setTimeout(() => {
      _this.setData({
        isInOperationByOpenOrClose:false,
        "kpiParas.status":true,
      })
    }, 10000);
    // 测试结束-----------
    // 判断如果是开机状态则调用关机api
    if(_this.data.kpiParas.status){
      _this.testClosePump()
    }else{
      // 如果是关机状态则调用开机api
      _this.testStartPump()
    }
    
  },
  //隐藏开关机模态框
@@ -1111,9 +1139,78 @@
      dialogModalVisible: false
    })
  },
  //泵测试开机
testStartPump(){
let  _this = this
Request({
  url: Constant.BASE_SERVER_URL + "Monitor/Control/NT/TestStart@V1.0",
  method: 'POST',
  data: {},
  header: {
    'content-type': 'application/json'
  },
  fail: function (err) {
    console.log(err,"开机失败")
        // 测试使用-----------
        setTimeout(() => {
          wx.showToast({
            title: '开机操作失败',
            icon:"error",
            duration:2000
          })
        }, 5000);
        // 测试结束-----------
  }, //请求失败
  success: function (res) {
    console.log(res,"开机成功")
        // 测试使用-----------
        setTimeout(() => {
          _this.setData({
            isInOperationByOpenOrClose:false,
            "kpiParas.status":true,
          })
        }, 5000);
        // 测试结束-----------
  }
})
},
//泵测试关机
testClosePump(){
  let  _this = this
  Request({
    url: Constant.BASE_SERVER_URL + "Monitor/Control/NT/TestStop@V1.0",
    method: 'POST',
    data: {},
    header: {
      'content-type': 'application/json'
    },
    fail: function (err) {
      console.log(err,"关机失败")
      // 测试使用-----------
      setTimeout(() => {
        wx.showToast({
          title: '关机操作失败',
          icon:"error",
          duration:2000
        })
      }, 5000);
      // 测试结束-----------
    }, //请求失败
    success: function (res) {
      console.log(res,"关机成功")
      setTimeout(() => {
        _this.setData({
          isInOperationByOpenOrClose:false,
          "kpiParas.status":false,
        })
      }, 5000);
    }
  })
},
  // 泵开机
  openProduct() {
    let _this = this
    return
    wx.showModal({
      title: "提示",
      content: "是否开启当前机组?",
monitor/station/index.wxml
@@ -246,7 +246,7 @@
    bindtap="goTop" wx:if="{{isShowFloatMenu && currentTabIndex == 0 || isShowFloatMenu && currentTabIndex == 2}}"></view>
<!-- 开关机按钮 -->
<view class="cuIcon-video {{isInOperationByOpenOrClose || isInOperationByEdit?'bg-ban':'bg-normal'}}  {{isExpandList? '.down':'.xia'}}"
<view class="{{kpiParas.status?'cuIcon-stop':'cuIcon-video'}} {{isInOperationByOpenOrClose || isInOperationByEdit?'bg-ban':'bg-normal'}}  {{isExpandList? '.down':'.xia'}}"
    style="font-size:26px;color:#fff;width: 40px; height: 40px; position: fixed; right: 10px; bottom: 155px;z-index:200;display: flex;align-items: center;justify-content:center;border-radius:10rpx;box-shadow: 0 2px 6px 0 rgba(114, 124, 245, .5);"
    bindtap="changeProductRunStatus" wx:if="{{currentTabIndex == 0}}"></view>
@@ -260,7 +260,7 @@
      </view>
    </view>
    <view  style="text-align: left; min-height: 150rpx; box-sizing: border-box; padding: 19rpx;">
     <label>请输入启动密码</label>
     <label>请输入操作密码</label>
     <input  style="border-bottom: 1rpx solid #aaaaaa; margin-top: 16rpx;height: 45rpx;"  password="{{true}}" bindinput="handleInputPwd" value="{{openPwd}}" />
     <view wx:if="{{rulePwd}}" class="text-red text-sm" style="margin-top: 15rpx;">密码不能为空</view>
    </view>