|
|
@ -3,6 +3,7 @@ |
|
|
|
<store-name></store-name> |
|
|
|
<view class="sm-tit">{{pageInfo.name || '-'}}</view> |
|
|
|
<view class="sm-tip" v-if="pageInfo.longOpenName"><text>*</text>长开表示不再被系统智能控制,只有手动关闭后才会被智能控制。请谨慎操作。</view> |
|
|
|
<view class="sm-tip" v-if="['Light', 'Air'].includes(pageInfo.hardware_type)">现场电源断开,则无法获取到开关状态;状态是通过硬件发送通知给服务器,则状态获取可能存在延时。</view> |
|
|
|
<view class="sm-list"> |
|
|
|
<view v-for="(e, i) in deviceList" :key="i" :class="[ 'sl-item', pageInfo.iconNum<=2?'sl-limit':'' ]"> |
|
|
|
|
|
|
@ -16,10 +17,16 @@ |
|
|
|
sim状态: <text>{{getLotStatus(e)}}</text> |
|
|
|
</view> |
|
|
|
<view class="sr-bot" v-else-if="pageInfo.id !=5"> |
|
|
|
<view :class="[e.defineStatusCode == 1?'active':'']"> |
|
|
|
<text>{{ e.defineStatusCode == 1 ? '设备在线' : e.defineStatusCode == 0?'设备离线' : '-' }}</text> |
|
|
|
<view class="sb-online-status"> |
|
|
|
<view :class="[e.defineStatusCode == 1?'active':'']"> |
|
|
|
<text>{{ e.defineStatusCode == 1 ? '设备在线' : e.defineStatusCode == 0?'设备离线' : '-' }}</text> |
|
|
|
</view> |
|
|
|
<image mode="aspectFit" src="/subpackage/device/static/images/refresh.png" @click="refreshStatusBtn({switchInfo:e, index:i})"></image> |
|
|
|
</view> |
|
|
|
<view class="sb-open-status" v-if="['Light', 'Air'].includes(e.hardware_type)"> |
|
|
|
当前开关状态:{{ (e.extension&&e.extension.hardware_status_info&&e.extension.hardware_status_info.switch_status) || '-' }} |
|
|
|
<image mode="aspectFit" src="/subpackage/device/static/images/refresh.png" @click="refreshOpenStatusBtn(e, i)"></image> |
|
|
|
</view> |
|
|
|
<image mode="aspectFit" src="/subpackage/device/static/images/refresh.png" @click="refreshStatusBtn({switchInfo:e, index:i})"></image> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -72,7 +79,7 @@ import deviceServer from '../../js/device_server'; |
|
|
|
import deviceApi from '../../js/device_api'; |
|
|
|
|
|
|
|
import { mapState } from 'vuex'; |
|
|
|
import util from '../../../../utils/util'; |
|
|
|
import util, { debounce, showLoad, hideLoad } from '../../../../utils/util'; |
|
|
|
import DEVICE_FUN from '../../js/device_fun.js'; |
|
|
|
|
|
|
|
export default { |
|
|
@ -111,6 +118,7 @@ export default { |
|
|
|
return { |
|
|
|
pageInfo: {}, |
|
|
|
deviceList: [], |
|
|
|
stadium_id: '', |
|
|
|
} |
|
|
|
}, |
|
|
|
/** |
|
|
@ -121,24 +129,29 @@ export default { |
|
|
|
*/ |
|
|
|
onLoad(options){ |
|
|
|
let _pageInfo = getShowArr(`s${options.sid}`) || {}; |
|
|
|
let _stadiumId = options?.stadium_id ?? ''; |
|
|
|
this.pageInfo = _pageInfo; |
|
|
|
this.stadium_id = _stadiumId |
|
|
|
uni.setNavigationBarTitle({ title: _pageInfo.name }); |
|
|
|
|
|
|
|
this.getDeviceList({ |
|
|
|
stadium_id: options.stadium_id || this.curStoreInfo.id, |
|
|
|
stadium_id: _stadiumId || this.curStoreInfo.id, |
|
|
|
hardware_type: _pageInfo.hardware_type |
|
|
|
}) |
|
|
|
setTimeout(_=>{ |
|
|
|
this.$nextTick(_=>{ |
|
|
|
uni.createSelectorQuery().selectAll(".si-bottom > view") |
|
|
|
.boundingClientRect(data => { |
|
|
|
console.warn('createSelectorQuery', data) |
|
|
|
}).exec(); |
|
|
|
|
|
|
|
}) |
|
|
|
}, 1000) |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
refreshOpenStatusBtn: debounce(async function(e, i){ |
|
|
|
let _devices = await this.getDevices({ |
|
|
|
stadium_id: e?.stadium_id ?? '', |
|
|
|
hardware_type: e?.hardware_type ?? '', |
|
|
|
"filter[id]": e?.id ?? '' |
|
|
|
}); |
|
|
|
let _deviceInfo = _devices?.[0] ?? {}; |
|
|
|
if(_deviceInfo?.id === e.id){ |
|
|
|
this.deviceList[i].extension.hardware_status_info = _deviceInfo?.extension?.hardware_status_info ?? null |
|
|
|
} |
|
|
|
|
|
|
|
}, 300, true), |
|
|
|
isDetailBtn(e){ |
|
|
|
if(e&&e.toString() === "[object Object]"){ |
|
|
|
return e.hardware_model == 'XiaoHuiXiong' && e.hardware_type === 'Air'; |
|
|
@ -152,39 +165,48 @@ export default { |
|
|
|
let _qrStr = util.jsonStr(_queryObj); |
|
|
|
if(e.hardware_type == "Air")return util.routeTo(`/subpackage/device/pages/air_conditioner/detail/detail?qrstr=${_qrStr}&name=${e.hardware_name || '-'}`, 'nT'); |
|
|
|
}, |
|
|
|
getDeviceList({ |
|
|
|
stadium_id, |
|
|
|
hardware_type, |
|
|
|
limit = 100, |
|
|
|
page = 1 |
|
|
|
}){ |
|
|
|
util.showLoad(); |
|
|
|
|
|
|
|
let reqListData = { |
|
|
|
getDevices({ stadium_id, hardware_type = '', id = '', limit = 1000, page = 1, ...agrs }){ |
|
|
|
showLoad(); |
|
|
|
return deviceServer.get({ |
|
|
|
url: deviceApi.hardwareList, |
|
|
|
data: { |
|
|
|
'filter[hardware_type]': hardware_type, |
|
|
|
'filter[stadium_id]': stadium_id, |
|
|
|
'limit': limit, |
|
|
|
'page': page, |
|
|
|
} |
|
|
|
if(hardware_type=="WaterValve") reqListData.operating_status = 1; //0723 按测试要求 水阀这里加多一个状态 |
|
|
|
deviceServer.get({ |
|
|
|
url: deviceApi.hardwareList, |
|
|
|
data: reqListData, |
|
|
|
limit, |
|
|
|
page, |
|
|
|
...agrs |
|
|
|
}, |
|
|
|
failMsg: '加载失败!' |
|
|
|
}) |
|
|
|
.then(res=>{ |
|
|
|
util.hideLoad(); |
|
|
|
let _list = res.list || []; |
|
|
|
if(hardware_type=="Router4G"){ //路由器在线状态设置 |
|
|
|
_list = _list.map((e,i)=>{ |
|
|
|
hideLoad(); |
|
|
|
return res?.list ?? [] |
|
|
|
}) |
|
|
|
.catch(err=>{ |
|
|
|
hideLoad(); |
|
|
|
console.warn('subpackage device pages switch mange getSingleDevice err', err); |
|
|
|
}) |
|
|
|
}, |
|
|
|
async getDeviceList({ |
|
|
|
stadium_id, |
|
|
|
hardware_type, |
|
|
|
limit = 1000, |
|
|
|
page = 1 |
|
|
|
}){ |
|
|
|
let _query = { |
|
|
|
stadium_id, hardware_type, limit, page |
|
|
|
} |
|
|
|
if(hardware_type=="WaterValve") _query['operating_status'] = 1; //0723 按测试要求 水阀这里加多一个状态 |
|
|
|
let _devices = await this.getDevices(_query); |
|
|
|
if(_devices?.length){ |
|
|
|
if(hardware_type=="Router4G"){ //路由器在线状态设置 |
|
|
|
_devices = _devices.map((e,i)=>{ |
|
|
|
e['defineStatusCode'] = e.extension.online? 1 : 0; |
|
|
|
return e |
|
|
|
}) |
|
|
|
} |
|
|
|
this.deviceList = _list; |
|
|
|
console.log(res) |
|
|
|
}) |
|
|
|
.catch(util.hideLoad) |
|
|
|
} |
|
|
|
this.deviceList = _devices; |
|
|
|
}, |
|
|
|
controlDevice(e){ |
|
|
|
util.routeTo(`/subpackage/device/pages/index/lot_manage?mac=${switchInfo.hardware_standard}`, 'nT'); |
|
|
@ -229,7 +251,6 @@ export default { |
|
|
|
} |
|
|
|
|
|
|
|
this.operateReq({ data: _data }); |
|
|
|
|
|
|
|
}, 300, 300), |
|
|
|
|
|
|
|
// 获取接口参数结构 |
|
|
@ -652,6 +673,17 @@ function getShowArr(key){ |
|
|
|
&.sl-limit{ |
|
|
|
flex-grow: 0; |
|
|
|
width: 328upx !important; |
|
|
|
.si-top>.st-right>.sr-bot{ |
|
|
|
flex-wrap: wrap; |
|
|
|
.sb-open-status{ |
|
|
|
margin-left: 0; |
|
|
|
font-size: 20upx; |
|
|
|
} |
|
|
|
image{ |
|
|
|
width: 26upx; |
|
|
|
height: 26upx; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
.si-top{ |
|
|
|
padding: 20upx 20upx 30upx; |
|
|
@ -683,36 +715,45 @@ function getShowArr(key){ |
|
|
|
} |
|
|
|
.sr-bot{ |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
>view{ |
|
|
|
margin-right: 8upx; |
|
|
|
padding: 0 12upx; |
|
|
|
font-size: 20upx; |
|
|
|
line-height: 28upx; |
|
|
|
border-radius: 28upx; |
|
|
|
border: 2upx solid #9A9A9D; |
|
|
|
color: #9A9A9D; |
|
|
|
&::before{ |
|
|
|
content: ''; |
|
|
|
margin-right: 12upx; |
|
|
|
margin-top: -4upx; |
|
|
|
display: inline-block; |
|
|
|
vertical-align: middle; |
|
|
|
width: 8upx; |
|
|
|
height: 8upx; |
|
|
|
border-radius: 50%; |
|
|
|
background-color: #9A9A9D; |
|
|
|
} |
|
|
|
&.active{ |
|
|
|
color: #333333; |
|
|
|
.sb-online-status{ |
|
|
|
@include ctf; |
|
|
|
>view{ |
|
|
|
padding: 0 12upx; |
|
|
|
border-radius: 28upx; |
|
|
|
border: 2upx solid #9A9A9D; |
|
|
|
@include flcw(20upx, 28upx, #9A9A9D); |
|
|
|
&::before{ |
|
|
|
background-color: $themeColor; |
|
|
|
content: ''; |
|
|
|
margin-right: 12upx; |
|
|
|
margin-top: -4upx; |
|
|
|
display: inline-block; |
|
|
|
vertical-align: middle; |
|
|
|
width: 8upx; |
|
|
|
height: 8upx; |
|
|
|
border-radius: 50%; |
|
|
|
background-color: #9A9A9D; |
|
|
|
} |
|
|
|
&.active{ |
|
|
|
color: #333333; |
|
|
|
&::before{ |
|
|
|
background-color: $themeColor; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
.sb-open-status{ |
|
|
|
margin-left: auto; |
|
|
|
margin-right: 0; |
|
|
|
@include flcw(28upx, 40upx, #333); |
|
|
|
image{ |
|
|
|
vertical-align: middle; |
|
|
|
} |
|
|
|
} |
|
|
|
>image{ |
|
|
|
image{ |
|
|
|
flex-shrink: 0; |
|
|
|
flex-grow: 0; |
|
|
|
margin-left: 8upx; |
|
|
|
width: 32upx; |
|
|
|
height: 32upx; |
|
|
|
} |
|
|
|