diff --git a/src/api/RFID/RFID.js b/src/api/RFID/RFID.js index b1ca5d5..235bb6a 100644 --- a/src/api/RFID/RFID.js +++ b/src/api/RFID/RFID.js @@ -24,4 +24,19 @@ export function writeEPC(params) { }) } -export default { checkStatus, readEpc, writeEPC } +export function getDeviceMac() { + return request({ + url: 'api/mac/get', + method: 'get' + }) +} + +export function getDeviceIdByMac(mac) { + const params = { mac: mac } + return request({ + url: 'api/RFID/getDeviceIdByMac', + method: 'get', + params + }) +} +export default { checkStatus, readEpc, writeEPC, getDeviceMac, getDeviceIdByMac } diff --git a/src/api/storeManage/levelManage/level.js b/src/api/storeManage/levelManage/level.js new file mode 100644 index 0000000..90642f1 --- /dev/null +++ b/src/api/storeManage/levelManage/level.js @@ -0,0 +1,33 @@ +import request from '@/utils/request' + +export function menu() { + return request({ + url: 'api/tag/menu', + method: 'get' + }) +} + +export function bingdingLabel(data) { + return request({ + url: 'api/tag/bingdingLabel', + method: 'post', + data + }) +} + +export function unbindTag(data) { + return request({ + url: 'api/tag/unbindTag', + method: 'post', + data + }) +} + +export function initTagLogList(parameter) { + return request({ + url: 'api/tag/initTagLogList', + method: 'get', + params: parameter + }) +} +export default { menu, bingdingLabel, unbindTag, initTagLogList } diff --git a/src/views/components/BindingTagDlg.vue b/src/views/components/BindingTagDlg.vue index 630a17f..7339bff 100644 --- a/src/views/components/BindingTagDlg.vue +++ b/src/views/components/BindingTagDlg.vue @@ -126,7 +126,8 @@ export default { step5Message: '当前标签与' + this.bindingTxt + '绑定成功', readData: {}, timeOut: null, - timer: null + timer: null, + devId: '' } }, computed: { @@ -279,7 +280,7 @@ export default { this.coverBindingVisible = true resolve() } else if (res === 1) { - let writeRes = await RFID.writeEPC({ op: 'RFID_WriteEPC', sDevID: 'D002', EAS: '1', Type: this.bindingType, Code: this.bindingId, Tid: this.readData.tid }) + let writeRes = await RFID.writeEPC({ op: 'RFID_WriteEPC', sDevID: this.devId, EAS: '1', Type: this.bindingType, Code: this.bindingId, Tid: this.readData.tid }) writeRes = JSON.parse(writeRes) if (writeRes.code === '0') { this.step = 5 @@ -306,17 +307,24 @@ export default { } }) }, + async getDevId() { + const Mac = await RFID.getDeviceMac() + const dev = await RFID.getDeviceIdByMac(Mac) + return dev.deviceId + }, async opened() { if (!this.isBinding) { - await this.tryConnect({ op: 'RFID_CheckStatus', sDevID: 'D002' }) - await this.readEpc({ op: 'RFID_ReadEpc', sDevID: 'D002' }) + 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() } }, async nextStep() { this.isBinding = false - await this.tryConnect({ op: 'RFID_CheckStatus', sDevID: 'D002' }) - await this.readEpc({ op: 'RFID_ReadEpc', sDevID: 'D002' }) + 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() }, // 关闭 diff --git a/src/views/storeManage/levelManage/index.vue b/src/views/storeManage/levelManage/index.vue index e5637f2..78301e2 100644 --- a/src/views/storeManage/levelManage/index.vue +++ b/src/views/storeManage/levelManage/index.vue @@ -20,7 +20,6 @@ - @@ -47,11 +46,11 @@