|
|
@ -20,10 +20,13 @@ |
|
|
|
|
|
|
|
<view class="ic-section"> |
|
|
|
<view class="is-list"> |
|
|
|
<view class="il-item" v-for="(e,i) in tabArr" :key="i" @click="routeTo(e)"> |
|
|
|
<view><image mode="aspectFit" :src="getImgPath(e.id) || ''"></image></view> |
|
|
|
<view>{{e.name || ''}}</view> |
|
|
|
</view> |
|
|
|
<block v-for="(e,i) in tabArr" :key="i"> |
|
|
|
<view class="il-item" @click="routeTo(e)" v-if="isShowHardwareTab(e)"> |
|
|
|
<view><image mode="aspectFit" :src="getImgPath(e.id) || ''"></image></view> |
|
|
|
<view>{{e.name || ''}}</view> |
|
|
|
</view> |
|
|
|
</block> |
|
|
|
|
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -37,7 +40,6 @@ import deviceApi from '../../js/device_api'; |
|
|
|
|
|
|
|
const rootPage = '/subpackage/device' |
|
|
|
const tabArr = [ |
|
|
|
|
|
|
|
{id: 1, name: '照明', path: `/pages/switch_manage/switch_manage`}, |
|
|
|
{id: 2, name: '空调', path: `/pages/switch_manage/switch_manage`}, |
|
|
|
{id: 3, name: '风扇', path: `/pages/switch_manage/switch_manage`}, |
|
|
@ -57,7 +59,6 @@ const tabArr = [ |
|
|
|
// {id: 17, name: '窗帘', path: `/pages/switch_manage/switch_manage`}, |
|
|
|
{id: 18, name: '路由器', path: `/pages/switch_manage/switch_manage`}, |
|
|
|
{id: 19, name: '物联卡', path: `/pages/switch_manage/switch_manage`}, |
|
|
|
|
|
|
|
]; |
|
|
|
import { mapState } from 'vuex' |
|
|
|
export default { |
|
|
@ -69,7 +70,6 @@ export default { |
|
|
|
storeList: state => state.device.storeList, |
|
|
|
curStoreInfo: state => state.device.curStoreInfo, |
|
|
|
}), |
|
|
|
|
|
|
|
getTop(){ |
|
|
|
return (lineHeight)=>{ |
|
|
|
// #ifdef MP-WEIXIN |
|
|
@ -80,12 +80,27 @@ export default { |
|
|
|
return top |
|
|
|
} |
|
|
|
}, |
|
|
|
// |
|
|
|
showHardwareIdLs(){ |
|
|
|
let { hardwareTypeList } = this; |
|
|
|
let _ls = hardwareTypeList || []; |
|
|
|
let _fls = _ls.filter(ele=>ele.stadium_has); |
|
|
|
let _idLs = _fls.map(el => el.mini_local_menu_id); |
|
|
|
return _idLs || []; |
|
|
|
}, |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
curStoreInfo(nw, od){ |
|
|
|
console.warn(od.id, nw.id); |
|
|
|
this.getHardwareTypeList(); |
|
|
|
} |
|
|
|
}, |
|
|
|
data(){ |
|
|
|
return { |
|
|
|
tabArr, |
|
|
|
deviceInfo:"" |
|
|
|
} |
|
|
|
tabArr: [], |
|
|
|
deviceInfo:"", |
|
|
|
hardwareTypeList: [], |
|
|
|
} |
|
|
|
}, |
|
|
|
async onLoad(){ |
|
|
|
try{ |
|
|
@ -93,6 +108,7 @@ export default { |
|
|
|
let _brandInfo = await this.$store.dispatch('getBrandInfo'); |
|
|
|
await this.$store.dispatch('getStoreList'); |
|
|
|
this.updateAC(); |
|
|
|
await this.getHardwareTypeList(); |
|
|
|
util.hideLoad(); |
|
|
|
}catch(err){ |
|
|
|
util.hideLoad(); |
|
|
@ -100,9 +116,28 @@ export default { |
|
|
|
|
|
|
|
}, |
|
|
|
onShow() { |
|
|
|
this.updateAC()//更新中控信息 |
|
|
|
this.updateAC() // 更新中控信息 |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
isShowHardwareTab(e){ |
|
|
|
let { showHardwareIdLs } = this; |
|
|
|
if(!showHardwareIdLs || !showHardwareIdLs.length)return false; |
|
|
|
return showHardwareIdLs.includes(e.id); |
|
|
|
}, |
|
|
|
getHardwareTypeList(){ |
|
|
|
let { curStoreInfo } = this; |
|
|
|
this.tabArr = []; |
|
|
|
return deviceServer.get({ |
|
|
|
url: deviceApi.hardwareTypeList, |
|
|
|
data: { stadium_id: curStoreInfo.id }, |
|
|
|
failMsg: '加载设备类型列表失败!' |
|
|
|
}) |
|
|
|
.then(res=>{ |
|
|
|
let _ls = res || []; |
|
|
|
if(_ls&&_ls.length)this.tabArr = tabArr; |
|
|
|
return this.hardwareTypeList = _ls || []; |
|
|
|
}) |
|
|
|
}, |
|
|
|
copyDeviceID(){ |
|
|
|
let that = this |
|
|
|
uni.setClipboardData({ |
|
|
|