Browse Source

feat:fix bugs

master
zhaobing’ 1 year ago
parent
commit
ff14147b6c
  1. 27
      api/app/lib/controllers/AIOTOverview/AIOTOverview.js
  2. 3
      weapp/package/AIOTOverview/AIOTOverview.js
  3. 2
      weapp/package/AIOTOverview/electricityMonitoring/electricityMonitoring.js
  4. 8
      weapp/package/AIOTOverview/electricityMonitoring/electricityMonitoring.wxml

27
api/app/lib/controllers/AIOTOverview/AIOTOverview.js

@ -86,6 +86,12 @@ async function getThingsDeploy (ctx) {
} }
} }
//查询物联网卡相关信息 //查询物联网卡相关信息
// cs.PType as pType,
// cs.Status as status,
// cs.Total as total,
// cs.Allowance as allowance,
// cs.Time as time
// FROM alarm.CardStatus cs
async function getCardInfo (ctx) { async function getCardInfo (ctx) {
try{ try{
let rlst = [] let rlst = []
@ -97,16 +103,21 @@ async function getCardInfo (ctx) {
rlst = await clickHouse.dataAlarm.query(` rlst = await clickHouse.dataAlarm.query(`
with tmp as ( SELECT cs.DeviceId as deviceId, with tmp as ( SELECT cs.DeviceId as deviceId,
cs.CardNo as cardNo, cs.CardNo as cardNo,
cs.PType as pType, MAX(cs.Time) as time
cs.Status as status,
cs.Total as total,
cs.Allowance as allowance,
cs.Time as time
FROM alarm.CardStatus cs FROM alarm.CardStatus cs
WHERE cs.DeviceId in ${id} WHERE cs.DeviceId in ${id}
ORDER BY cs.Time DESC GROUP BY cs.DeviceId, cs.CardNo
LIMIT 1) )
SELECT t.*,d.thingId,d.name FROM tmp t SELECT t.*,d.thingId,d.name,
q.CardNo as cardNo,
q.PType as pType,
q.Status as status,
q.Total as total,
q.Allowance as allowance
FROM tmp t
LEFT JOIN alarm.CardStatus q
ON t.deviceId = q.DeviceId
AND q.Time=t.time
LEFT JOIN ${iota}.Device d LEFT JOIN ${iota}.Device d
ON Device.id = t.deviceId` ).toPromise() ON Device.id = t.deviceId` ).toPromise()
ctx.status = 200 ctx.status = 200

3
weapp/package/AIOTOverview/AIOTOverview.js

@ -67,7 +67,6 @@ Page({
} }
} }
} }
} }
if (status && status.length) { if (status && status.length) {
const data = deviceId.map(item => { const data = deviceId.map(item => {
@ -79,7 +78,7 @@ Page({
xjId:item.xjId xjId:item.xjId
} }
}) })
deviceAll.push({ id: '012ccc98-c99d-445e-8397-6da1b4567533', name: '设备二', structId: 'df48d7c5-d902-47b1-b671-d88d546ba3e4' }) // deviceAll.push({ id: '012ccc98-c99d-445e-8397-6da1b4567533', name: '设备二', structId: 'df48d7c5-d902-47b1-b671-d88d546ba3e4' })
if (deviceAll && deviceAll.length) { if (deviceAll && deviceAll.length) {
Request.post(getCardInfo(), { structIds: deviceAll }).then(res => { Request.post(getCardInfo(), { structIds: deviceAll }).then(res => {
if (res) { if (res) {

2
weapp/package/AIOTOverview/electricityMonitoring/electricityMonitoring.js

@ -62,6 +62,7 @@ Page({
let listt=[] let listt=[]
//智能断路器的设备的状态 //智能断路器的设备的状态
const res1 =await Request.post(createInvoke(),data) const res1 =await Request.post(createInvoke(),data)
// console.log('resss',res1)
//获取结构物列表(巡检) //获取结构物列表(巡检)
// console.log('getProjectList',getProjectList) // console.log('getProjectList',getProjectList)
const res=await Request.get(getProjectList()) const res=await Request.get(getProjectList())
@ -84,6 +85,7 @@ Page({
}) })
} }
data.unshift({text: '全部', value: 'all' }) data.unshift({text: '全部', value: 'all' })
// console.log('listt',listt)
this.setData({ this.setData({
structList:data, structList:data,
list:listt, list:listt,

8
weapp/package/AIOTOverview/electricityMonitoring/electricityMonitoring.wxml

@ -26,14 +26,14 @@
<view class="row flex flex-between detail"> <view class="row flex flex-between detail">
<view class="content-left">运行状态</view> <view class="content-left">运行状态</view>
<view class="content-right" wx:if="{{!item.data.data}}">{{'离线'}}</view> <view class="content-right" wx:if="{{!item.data.data}}">{{'离线'}}</view>
<view class="content-right" wx:if="{{item.data.data.info&&item.data.data.info.includes('离线')}}">{{'离线'}}</view> <view class="content-right" wx:if="{{item.data.data&&item.data.data.info.includles('离线')}}">{{'离线'}}</view>
<view class="content-right" wx:if="{{item.data.data.info&&item.data.data.info.includes('正常')}}">{{'正常'}}</view> <view class="content-right" wx:if="{{item.data.data&&item.data.data.info.includles('在线')}}">{{'正常'}}</view>
</view> </view>
<view class="row flex flex-between detail"> <view class="row flex flex-between detail">
<view class="content-left">电源状态</view> <view class="content-left">电源状态</view>
<view class="content-right" wx:if="{{!item.data.data}}">{{'离线'}}</view> <view class="content-right" wx:if="{{!item.data.data}}">{{'离线'}}</view>
<view class="content-right" wx:if="{{item.data.data.info&&item.data.data.info.includes('离线')}}">{{'离线'}}</view> <view class="content-right" wx:if="{{item.data.data&&item.data.data.info.includles('离线')}}">{{'离线'}}</view>
<view class="content-right" wx:if="{{item.data.data.info&&item.data.data.info.includes('正常')}}">{{'正常'}}</view> <view class="content-right" wx:if="{{item.data.data&&item.data.data.info.includles('在线')}}">{{'正常'}}</view>
</view> </view>
</view> </view>
</view> </view>

Loading…
Cancel
Save