You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
91 lines
1.9 KiB
91 lines
1.9 KiB
<template> |
|
<ifrm ref="ifrm"> |
|
<uni-section title="终端配置" type="line"/> |
|
<view class="uni-list-cell"> |
|
<view class="uni-list-cell-left"> |
|
绑定设备 |
|
</view> |
|
<view class="uni-list-cell-db"> |
|
<picker mode="selector" :range="macs" range-key="macInfo" @change="bindMacChange"> |
|
<view class="uni-input">{{mac.macId>0?mac.macCode+'|'+mac.macName:'未绑定'}}</view> |
|
</picker> |
|
</view> |
|
</view> |
|
<view class="uni-btn-v"> |
|
<button type="primary" :loading="btnLoading" :disabled="btnLoading" class="btn-save" @click="save">保存</button> |
|
</view> |
|
</ifrm> |
|
</template> |
|
|
|
<script> |
|
import ifrm from '@/pages/index/ifrm'; |
|
export default { |
|
components: { |
|
ifrm |
|
}, |
|
data(){ |
|
return { |
|
mac:{macId:0,macInfo:'未绑定'}, |
|
macs:[], |
|
btnLoading:false |
|
} |
|
}, |
|
mounted() { |
|
this.$ajax.request({ |
|
method: 'POST', |
|
url: 'config/machineAll', |
|
data:{}, |
|
success: (data) => { |
|
this.macs = data.list; |
|
this.macs.forEach(m=>{ |
|
m.macInfo=m.macCode+'|'+m.macName; |
|
}); |
|
} |
|
}); |
|
this.mac = uni.getStorageSync('default-mac'); |
|
}, |
|
methods:{ |
|
bindMacChange:function(e){ |
|
this.mac=this.macs[e.detail.value]; |
|
}, |
|
save(){ |
|
uni.setStorageSync('default-mac',this.mac); |
|
uni.showToast({ |
|
title: '保存成功' |
|
}); |
|
//do save request |
|
// this.btnLoading=true; |
|
// this.$ajax.request({ |
|
// url: 'rate',//临时 |
|
// method:'POST', |
|
// data: { |
|
// taskId: 0, |
|
// rate:0 |
|
// }, |
|
// success: (data) => { |
|
// uni.showToast({ |
|
// title: '保存成功' |
|
// }); |
|
// this.btnLoading=false; |
|
// } |
|
// }); |
|
} |
|
}, |
|
onNavigationBarButtonTap(btn) { |
|
this.$refs.ifrm.topMenuClick(btn); |
|
} |
|
} |
|
</script> |
|
|
|
<style scoped> |
|
.btn-save { |
|
margin: 50rpx; |
|
} |
|
.uni-list-cell{ |
|
color:rgba(0,0,0,0.85); |
|
} |
|
.uni-list-cell-db{ |
|
display: flex; |
|
color:rgba(0,0,0,0.65); |
|
} |
|
</style>
|
|
|