Browse Source

bug 6,15,16和绑定标签修改

master
z_yu 3 years ago
parent
commit
36dd0bc33a
  1. 2
      src/views/archivesConfig/dict/dictDetail.vue
  2. 8
      src/views/archivesConfig/dict/index.vue
  3. 204
      src/views/components/BindingTagDlg.vue
  4. 2
      src/views/system/user/index.vue

2
src/views/archivesConfig/dict/dictDetail.vue

@ -82,7 +82,7 @@ export default {
},
queryOnPresenterCreated: false,
confirmDeleteMsg: '确认删除当前字典内容么?',
sort: ['dicSequence,asc']
sort: ['dicCode,asc']
})
]
},

8
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 = {}

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

2
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 },

Loading…
Cancel
Save