tanghaolin
2022-10-28 7cd39dc28edf906199478b7454b22282cb61de5c
添加开关机状态切换
已修改6个文件
172 ■■■■ 文件已修改
monitor/station/index.js 117 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
monitor/station/index.wxml 33 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
monitor/station/index.wxss 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
project.private.config.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
station/list/index.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
station/list/index.wxml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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 = []
@@ -693,7 +701,7 @@
      }, //请求失败
      complete: function () {}, //请求完成后执行的函数
      success: function (res) {
        // console.log('打印刷新后的数据',res);
        //  console.log('打印刷新后的数据',res);
        that.setData({
          loadingHidden: true
        });
@@ -762,7 +770,7 @@
            }
          }
        }
          // console.log(allProductPoints, 736)
        //  console.log(allProductPoints, 736)
        //更新数据
        that.setData({
          allProductPoints: allProductPoints,
@@ -1000,13 +1008,32 @@
  //改变设备开机状态
  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
      })
    },
  // 监听输入的频率值并赋值
  handleFrequencyValue(e) {
    this.setData({
@@ -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,11 +1157,36 @@
        })
      }
      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){
        _this.setData({
@@ -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);
      }
    })
monitor/station/index.wxml
@@ -34,6 +34,13 @@
      <icon class="iconfont icon-guzhang"></icon>
      <view class="kpiText"><text>故障:({{kpiParas.alarmNumber}})</text></view>
    </view>
    <view class="y_c_list">
    <view class="operation_model" style="width: 103px;height: 36px;">
      <switch class="cyan sm radius switch-open" val checked="{{kpiParas.operationModel}}" bindchange="handlCloseOrOpen"></switch>
    </view>
      <view class="kpiText" wx:if="{{kpiParas.operationModel}}"><text>远程开关机</text></view>
      <view class="kpiText" wx:else><text>手动开关机</text></view>
    </view>
  </view>
  <scroll-view wx:if="{{currentTabIndex==0}}" scroll-y class='pointLists' scroll-top="{{scrollTop}}" style="height: calc(100vh - 116rpx);" scroll-with-animation bindscroll="scrollListView">
@@ -228,7 +235,7 @@
<view class="iconfont icon-weibiaoti- {{animationFloatMenu}}" style="font-size:40px;color:#fff;width: 40px; height: 40px; position: fixed; right: 10px; bottom: 100px;z-index:200;display: flex;align-items: center;justify-content:center;background-color: #16b5cb;border-radius:10rpx;box-shadow: 0 2px 6px 0 rgba(114, 124, 245, .5);" bindtap="goTop" wx:if="{{isShowFloatMenu && currentTabIndex == 0 || isShowFloatMenu && currentTabIndex == 2}}"></view>
<!-- 开关机按钮 -->
<view wx:if="{{currentTabIndex == 0}}" 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"></view>
<view wx:if="{{currentTabIndex == 0}}" class="{{kpiParas.status?'cuIcon-stop':'cuIcon-video'}} {{isInOperationByOpenOrClose || !kpiParas.operationModel?'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"></view>
<!-- 开关机密码模态框 -->
<view class="cu-modal {{dialogModalVisible?'show':''}}" style="{{dialogModalVisible?'z-index: 1200;':'z-index: 1100;'}}">
@@ -247,8 +254,12 @@
      <view class="operation_item">
        <label>自动停止模式</label>
        <view style="height: 45rpx; margin-top: 32rpx;">
          <radio class="cyan radio" checked="{{true}}" value="{{operationModel}}" color="#16b5cb" style="margin-right: 10rpx;"></radio><text>按时长</text>
          <radio class="cyan radio" disabled="{{true}}" style="margin:0 10rpx;"></radio><text>按流量</text>
        <radio-group bindchange="handleOperationModelRadio">
          <radio class="cyan radio" checked="{{true}}" value="{{1}}" color="#16b5cb" style="margin-right: 10rpx;"></radio><text>按时长</text>
          <radio class="cyan radio" value="{{2}}" disabled="{{true}}" style="margin:0 10rpx;"></radio><text>按流量</text>
          <radio class="cyan radio" value="{{0}}" style="margin:0 10rpx;"></radio><text>按功率</text>
          <radio class="cyan radio" value="{{3}}" style="margin:0 10rpx;"></radio><text>手动关机</text>
        </radio-group>
        </view>
      </view>
      <view class="operation_item">
