From 954f4bd920b9f218a5a9dd7584e5809796cdaaff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A3=8E=E8=8A=B1=E4=B8=80=E4=B8=96=E6=9C=88?= <1149505133@qq.com> Date: Tue, 2 Jul 2024 23:18:43 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E6=94=B9=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E6=8E=A5=E5=8F=A3=EF=BC=8C=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E9=A1=B5=E9=9D=A2=E3=80=81=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E9=83=A8=E5=88=86=E5=B1=9E=E6=80=A7=E5=88=86=E7=BB=84=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E5=92=8C=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- network/api/index.js | 2 +- pages/iots/device/device-detail.vue | 84 +++++++++++++++++++++++++++-- pages/tabbar/workbench.vue | 6 +-- 3 files changed, 85 insertions(+), 7 deletions(-) diff --git a/network/api/index.js b/network/api/index.js index 7f64d45..a376bf4 100644 --- a/network/api/index.js +++ b/network/api/index.js @@ -87,7 +87,7 @@ export default { getUserMenu(data){ return new Promise((resolve, reject) => { request.TokenRequest({ - url: '/user/admin/menu/list', + url: '/user/admin/role/header', method: 'GET', },data) .then((res) =>{ diff --git a/pages/iots/device/device-detail.vue b/pages/iots/device/device-detail.vue index 11bf90e..f88e4de 100644 --- a/pages/iots/device/device-detail.vue +++ b/pages/iots/device/device-detail.vue @@ -34,6 +34,18 @@ {{wsStatus?'刷新':'已断连'}} --> + + + 属性分组: + + + @@ -158,7 +170,7 @@ :disabled="true" :name="item.name" v-model="item.value" - :unit="item.ioObj.unit" + :unit="item.ioObj?item.ioObj.unit?item.ioObj.unit:'':''" @change="downData($event,index)" @clickLog="clickLog(index)" > @@ -320,6 +332,7 @@ import IotsInput from '@/components/iot-components/input/iots-input.vue' import IotsSelectTime from '@/components/iot-components/select-time/iots-select-time.vue' import IotsImg from '@/components/iot-components/img/iots-img.vue' + import uniDataSelect from "@/components/iot-components/uni-data-select/uni-data-select.vue" export default{ data(){ @@ -347,7 +360,18 @@ }, scrollTop:0, - // 设备属性 + selectGroup:0, + // 属性分组 + groupList:[{ + value:0, + label:'全部', + groupKey:'all', + groupName:'全部', + ioRelKey:[] + }], + // 全部设备属性用于属性分组(不变) + dataAllData:[], + // 设备属性用于属性分组后数据(会变) dataList:[], dataIndex: 0, // 设备功能 @@ -418,7 +442,8 @@ IotsPie, IotsGauge, IotsInput, - IotsImg + IotsImg, + uniDataSelect }, onLoad(option) { console.log("option",option) @@ -453,6 +478,10 @@ url:'./device-control?dataList=' + dataList + '&devId=' + this.deviceInfo.devId + '&pk=' + this.deviceInfo.pk + '&devName=' + this.deviceInfo.devName }) }, + // 选择分组 + changeGroup(e){ + console.log("选择分组",e) + }, getChartData(type,data){ if(type == 'charts_dashboard'){ let min = 0; @@ -530,8 +559,43 @@ item.time = 0; return item; }) + this.dataAllData = this.dataList; }else{ this.dataList = []; + this.dataAllData = []; + } + if(thingModel.contents.groups.length){ + let groupList = [{ + value:0, + label:'全部', + groupKey:'all', + groupName:'全部', + ioRelKey:[] + }]; + thingModel.contents.groups.forEach((item,index)=>{ + groupList.push({ + value:index+1, + label:item.groupName, + ...item + }) + }) + this.groupList = groupList; + // this.$nextTick(()=>{ + // this.$set(this,'groupList',groupList) + // }) + }else{ + this.groupList = [{ + value:0, + label:'全部', + groupKey:'all', + groupName:'全部', + ioRelKey:[] + }]; + } + if(thingModel.contents.server.length){ + this.abilityList = thingModel.contents.server; + }else{ + this.abilityList = []; } if(thingModel.contents.server.length){ this.abilityList = thingModel.contents.server; @@ -893,6 +957,20 @@ } } } + .group-list{ + display: flex; + // justify-content: space-between; + align-items: center; + margin: 0 20rpx; + margin-top: 20rpx; + padding: 20rpx; + background-color: #fff; + border-radius: 20rpx; + .group-list-label{ + margin-right: 10rpx; + font-weight: bold; + } + } // 设备详情弹窗 .detail-model{ padding: 30rpx; diff --git a/pages/tabbar/workbench.vue b/pages/tabbar/workbench.vue index 8f21a05..f2e293b 100644 --- a/pages/tabbar/workbench.vue +++ b/pages/tabbar/workbench.vue @@ -42,9 +42,9 @@ - {{item.label[0]}} + {{item.title[0]}} - {{item.label}} + {{item.title}} { + this.$api.getUserMenu({clientType:2}).then(res => { console.log("获取用户菜单",res) if(res.code == 0){ this.commonList = res.data.list?res.data.list:[];