diff --git a/pages/mine/equipment/index.vue b/pages/mine/equipment/index.vue index 9daf6f2..3cf2565 100644 --- a/pages/mine/equipment/index.vue +++ b/pages/mine/equipment/index.vue @@ -2,9 +2,10 @@ - + + - + - + - - + + @@ -30,23 +32,29 @@ - 电量: + 电量: {{item.electricity}}% {{item.electricity}}% - + - - - - - - + + + + + + 信号:0 信号:{{item.signalDevice}} - + 设备编号 @@ -55,8 +63,8 @@ 录音状态 关闭 - 开启 - 关闭 + 开启 + 关闭 待上传 @@ -66,7 +74,7 @@ - @@ -91,8 +99,7 @@ export default { data() { return { - tablist: [ - { + tablist: [{ name: "全部(0)", }, { @@ -109,35 +116,35 @@ } ], activeClass: 0, - pageNum:1, - pageSize:20, - imei:"", - orgcode:"", - newListdata:[], - buildingID:'', - jump:'' + pageNum: 1, + pageSize: 20, + imei: "", + orgcode: "", + newListdata: [], + buildingID: '', + jump: '' }; }, onReachBottom() { - this.pageNum +=1; + this.pageNum += 1; this.init() }, - onPullDownRefresh(){ + onPullDownRefresh() { this.init() - setTimeout(function () { - uni.stopPullDownRefresh(); + setTimeout(function() { + uni.stopPullDownRefresh(); }, 1000); }, onLoad(options) { - if(options.active){ - this.activeClass=options.active - }else{ - this.activeClass=0 + if (options.active) { + this.activeClass = options.active + } else { + this.activeClass = 0 } - this.newListdata=[] - this.pageNum=1; - this.pageSize=20; - this.init() + this.newListdata = [] + this.pageNum = 1; + this.pageSize = 20; + this.init() }, filters: { formatDate: (dateTimeStamp) => { @@ -147,113 +154,114 @@ var day = hour * 24; var halfamonth = day * 15; var month = day * 30; - var now = new Date().getTime(); + var now = new Date().getTime(); var diffValue = now - newDate; - if(diffValue < 0){return;} - var monthC =diffValue/month; - var weekC =diffValue/(7*day); - var dayC =diffValue/day; - var hourC =diffValue/hour; - var minC =diffValue/minute; - var result = ''; - if(weekC>=1){ - result= "1周前"; - }else if(dayC>=1){ - result=""+ parseInt(dayC) +"天前"; - } else if(hourC>=1){ - result=""+ parseInt(hourC) +"小时前"; + if (diffValue < 0) { + return; } - else if(minC>=1){ - result=""+ parseInt(minC) +"分钟前"; - }else{ - result="刚刚"; + var monthC = diffValue / month; + var weekC = diffValue / (7 * day); + var dayC = diffValue / day; + var hourC = diffValue / hour; + var minC = diffValue / minute; + var result = ''; + if (weekC >= 1) { + result = "1周前"; + } else if (dayC >= 1) { + result = "" + parseInt(dayC) + "天前"; + } else if (hourC >= 1) { + result = "" + parseInt(hourC) + "小时前"; + } else if (minC >= 1) { + result = "" + parseInt(minC) + "分钟前"; + } else { + result = "刚刚"; } return result; } }, methods: { - shecs(){ - this.newListdata=[] - this.pageNum=1; - this.pageSize=20; - this.init() + shecs() { + this.newListdata = [] + this.pageNum = 1; + this.pageSize = 20; + this.init() }, // tab clocktab(index) { - this.activeClass=index; - this.newListdata=[] - this.pageNum=1; - this.pageSize=20; + this.activeClass = index; + this.newListdata = [] + this.pageNum = 1; + this.pageSize = 20; this.init() }, - init(){ - this.buildingID=uni.getStorageSync('buildingID').id; + init() { + this.buildingID = uni.getStorageSync('buildingID').id; const parames = { pageNum: this.pageNum, pageSize: this.pageSize, - query:{ - imei:this.imei, - onLine:this.activeClass, - propertyId:this.buildingID, - orderType:1 + query: { + imei: this.imei, + onLine: this.activeClass, + propertyId: this.buildingID, + orderType: 1 } } - - if(this.activeClass==0){ - parames.query.onLine=null + + if (this.activeClass == 0) { + parames.query.onLine = null } this.$u.post("/equipment/apiFindByPage", parames).then(res => { - this.tablist[0].name="全部("+res.allCount+")"; - this.tablist[1].name="在线("+res.eqOnLineCount+")"; - this.tablist[2].name="低电量("+res.lowElectricityCount+")"; - this.tablist[3].name="今日活跃("+res.activeCount+")"; - this.tablist[4].name="离线("+res.eqOffLineCount+")"; - if(res.obj.list.results==null){ - if (this.pageNum == 1){ + this.tablist[0].name = "全部(" + res.allCount + ")"; + this.tablist[1].name = "在线(" + res.eqOnLineCount + ")"; + this.tablist[2].name = "低电量(" + res.lowElectricityCount + ")"; + this.tablist[3].name = "今日活跃(" + res.activeCount + ")"; + this.tablist[4].name = "离线(" + res.eqOffLineCount + ")"; + if (res.obj.list.results == null) { + if (this.pageNum == 1) { return - }else{ + } else { uni.showToast({ - title: '已经到底了!', - duration: 2000 + title: '已经到底了!', + duration: 2000 }); } - }else{ - res.obj.list.results.forEach(item=>{ - if(item.onLine==0){ - item.signalDevice=0 + } else { + res.obj.list.results.forEach(item => { + if (item.onLine == 0) { + item.signalDevice = 0 } - - if(item.electricity==''){ - item.electricity=0 + + if (item.electricity == '') { + item.electricity = 0 } - if(item.electricity>100){ - item.electricity=100 + if (item.electricity > 100) { + item.electricity = 100 } - let num=this.ascformatDate(item.updateTime) - if(num>12){ - item.electricity=0 + let num = this.ascformatDate(item.updateTime) + if (num > 12) { + item.electricity = 0 } - + }) - + if (this.pageNum == 1) { - this.newListdata=res.obj.list.results + this.newListdata = res.obj.list.results } else { - this.newListdata = [...this.newListdata, ...res.obj.list.results]; + this.newListdata = [...this.newListdata, ...res.obj.list.results]; } } }) }, - ascformatDate(dateTimeStamp){ + ascformatDate(dateTimeStamp) { let newDate = new Date(dateTimeStamp.replace(/-/g, '/')).getTime(); let minute = 1000 * 60; let hour = minute * 60; let day = hour * 24; let halfamonth = day * 15; let month = day * 30; - let now = new Date().getTime(); + let now = new Date().getTime(); let diffValue = now - newDate; - let result =diffValue/hour; + let result = diffValue / hour; return result; } }, @@ -265,7 +273,7 @@ width: 100%; min-height: 100vh; background: #FFFFFF; - + .header { position: sticky; top: var(--window-top); @@ -384,6 +392,7 @@ background-color: #333333; } } + .you11 { width: 20rpx; height: 28rpx; @@ -392,7 +401,7 @@ background-size: 100% 100%; display: flex; flex-direction: column-reverse; - + .youimg { width: 100%; background-color: red; @@ -407,6 +416,7 @@ color: #333333; margin-left: 6rpx; } + .you22 { width: 114rpx; height: 30rpx; @@ -463,7 +473,7 @@ font-size: 24rpx; color: #333333; text-indent: 30rpx; - + .stayupload { color: #F41313; } diff --git a/pages/mine/reception/addreception.vue b/pages/mine/reception/addreception.vue index 8e50a33..7a0cfde 100644 --- a/pages/mine/reception/addreception.vue +++ b/pages/mine/reception/addreception.vue @@ -125,10 +125,16 @@ canceltext: '2', //取消文字 daitiReceptionobj: {}, isShow: false, // 默认隐藏该权限 + userInfo: {}, // 用户信息 }; }, + onLoad() { + this.userInfo = uni.getStorageSync('weapp_session_userInfo_data'); + console.log(this.userInfo, 'adkljsakldjaskljdklasjdklsajdklasjdklasjdlk') + }, + onShow() { - let newmenulist= uni.getStorageSync('weapp_session_Menu_data'); + let newmenulist = uni.getStorageSync('weapp_session_Menu_data'); this.isShow = newmenulist.jd_zp this.parames.projectId = uni.getStorageSync('buildingID').id; this.getFreeList(); @@ -254,6 +260,9 @@ this.parames.howMany = num; }, clickShowhid() { + if (this.userInfo.userRoleType == 6) { + return + } if (this.freeList.length == 0) { uni.showToast({ icon: 'none', @@ -286,16 +295,21 @@ //获取顾问列表 getFreeList() { this.$u.get("/zkAgentPool/freeList?itemId=" + this.parames.projectId).then(res => { - this.freeList = res; + this.freeList = res; this.freeList.forEach(item => { + console.log(item, '顾问') if (item.onLine == 0) { item.label = item.name + "(离线)"; } else if (item.onLine == 1) { - item.label = item.name + "(在线)"; + item.label = item.name + "(在线)"; } else { - item.label = item.name + "(无设备)"; + item.label = item.name + "(无设备)"; } item.value = item.agentId + if (this.userInfo.accountId == item.agentId) { + this.text = item.label + this.parames.agentId = item.agentId; + } }) }) },