tanghaolin
2022-10-28 7cd39dc28edf906199478b7454b22282cb61de5c
monitor/station/index.js
@@ -78,7 +78,8 @@
    kpiParas: { //顶部状态
      status: false,
      runNnumber: 0,
      alarmNumber: "无"
      alarmNumber: "无",
      operationModel:true,//true 表示远程开关机 false 表示手动开关机
    },
    scrollHeight: wx.getSystemInfoSync().windowHeight,
@@ -114,7 +115,8 @@
    scrollTop: 0,
    dialogModalVisible: false, //对话框显隐
    operationModel:0,//当前自动关机的模式 0 表示按时长 1表示按流量
    operationModel:1,//当前自动关机的模式 1 表示按时长 2表示按流量 1也表示手动关机--前提是时长为0
    openPwd: "", //开启设备的密码
    rulePwd: {
      visibleStatus: false,
@@ -126,6 +128,7 @@
      message: "密码不能为空"
    }, //关机密码校验
    openTime:"",//开机时长
    openTimeUnit:"hours",//hours 表示按小时 minute 表示按分钟
    ruleOpenTime: {
      visibleStatus: false,
      message: "开机时间不能为空"
@@ -135,6 +138,11 @@
      visibleStatus: false,
      message: "频率不能为空"
    },//频率校验
    openPower:"",
    ruleOpenPower:{
      visibleStatus: false,
      message: "功率不能为空"
    },
    initVideoInfoList: false, //是否请求过监控列表
    isInOperationByEdit: false, //是在进行修改 
    isInOperationByOpenOrClose: false, //是否在进行开关机操作
@@ -262,7 +270,7 @@
        if (allProductPoints.length == 0) {
          return;
        }
        console.log('allProductPoints', allProductPoints);
        // console.log('allProductPoints', allProductPoints);
        var machineList = []
@@ -1000,11 +1008,30 @@
  //改变设备开机状态
  changeProductRunStatus(e) {
    let _this = this
    if (_this.data.isInOperationByOpenOrClose) {
    if (_this.data.isInOperationByOpenOrClose || !_this.data.kpiParas.operationModel) {
      return
    }
    _this.setData({
      dialogModalVisible: true
    })
  },
  //监听开关机模式切换
  handlCloseOrOpen(e){
    this.setData({
      "kpiParas.operationModel":e.detail.value
    })
  },
  //监听自动停止模式选择
  handleOperationModelRadio(e){
    // console.log(e,1012)
    this.setData({
      operationModel:e.detail.value
    })
  },
    // 监听输入的功率值并赋值
    handlePowerValue(e) {
      this.setData({
        openPower: e.detail.value
    })
  },
  // 监听输入的频率值并赋值
@@ -1017,6 +1044,23 @@
  handleInputOpenTime(e){
    this.setData({
      openTime: e.detail.value
    })
  },
  //监听开机时间单位
  handleOpenTimeUnit(e){
    let openTime = this.data.openTime
    if(openTime>0){
      if(e.detail.value == "hours"){
        openTime = openTime / 60
      }
      if(e.detail.value == "minute"){
        openTime = openTime * 60
      }
    }
    this.setData({
      openTimeUnit:e.detail.value,
      openTime:openTime
    })
  },
  //监听开机密码的输入
@@ -1034,6 +1078,12 @@
  },
  //监听停止密码的输入
  handleInputclosePwd(e){
    let openTime = 0
    if(e.detail.value == 3){
      this.setData({
        openTime:openTime
      })
    }
    this.setData({
      closePwd:e.detail.value
    })
@@ -1073,9 +1123,11 @@
      let openTimeRuleMsg = "" //开机时间校验提示
      let frequencyValueRuleMsg = "" //频率校验提示
      let openPwdMsg = "" //开机密码校验提示
      let openTimeRuleVisible = false
      let frequencyValueRuleVisible = false
      let openPwdRule = false
      let openPowerMsg = "" //开机功率校验提示
      let openTimeRuleVisible = false //开机时间校验提示显示
      let frequencyValueRuleVisible = false //开机频率校验提示显示
      let openPwdRule = false // 开机密码校验提示显示
      let openPowerRule = false //开机功率校验提示显示
      if (_this.data.openPwd.length == 0) {
        openPwdMsg = "开机密码不能为空"
        openPwdRule = true
@@ -1105,10 +1157,35 @@
        })
      }
      let openTime = _this.data.openTime
      if(_this.data.operationModel == 1){
      if(openTime.length == 0 || openTime <= 0){
        openTimeRuleMsg = "开机时间填写错误"
        openTimeRuleVisible = true
        isPassRule = false
      }
      if(_this.data.openTimeUnit == "hours"){
        if(openTime < 0.1){
          openTimeRuleMsg = "开机时间不能小于6分钟"
          openTimeRuleVisible = true
          isPassRule = false
        }
      }
      if(_this.data.openTimeUnit == "minute"){
        if(openTime < 6){
          openTimeRuleMsg = "开机时间不能小于6分钟"
          openTimeRuleVisible = true
          isPassRule = false
        }
      }
    }
    let openPower = _this.data.openPower
    if(_this.data.operationModel == 0){
    if(openPower.length == 0 || openPower <= 0){
      openPowerRuleMsg = "功率不能为空或是0"
      openPowerRuleVisible = true
      isPassRule = false
    }
      }
      
      if(!isPassRule){
@@ -1118,7 +1195,9 @@
          "ruleFrequency.message":frequencyValueRuleMsg,
          "ruleFrequency.visibleStatus":frequencyValueRuleVisible,
          "ruleOpenTime.visibleStatus":openTimeRuleVisible,
          "ruleOpenTime.message":openTimeRuleMsg
          "ruleOpenTime.message":openTimeRuleMsg,
          "ruleOpenPower.visibleStatus":openTimeRuleVisible,
          "ruleOpenPower.message":openTimeRuleMsg,
        })
        return
      }
@@ -1139,14 +1218,26 @@
  //泵测试开机
  testStartPump() {
    let _this = this
    let OperatingMode = _this.data.operationModel
    let OperatingValue = ""
    if(OperatingMode == 0){
      OperatingValue = _this.data.openPower
    }
    if(OperatingMode == 1){
      OperatingValue  = _this.data.openTime
    }
    if(OperatingMode == 3){
      OperatingMode = 1
      OperatingValue  = 0
    }
    Request({
      url: Constant.BASE_SERVER_URL + "Monitor/Control/NT/TestStart@V1.0",
      method: 'POST',
      data: {
        Password: _this.data.openPwd,
        HZ: _this.data.frequencyValue,
        OperatingMode: _this.data.operationModel,
        OperatingValue: _this.data.openTime
        OperatingMode: OperatingMode,
        OperatingValue: OperatingValue
      },
      header: {
        'content-type': 'application/json'
@@ -1182,6 +1273,7 @@
            isInOperationByOpenOrClose: false,
            "kpiParas.status": true,
          })
          _this.refreshRecordValue()
        }, 5000);
        // 测试结束-----------
      }
@@ -1229,6 +1321,7 @@
            isInOperationByOpenOrClose: false,
            "kpiParas.status": false,
          })
          _this.refreshRecordValue()
        }, 5000);
      }
    })