|
|
@ -30,7 +30,12 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<!-- <view class="ic-btn" hover-class="hover-active" @click="restartBtn">重启</view> --> |
|
|
|
<view |
|
|
|
v-if="oxAcInfo.extension&&oxAcInfo.extension.switch_device_name" |
|
|
|
class="ic-btn" |
|
|
|
hover-class="hover-active" |
|
|
|
@click="restartBtn" |
|
|
|
>重启</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
@ -104,7 +109,7 @@ export default { |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
curStoreInfo(nw, od){ |
|
|
|
console.warn(od.id, nw.id); |
|
|
|
this.getOuxuanacInfo(nw.device_name); |
|
|
|
this.getHardwareTypeList(); |
|
|
|
} |
|
|
|
}, |
|
|
@ -117,6 +122,7 @@ export default { |
|
|
|
statusBarHeight: 0, |
|
|
|
titleBarHeight: 0 |
|
|
|
}, |
|
|
|
oxAcInfo: {}, |
|
|
|
} |
|
|
|
}, |
|
|
|
async onLoad(options){ |
|
|
@ -124,10 +130,13 @@ export default { |
|
|
|
util.showLoad(); |
|
|
|
let _brandInfo = await this.$store.dispatch('getBrandInfo'); |
|
|
|
await this.$store.dispatch('getStoreList', { stadium_id: +options.stadium_id || '' }); |
|
|
|
let { curStoreInfo } = this; |
|
|
|
this.updateAC(); |
|
|
|
await this.getHardwareTypeList(); |
|
|
|
await this.getOuxuanacInfo(curStoreInfo.device_name); |
|
|
|
util.hideLoad(); |
|
|
|
}catch(err){ |
|
|
|
console.warn('onLoad err--->', err) |
|
|
|
util.hideLoad(); |
|
|
|
} |
|
|
|
|
|
|
@ -139,9 +148,7 @@ export default { |
|
|
|
this.initSysBarInfo(); |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
restartBtn(){ |
|
|
|
util.showNone('调试开发中!'); |
|
|
|
}, |
|
|
|
|
|
|
|
initSysBarInfo(){ |
|
|
|
let wxBtn = uni.getMenuButtonBoundingClientRect(); |
|
|
|
let sysInfo = uni.getSystemInfoSync(); |
|
|
@ -213,7 +220,85 @@ export default { |
|
|
|
let { curStoreInfo } = this; |
|
|
|
if(e.path == '')return util.showNone('开发中!'); |
|
|
|
util.routeTo(`${rootPage}${e.path}?sid=${e?.id || ''}&stadium_id=${curStoreInfo?.id || ''}`, 'nT'); |
|
|
|
} |
|
|
|
}, |
|
|
|
// 获取中控重启参数 |
|
|
|
getOuxuanacInfo(id_ouxuanac){ |
|
|
|
if(!id_ouxuanac){ |
|
|
|
console.log('中控id不存在 id_ouxuanac ->', id_ouxuanac); |
|
|
|
return Promise.resolve([]); |
|
|
|
} |
|
|
|
return deviceServer.get({ |
|
|
|
url: deviceApi.ouxuanacList, |
|
|
|
data: { id_ouxuanac }, |
|
|
|
failMsg: '加载中控信息失败!' |
|
|
|
}) |
|
|
|
.then(res=>{ |
|
|
|
console.log('id_ouxuanac', res); |
|
|
|
this.initOuxuancInfo({ oxacLs: res?.list || [], id_ouxuanac }); |
|
|
|
return res |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 初始化中控信息 |
|
|
|
initOuxuancInfo({ oxacLs, id_ouxuanac }){ |
|
|
|
this.oxAcInfo = oxacLs.find(e=>e.id_ouxuanac == id_ouxuanac) || {}; |
|
|
|
}, |
|
|
|
restartBtn(){ |
|
|
|
let { curStoreInfo, oxAcInfo } = this; |
|
|
|
let _dvName = oxAcInfo?.extension?.switch_device_name; |
|
|
|
this.operateReq({ deviceName: _dvName, op: 'off', }) |
|
|
|
.then(code=>{ |
|
|
|
if(code === 0){ |
|
|
|
setTimeout(_=>{ this.operateReq({ deviceName: _dvName, op: 'on', }) }, 1000) |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
// util.showNone('调试开发中!'); |
|
|
|
}, |
|
|
|
// 操作接口请求 |
|
|
|
operateReq({deviceName, op, isTip=true}){ |
|
|
|
// let _query = { |
|
|
|
// is_delay: true, |
|
|
|
// name: "gate-switch", |
|
|
|
// queue_group: "gate", |
|
|
|
// value: { tcp: "", cid: "", op}, |
|
|
|
// device: deviceName, |
|
|
|
// hardware_id: "", |
|
|
|
// } |
|
|
|
let _query = { |
|
|
|
"data": { |
|
|
|
"name": "gate-switch", |
|
|
|
"value":{ |
|
|
|
"op": op |
|
|
|
}, |
|
|
|
"is_async":true |
|
|
|
}, |
|
|
|
"device": deviceName |
|
|
|
} |
|
|
|
util.showLoad(); |
|
|
|
return deviceServer.post({ |
|
|
|
url: deviceApi.ouxuanac, |
|
|
|
data: _query, |
|
|
|
isDefaultGet: false, |
|
|
|
}) |
|
|
|
.then(res=>{ |
|
|
|
util.hideLoad(); |
|
|
|
if(res.data.code == 0){ |
|
|
|
if(isTip)util.showNone(res.data.message || '操作成功!'); |
|
|
|
return 0 |
|
|
|
}else{ |
|
|
|
util.showModal({ |
|
|
|
title: '提示', |
|
|
|
content: res.data.message || '操作失败!', |
|
|
|
showCancel: false, |
|
|
|
}) |
|
|
|
return 1 |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch(err=>{ |
|
|
|
util.hideLoad(); |
|
|
|
return Promise.reject(err); |
|
|
|
}) |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|