@@ -261,11 +272,23 @@
        <input type="number" bindinput="handleFrequencyValue" value="{{frequencyValue}}" />
        <view wx:if="{{ruleFrequency.visibleStatus}}" class="text-red text-sm" style="margin-top: 15rpx;">{{ruleFrequency.message}}</view>
      </view>
      <view class="operation_item">
        <label>请输入总开机时间(小时)</label>
      <view class="operation_item" wx:if="{{operationModel == 1}}">
        <label style="display: flex; justify-content: space-between;align-items: center;">
        <text>请输入总开机时间</text>
        <!-- 开机时间单位切换 -->
        <radio-group bindchange="handleOpenTimeUnit">
          <radio checked="{{true}}" value="hours" class="radio cyan" style="margin-right: 10rpx;"></radio>小时
          <radio value="minute" class="radio cyan" style="margin-right: 10rpx;"></radio>分钟
        </radio-group>
        </label>
        <input type="digit" bindinput="handleInputOpenTime" value="{{openTime}}" />
        <view wx:if="{{ruleOpenTime.visibleStatus}}" class="text-red text-sm" style="margin-top: 15rpx;">{{ruleOpenTime.message}}</view>
      </view>
      <view class="operation_item" wx:if="{{operationModel == 0}}">
        <label>请输入功率</label>
        <input type="digit" bindinput="handlePowerValue" value="{{openPower}}" />
        <view wx:if="{{ruleOpenPower.visibleStatus}}" class="text-red text-sm" style="margin-top: 15rpx;">{{ruleOpenPower.message}}</view>
      </view>
    </block>
    <!-- 停止时输入的密码 -->
    <block wx:else>
monitor/station/index.wxss
@@ -829,4 +829,18 @@
  border-bottom: 1rpx solid #aaaaaa;
  margin-top: 16rpx;
  height: 45rpx;
}
.operation_model{
  width: 207rpx;
    height: 72rpx;
    display: flex;
    justify-content: center;
    align-items: center;
}
.switch-open::after {
  content: "\e7d4";
}
.switch-open::before {
  content: "\e78b";
}
project.private.config.json
@@ -2,7 +2,7 @@
  "projectname": "Wxxcx.NTNY.V4.1",
  "setting": {
    "compileHotReLoad": false,
    "urlCheck": true
    "urlCheck": false
  },
  "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
  "libVersion": "2.26.2"
station/list/index.js
@@ -311,7 +311,7 @@
    //  console.log('泵站列表及其他信息', stationRegionComp);
    if (stationRegionComp != null && stationRegionComp != "") {
      allRegionList = stationRegionComp.RegionList;
      // console.log(allRegionList, "RegionList")
       console.log(allRegionList, "RegionList")
      //
      var timestamp = Date.parse(new Date());
      var cache_length = timestamp / 1000 - stationRegionComp.T;
station/list/index.wxml
@@ -34,10 +34,6 @@
              <view bindtap="tapOpenStationBimPageInList" data-stationid="{{station.ID}}">
                <icon class="iconfont icon-BIM"></icon> <span style="padding-left:10px;padding-right:10px;">模型</span>
              </view>
              <view wx:if="{{false}}" style="width:40rpx;height:100%;" data-stationid="{{station.ID}}" bindtap="moreMeun"
                data-target="bottomModal">
                <text class="cuIcon-moreandroid"></text>
              </view>
            </view>
            <view class="station_status {{zhuangtaiColor=='正常' ?'.buzhengchang':'.zhengchang'}}">
              {{station.Status}}