From 36dd0bc33a6239703897e6d99fb3f1bba97ff319 Mon Sep 17 00:00:00 2001 From: z_yu <1534695664@qq.com> Date: Mon, 4 Jul 2022 15:46:56 +0800 Subject: [PATCH] =?UTF-8?q?bug=206,15,16=E5=92=8C=E7=BB=91=E5=AE=9A?= =?UTF-8?q?=E6=A0=87=E7=AD=BE=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/archivesConfig/dict/dictDetail.vue | 2 +- src/views/archivesConfig/dict/index.vue | 8 +- src/views/components/BindingTagDlg.vue | 204 ++++++++++--------- src/views/system/user/index.vue | 2 +- 4 files changed, 112 insertions(+), 104 deletions(-) diff --git a/src/views/archivesConfig/dict/dictDetail.vue b/src/views/archivesConfig/dict/dictDetail.vue index 4ffba5b..5151b6c 100644 --- a/src/views/archivesConfig/dict/dictDetail.vue +++ b/src/views/archivesConfig/dict/dictDetail.vue @@ -82,7 +82,7 @@ export default { }, queryOnPresenterCreated: false, confirmDeleteMsg: '确认删除当前字典内容么?', - sort: ['dicSequence,asc'] + sort: ['dicCode,asc'] }) ] }, diff --git a/src/views/archivesConfig/dict/index.vue b/src/views/archivesConfig/dict/index.vue index fc994a0..21ed56e 100644 --- a/src/views/archivesConfig/dict/index.vue +++ b/src/views/archivesConfig/dict/index.vue @@ -81,7 +81,6 @@ export default { download: false, group: false }, - confirmDeleteMsg: '确定要删除当前字典吗', sort: ['dicSequence,asc'] }) ] @@ -135,7 +134,6 @@ export default { }, // 编辑前将字典明细临时清空,避免日志入库数据过长 [CRUD.HOOK.beforeToEdit](crud, form) { - // 将角色的菜单清空,避免日志入库数据过长 form.dictDetails = null }, updateKeyChildren(data) { @@ -157,7 +155,11 @@ export default { handleConfirm() { this.deleteVisible = false this.crud.delAllLoading = true - this.crud.doDelete(this.deleteData) + this.crud.doDelete(this.deleteData).then(() => { + this.crud.selectionChangeHandler([]) + this.$refs.dictDetail.crud.data = [] + this.$refs.dictDetail.crud.page.total = 0 + }) }, handleClose(done) { this.deleteData = {} diff --git a/src/views/components/BindingTagDlg.vue b/src/views/components/BindingTagDlg.vue index 5f87883..938a42f 100644 --- a/src/views/components/BindingTagDlg.vue +++ b/src/views/components/BindingTagDlg.vue @@ -169,82 +169,82 @@ export default { } }) }, + readEpc(param) { + return new Promise((resolve, reject) => { + RFID.readEpc(param).then(res => { + 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 = '当前标签存在多个,请取出多余的标签只保留一张!' + clearTimeout(this.timer) + this.timer = setTimeout(() => { + resolve(this.readEpc(param)) + }, 2000) + } else if (res.data.length === 1) { + this.readData = res.data[0] + this.step3Message = '读取成功!' + this.step = 4 + resolve() + } + } else if (res.code && res.code === '-2') { + this.errorStep = 2 + this.step2Message = '未读取到标签,请重新放入' + clearTimeout(this.timer) + this.timer = setTimeout(() => { + resolve(this.readEpc(param)) + }, 2000) + } else { + this.errorStep = 2 + this.step2Message = '读取标签失败' + reject() + } + }) + }) + }, // async readEpc(param) { - // return new Promise((resolve, reject) => { - // RFID.readEpc(param).then(res => { - // 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 = '当前标签存在多个,请取出多余的标签只保留一张!' - // clearTimeout(this.timer) - // this.timer = setTimeout(() => { - // reject(this.readEpc(param)) - // }, 2000) - // } else if (res.data.length === 1) { - // this.readData = res.data[0] - // this.step3Message = '读取成功!' - // this.step = 4 - // } - // resolve() - // } else if (res.code && res.code === '-2') { - // this.errorStep = 2 - // this.step2Message = '未读取到标签,请重新放入' - // clearTimeout(this.timer) - // this.timer = setTimeout(() => { - // reject(this.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) - // } else { - // this.errorStep = 2 - // this.step2Message = '读取标签失败' - // reject() // } - // }) - // }) + // 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 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 @@ -267,34 +267,40 @@ export default { }, async startBind(isCover) { console.log(isCover) - // return new Promise((resolve, reject) => { - this.step4Message = '绑定中' - const data = { id: this.bindingId, labelType: this.bindingType, tid: this.readData.tid } - if (isCover || this.readData.tid === this.tidCode) { - data.coverLabel = true - } - const res = await bingdingLabel(data) - if (res === '当前标签已被绑定') { - this.coverBindingVisible = true - } else { - let writeRes = await RFID.writeEPC({ op: 'RFID_WriteEPC', sDevID: 'D001', EAS: '1', Type: this.bindingType, Code: this.bindingId, Tid: this.readData.tid }) - writeRes = JSON.parse(writeRes) - if (writeRes.code === '0') { - this.step = 5 - } else if (writeRes.code === '-1') { - this.$notify({ - title: writeRes.message, - type: 'error', - duration: 2500 - }) - } else if (writeRes.code === '-1000') { - this.$notify({ - title: '读写器超时未响应', - type: 'error', - duration: 2500 - }) + return await new Promise(async(resolve, reject) => { + this.step4Message = '绑定中' + const data = { id: this.bindingId, labelType: this.bindingType, tid: this.readData.tid } + if (isCover || this.readData.tid === this.tidCode) { + data.coverLabel = true } - } + const res = await bingdingLabel(data) + if (res === '当前标签已被绑定') { + this.coverBindingVisible = true + resolve() + // else if() {} else {reject()} + } else { + let writeRes = await RFID.writeEPC({ op: 'RFID_WriteEPC', sDevID: 'D001', EAS: '1', Type: this.bindingType, Code: this.bindingId, Tid: this.readData.tid }) + writeRes = JSON.parse(writeRes) + if (writeRes.code === '0') { + this.step = 5 + resolve() + } else if (writeRes.code === '-1') { + this.$notify({ + title: writeRes.message, + type: 'error', + duration: 2500 + }) + reject() + } else if (writeRes.code === '-1000') { + this.$notify({ + title: '读写器超时未响应', + type: 'error', + duration: 2500 + }) + reject() + } + } + }) }, async opened() { if (!this.isBinding) { diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index 03e2195..6e41d36 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -219,7 +219,7 @@ import '@riophae/vue-treeselect/dist/vue-treeselect.css' import { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect' let userRoles = [] let userJobs = [] -const defaultForm = { id: null, username: null, nickName: null, gender: '男', email: null, enabled: 'false', roles: [], jobs: [], dept: { id: null }, phone: null } +const defaultForm = { id: null, username: null, nickName: null, gender: '男', email: null, enabled: 'true', roles: [], jobs: [], dept: { id: null }, phone: null } export default { name: 'User', components: { Treeselect, crudOperation, rrOperation, udOperation, pagination, DateRangePicker },