From d7dd4ec28f00307182c022276d4fbed3b3897830 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?home=E5=AD=99?= <1162067978@qq.com> Date: Tue, 26 Aug 2025 09:44:02 +0800 Subject: [PATCH] =?UTF-8?q?08/26=E6=9B=B4=E6=8D=A2=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E5=99=A8=E9=A1=B5=E9=9D=A2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/driverapi.js | 8 +- pages/controller/controller.vue | 4305 ++++++++++++------------------- static/no-sel.png | Bin 0 -> 1651 bytes static/sel-1.png | Bin 0 -> 1415 bytes 4 files changed, 1633 insertions(+), 2680 deletions(-) create mode 100644 static/no-sel.png create mode 100644 static/sel-1.png diff --git a/api/driverapi.js b/api/driverapi.js index 551808e7..a076be61 100644 --- a/api/driverapi.js +++ b/api/driverapi.js @@ -31,13 +31,14 @@ let api = { getcontrol_rtdata: "/getcontrol/rtdata", //主页查看控制器实时数据 getcontrol_fsdata: "/getcontrol/fsdata", //控制器实时数据折线图 - getcontrol_cpermission: '/getcontrol/cpermission', //根据设备id查询控制器权限 + getcontrol_cpermission: '/dcpermission/get', //根据设备id查询控制器权限 getControl_getState: '/readControl/getState', //控制器 设备运行状态 getReadControlliShuiControl: '/readControl/liShuiControl', //控制器 顶模和风机 readControl_fiveControl: '/readControl/fiveControl', //读取(五防项目)控制器 getcontrol_wxgetpermission: '/getcontrol/wxgetpermission', //小程序手机控制权限数据 getcontrol_getPermissionStatus: '/getcontrol/getPermissionStatus', //控制器页面显示 + getcontrol_getStatePermissionStatus: '/getcontrol/getStatePermissionStatus', //控制器 全部设备权限 readControl_solenoidValve1: '/readControl/solenoidValve1', //1#电磁阀 readControl_solenoidValve2: '/readControl/solenoidValve2', //2#电磁阀 readControl_solenoidValve3: '/readControl/solenoidValve3', //3#电磁阀 @@ -52,7 +53,10 @@ let api = { readControl_readcirculationfan: '/readControl/readcirculationfan', //读取(环流风扇)控制器 readControl_fanwetcurtain: '/readControl/fanwetcurtain', //读取(风机湿帘)控制器 readControl_co2replenishment: '/readControl/co2replenishment', //读取CO2控制器 - + + getcontrol_delPermissionStatus: '/getcontrol/delPermissionStatus', //控制器 删除设备 + getcontrol_addStatepermission: '/getcontrol/addStatepermission', //控制器 添加设备 + readControl_innercurtain: '/readControl/innercurtain', //内遮阳 readControl_externalsunshade: '/readControl/externalsunshade', //外遮阳 readControl_readskylight: '/readControl/readskylight', //通风窗 diff --git a/pages/controller/controller.vue b/pages/controller/controller.vue index 765d62e5..f1527ac2 100644 --- a/pages/controller/controller.vue +++ b/pages/controller/controller.vue @@ -2,1047 +2,353 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {{ standardFanStatus.name }} - - - 设置 - - - - - - - - - - 自动控制 - - - - - - 手机控制 - - - - - - - - 1#风机 - - - - - 2#风机 - - - - - 3#风机 - - - - - 4#风机 - - - - - 5#风机 - - - - - - - 当前设备无效 - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - 控制模式: - - - 打   开 - {{ item.type_2 ? '关   闭' : '停   止' }} - 关   闭 - - - - - - - - 通道打开; + + + + 当前设备无效 - - - - - - 1#风机 - - - - - 2#风机 - - - - - 3#风机 - - - - - 4#风机 - - - - - 5#风机 - - - - - - - 当前设备无效 - - - + + - - - - - - - - - - - {{coldWarmFanStatus.name}} - - - 设置 - - - - - - - - - - 自动控制 - - - - - - 手机控制 - - - - - - 加热模式 - - - - 制冷模式 - - - - - - - - - 1#风机 - - - - - - - 2#风机 - - - - - - - 3#风机 - - - - - - - 4#风机 - - - - - - - 当前设备无效 - - - - - - - - - {{supplementLightStatus.name}} - - - 设置 - - - - - - - - - 自动控制 - - - - - 手机控制 - - - - - - - - - 1#补光灯 - - - - - - - 2#补光灯 - - - - - - - 3#补光灯 - - - - - - - 4#补光灯 - - - - - - - 5#补光灯 - - - - - - - 6#补光灯 - - - - - - - 7#补光灯 - - - - - - - 8#补光灯 - - - - - - - 当前设备无效 - - - - - - - - - - - - - - + + + + + + + + + {{ item.statePermissions }} + + + + + @@ -1089,7 +395,7 @@ - 顶卷膜{{indexs}} + {{skylightName}} @@ -1125,7 +431,7 @@ - {{fanStatus.name}} + {{fanName}} @@ -1181,7 +487,7 @@ - {{standardFanStatus.name}} + {{standardFanName}} @@ -1284,7 +590,7 @@ - 冷暖风机 + {{coldWarmFanName}} @@ -1347,7 +653,7 @@ - 补光灯 + {{supplementLightName}} @@ -1423,7 +729,7 @@ - {{ circulationFengshanList[popCirculationFengshanName].name }} + {{ popCirculationFengshanName }} @@ -1459,7 +765,7 @@ - {{ airconditioning.name}} + {{ airconditioningName}} @@ -1486,17 +792,17 @@ 手动开启空调的温度℃ + @blur="blurChangeCount(22043, $event)" />℃ 手自动设置: - 空调的风速 + 空调的风速 {{airconditioningInputDataNew[22041]}} - + 空调的模式 @@ -1556,7 +862,7 @@ 16# - + @@ -1566,15 +872,17 @@ - - + + - {{ CO2List[popCO2Name].name}} + {{ popCO2Name}} @@ -1606,7 +914,7 @@ - {{ fanwetcurtainList[popfanwetcurtainName].name}} + {{ popfanwetcurtainName}} @@ -1642,7 +950,7 @@ - {{ highpressuremistList[pophighpressuremistName].name}} + {{ pophighpressuremistName}} @@ -1678,7 +986,7 @@ - {{ outFlipWindowList[popoutFlipWindowName].name}} + {{ popoutFlipWindowName}} @@ -1718,7 +1026,7 @@ - {{ innercurtainList[popinnercurtainName].name }} + {{ popinnercurtainName }} @@ -1758,7 +1066,7 @@ - {{externalsunshadeList[popexternalsunshadeName].name}} + {{popexternalsunshadeName}} @@ -1798,7 +1106,7 @@ - {{airWindowList[popairWindowName].name}} + {{popairWindowName}} @@ -1838,7 +1146,7 @@ - {{ interiorthermalinsulationList[interiorthermalinsulationName].name}} + {{interiorthermalinsulationName}} @@ -1878,7 +1186,7 @@ - {{ upFaceInsulationList[upFaceInsulationName].name}} + {{ upFaceInsulationName}} @@ -1913,7 +1221,7 @@ - + 暂无权限查看 @@ -1923,134 +1231,22 @@ export default { data() { return { + // 添加设备弹窗 + addModel:false, // 头部导航背景 background: { backgroundColor: '#24B383', }, deviceId: '', + statusTime: 2, //status状态的秒数 + allDevicestatus: [],//所有权限 + nowDevicestatus: [],//当前设备权限 + selDevicestatus: [],//重叠上面数组 判断选择弹窗是否打勾 + statusList: [], + wxgetpermission: [], //小程序手机控制权限数据 - itemList: [{ - head: "1#顶卷膜", - type: 21680, - open_value: 0, - close_value: 0 - }, - { - head: "2#顶卷膜", - type: 21683, - open_value: 0, - close_value: 0 - }, - { - head: "3#顶卷膜", - type: 21686, - open_value: 0, - close_value: 0 - }, - { - head: "1#侧卷膜", - type: 21689, - open_value: 0, - close_value: 0 - }, - { - head: "2#侧卷膜", - type: 21692, - open_value: 0, - close_value: 0 - }, - { - head: "外遮阳1", - type: 21695, - open_value: 0, - close_value: 0 - }, - { - head: "外遮阳2", - type: 21698, - open_value: 0, - close_value: 0 - }, - { - head: "外遮阳3", - type: 21701, - open_value: 0, - close_value: 0 - }, - { - head: "外遮阳4", - type: 21704, - open_value: 0, - close_value: 0 - }, - { - head: "外遮阳5", - type: 21707, - open_value: 0, - close_value: 0 - }, - { - head: "风机1", - type: 21710, - value: 0, - type_2: 2 - }, - { - head: "风机2", - type: 21712, - value: 0, - type_2: 2 - }, - { - head: "风机3", - type: 21714, - value: 0, - type_2: 2 - }, - { - head: "风机4", - type: 21716, - value: 0, - type_2: 2 - }, - { - head: "风机5", - type: 21718, - value: 0, - type_2: 2 - }, - { - head: "风机6", - type: 21720, - value: 0, - type_2: 2 - }, - { - head: "风机7", - type: 21722, - value: 0, - type_2: 2 - }, - { - head: "风机8", - type: 21724, - value: 0, - type_2: 2 - }, - { - head: "风机9", - type: 21726, - value: 0, - type_2: 2 - }, - { - head: "风机10", - type: 21728, - value: 0, - type_2: 2 - }, - ], + itemStyle: { width: "690rpx", background: " #FFFFFF", @@ -2066,95 +1262,15 @@ color: "#333333", height: '91rpx' }, - txt_act_list: [{ - txt_act21680: 0, - key: 21680 - }, - { - txt_act21683: 0, - key: 21683 - }, - { - txt_act21686: 0, - key: 21686 - }, - { - txt_act21689: 0, - key: 21689 - }, - { - txt_act21692: 0, - key: 21692 - }, - { - txt_act21695: 0, - key: 21695 - }, - { - txt_act21698: 0, - key: 21698 - }, - { - txt_act21701: 0, - key: 21701 - }, - { - txt_act21704: 0, - key: 21704 - }, - { - txt_act21707: 0, - key: 21707 - }, - { - txt_act21710: 0, - key: 21710 - }, - { - txt_act21712: 0, - key: 21712 - }, - { - txt_act21714: 0, - key: 21714 - }, - { - txt_act21716: 0, - key: 21716 - }, - { - txt_act21718: 0, - key: 21718 - }, - { - txt_act21720: 0, - key: 21720 - }, - { - txt_act21722: 0, - key: 21722 - }, - { - txt_act21724: 0, - key: 21724 - }, - { - txt_act21726: 0, - key: 21726 - }, - { - txt_act21728: 0, - key: 21728 - }, - ], + inputData: [], inputData1: [], timer: '', purviewList: [], //权限的list typeList: [], - statusList: [], statusInterval: null, //状态接口调取 + fanName:'', fanStatus: { name: '风机', open: 0, @@ -2163,13 +1279,16 @@ indexs: 1, //弹窗打开的顶卷膜index openIndex1: 0, //顶卷膜的index modelShow: false, //顶卷膜show + + skylightName:'', fanmodelShow: false, //风机show openIndex: 0, //风机有效性 inputData2: [], actList1: [], - + //标准风机 standardFanmodelShow: false, + standardFanName:'', standardFanStatus: { name: '标准风机', open: 0, @@ -2185,310 +1304,64 @@ pop_title: '', close_btn_all: false, fiveControlUrl: "", - fiveControlList: [{ - title: '加温水泵', - controlState: 0, - num: '1000', - close_btn: false, - open_num: 1001, - open: 0 - }, - { - title: '地热风机', - controlState: 0, - num: '1002', - close_btn: false, - open_num: 1003, - open: 0 - }, - { - title: '上风口', - controlState: 0, - num: '1004', - close_btn: true, - progress_state_num: 1005, //状态 - progress_state: 0, //状态值 - progress_num: '1006', //开度值 - progress: '' - }, - { - title: '下风口', - controlState: 0, - num: '1007', - close_btn: true, - progress_state_num: 1008, //状态 - progress_state: 0, //状态值 - progress_num: '1009', - progress: '' - }, - { - title: '卷被', - controlState: 0, - num: '1010', - close_btn: true, - progress_state_num: 1011, //状态 - progress_state: 0, //状态值 - progress_num: '1012', - progress: '' - }, - { - title: '除雪', - controlState: 0, - num: '1013', - close_btn: false, - open_num: 1014, - open: 0 - }, - ], - + valveControlShow: false, //电磁阀 valvePopTitle: '', valve_input_value: '', valveControlIndex: 0, - electronMagneticStatus: [{ - id:11, - name: '1#电磁阀', - code: 1166, - state:0, - open:0, - show:0, - }, - { - id:12, - name: '2#电磁阀', - code: 1167, - state:0, - open:0, - show:0, - }, - { - id:13, - name: '3#电磁阀', - code: 1168, - state:0, - open:0, - show:0, - }, - { - id:14, - name: '4#电磁阀', - code: 1169, - state:0, - open:0, - show:0, - }, - { - id:15, - name: '5#电磁阀', - code: 1170, - state:0, - open:0, - show:0, - }, - { - id:16, - name: '6#电磁阀', - code: 1171, - state:0, - open:0, - show:0, - }, - { - id:17, - name: '7#电磁阀', - code: 1172, - state:0, - open:0, - show:0, - }, - { - id:18, - name: '8#电磁阀', - code: 1173, - state:0, - open:0, - show:0, - }, - ], - electronMagneticList:[], + + electronMagneticList: [], supplementLightShow: false, //补光灯 lightControlIndex: 0, - supplementLightStatus: { - name: '补光灯', - open: 0, - status: [] - }, + supplementLightName:'', + actListLight: [], coldWarmFanShow: false, //冷暖风机 coldWarmFanIndex: 0, - coldWarmFanStatus: { - name: '冷暖风机', - open: 0, - open1: 0, - status: [] - }, + coldWarmFanName:'', + coldWarmFanList: [], circulationFengshanShow: false, //环流风扇 circulationControlIndex: 0, - circulationFengshanList: [{ - name: '1#环流风扇', - state: 0, - open: 0 - }, - { - name: '2#环流风扇', - state: 0, - open: 0 - }, - ], + popCirculationFengshanName: '', fanwetcurtainShow: false, //湿帘泵 fanwetcurtainControlIndex: 0, - fanwetcurtainList: [{ - name: '1#湿帘泵', - state: 0, - open: 0 - }, - { - name: '2#湿帘泵', - state: 0, - open: 0 - }, - ], + popfanwetcurtainName: '', CO2Show: false, //CO2补气 CO2Index: 0, - CO2List: [{ - name: 'CO2补气1', - state: 0, - open: 0 - }, - { - name: 'CO2补气2', - state: 0, - open: 0 - }, - ], popCO2Name: '', highpressuremistShow: false, //高压微雾 highpressuremistControlIndex: 0, - highpressuremistList: [{ - name: '1#高压微雾', - state: 0, - open: 0 - }, - { - name: '2#高压微雾', - state: 0, - open: 0 - }, - ], + pophighpressuremistName: '', outFlipWindowShow: false, //湿帘外翻窗 outFlipWindowControlIndex: 0, - outFlipWindowList: [{ - name: '1#湿帘外翻窗', - state: 0, - progress: 0, - statusProgress: 0 - }, - { - name: '2#湿帘外翻窗', - state: 0, - progress: 0, - statusProgress: 0 - }, - ], + popoutFlipWindowName: '', innercurtainShow: false, //内遮阳 innercurtainControlIndex: 0, - innercurtainList: [{ - name: '1#内遮阳', - state: 0, - progress: 0, - statusProgress: 0 - }, - { - name: '2#内遮阳', - state: 0, - progress: 0, - statusProgress: 0 - }, - ], + popinnercurtainName: '', externalsunshadeShow: false, //外遮阳 externalsunshadeControlIndex: 0, - externalsunshadeList: [{ - name: '1#外遮阳', - state: 0, - progress: 0, - statusProgress: 0 - }, - { - name: '2#外遮阳', - state: 0, - progress: 0, - statusProgress: 0 - }, - ], + popexternalsunshadeName: '', airWindowShow: false, //通风窗 airWindowControlIndex: 0, - airWindowList: [{ - name: '1#通风窗', - state: 0, - progress: 0, - statusProgress: 0, - pid: 0 - }, - { - name: '2#通风窗', - state: 0, - progress: 0, - statusProgress: 0, - pid: 0 - }, - { - name: '3#通风窗', - state: 0, - progress: 0, - statusProgress: 0, - pid: 0 - }, - { - name: '4#通风窗', - state: 0, - progress: 0, - statusProgress: 0, - pid: 0 - }, - { - name: '5#通风窗', - state: 0, - progress: 0, - statusProgress: 0, - pid: 0 - }, - { - name: '6#通风窗', - state: 0, - progress: 0, - statusProgress: 0, - pid: 0 - }, - ], popairWindowName: '', interiorthermalinsulationShow: false, //内保温 @@ -2510,68 +1383,77 @@ upFaceInsulationShow: false, //立面保温 upFaceInsulationIndex: 0, - upFaceInsulationList: [{ - name: '1#立面保温', - state: 0, - progress: 0, - statusProgress: 0 - }, - { - name: '2#立面保温', - state: 0, - progress: 0, - statusProgress: 0 - }, - { - name: '3#立面保温', - state: 0, - progress: 0, - statusProgress: 0 - }, - { - name: '4#立面保温', - state: 0, - progress: 0, - statusProgress: 0 - }, - ], + upFaceInsulationName: '', airconditioningShow: false, //湿空调 airconditioningControlIndex: 0, - airconditioning: { - name: '空调', - state: 0, - open: 0, - open1: 0 - }, - actList2:[], - airconditioningInputData:{}, - airconditioningInputDataNew:{}, - type1show:false, - typeList1: [ - { label: "自动调整风速", value: 0 }, - { label: "1级风速", value: 1 }, - { label: "2级风速", value: 2 }, - { label: "3级风速", value: 3 }, - { label: "4级风速", value: 4 }, - { label: "5级风速", value: 5 }, - { label: "6级风速", value: 6 }, - ], - - type2show:false, - typeList2: [ - { label: "自动模式", value: 0 }, - { label: "制冷模式", value: 1 }, - { label: "制热模式", value: 2 }, - { label: "除湿模式", value: 3 }, - { label: "送风模式", value: 4 }, - { label: "冷暖模式", value: 5 }, - ], + airconditioningName:'', + + actList2: [], + airconditioningInputData: {}, + airconditioningInputDataNew: {}, + type1show: false, + typeList1: [{ + label: "自动调整风速", + value: 0 + }, + { + label: "1级风速", + value: 1 + }, + { + label: "2级风速", + value: 2 + }, + { + label: "3级风速", + value: 3 + }, + { + label: "4级风速", + value: 4 + }, + { + label: "5级风速", + value: 5 + }, + { + label: "6级风速", + value: 6 + }, + ], + + type2show: false, + typeList2: [{ + label: "自动模式", + value: 0 + }, + { + label: "制冷模式", + value: 1 + }, + { + label: "制热模式", + value: 2 + }, + { + label: "除湿模式", + value: 3 + }, + { + label: "送风模式", + value: 4 + }, + { + label: "冷暖模式", + value: 5 + }, + ], }; }, onReady() { - if (this.purviewList.findIndex(item => item.id =='10') != -1) { + if (this.purviewList.indexOf('10') != -1) { setTimeout(() => { this.$refs.collapseView.init(); }, 1000); @@ -2583,7 +1465,9 @@ if (options.id) { this.deviceId = options.id; } - + uni.showLoading({ + title: '加载中...' + }); this.dataInit() }, beforeDestroy() { @@ -2596,6 +1480,119 @@ this.dataInit(); }, methods: { + selClick(item) { + var deviceId = this.deviceId + var statusId = item.id.toString() + if (item.select) { + item.select = false + this.$forceUpdate(); + this.$http({ + url: this.api.getcontrol_delPermissionStatus + '?deviceId=' + deviceId+'&permissionid='+statusId, + method: 'POST' + }).then((res => { + if (res.code == 200) { + uni.showToast({ + title: '修改成功', + icon: 'none', + duration: 2000 + }) + this.getPermissionStatus() + } else { + uni.showToast({ + title:res.msg, + icon: 'none', + duration: 2000 + }) + } + })) + } else { + item.select = true + this.$forceUpdate(); + this.$http({ + url: this.api.getcontrol_addStatepermission + '?deviceId=' + deviceId+'&Permissionid='+statusId, + method: 'POST' + }).then((res => { + if (res.code == 200) { + uni.showToast({ + title: '修改成功', + icon: 'none', + duration: 2000 + }) + this.getPermissionStatus() + } + })) + } + }, + openModel(item){ + // 根据id打开弹窗 + if(item.id==6||item.id==7||item.id==8||item.id==9||item.id==10||item.id==11){ + //五防弹窗 + this.openFiveControlShow(item) + }else if(item.id==2||item.id==3||item.id==4||item.id==5){ + //顶卷膜 + this.openModelShow(item) + }else if(item.id==1){ + //丽水风机 + this.fanmodelHander(item) + }else if(item.id==17){ + //标准风机 + this.standardFanmodelHander(item) + }else if(item.id==42||item.id==43||item.id==44||item.id==45||item.id==46||item.id==47||item.id==48||item.id==49){ + //电磁阀 + this.openValveControlShow(item) + }else if(item.id==39){ + //冷暖风机 + this.standardFanmodelHander(item) + }else if(item.id==12){ + //补光灯 + this.supplementLightHander(item) + }else if(item.id==15||item.id==16){ + //环流风扇 + this.circulationFengshanHander(item) + }else if(item.id==38){ + //空调 + this.airconditioningHander(item) + }else if(item.id==40||item.id==41){ + //CO2补气 + this.CO2Hander(item) + }else if(item.id==18||item.id==19){ + //湿帘泵 + this.fanwetcurtainHander(item) + }else if(item.id==13||item.id==14){ + //高压微雾 + this.highpressuremistHander(item) + }else if(item.id==20||item.id==21){ + //湿帘外翻窗 + this.outFlipWindowHander(item) + }else if(item.id==22||item.id==23){ + //内遮阳 + this.innercurtainHander(item) + }else if(item.id==24||item.id==25){ + //外遮阳 + this.externalsunshadeHander(item) + }else if(item.id==26||item.id==27||item.id==28||item.id==29){ + //通风窗1234 + this.airWindowHander(item) + }else if(item.id==32||item.id==33){ + //通风窗56 + this.airWindowHander1(item) + }else if(item.id==30||item.id==31){ + //内保温 + this.interiorthermalinsulationHander(item) + }else if(item.id==34||item.id==35|item.id==36||item.id==37){ + //立面保温 + this.upFaceInsulationHander(item) + }else{ + uni.showToast({ + title: '暂无法设置。', + icon: 'none', + duration: 2000 + }) + } + + + + }, // 小程序手机控制权限数据 getcontrol_wxgetpermission() { var deviceId = this.deviceId @@ -2960,7 +1957,7 @@ this.changeBtn(22339, dataNum); } }, - + changeBtn(code, el) { @@ -2988,10 +1985,11 @@ }, 100); }, // 丽水 打开顶卷膜的弹窗 - openModelShow(index) { - this.indexs = index + 1 + openModelShow(item) { + // id从2开始 需要减到0 + this.indexs = (item.id-2) + 1 this.modelShow = true - + this.skylightName=item.name var data = { deviceId: this.deviceId }; @@ -3007,1076 +2005,984 @@ // this.getAct21601() })) }, - // 根据type参数返回对应的txt_act21680 - getTypeRoll(i) { - let arr = this.txt_act_list.filter(el => el.key == i) - return arr[0][Object.keys(arr[0])[0]] - }, + // 合并两个数组 toNewList(list, list2) { let newList = list.map((item, index) => { // 从第二个数组中获取对应的 nickName 并赋值给 name const match = list2[index]; return match ? { - ...item, - id: match.childId, - name: match.nickName ? match.nickName : item.name - } : item; + ...match, + ...item, + name: match.permissionNickName ? match.permissionNickName : item.name + } : + item; }); - return newList + return newList; + }, + getPermissionStatus() { + var deviceId = this.deviceId + + this.$http({ + url: this.api.getcontrol_getPermissionStatus, + data: { + deviceId: deviceId + }, + method: 'get', + }).then(res => { + if (res.code == 200) { + uni.hideLoading() + uni.stopPullDownRefresh(); + this.nowDevicestatus = res.data + this.getControl_getState() + var list1 = this.allDevicestatus + var list2 = this.nowDevicestatus + var resultArray = [] + // 遍历 list1 + for (const item1 of list1) { + // 查找在 list2 中是否有相同 id 的对象 + const matchingItem = list2.find(item2 => item2.id === item1.id); + + // 如果找到匹配的对象,则在 list1 对应的对象中添加 select 属性 + if (matchingItem) { + item1.select = true; + } else { + // 如果没找到匹配的对象,则添加 select 属性并设置为 false + item1.select = false; + } + + // 将处理后的对象添加到结果数组中 + resultArray.push(item1); + } + this.selDevicestatus = resultArray + } + }) + }, + getStatePermissionStatus() { + + this.$http({ + url: this.api.getcontrol_getStatePermissionStatus, + method: 'get', + }).then(res => { + if (res.code == 200) { + this.allDevicestatus = res.data + this.getPermissionStatus() + } + }) }, // 读取所有寄存器的状态值 dataInit() { - var deviceId = this.deviceId - this.$http({ - url: this.api.getcontrol_cpermission + '?deviceId=' + deviceId, - method: 'POST', - }).then((res => { - if (res.code == 200) { - uni.hideLoading() - uni.stopPullDownRefresh(); - + // 控制器状态获取 - res.data.forEach((el, index) => { - this.purviewList.push({id:el.id.toString(),state:el.state}) - if (el.id == '19') { - //通风窗 - this.airWindowList = this.toNewList(this.airWindowList, el.child) + this.getStatePermissionStatus() + clearInterval(this.statusInterval) && this.statusInterval + this.statusInterval = setInterval(() => { + this.getControl_getState() + }, this.statusTime * 1000); + // //查看金华权限 + // if (this.purviewList.indexOf('10') != -1) { + // // 小程序手机控制权限数据 + // this.getcontrol_wxgetpermission(); + // this.$http({ + // url: this.api.readJinHuaControl_reg + '?deviceId=' + deviceId, + // method: 'POST', + // }).then(res => { + // // console.log(res, 'deviceId读取所有寄存器的状态值'); + // if (res.code == 200) { + // uni.hideLoading() + // uni.stopPullDownRefresh(); + // this.inputData = res.data + // for (let i = 0; i < this.itemList.length; i++) { + // if (!this.itemList[i].type_2) { + // this.itemList[i].open_value = this.inputData[Number( + // '21681') + + // i * + // 3] + // this.itemList[i].close_value = this.inputData[Number( + // '21682') + + // i * + // 3] + // this.getType((21680 + i * 3), 1) + // } else { + // this.itemList[i].value = this.inputData[21711 + (i - 10) * + // 2] + // this.getType((21710 + (i - 10) * 2), 2) + // } - } else if (el.id == '25') { - //外遮阳 - this.externalsunshadeList = this.toNewList(this.externalsunshadeList, - el.child) - console.log(this.externalsunshadeList); - } else if (el.id == '24') { - //内遮阳 - this.innercurtainList = this.toNewList(this.innercurtainList, el.child) - } else if (el.id == '27') { - //内保温 - this.interiorthermalinsulationList = this.toNewList(this - .interiorthermalinsulationList, el.child) - } else if (el.id == '30') { - //立面保温 - this.CO2List = this.toNewList(this.CO2List, el.child) - } else if (el.id == '29') { - //立面保温 - this.upFaceInsulationList = this.toNewList(this.upFaceInsulationList, - el.child) - } else if (el.id == '20') { - //补光灯 - this.supplementLightStatus.name = el.nickName + // } - } else if (el.id == '31') { - //冷暖风机 - this.coldWarmFanStatus.name = el.nickName + // // this.getType('21680') + // // this.getType('21683') + // // this.getType('21686') + // // this.getType('21689') + // // this.getType('21692') - } else if (el.id == '26') { - //风机/湿帘泵/湿帘外翻窗 - el.child.forEach((el1, index1) => { - if (el1.childId == '20') { - //风机 - this.standardFanStatus.name = el1.nickName - } else if (el1.childId == '21') { - this.fanwetcurtainList.forEach((el2, index2) => { - el2.name = el1.nickName + (index2 + 1) - }) - } else if (el1.childId == '22') { - this.outFlipWindowList.forEach((el2, index2) => { - el2.name = el1.nickName + (index2 + 1) - }) - } - }) - } else if (el.id == '28') { - //空调 - this.airconditioning.name = el.nickName - } else if (el.id == '21') { - //环流风扇 - this.circulationFengshanList = this.toNewList(this - .circulationFengshanList, el.child) - } else if (el.id == '23') { - //高压微雾 - this.highpressuremistList = this.toNewList(this.highpressuremistList, - el.child) - } else { - this.electronMagneticStatus.forEach((el1,index)=>{ - if(el1.id==el.id){ - this.electronMagneticStatus[index].name=el.nickName - this.electronMagneticStatus[index].show=el.state - } - }) - } + // } + // }) + // } + //查看丽水权限 + // if (this.purviewList.indexOf('9') != -1) { + // // this.getControl_getState() + // // this.getReadControlliShuiControl() + // // clearInterval(this.statusInterval) && this.statusInterval + // // this.statusInterval = setInterval(() => { + // // this.getControl_getState() + // // }, 3000); + // } + // 查看五防项目权限 + // if (this.purviewList.indexOf('8') != -1) { + // } - }) + // 读取(补光灯)控制器 + // if(this.purviewList.indexOf('20') != -1){ + // }; - // 控制器状态获取 - this.getControl_getState(); - clearInterval(this.statusInterval) && this.statusInterval - this.statusInterval = setInterval(() => { - this.getControl_getState() - }, 3000); + // 环流风扇 + // if(this.purviewList.indexOf('21') != -1){}; - //查看金华权限 - if (this.purviewList.findIndex(item => item.id =='10') != -1) { - // 小程序手机控制权限数据 - this.getcontrol_wxgetpermission(); - this.$http({ - url: this.api.readJinHuaControl_reg + '?deviceId=' + deviceId, - method: 'POST', - }).then(res => { - // console.log(res, 'deviceId读取所有寄存器的状态值'); - if (res.code == 200) { - uni.hideLoading() - uni.stopPullDownRefresh(); - this.inputData = res.data - for (let i = 0; i < this.itemList.length; i++) { - if (!this.itemList[i].type_2) { - this.itemList[i].open_value = this.inputData[Number( - '21681') + - i * - 3] - this.itemList[i].close_value = this.inputData[Number( - '21682') + - i * - 3] - this.getType((21680 + i * 3), 1) - } else { - this.itemList[i].value = this.inputData[21711 + (i - 10) * - 2] - this.getType((21710 + (i - 10) * 2), 2) - } + }, - } + // getReadControlliShuiControl() { + // var data = { + // deviceId: this.deviceId + // }; + // this.$http({ + // url: this.api.getReadControlliShuiControl, + // data: data, + // method: 'GET', + // }).then((res => { + // this.inputData2 = res.data; + // this.openIndex = this.inputData2[21600] + // this.getAct21601() + // })) + // }, + getAct21601() { + this.actList1 = [] + var num = this.inputData2['21601'] + var num1 = this.padString(num.toString(2), 5) + var openListNew = [] + openListNew = num1.split("") + openListNew.forEach((el, index) => { + this.actList1.push(openListNew[openListNew.length - index - 1]) + }) + }, + getAct22063() { + this.actList2 = [] + var num = this.airconditioningInputData[22063] - // this.getType('21680') - // this.getType('21683') - // this.getType('21686') - // this.getType('21689') - // this.getType('21692') - - } - }) - } - //查看丽水权限 - // if (this.purviewList.findIndex(item => item.id =='9') != -1) { - // // this.getControl_getState() - // // this.getReadControlliShuiControl() - // // clearInterval(this.statusInterval) && this.statusInterval - // // this.statusInterval = setInterval(() => { - // // this.getControl_getState() - // // }, 3000); - // } - - // 查看五防项目权限 - // if (this.purviewList.findIndex(item => item.id =='8') != -1) { - - // } - - // 读取(补光灯)控制器 - // if(this.purviewList.findIndex(item => item.id =='20') != -1){ - - // }; - - // 环流风扇 - // if(this.purviewList.findIndex(item => item.id =='21') != -1){}; - } - })) - - }, - - // getReadControlliShuiControl() { - // var data = { - // deviceId: this.deviceId - // }; - // this.$http({ - // url: this.api.getReadControlliShuiControl, - // data: data, - // method: 'GET', - // }).then((res => { - // this.inputData2 = res.data; - // this.openIndex = this.inputData2[21600] - // this.getAct21601() - // })) - // }, - getAct21601() { - this.actList1 = [] - var num = this.inputData2['21601'] - var num1 = this.padString(num.toString(2), 5) - var openListNew = [] - openListNew = num1.split("") - openListNew.forEach((el, index) => { - this.actList1.push(openListNew[openListNew.length - index - 1]) - }) - }, - getAct22063() { - this.actList2 = [] - var num = this.airconditioningInputData[22063] - - var num1 = this.padString(num.toString(2), 16) - var openListNew = [] - openListNew = num1.split("") - this.actList2 = openListNew.reverse(); - }, - changeIndexOpen2(active) { - if (this.actList2[active] == '1') { - this.actList2[active] = '0' - } else { - this.actList2[active] = '1' - } - this.$forceUpdate(); - var revList = this.actList2.slice().reverse() - var num = revList.join(""); - var dataNum = { - target: { - value: parseInt(num, 2), - }, - }; - this.changeBtn(22063, dataNum); - }, - getControl_getState() { - var data = { - deviceId: this.deviceId - }; - this.$http({ - url: this.api.getControl_getState, - data: data, - method: 'GET', - }).then(res => { - if (res.code == 200) { - // 丽水 - if (this.purviewList.findIndex(item => item.id =='9') != -1) { - this.fanStatus.open = res.data['1023'] - this.fanStatus.status = [] - var num = res.data['1024'] - var num1 = this.padString(num.toString(2), 5) - var openListNew = [] - openListNew = num1.split("") - this.fanStatus.status = openListNew.reverse() - this.statusList = [] - for (var i = 0; i < 4; i++) { - var statusData = { - name: `顶卷膜${i + 1}`, - open: res.data[(1025 + (i * 3))], - progress: res.data[(1027 + (i * 3))], - index: res.data[(1026 + (i * 3))] - } - this.statusList.push(statusData) - } - } - - // 五防项目状态 - if (this.purviewList.findIndex(item => item.id =='8') != -1) { - this.fiveControlList.forEach(el => { - el.controlState = res.data[el.num]; - if (el.progress_num) { - el.progress = res.data[el.progress_num]; - el.progress_state = res.data[el.progress_state_num]; - } - if (el.open_num) { - el.open = res.data[el.open_num] - } - }); - console.log(this.fiveControlList, 'this.fiveControlList'); - } - // 冷暖风机状态值获取 - if (this.purviewList.findIndex(item => item.id =='31') != -1) { - this.coldWarmFanStatus.open = res.data[1175]; - this.coldWarmFanStatus.open1 = res.data[1176]; - this.coldWarmFanStatus.status = []; - let numLight = res.data[1177]; - let numLight1 = this.padString(numLight.toString(2), 4); - let openListNew = []; - openListNew = numLight1.split('') - this.coldWarmFanStatus.status = openListNew.reverse() - }; - // 补光灯状态值获取 - if (this.purviewList.findIndex(item => item.id =='20') != -1) { - this.supplementLightStatus.open = res.data[1068]; - this.supplementLightStatus.status = []; - let numLight = res.data[1069]; - let numLight1 = this.padString(numLight.toString(2), 8); - let openListNew = []; - openListNew = numLight1.split('') - this.supplementLightStatus.status = openListNew.reverse() - }; - - // 环流风扇状态值获取 - if (this.purviewList.findIndex(item => item.id =='21') != -1) { - this.circulationFengshanList.forEach((el, index) => { - el.state = res.data[1074 + index * 2]; - el.open = res.data[1075 + index * 2]; - }) - }; - - // 标准风机 - if (this.purviewList.findIndex(item => item.id =='26') != -1) { - this.standardFanStatus.open = res.data['1078'] - this.standardFanStatus.status = [] - var standardnum = res.data['1079'] - var standardnum1 = this.padString(standardnum.toString(2), 5) - var openListNew = [] - openListNew = standardnum1.split("") - this.standardFanStatus.status = openListNew.reverse() - }; - // CO2补气 - if (this.purviewList.findIndex(item => item.id =='30') != -1) { - this.CO2List.forEach((el, index) => { - el.state = res.data[1178 + index * 2]; - el.open = res.data[1179 + index * 2]; - }) - }; - // 湿帘泵 - if (this.purviewList.findIndex(item => item.id =='26') != -1) { - this.fanwetcurtainList.forEach((el, index) => { - el.state = res.data[1080 + index * 2]; - el.open = res.data[1081 + index * 2]; - }) - }; - // 空调 - if (this.purviewList.findIndex(item => item.id =='28') != -1) { - this.airconditioning.state = res.data['1160'] - this.airconditioning.open = res.data['1161'] - this.airconditioning.open1 = res.data['1162'] - - }; - // 高压微雾 - if (this.purviewList.findIndex(item => item.id =='23') != -1) { - this.highpressuremistList.forEach((el, index) => { - el.state = res.data[1070 + index * 2]; - el.open = res.data[1071 + index * 2]; - }) - }; - - // 湿窗外翻窗 - if (this.purviewList.findIndex(item => item.id =='26') != -1) { - this.outFlipWindowList.forEach((el, index) => { - el.state = res.data[1084 + index * 3]; - el.progress = res.data[1086 + index * 3]; - el.statusProgress = res.data[1085 + index * 3] - }) - }; - - //内遮阳 - if (this.purviewList.findIndex(item => item.id =='24') != -1) { - this.innercurtainList.forEach((el, index) => { - el.state = res.data[1090 + index * 3]; - el.progress = res.data[1092 + index * 3]; - el.statusProgress = res.data[1091 + index * 3] - }) - }; - - //外遮阳 - if (this.purviewList.findIndex(item => item.id =='25') != -1) { - this.externalsunshadeList.forEach((el, index) => { - el.state = res.data[1096 + index * 3]; - el.progress = res.data[1098 + index * 3]; - el.statusProgress = res.data[1097 + index * 3] - }) - }; - - //通风窗 - if (this.purviewList.findIndex(item => item.id =='19') != -1) { - this.airWindowList.forEach((el, index) => { - if (el.id == '8') { - el.state = res.data[1188] ? res.data[1188] : 0; - el.progress = res.data[1190]; - el.statusProgress = res.data[1189] - el.pid = res.data[1194] - } else if (el.id == '9') { - el.state = res.data[1191] ? res.data[1191] : 0; - el.progress = res.data[1193]; - el.statusProgress = res.data[1192] - el.pid = res.data[1195] - } else { - el.state = res.data[1102 + index * 3] ? res.data[1102 + - index * 3] : 0; - el.progress = res.data[1104 + index * 3]; - el.statusProgress = res.data[1103 + index * 3] - el.pid = res.data[1115 + index] - } - }) - }; - - // 内保温 - if (this.purviewList.findIndex(item => item.id =='27') != -1) { - this.interiorthermalinsulationList.forEach((el, index) => { - el.state = res.data[1182 + index * 3]; - el.progress = res.data[1184 + index * 3]; - el.statusProgress = res.data[1183 + index * 3] - }) - }; - - // 立面保温 - if (this.purviewList.findIndex(item => item.id =='29') != -1) { - this.upFaceInsulationList.forEach((el, index) => { - el.state = res.data[1196 + index * 3]; - el.progress = res.data[1198 + index * 3]; - el.statusProgress = res.data[1197 + index * 3] - }) - }; - - - // 电磁阀 - for (let t = 0; t < this.electronMagneticStatus.length; t++) { - this.electronMagneticStatus[t].state = res.data[1166 + t] - this.electronMagneticStatus[t].open=this.getDCF(t,res.data) - } - // console.log(this.electronMagneticStatus,'this.electronMagneticStatus'); - } - }) - }, - getDCF(t,data){ - var index=t - var num=data[1174]?data[1174]:'0' - - var num1 = this.padString(num.toString(2), 8) - - var openListNew = [] - openListNew = num1.split("") - var actList = openListNew.reverse(); - - return actList[index] - }, - // 丽水 风机 - fanmodelHander() { - this.fanmodelShow = true; - - var data = { - deviceId: this.deviceId - }; - this.$http({ - url: this.api.getReadControlliShuiControl, - data: data, - method: 'GET', - }).then((res => { - this.inputData2 = res.data; - // this.openIndex1 = this.inputData2[21613 + ((this.indexs - 1) * 11)] - - this.openIndex = this.inputData2[21600] - this.getAct21601() - })) - - }, - - // 标准风机 - standardFanmodelHander() { - this.standardFanmodelShow = true; - var deviceId = this.deviceId - this.$http({ - url: this.api.readControl_fanwetcurtain + '?deviceId=' + deviceId, - method: 'GET' - }).then(res => { - if (res.code == 200) { - this.standardFanInputData2 = res.data; - this.standardFanOpenIndex = this.standardFanInputData2[21950] - - this.standardFanActList1 = [] - let num = this.standardFanInputData2['21951'] - let num1 = this.padString(num.toString(2), 5) - let openListNew = [] - openListNew = num1.split("") - openListNew.forEach((el, index) => { - this.standardFanActList1.push(openListNew[openListNew.length - index - 1]) - }) - } - }) - }, - - // 东北五防弹框 - openFiveControlShow(index) { - this.fiveControlShow = true; - this.pop_title = this.fiveControlList[index].title; - this.close_btn_all = this.fiveControlList[index].close_btn; - var deviceId = this.deviceId - this.$http({ - url: this.api.readControl_fiveControl + '?deviceId=' + deviceId, - method: 'GET' - }).then(res => { - if (res.code == 200) { - uni.hideLoading(); - uni.stopPullDownRefresh(); - this.fiveControl = res.data - if (index == 0) { - this.fiveControlIndex = this.fiveControl[21520]; - this.fiveControlUrl = 'waterPump'; - - } else if (index == 1) { - this.fiveControlIndex = this.fiveControl[21526]; - this.fiveControlUrl = 'geothermalFan' - } else if (index == 2) { - this.fiveControlIndex = this.fiveControl[21530]; - this.fiveControlUrl = 'uptake' - } else if (index == 3) { - this.fiveControlIndex = this.fiveControl[21541]; - this.fiveControlUrl = 'downtake' - } else if (index == 4) { - this.fiveControlIndex = this.fiveControl[21548]; - this.fiveControlUrl = 'rollByRoll' - } else if (index == 5) { - this.fiveControlIndex = this.fiveControl[21558]; - this.fiveControlUrl = 'snowRemoval' - } - } - }) - }, - - // 电磁阀 - openValveControlShow(index) { - this.valveControlShow = true - this.valvePopTitle = index + 1 + '#电磁阀'; - var data = { - deviceId: this.deviceId - }; - this.$http({ - url: this.api['readControl_solenoidValve' + `${index+1}`], - data: data, - method: 'GET', - }).then(res => { - if (res.code == 200) { - this.valveControlIndex = res.data[20201 + index * 50] - this.valve_input_value = res.data[20202 + index * 50] - } - }) - }, - // 冷暖风机 - coldWarmFanHander() { - var deviceId = this.deviceId; - this.coldWarmFanShow = true; - this.$http({ - url: this.api.readControl_heatfan + '?deviceId=' + deviceId, - method: 'GET' - }).then(res => { - if (res.code == 200) { - // console.log(res,'补光灯'); - uni.hideLoading(); - uni.stopPullDownRefresh(); - this.coldWarmFanIndex = res.data[22250]; - this.coldWarmFanList = [] - let numLight = res.data[22251]; - let numLight1 = this.padString(numLight.toString(2), 4); - let openListNew = []; - openListNew = numLight1.split('') - this.coldWarmFanList = openListNew.reverse() - } - }) - }, - // 补光灯 - supplementLightHander() { - var deviceId = this.deviceId; - this.supplementLightShow = true; - this.$http({ - url: this.api.readControl_readfilllight + '?deviceId=' + deviceId, - method: 'GET' - }).then(res => { - if (res.code == 200) { - // console.log(res,'补光灯'); - uni.hideLoading(); - uni.stopPullDownRefresh(); - this.lightControlIndex = res.data[21400]; - this.actListLight = [] - let numLight = res.data[21401]; - let numLight1 = this.padString(numLight.toString(2), 8); - let openListNew = []; - openListNew = numLight1.split('') - this.actListLight = openListNew.reverse() - } - }) - }, - - // 环流风扇弹框 - circulationFengshanHander(index) { - this.circulationControlIndex = 0; - this.popCirculationFengshanName = index; - var deviceId = this.deviceId - this.circulationFengshanShow = true; - this.$http({ - url: this.api.readControl_readcirculationfan + '?deviceId=' + deviceId, - method: 'GET' - }).then(res => { - if (res.code == 200) { - uni.hideLoading(); - uni.stopPullDownRefresh(); - this.circulationControlIndex = res.data[21450 + index * 20]; - } - }) - }, - // CO2补气弹框 - CO2Hander(index) { - this.CO2Index = 0; - this.popCO2Name = index; - var deviceId = this.deviceId - this.CO2Show = true; - this.$http({ - url: this.api.readControl_co2replenishment + '?deviceId=' + deviceId, - method: 'GET' - }).then(res => { - if (res.code == 200) { - uni.hideLoading(); - uni.stopPullDownRefresh(); - this.CO2Index = res.data[21970 + index * 2]; - } - }) - }, - // 湿帘泵弹框 - fanwetcurtainHander(index) { - this.fanwetcurtainControlIndex = 0; - this.popfanwetcurtainName = index; - var deviceId = this.deviceId - this.fanwetcurtainShow = true; - this.$http({ - url: this.api.readControl_fanwetcurtain + '?deviceId=' + deviceId, - method: 'GET' - }).then(res => { - if (res.code == 200) { - uni.hideLoading(); - uni.stopPullDownRefresh(); - this.fanwetcurtainControlIndex = res.data[21970 + index * 2]; - } - }) - }, - - countData(data) { - if (data) { - return (data - 400) / 10; - } else { - return 0; - } - }, - //失去焦点 - blurChangeCount(code, el) { - var data = { - equipmentId: this.deviceId, - regAddress: code, - num: el.target.value * 10 + 400, - }; //避免开启多个计时器 - this.changeData(data); - - }, - // 空调选择弹窗反选1 - getData1(data) { - var name = ""; - this.typeList1.forEach((el, index) => { - if (el.value == data) { - name = el.label; - } - }); - return name; - }, - // 空调选择弹窗反选2 - getData2(data) { - var name = ""; - this.typeList2.forEach((el, index) => { - if (el.value == data) { - name = el.label; - } - }); - return name; - }, - //类型选择 - handleCommand1(selData) { - var code=22041 - var command=selData[0] - // command, code - this.typeList1.forEach((el, index) => { - if (el.value == command) { - this.airconditioningInputDataNew[code] = el.label; - } - }); - this.airconditioningInputData[code] = command; - var dataNum = { - target: { - value: command, - }, - }; - this.changeBtn(code, dataNum); - }, - //制冷制热类型选择 - handleCommand2(selData) { - - var code=22042 - var command=selData[0] - this.typeList2.forEach((el, index) => { - if (el.value == command) { - this.airconditioningInputDataNew[code] = el.label; - } - }); - this.airconditioningInputData[code] = command; - var dataNum = { - target: { - value: command, - }, - }; - this.changeBtn(code, dataNum); - }, - // 空调弹框 - airconditioningHander(index) { - this.airconditioningControlIndex = 0; - this.popfanwetcurtainName = index; - var deviceId = this.deviceId - this.airconditioningShow = true; - this.$http({ - url: this.api.readControl_airconditioner + '?deviceId=' + deviceId, - method: 'GET' - }).then(res => { - if (res.code == 200) { - uni.hideLoading(); - uni.stopPullDownRefresh(); - this.airconditioningInputData=res.data - this.airconditioningInputData[22043] = this.countData(this.airconditioningInputData[22043]); - this.getAct22063() - this.airconditioningInputDataNew[22041] = this.getData1(this.airconditioningInputData[22041]); - this.airconditioningInputDataNew[22042] = this.getData2(this.airconditioningInputData[22042]); - - this.airconditioningControlIndex = res.data[22040]; - } - }) - }, - // 高压微雾 - highpressuremistHander(index) { - this.highpressuremistControlIndex = 0; - this.pophighpressuremistName = index; - var deviceId = this.deviceId - this.highpressuremistShow = true; - this.$http({ - url: this.api.readControl_highpressuremist + '?deviceId=' + deviceId, - method: 'GET' - }).then(res => { - if (res.code == 200) { - uni.hideLoading(); - uni.stopPullDownRefresh(); - this.highpressuremistControlIndex = res.data[21800 + index * 8]; - } - }) - }, - - // 湿帘外翻窗 - outFlipWindowHander(index) { - this.outFlipWindowControlIndex = 0; - this.popoutFlipWindowName = index; - var deviceId = this.deviceId - this.outFlipWindowShow = true; - this.$http({ - url: this.api.readControl_fanwetcurtain + '?deviceId=' + deviceId, - method: 'GET' - }).then(res => { - if (res.code == 200) { - uni.hideLoading(); - uni.stopPullDownRefresh(); - this.outFlipWindowControlIndex = res.data[21974 + index * 5]; - } - }) - }, - - // 内遮阳 - innercurtainHander(index) { - this.innercurtainControlIndex = 0; - this.popinnercurtainName = index; - var deviceId = this.deviceId - this.innercurtainShow = true; - this.$http({ - url: this.api.readControl_innercurtain + '?deviceId=' + deviceId, - method: 'GET' - }).then(res => { - if (res.code == 200) { - uni.hideLoading(); - uni.stopPullDownRefresh(); - this.innercurtainControlIndex = res.data[21840 + index * 18]; - } - }) - }, - - // 外遮阳 - externalsunshadeHander(index) { - this.externalsunshadeControlIndex = 0; - this.popexternalsunshadeName = index; - var deviceId = this.deviceId - this.externalsunshadeShow = true; - this.$http({ - url: this.api.readControl_externalsunshade + '?deviceId=' + deviceId, - method: 'GET' - }).then(res => { - if (res.code == 200) { - uni.hideLoading(); - uni.stopPullDownRefresh(); - this.externalsunshadeControlIndex = res.data[21900 + index * 15]; - } - }) - }, - - // 通风窗 - airWindowHander(index) { - this.airWindowControlIndex = 0; - this.popairWindowName = index; - var deviceId = this.deviceId - this.airWindowShow = true; - this.$http({ - url: this.api.readControl_readskylight + '?deviceId=' + deviceId, - method: 'GET' - }).then(res => { - if (res.code == 200) { - uni.hideLoading(); - uni.stopPullDownRefresh(); - this.airWindowControlIndex = res.data[21250 + index * 23]; - } - }) - }, - - // 内保温 - interiorthermalinsulationHander(index) { - this.interiorthermalinsulationIndex = 0; - this.interiorthermalinsulationName = index; - var deviceId = this.deviceId; - this.interiorthermalinsulationShow = true; - this.$http({ - url: this.api.readControl_interiorthermalinsulation + '?deviceId=' + deviceId, - method: 'GET' - }).then(res => { - if (res.code == 200) { - uni.hideLoading(); - uni.stopPullDownRefresh(); - this.interiorthermalinsulationIndex = res.data[22000 + index * 12]; - } - }) - }, - - //立面保温 - upFaceInsulationHander(index) { - this.upFaceInsulationIndex = 0; - this.upFaceInsulationName = index; - var deviceId = this.deviceId; - this.upFaceInsulationShow = true; - this.$http({ - url: this.api.readControl_facadeinsulation + '?deviceId=' + deviceId, - method: 'GET' - }).then(res => { - if (res.code == 200) { - uni.hideLoading(); - uni.stopPullDownRefresh(); - this.upFaceInsulationIndex = res.data[22300 + index * 13]; - } - }) - }, - - getNumberStatus(index) { - if (index == 0) { - return '静止状态' - } else if (index == 1) { - return '正向打开中' - } else if (index == 2) { - return '反向关闭中' - } else { - return '' - } - }, - getNumberStatus1(index) { - if (index == 0) { - return '静止状态' - } else if (index == 1) { - return '正向展开' - } else if (index == 2) { - return '反向收拢' - } else { - return '' - } - }, - getNumberStatus2(index) { - if (index == 0) { - return '静止状态' - } else if (index == 1) { - return '正向开窗' - } else if (index == 2) { - return '反向关窗' - } else { - return '' - } - }, - padString(str, length) { - return str.padStart(length, '0'); - }, - - getType(type, flag) { - if (flag == 1) { - var number = this.padString(Number(this.inputData[type]).toString(2), 3) - // console.log(number); //001 - // console.log(number[0]); //0 bit2 关闭 - // console.log(number[1]); //0 bit1 停止 - // console.log(number[2]); //1 bit0 打开 - let arr = this.txt_act_list.filter(el => el.key == type) - let key1 = Object.keys(arr[0])[0]; - this.txt_act_list.forEach(el => { - if (el.key == type) { - if (Number(number[0])) { - el[key1] = 3 - } else if (Number(number[1])) { - el[key1] = 2 - } else if (Number(number[2])) { - el[key1] = 1 - } else { - el[key1] = 0 - } - } - }) - } else if (flag == 2) { - var number = this.padString(Number(this.inputData[type]).toString(2), 2) - // console.log(number); //01 - // console.log(number[0]); //1 bit1 关闭 - // console.log(number[1]); //1 bit0 打开 - let arr = this.txt_act_list.filter(el => el.key == type) - let key1 = Object.keys(arr[0])[0]; - this.txt_act_list.forEach(el => { - if (el.key == type) { - if (Number(number[0])) { - el[key1] = 2 - } else if (Number(number[1])) { - el[key1] = 1 - } else { - el[key1] = 0 - } - } - }) - } - }, - - change00(type, index) { - uni.showLoading({ - title: '加载中...' - }) - let arr = this.txt_act_list.filter(el => el.key == type) - let key1 = Object.keys(arr[0])[0]; - this.txt_act_list.forEach(el => { - if (el.key == type) { - el[key1] = index - } - }) - - if (type > 21679 && type < 21708) { - var list = ["0", "0", "0"]; - if (index == 1) { - list[2] = "1"; - } else { - list[2] = "0"; - } - if (index == 2) { - list[1] = "1"; - } else { - list[1] = "0"; - } - if (index == 3) { - list[0] = "1"; - } else { - list[0] = "0"; - } - } else if (type > 21709 && type < 21729) { - var list = ["0", "0"]; - if (index == 1) { - list[1] = "1"; - } else { - list[1] = "0"; - }; - if (index == 2) { - list[0] = "1"; - } else { - list[0] = "0"; - }; - } - - var num = list.join(""); - var dataNum = { - target: { - value: parseInt(num, 2), - }, - }; - this.change(type, dataNum); - }, - changeCountData(code, el) { - var data = el.target.value * 10 + 400; - var sendData = { - target: { - value: data, - }, - }; - this.change(code, sendData); - }, - change(code, el) { - var data = { - equipmentId: this.deviceId, - regAddress: code, - num: el.target.value, - }; - this.delayTimer(0, data); - }, - - delayTimer(i, data) { - const that = this; - //整体接口 - let j = 5; - //避免开启多个计时器 - this.timer && clearInterval(this.timer); - - this.timer = setInterval(() => { - ++i; - if (i == j) { - that.changeData(data); - clearInterval(this.timer); - } - }, 100); - }, - - changeData(data) { - const that = this - this.$http({ - url: this.api.writeJinHuaControl_write, - data: data - }).then((res) => { - if (res.code == 200) { + var num1 = this.padString(num.toString(2), 16) + var openListNew = [] + openListNew = num1.split("") + this.actList2 = openListNew.reverse(); + }, + changeIndexOpen2(active) { + if (this.actList2[active] == '1') { + this.actList2[active] = '0' + } else { + this.actList2[active] = '1' + } + this.$forceUpdate(); + var revList = this.actList2.slice().reverse() + var num = revList.join(""); + var dataNum = { + target: { + value: parseInt(num, 2), + }, + }; + this.changeBtn(22063, dataNum); + }, + getControl_getState() { + var data = { + deviceId: this.deviceId + }; + this.$http({ + url: this.api.getControl_getState, + data: data, + method: 'GET', + }).then(res => { + if (res.code == 200) { uni.hideLoading() - uni.showToast({ - title: res.msg, - icon: "success", - duration: 1500 - }) - setTimeout(() => { - this.dataInit() - }, 1500) - } else { - uni.showToast({ - title: "失败!", - icon: "error", - }) - } - }); - }, + const statusList = [] + this.nowDevicestatus.forEach((el, index) => { + if (el.id == 1) { + //风机 + var fandata = {} + fandata.open = res.data['1023'] + fandata.id = el.id + fandata.type = 1 + fandata.name = el.nickName + fandata.status = [] + var num = res.data['1024'] ? res.data['1024'] : 0 + var num1 = this.padString(num.toString(2), 5) + var openListNew = [] + openListNew = num1.split("") + fandata.status = openListNew.reverse() + statusList.push(fandata) + } else if (el.id == 17) { + //风机 + var fandata = {} + fandata.open = res.data['1078'] + fandata.id = el.id + fandata.type = 1 + fandata.name = el.nickName + fandata.status = [] + var num = res.data['1079'] ? res.data['1079'] : 0 + var num1 = this.padString(num.toString(2), 5) + var openListNew = [] + openListNew = num1.split("") + fandata.status = openListNew.reverse() + statusList.push(fandata) + } else if (el.id == 12) { + //补光灯 + var fandata = {} + fandata.open = res.data['1068'] + fandata.id = el.id + fandata.type = 8 + fandata.name = el.nickName + fandata.status = [] + var num = res.data['1069'] ? res.data['1069'] : 0 + var num1 = this.padString(num.toString(2), 8) + var openListNew = [] + openListNew = num1.split("") + fandata.status = openListNew.reverse() + statusList.push(fandata) + } else if (el.id == 39) { + //冷暖风机 + var fandata = {} + fandata.open = res.data['1175'] + fandata.id = el.id + fandata.type = 18 + fandata.name = el.nickName + fandata.status = [] + fandata.count = res.data['1176'] + var num = res.data['1177'] ? res.data['1177'] : 0 + var num1 = this.padString(num.toString(2), 4) + var openListNew = [] + openListNew = num1.split("") + fandata.status = openListNew.reverse() + statusList.push(fandata) + } + else if (el.id == 2 || el.id == 3 || el.id == 4 || el.id == 5) { + //顶卷膜 + var statusData = { name: el.nickName, type: 2, id: el.id, open: res.data[(1025 + ((el.id - 2) * 3))], progress: res.data[(1027 + ((el.id - 2) * 3))], index: res.data[(1026 + ((el.id - 2) * 3))], count: 0 } + statusList.push(statusData) + } else if (el.id == 6) { + //加温水泵 + var statusData = { name: el.nickName, type: 3, id: el.id, open: res.data['1000'], progress: 0, index: res.data['1001'], count: 0 } + statusList.push(statusData) + } else if (el.id == 7) { + //地热风机 + var statusData = { name: el.nickName, type: 4, id: el.id, open: res.data['1002'], progress: 0, index: res.data['1003'], count: 0 } + statusList.push(statusData) + } else if (el.id == 8) { + //上风口 + var statusData = { name: el.nickName, type: 5, id: el.id, open: res.data['1004'], progress: res.data['1006'], index: res.data['1005'], count: 0 } + statusList.push(statusData) + } else if (el.id == 9) { + //下风口 + var statusData = { name: el.nickName, type: 5, id: el.id, open: res.data['1007'], progress: res.data['1009'], index: res.data['1008'], count: 0 } + statusList.push(statusData) + } else if (el.id == 10) { + //卷被 + var statusData = { name: el.nickName, type: 6, id: el.id, open: res.data['1010'], progress: res.data['1012'], index: res.data['1011'], count: 0 } + statusList.push(statusData) + } else if (el.id == 11) { + //除雪 + var statusData = { name: el.nickName, type: 7, id: el.id, open: res.data['1013'], progress: 0, index: res.data['1014'], count: 0 } + statusList.push(statusData) + } + else if (el.id == 13 || el.id == 14) { + //高压微雾 + var statusData = { name: el.nickName, type: 9, id: el.id, open: res.data[(1070 + ((el.id - 13) * 2))], progress: 0, index: res.data[(1071 + ((el.id - 13) * 2))], count: 0 } + statusList.push(statusData) + } + else if (el.id == 15 || el.id == 16) { + //环流风扇 + var statusData = { name: el.nickName, type: 10, id: el.id, open: res.data[(1074 + ((el.id - 15) * 2))], progress: 0, index: res.data[(1075 + ((el.id - 15) * 2))], count: 0 } + statusList.push(statusData) + } + else if (el.id == 18 || el.id == 19) { + //湿帘泵 + var statusData = { name: el.nickName, type: 11, id: el.id, open: res.data[(1080 + ((el.id - 18) * 2))], progress: 0, index: res.data[(1081 + ((el.id - 18) * 2))], count: 0 } + statusList.push(statusData) + } + else if (el.id == 20 || el.id == 21) { + //湿帘外翻窗 + var statusData = { name: el.nickName, type: 12, id: el.id, open: res.data[(1084 + ((el.id - 20) * 3))], progress: res.data[(1086 + ((el.id - 20) * 3))], index: res.data[(1085 + ((el.id - 20) * 3))], count: 0 } + statusList.push(statusData) + } + else if (el.id == 22 || el.id == 23) { + //内遮阳 + var statusData = { name: el.nickName, type: 13, id: el.id, open: res.data[(1090 + ((el.id - 22) * 3))], progress: res.data[(1092 + ((el.id - 22) * 3))], index: res.data[(1091 + ((el.id - 22) * 3))], count: 0 } + statusList.push(statusData) + } + else if (el.id == 24 || el.id == 25) { + //外遮阳 + var statusData = { name: el.nickName, type: 14, id: el.id, open: res.data[(1096 + ((el.id - 24) * 3))], progress: res.data[(1098 + ((el.id - 24) * 3))], index: res.data[(1097 + ((el.id - 24) * 3))], count: 0 } + statusList.push(statusData) + } + else if (el.id == 26 || el.id == 27 || el.id == 28 || el.id == 29) { + //通风窗1234 + var statusData = { name: el.nickName, type: 15, id: el.id, open: res.data[(1102 + ((el.id - 26) * 3))], progress: res.data[(1104 + ((el.id - 26) * 3))], index: res.data[(1103 + ((el.id - 26) * 3))], count: res.data[1115 + (el.id - 26)] } + statusList.push(statusData) + } + else if (el.id == 30 || el.id == 31) { + //内保温 + var statusData = { name: el.nickName, type: 16, id: el.id, open: res.data[(1182 + ((el.id - 30) * 3))], progress: res.data[(1184 + ((el.id - 30) * 3))], index: res.data[(1183 + ((el.id - 30) * 3))], count: 0 } + statusList.push(statusData) + } + else if (el.id == 32 || el.id == 33) { + //通风窗56 + var statusData = { name: el.nickName, type: 15, id: el.id, open: res.data[(1188 + ((el.id - 32) * 3))], progress: res.data[(1190 + ((el.id - 32) * 3))], index: res.data[(1189 + ((el.id - 32) * 3))], count: res.data[1194 + (el.id - 32)] } + statusList.push(statusData) + } + else if (el.id == 34 || el.id == 35|| el.id == 36|| el.id == 37) { + //立面保温1234 + var statusData = { name: el.nickName, type: 16, id: el.id, open: res.data[(1196 + ((el.id - 34) * 3))], progress: res.data[(1198 + ((el.id - 34) * 3))], index: res.data[(1197 + ((el.id - 34) * 3))], count: 0 } + statusList.push(statusData) + } + else if (el.id ==38) { + //空调 + var statusData = { name: el.nickName, type:17, id: el.id, open: res.data['1160'], progress: 0, index: res.data['1161'], count: res.data['1162'] } + statusList.push(statusData) + } + else if (el.id ==40||el.id ==41) { + //CO2补气 + var statusData = { name: el.nickName, type:11, id: el.id, open: res.data[(1178 + ((el.id - 40) * 2))], progress: 0, index: res.data[(1179 + ((el.id - 40) * 2))], count: 0 } + statusList.push(statusData) + } + else if (el.id ==42||el.id ==43||el.id ==44||el.id ==45||el.id ==46||el.id ==47||el.id ==48||el.id ==49) { + //电磁阀 + var statusData = { name: el.nickName, type:9, id: el.id, open: res.data[(1166 + (el.id - 42))], progress: 0, index:this.getDCF(el,res.data), count: 0 } + statusList.push(statusData) + } + }) + this.statusList = statusList + this.$forceUpdate(); + + } + }) + }, + getDCF(t, data) { + var index = t + var num = data[1174] ? data[1174] : '0' - // x#顶卷膜输入框 - blurChangeData00_1(code, el) { - uni.showLoading({ - title: '加载中...' - }) + var num1 = this.padString(num.toString(2), 8) - var data = el.target.value - // console.log(data); - var sendData = { - target: { - value: data + var openListNew = [] + openListNew = num1.split("") + var actList = openListNew.reverse(); + + return actList[index] + }, + // 丽水 风机 + fanmodelHander() { + this.fanmodelShow = true; + + var data = { + deviceId: this.deviceId + }; + this.$http({ + url: this.api.getReadControlliShuiControl, + data: data, + method: 'GET', + }).then((res => { + this.inputData2 = res.data; + // this.openIndex1 = this.inputData2[21613 + ((this.indexs - 1) * 11)] + + this.openIndex = this.inputData2[21600] + this.getAct21601() + })) + + }, + + // 标准风机 + standardFanmodelHander() { + this.standardFanmodelShow = true; + var deviceId = this.deviceId + this.$http({ + url: this.api.readControl_fanwetcurtain + '?deviceId=' + deviceId, + method: 'GET' + }).then(res => { + if (res.code == 200) { + this.standardFanInputData2 = res.data; + this.standardFanOpenIndex = this.standardFanInputData2[21950] + + this.standardFanActList1 = [] + let num = this.standardFanInputData2['21951'] + let num1 = this.padString(num.toString(2), 5) + let openListNew = [] + openListNew = num1.split("") + openListNew.forEach((el, index) => { + this.standardFanActList1.push(openListNew[openListNew.length - index - 1]) + }) + } + }) + }, + + // 东北五防弹框 + openFiveControlShow(item) { + this.fiveControlShow = true; + this.pop_title = item.name; + this.close_btn_all = true; + var deviceId = this.deviceId + this.$http({ + url: this.api.readControl_fiveControl + '?deviceId=' + deviceId, + method: 'GET' + }).then(res => { + if (res.code == 200) { + uni.hideLoading(); + uni.stopPullDownRefresh(); + this.fiveControl = res.data + if (item.id == 6) { + this.fiveControlIndex = this.fiveControl[21520]; + this.fiveControlUrl = 'waterPump'; + + } else if (item.id == 7) { + this.fiveControlIndex = this.fiveControl[21526]; + this.fiveControlUrl = 'geothermalFan' + } else if (item.id == 8) { + this.fiveControlIndex = this.fiveControl[21530]; + this.fiveControlUrl = 'uptake' + } else if (item.id == 9) { + this.fiveControlIndex = this.fiveControl[21541]; + this.fiveControlUrl = 'downtake' + } else if (item.id == 10) { + this.fiveControlIndex = this.fiveControl[21548]; + this.fiveControlUrl = 'rollByRoll' + } else if (item.id == 11) { + this.fiveControlIndex = this.fiveControl[21558]; + this.fiveControlUrl = 'snowRemoval' } } - this.change(code, sendData) - }, - blurChangeData00_2(code, el) { - uni.showLoading({ - title: '加载中...' - }) - var data = el.target.value - var sendData = { - target: { - value: data - } + }) + }, + + // 电磁阀 + openValveControlShow(item) { + this.valveControlShow = true + var index= item.id-42 + this.valvePopTitle = item.name; + var data = { + deviceId: this.deviceId + }; + this.$http({ + url: this.api['readControl_solenoidValve' + `${index+1}`], + data: data, + method: 'GET', + }).then(res => { + if (res.code == 200) { + this.valveControlIndex = res.data[20201 + index * 50] + this.valve_input_value = res.data[20202 + index * 50] } - this.change(code, sendData) - }, - } + }) + }, + // 冷暖风机 + coldWarmFanHander(item) { + var deviceId = this.deviceId; + this.coldWarmFanShow = true; + this.coldWarmFanName=item.name + this.$http({ + url: this.api.readControl_heatfan + '?deviceId=' + deviceId, + method: 'GET' + }).then(res => { + if (res.code == 200) { + // console.log(res,'补光灯'); + uni.hideLoading(); + uni.stopPullDownRefresh(); + this.coldWarmFanIndex = res.data[22250]; + this.coldWarmFanList = [] + let numLight = res.data[22251]; + let numLight1 = this.padString(numLight.toString(2), 4); + let openListNew = []; + openListNew = numLight1.split('') + this.coldWarmFanList = openListNew.reverse() + } + }) + }, + // 补光灯 + supplementLightHander(item) { + var deviceId = this.deviceId; + this.supplementLightShow = true; + this.supplementLightName=item.name + this.$http({ + url: this.api.readControl_readfilllight + '?deviceId=' + deviceId, + method: 'GET' + }).then(res => { + if (res.code == 200) { + // console.log(res,'补光灯'); + uni.hideLoading(); + uni.stopPullDownRefresh(); + this.lightControlIndex = res.data[21400]; + this.actListLight = [] + let numLight = res.data[21401]; + let numLight1 = this.padString(numLight.toString(2), 8); + let openListNew = []; + openListNew = numLight1.split('') + this.actListLight = openListNew.reverse() + } + }) + }, + + // 环流风扇弹框 + circulationFengshanHander(item) { + var index=item.id-15 + this.circulationControlIndex = 0; + this.popCirculationFengshanName = item.name; + var deviceId = this.deviceId + this.circulationFengshanShow = true; + this.$http({ + url: this.api.readControl_readcirculationfan + '?deviceId=' + deviceId, + method: 'GET' + }).then(res => { + if (res.code == 200) { + uni.hideLoading(); + uni.stopPullDownRefresh(); + this.circulationControlIndex = res.data[21450 + index * 20]; + } + }) + }, + // CO2补气弹框 + CO2Hander(item) { + var index=item.id-40 + this.CO2Index = 0; + this.popCO2Name = item.name; + var deviceId = this.deviceId + this.CO2Show = true; + this.$http({ + url: this.api.readControl_co2replenishment + '?deviceId=' + deviceId, + method: 'GET' + }).then(res => { + if (res.code == 200) { + uni.hideLoading(); + uni.stopPullDownRefresh(); + this.CO2Index = res.data[21970 + index * 2]; + } + }) + }, + // 湿帘泵弹框 + fanwetcurtainHander(item) { + var index= item.id-18 + this.fanwetcurtainControlIndex = 0; + this.popfanwetcurtainName = item.name; + var deviceId = this.deviceId + this.fanwetcurtainShow = true; + this.$http({ + url: this.api.readControl_fanwetcurtain + '?deviceId=' + deviceId, + method: 'GET' + }).then(res => { + if (res.code == 200) { + uni.hideLoading(); + uni.stopPullDownRefresh(); + this.fanwetcurtainControlIndex = res.data[21970 + index * 2]; + } + }) + }, + + countData(data) { + if (data) { + return (data - 400) / 10; + } else { + return 0; + } + }, + //失去焦点 + blurChangeCount(code, el) { + var data = { + equipmentId: this.deviceId, + regAddress: code, + num: el.target.value * 10 + 400, + }; //避免开启多个计时器 + this.changeData(data); + + }, + // 空调选择弹窗反选1 + getData1(data) { + var name = ""; + this.typeList1.forEach((el, index) => { + if (el.value == data) { + name = el.label; + } + }); + return name; + }, + // 空调选择弹窗反选2 + getData2(data) { + var name = ""; + this.typeList2.forEach((el, index) => { + if (el.value == data) { + name = el.label; + } + }); + return name; + }, + //类型选择 + handleCommand1(selData) { + var code = 22041 + var command = selData[0] + // command, code + this.typeList1.forEach((el, index) => { + if (el.value == command) { + this.airconditioningInputDataNew[code] = el.label; + } + }); + this.airconditioningInputData[code] = command; + var dataNum = { + target: { + value: command, + }, + }; + this.changeBtn(code, dataNum); + }, + //制冷制热类型选择 + handleCommand2(selData) { + + var code = 22042 + var command = selData[0] + this.typeList2.forEach((el, index) => { + if (el.value == command) { + this.airconditioningInputDataNew[code] = el.label; + } + }); + this.airconditioningInputData[code] = command; + var dataNum = { + target: { + value: command, + }, + }; + this.changeBtn(code, dataNum); + }, + // 空调弹框 + airconditioningHander(item) { + this.airconditioningControlIndex = 0; + this.airconditioningName = item.name; + var deviceId = this.deviceId + this.airconditioningShow = true; + this.$http({ + url: this.api.readControl_airconditioner + '?deviceId=' + deviceId, + method: 'GET' + }).then(res => { + if (res.code == 200) { + uni.hideLoading(); + uni.stopPullDownRefresh(); + this.airconditioningInputData = res.data + this.airconditioningInputData[22043] = this.countData(this.airconditioningInputData[ + 22043]); + this.getAct22063() + this.airconditioningInputDataNew[22041] = this.getData1(this.airconditioningInputData[ + 22041]); + this.airconditioningInputDataNew[22042] = this.getData2(this.airconditioningInputData[ + 22042]); + + this.airconditioningControlIndex = res.data[22040]; + } + }) + }, + // 高压微雾 + highpressuremistHander(item) { + var index = item.id - 13 + this.highpressuremistControlIndex = 0; + this.pophighpressuremistName = item.name; + var deviceId = this.deviceId + this.highpressuremistShow = true; + this.$http({ + url: this.api.readControl_highpressuremist + '?deviceId=' + deviceId, + method: 'GET' + }).then(res => { + if (res.code == 200) { + uni.hideLoading(); + uni.stopPullDownRefresh(); + this.highpressuremistControlIndex = res.data[21800 + index * 8]; + } + }) + }, + + // 湿帘外翻窗 + outFlipWindowHander(item) { + var index = item.id - 20 + this.outFlipWindowControlIndex = 0; + this.popoutFlipWindowName = item.name; + var deviceId = this.deviceId + this.outFlipWindowShow = true; + this.$http({ + url: this.api.readControl_fanwetcurtain + '?deviceId=' + deviceId, + method: 'GET' + }).then(res => { + if (res.code == 200) { + uni.hideLoading(); + uni.stopPullDownRefresh(); + this.outFlipWindowControlIndex = res.data[21974 + index * 5]; + } + }) + }, + + // 内遮阳 + innercurtainHander(item) { + var index = item.id - 22 + this.innercurtainControlIndex = 0; + this.popinnercurtainName = item.name; + var deviceId = this.deviceId + this.innercurtainShow = true; + this.$http({ + url: this.api.readControl_innercurtain + '?deviceId=' + deviceId, + method: 'GET' + }).then(res => { + if (res.code == 200) { + uni.hideLoading(); + uni.stopPullDownRefresh(); + this.innercurtainControlIndex = res.data[21840 + index * 18]; + } + }) + }, + + // 外遮阳 + externalsunshadeHander(item) { + var index = item.id - 24 + this.externalsunshadeControlIndex = 0; + this.popexternalsunshadeName = item.name; + var deviceId = this.deviceId + this.externalsunshadeShow = true; + this.$http({ + url: this.api.readControl_externalsunshade + '?deviceId=' + deviceId, + method: 'GET' + }).then(res => { + if (res.code == 200) { + uni.hideLoading(); + uni.stopPullDownRefresh(); + this.externalsunshadeControlIndex = res.data[21900 + index * 15]; + } + }) + }, + + // 通风窗1234 + airWindowHander(item) { + var index = item.id - 26 + this.airWindowControlIndex = 0; + this.popairWindowName = item.name; + var deviceId = this.deviceId + this.airWindowShow = true; + this.$http({ + url: this.api.readControl_readskylight + '?deviceId=' + deviceId, + method: 'GET' + }).then(res => { + if (res.code == 200) { + uni.hideLoading(); + uni.stopPullDownRefresh(); + this.airWindowControlIndex = res.data[21250 + index * 23]; + } + }) + }, +// 通风窗56 + airWindowHander1(item) { + // 通风窗 从五开始(4) + var index = item.id - 28 + this.airWindowControlIndex = 0; + this.popairWindowName = item.name; + var deviceId = this.deviceId + this.airWindowShow = true; + this.$http({ + url: this.api.readControl_readskylight + '?deviceId=' + deviceId, + method: 'GET' + }).then(res => { + if (res.code == 200) { + uni.hideLoading(); + uni.stopPullDownRefresh(); + this.airWindowControlIndex = res.data[21250 + index * 23]; + } + }) + }, + // 内保温 + interiorthermalinsulationHander(item) { + var index = item.id - 30 + this.interiorthermalinsulationIndex = 0; + this.interiorthermalinsulationName = item.name; + var deviceId = this.deviceId; + this.interiorthermalinsulationShow = true; + this.$http({ + url: this.api.readControl_interiorthermalinsulation + '?deviceId=' + deviceId, + method: 'GET' + }).then(res => { + if (res.code == 200) { + uni.hideLoading(); + uni.stopPullDownRefresh(); + this.interiorthermalinsulationIndex = res.data[22000 + index * 12]; + } + }) + }, + + //立面保温 + upFaceInsulationHander(item) { + var index = item.id - 34 + this.upFaceInsulationIndex = 0; + this.upFaceInsulationName = item.name; + var deviceId = this.deviceId; + this.upFaceInsulationShow = true; + this.$http({ + url: this.api.readControl_facadeinsulation + '?deviceId=' + deviceId, + method: 'GET' + }).then(res => { + if (res.code == 200) { + uni.hideLoading(); + uni.stopPullDownRefresh(); + this.upFaceInsulationIndex = res.data[22300 + index * 13]; + } + }) + }, + + getNumberStatus(item) { + var index = item.index + if (item.type == 2 || item.type == 5 || item.type == 6 ) { + //顶卷膜 + if (index == 0) { + return '静止状态' + } else if (index == 1) { + return '正向打开中' + } else if (index == 2) { + return '反向关闭中' + } else { + return '' + } + } + + if(item.type == 16|| item.type == 13 || item.type == 14){ + if (index == 0) { + return '静止状态' + } else if (index == 1) { + return '正向展开中' + } else if (index == 2) { + return '反向收拢中' + } else { + return '' + } + } + if(item.type == 15|| item.type == 12){ + if (index == 0) { + return '静止状态' + } else if (index == 1) { + return '正向开窗' + } else if (index == 2) { + return '反向关窗' + } else { + return '' + } + } + }, + getNumberStatus1(index) { + if (index == 0) { + return '静止状态' + } else if (index == 1) { + return '正向展开' + } else if (index == 2) { + return '反向收拢' + } else { + return '' + } + }, + getNumberStatus2(index) { + if (index == 0) { + return '静止状态' + } else if (index == 1) { + return '正向开窗' + } else if (index == 2) { + return '反向关窗' + } else { + return '' + } + }, + padString(str, length) { + return str.padStart(length, '0'); + }, + + changeCountData(code, el) { + var data = el.target.value * 10 + 400; + var sendData = { + target: { + value: data, + }, + }; + this.change(code, sendData); + }, + change(code, el) { + var data = { + equipmentId: this.deviceId, + regAddress: code, + num: el.target.value, + }; + this.delayTimer(0, data); + }, + + delayTimer(i, data) { + const that = this; + //整体接口 + let j = 5; + //避免开启多个计时器 + this.timer && clearInterval(this.timer); + + this.timer = setInterval(() => { + ++i; + if (i == j) { + that.changeData(data); + clearInterval(this.timer); + } + }, 100); + }, + + changeData(data) { + const that = this + this.$http({ + url: this.api.writeJinHuaControl_write, + data: data + }).then((res) => { + if (res.code == 200) { + uni.hideLoading() + uni.showToast({ + title: res.msg, + icon: "success", + duration: 1500 + }) + setTimeout(() => { + this.dataInit() + }, 1500) + } else { + uni.showToast({ + title: "失败!", + icon: "error", + }) + } + }); + }, + + // x#顶卷膜输入框 + blurChangeData00_1(code, el) { + uni.showLoading({ + title: '加载中...' + }) + + var data = el.target.value + // console.log(data); + var sendData = { + target: { + value: data + } + } + this.change(code, sendData) + }, + blurChangeData00_2(code, el) { + uni.showLoading({ + title: '加载中...' + }) + var data = el.target.value + var sendData = { + target: { + value: data + } + } + this.change(code, sendData) + }, + } } @@ -4084,30 +2990,66 @@ .border-none { border: none !important; } - .border-top-none{ - border-top: none!important; + + .border-top-none { + border-top: none !important; } - .border-top{ + + .border-top { border-top: 1rpx solid #DDDDDD; } - - .airconditioning{ - .input_value{ + .slot-content{ + display: grid; + grid-template-columns: repeat(2,1fr); + grid-row-gap:20rpx;//纵向间隔 + grid-column-gap:5rpx;//横向间隔 + padding:40rpx 10rpx; + >view{ + font-size:28rpx; + display: flex; + align-items: center; + } + image{ + width: 36rpx; + height: 36rpx; + } + } + .add-btn{ + width: 90rpx; + height: 90rpx; + position: fixed; + right: 15rpx; + top: 70%; + background: #24B383; + display: flex; + border-radius: 50%; + align-items: center; + justify-content: center; + image{ + width: 38rpx; + height: 38rpx; + } + } + .airconditioning { + .input_value { margin-top: 0; justify-content: flex-start; - padding: 0 0 0 30rpx; - height: 100rpx; - &.input-sel{ + padding: 0 0 0 30rpx; + height: 100rpx; + + &.input-sel { flex-direction: column; justify-content: center; align-items: flex-start; height: auto; - >view{ + + >view { height: 100rpx; display: flex; align-items: center; justify-content: flex-start; - .select-label{ + + .select-label { width: 200rpx; height: 66rpx; background: #F5F6FA; @@ -4118,49 +3060,52 @@ justify-content: center; align-items: center; box-sizing: border-box; - + } } } } } - .input_value { - width: 100%; - height: 126rpx; - border-top: 1rpx solid #DDDDDD; - border-bottom: 1rpx solid #DDDDDD; - font-size: 30rpx; - font-family: PingFang SC; - font-weight: bold; - color: #333333; - display: flex; - align-items: center; - justify-content: center; - margin-top: 30rpx; - input { - width: 120rpx; - height: 66rpx; - background: #F5F6FA; - border: 2px solid #E1E2E6; - border-radius: 10rpx; - margin: 0 20rpx; - display: flex; - justify-content: center; - align-items: center; - box-sizing: border-box; - padding: 0 20rpx; - } - - &.input-sel{ - flex-direction: column; - >view{ - display: flex; - align-items: center; - justify-content: center; - } - } - } + .input_value { + width: 100%; + height: 126rpx; + border-top: 1rpx solid #DDDDDD; + border-bottom: 1rpx solid #DDDDDD; + font-size: 30rpx; + font-family: PingFang SC; + font-weight: bold; + color: #333333; + display: flex; + align-items: center; + justify-content: center; + margin-top: 30rpx; + + input { + width: 120rpx; + height: 66rpx; + background: #F5F6FA; + border: 2px solid #E1E2E6; + border-radius: 10rpx; + margin: 0 20rpx; + display: flex; + justify-content: center; + align-items: center; + box-sizing: border-box; + padding: 0 20rpx; + } + + &.input-sel { + flex-direction: column; + + >view { + display: flex; + align-items: center; + justify-content: center; + } + } + } + .controller { width: 100%; min-height: 100vh; @@ -4349,6 +3294,7 @@ border-radius: 20rpx; min-height: 150rpx; margin-bottom: 30rpx; + .model-title { font-size: 28rpx; font-family: PingFang SC; @@ -4356,67 +3302,70 @@ color: #333333; margin-bottom: 20rpx; } - .airconditioning-grid{ + + .airconditioning-grid { display: grid; grid-template-columns: repeat(4, 1fr); grid-row-gap: 20rpx; //纵向间隔 grid-column-gap: 24rpx; //横向间隔 padding: 30rpx 10px 15rpx 10px; + .btn { width: 130rpx; height: 66rpx; display: flex; align-items: center; justify-content: center; - + >image { width: 30rpx; height: 30rpx; - + &.fan-img { animation: rotate 5s linear infinite; /* 持续时间为 5 秒,线性缓动,无限循环 */ /* 定义旋转动画 */ } - + @keyframes rotate { from { transform: rotate(0deg); } - + to { transform: rotate(360deg); } } } - + span { margin-left: 10rpx; } - + &.btn-on { background: linear-gradient(0deg, #54CDA4, #27B584); border-radius: 10rpx; - + span { color: #fff; } } - + &.btn-off { background: #EFFCF7; border: 2px solid rgba(58, 187, 144, 0.25); border-radius: 10rpx; box-sizing: border-box; - + span { - + font-weight: bold; color: #24B383; } } } } + .lishui-title { width: 100%; padding: 0 20rpx 0 30rpx; @@ -4635,7 +3584,7 @@ } } - + .model-title { font-size: 28rpx; @@ -4644,14 +3593,14 @@ color: #333333; margin-bottom: 20rpx; } - + .lishui-grid { display: grid; grid-template-columns: repeat(3, 1fr); grid-row-gap: 30rpx; //纵向间隔 grid-column-gap: 30rpx; //横向间隔 padding: 30rpx 0 35rpx 0; - + .btn { width: 190rpx; height: 66rpx; diff --git a/static/no-sel.png b/static/no-sel.png new file mode 100644 index 0000000000000000000000000000000000000000..6425e0c07dc2be9a92ce25b5d9bd293a2e22a91f GIT binary patch literal 1651 zcmV-(28{WMP)O zV^yj8DiDBHvvtV`!7Fx*-Fl>w3wt8~YQ^uBO^-4r%0tEaPrBJR+^C*A6 zy1H6Xb-dJm{`vViqtcEtJZ7WzyJ}hKm55FR2zZE9X^N|AXG#DK$ou>I+1=gUnyU6j z`|ZQS!#kCBl&!U2s%FGM$kvRy7X%_?fXDq|yKQR%1pZZ1QnfQ>n+FX@)1yYfH6jK= z=Fvl3BJjMZOU;P>>7xlC(P_dr4d-QMEIyY7=KxTjUW$l-(4_{Wdf~B!^CY4tnA4PyzW&#iVTvl3F z&eYRMh+r-VcZQrwM-1eg@`SW)iPva?t8f5TC5K80up0h3GNpE%L~$WB?0Q3-t26cNb*q@g#sQx&FjaiQ0fJx z1jza+_=#M9l-AFqb-aMn|FZFFDFN!7x(-ii5|6uhUZ6Z?jG3XRBB0=|4saol9IQ3^3M>EdD#ut$-;zSLOlP`LK^J7221wkq4L` zPP}IWLx9)mQb6bR)UB~0;O6GWc!426zpAA1ZwAUwH1>90KZQj-0gmfjBmqss)_6dk zvDh}OMfs?AO+(ob;Ka^F65z$Vx0)FOJhL`s)4O&knHTS#E`|Uvc04w{!NxB0uo(g( zh{9b|Q#RwZW7(y*^R8ZH1f-cieKd9l8<{X&&fVu3mjEq==5cal;40OLPqS(AcAsZl z0=$)=?0LFUli^Mp_xDx+)N=`l$s)}IwLdX4;7F=*|A@(`=Mq3Kg+clYQ0-65TsL$* z#{JQ?lz6l7Q$k7v%-YQ^r8@a(9BD2v z4AXb$%H66w)PU8m#HkSrs#X#Zy}&GqinGy?pvQPmr`rExR1yGHF@6eOAUXeSG43Y$ zAVmf_ytt85;63V|6WL}h0bHU`fXOr=uDqC||2eC`WBGL1n<)0txmJ}%1P}@$VV;gg z%neC`z+-vyUmt;Q{O&>{0ssyP+8b7fAc2Gz!F!fpDeQjR7y&R^ThMzWNl(Q3P-$6L=)(9B*X25fUh=<6aA6isZKl-i(b- zGLQ*V(=iboO#s(N61>THAz>vYdm{qikg74utWLrs=8v*GIH;`%;6jnW+nY1B3#)^U zDH##G?;qao76{K}>1%2RS{4r}H#>Bpx9d_YI|w zqB>ty$SoVZO55u4 z(k-bk=l}ZjC7PVAKJh=V06y^mSiMF-jR@HM-fX`7^Ou`1{`&P!>CV_eX={4^fa!jx z^zN%ae!f!vqK0p?M1T=|ArUvS!}Fz@5)nUE9Qyv(A z0oqY{y_@Ws6u`!ev=O|MmyK-jB^ZDKS_?xkZw5COs5lt_oHN2li4OR=0*2l-nj#PM zrTiqjMgAF@?4VWwiNF8vn;*7MPtRNBi$KJp zzzZNXZ)%CQ{YWt4uepExzIl9p`*f*i*$_0Ce3A0*2wngp_BEX?!6fv9cU;mXWuG*6W)FMoQz$)(02~h$EPYN}u}CjNeBwTYwZ*)klto=RGszXtNM4eIRJcxyx#gBMj`z3-B0)aYOB@U;^|k~{wM94 z13)kTmW{cB5JHXC5KrH4pI@By%>kg5+X)jY7g{!iTH-ae?^%!fIvfC|kVC3pG2=c7 zp_X`jJ$rfaMz#Zh!m?Z06ju;JP4Nivg+I@|04ACSw2wIuYKzAS6WL^s%nQI2p7J+= z76M1@Q;65FWzYxD~<|6Q*5OU_6i_Ob0Z2!JSvksIk$&FazhEC>J( zSva(POtCG}+$oHIsYZ9SC;*~B+eeh(DOAP!?7d6+9tA*SX8ugMAkysY#`M)kn&{}` zL=pgn%z~I~jIs-{=)%|aF$(}wK@hG#lJ$Uj-+rF!3JvA608kkS=7T4C%3R0MIxPOe8F3VbsXqmySGIuwnpI0)irelj0H}G_kKt z_#3l90B8^hqJGPEqY6-`@a#FIx`^;vXH3ZUC_ z2gW4=2wS~xB#JM?K*3hJx4$UwmFFGM8X#KHw57VUT(be_dW!(UR-$et>RKs_7q-^@ z7UP*x-rXuc`AB#D>E^2d=ytfY{40Q^jYz3KW6Qq-00960lX3U+00006Nkl