|
|
@ -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) { |
|
|
|