Browse Source

绑定标签——当前电脑未绑定读写器,请到档案设备里进行绑定

master
z_yu 3 years ago
parent
commit
651568c83a
  1. 65
      src/views/components/BindingTagDlg.vue

65
src/views/components/BindingTagDlg.vue

@ -207,46 +207,6 @@ export default {
})
})
},
// async readEpc(param) {
// let res = await RFID.readEpc(param)
// res = JSON.parse(res)
// if (res.code && res.code === '0') {
// this.step = 3
// this.errorStep = 0
// this.step2Message = ''
// if (res.data.length > 1) {
// this.errorStep = 3
// this.step3Message = ''
// console.log(1)
// if (!this.timer) {
// this.timer = setInterval(() => {
// this.readEpc(param)
// }, 2000)
// }
// throw new Error('')
// } else if (res.data.length === 1) {
// this.readData = res.data[0]
// this.step3Message = ''
// this.step = 4
// if (this.timer) {
// clearTimeout(this.timer)
// }
// }
// } else if (res.code && res.code === '-2') {
// this.errorStep = 2
// this.step2Message = ''
// if (!this.timer) {
// this.timer = setInterval(() => {
// this.readEpc(param)
// }, 2000)
// }
// throw new Error('')
// } else {
// this.errorStep = 2
// this.step2Message = ''
// throw new Error('')
// }
// },
async tryConnect(param) {
let res
let err
@ -308,9 +268,23 @@ export default {
})
},
async getDevId() {
const Mac = await RFID.getDeviceMac()
const dev = await RFID.getDeviceIdByMac(Mac)
return dev.deviceId
return await new Promise(async(resolve, reject) => {
const mac = await RFID.getDeviceMac()
if (!mac || mac === '') {
this.step1Message = '获取mac地址失败'
this.errorStep = 1
reject('获取mac地址失败')
} else {
const dev = await RFID.getDeviceIdByMac(mac)
if (!dev || dev === {} || !dev.deviceId) {
this.step1Message = '当前电脑未绑定读写器,请到档案设备里进行绑定'
this.errorStep = 1
reject('当前电脑未绑定读写器,请到档案设备里进行绑定')
} else {
resolve(dev.deviceId)
}
}
})
},
async opened() {
if (!this.isBinding) {
@ -322,10 +296,7 @@ export default {
},
async nextStep() {
this.isBinding = false
this.devId = await this.getDevId()
await this.tryConnect({ op: 'RFID_CheckStatus', sDevID: this.devId })
await this.readEpc({ op: 'RFID_ReadEpc', sDevID: this.devId })
await this.startBind()
this.opened()
},
//
handleClose(done) {

Loading…
Cancel
Save