pc-master #12
@ -6,7 +6,7 @@ Vue.use(Vuex)
 | 
			
		||||
export default new Vuex.Store({
 | 
			
		||||
  state: {
 | 
			
		||||
    lateSend: 100,//写入停止后 *100毫秒进行发送 例如10*100就是1000毫秒(1s)
 | 
			
		||||
    lateSendBtn: 15,//写入停止后 *100毫秒进行发送 例如10*100就是1000毫秒(1s)
 | 
			
		||||
    lateSendBtn: 10,//写入停止后 *100毫秒进行发送 例如10*100就是1000毫秒(1s)
 | 
			
		||||
    equipmentList: [],//当前账户施肥设备
 | 
			
		||||
    equipmentIndex: 1,//当前在第几个设备
 | 
			
		||||
    equipmentName: null,//当前设备 小设备的各个名字
 | 
			
		||||
 | 
			
		||||
@ -130,7 +130,7 @@ export default {
 | 
			
		||||
                    value:command,
 | 
			
		||||
                },
 | 
			
		||||
            };
 | 
			
		||||
            this.change(this.numberList[this.active], dataNum);
 | 
			
		||||
            this.changeBtn(this.numberList[this.active], dataNum);
 | 
			
		||||
        },
 | 
			
		||||
        getSensorType(){
 | 
			
		||||
            this.typeList.forEach((el,index)=>{
 | 
			
		||||
@ -163,7 +163,7 @@ export default {
 | 
			
		||||
                    value: parseInt(listNew, 2),
 | 
			
		||||
                },
 | 
			
		||||
            };
 | 
			
		||||
            this.change('272', dataNum);
 | 
			
		||||
            this.changeBtn('272', dataNum);
 | 
			
		||||
        },
 | 
			
		||||
        getData272() {
 | 
			
		||||
            var inputData = this.inputData
 | 
			
		||||
@ -213,6 +213,31 @@ selectValue(e) {
 | 
			
		||||
      this.changeData(data);
 | 
			
		||||
     }
 | 
			
		||||
     
 | 
			
		||||
    },
 | 
			
		||||
    changeBtn(code,el){
 | 
			
		||||
      var store=this.$store.state
 | 
			
		||||
      var data = {
 | 
			
		||||
        equipmentId: store.equipmentList[store.equipmentIndex-1].deviceId,
 | 
			
		||||
        regAddress: code,
 | 
			
		||||
        num: el.target.value,
 | 
			
		||||
      };
 | 
			
		||||
      this.delayTimerBtn(0, data);
 | 
			
		||||
    },
 | 
			
		||||
    //切换btn的限制 写入停止后j*100毫秒调取函数
 | 
			
		||||
    delayTimerBtn(i, data) {
 | 
			
		||||
      const that = this;
 | 
			
		||||
      //整体接口
 | 
			
		||||
      let j = this.$store.state.lateSendBtn;
 | 
			
		||||
      //避免开启多个计时器
 | 
			
		||||
      this.timer && clearInterval(this.timer);
 | 
			
		||||
 | 
			
		||||
      this.timer = setInterval(() => {
 | 
			
		||||
        ++i;
 | 
			
		||||
        if (i == j) {
 | 
			
		||||
          that.changeData(data);
 | 
			
		||||
          clearInterval(this.timer);
 | 
			
		||||
        }
 | 
			
		||||
      }, 100);
 | 
			
		||||
    },
 | 
			
		||||
        change(code, el) {
 | 
			
		||||
            var store = this.$store.state
 | 
			
		||||
 | 
			
		||||
@ -288,6 +288,7 @@ export default {
 | 
			
		||||
        const that = this;
 | 
			
		||||
        if (localStorage.getItem('token')) {
 | 
			
		||||
            that.getEqbyid();
 | 
			
		||||
            this.getReg()
 | 
			
		||||
            setTimeout(() => {
 | 
			
		||||
                that.pageTimer && clearInterval(that.pageTimer)
 | 
			
		||||
                that.pageTimer = setInterval(() => {
 | 
			
		||||
@ -525,7 +526,7 @@ export default {
 | 
			
		||||
            var data = {
 | 
			
		||||
                "equipmentId": deviceDetail.deviceId,
 | 
			
		||||
                "pattern": 0,//需要根据文档填写 //6目标ph-数值
 | 
			
		||||
                "regNum": 71
 | 
			
		||||
                "regNum": 72
 | 
			
		||||
            }
 | 
			
		||||
            var week = [
 | 
			
		||||
                "星期日",
 | 
			
		||||
@ -542,7 +543,7 @@ export default {
 | 
			
		||||
                    this.getData30()    //数据30/进水出水泵
 | 
			
		||||
                    this.getData29()//数据29 启动方式/信号
 | 
			
		||||
 | 
			
		||||
                    this.getReg()
 | 
			
		||||
                  
 | 
			
		||||
                    this.getleft2List()//获取左下角数据
 | 
			
		||||
                    this.getrightList3()//获取又下角数据
 | 
			
		||||
                    this.getcenterBottom()//获取电磁阀
 | 
			
		||||
@ -570,7 +571,7 @@ export default {
 | 
			
		||||
            return i;
 | 
			
		||||
        },
 | 
			
		||||
        getReg() {
 | 
			
		||||
            var deviceDetail = this.deviceDetail
 | 
			
		||||
            var deviceDetail = store.equipmentList[store.equipmentIndex - 1]
 | 
			
		||||
            //获取传感器种类
 | 
			
		||||
            var data1 = {
 | 
			
		||||
                equipmentId: deviceDetail.deviceId,
 | 
			
		||||
 | 
			
		||||
@ -90,8 +90,8 @@ export default {
 | 
			
		||||
            var store = this.$store.state
 | 
			
		||||
            var data = {
 | 
			
		||||
                equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
 | 
			
		||||
                pattern: 55, //需要根据文档填写 //6目标ph-数值
 | 
			
		||||
                regNum: 17,
 | 
			
		||||
                pattern: 0, //需要根据文档填写 //6目标ph-数值
 | 
			
		||||
                regNum: 72,
 | 
			
		||||
            };
 | 
			
		||||
            this.api.postState(data).then((res) => {
 | 
			
		||||
                console.log(res, 11);
 | 
			
		||||
 | 
			
		||||
@ -164,6 +164,31 @@ selectValue(e) {
 | 
			
		||||
      this.changeData(data);
 | 
			
		||||
     }
 | 
			
		||||
     
 | 
			
		||||
    },
 | 
			
		||||
    changeBtn(code,el){
 | 
			
		||||
      var store=this.$store.state
 | 
			
		||||
      var data = {
 | 
			
		||||
        equipmentId: store.equipmentList[store.equipmentIndex-1].deviceId,
 | 
			
		||||
        regAddress: code,
 | 
			
		||||
        num: el.target.value,
 | 
			
		||||
      };
 | 
			
		||||
      this.delayTimerBtn(0, data);
 | 
			
		||||
    },
 | 
			
		||||
    //切换btn的限制 写入停止后j*100毫秒调取函数
 | 
			
		||||
    delayTimerBtn(i, data) {
 | 
			
		||||
      const that = this;
 | 
			
		||||
      //整体接口
 | 
			
		||||
      let j = this.$store.state.lateSendBtn;
 | 
			
		||||
      //避免开启多个计时器
 | 
			
		||||
      this.timer && clearInterval(this.timer);
 | 
			
		||||
 | 
			
		||||
      this.timer = setInterval(() => {
 | 
			
		||||
        ++i;
 | 
			
		||||
        if (i == j) {
 | 
			
		||||
          that.changeData(data);
 | 
			
		||||
          clearInterval(this.timer);
 | 
			
		||||
        }
 | 
			
		||||
      }, 100);
 | 
			
		||||
    },
 | 
			
		||||
        change(code, el) {
 | 
			
		||||
            var store = this.$store.state
 | 
			
		||||
@ -220,7 +245,7 @@ selectValue(e) {
 | 
			
		||||
                    value: parseInt(num, 2),
 | 
			
		||||
                },
 | 
			
		||||
            };
 | 
			
		||||
            this.change('500', dataNum);
 | 
			
		||||
            this.changeBtn('500', dataNum);
 | 
			
		||||
        },
 | 
			
		||||
        selList2(index) {
 | 
			
		||||
            if (this.actList2.indexOf(index) == -1) {
 | 
			
		||||
@ -238,7 +263,7 @@ selectValue(e) {
 | 
			
		||||
                    value: parseInt(num, 2),
 | 
			
		||||
                },
 | 
			
		||||
            };
 | 
			
		||||
            this.change('501', dataNum);
 | 
			
		||||
            this.changeBtn('501', dataNum);
 | 
			
		||||
        },
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user