diff --git a/src/views/archivesManage/lendManage/components/releaseAlarm.vue b/src/views/archivesManage/lendManage/components/releaseAlarm.vue new file mode 100644 index 0000000..e16f239 --- /dev/null +++ b/src/views/archivesManage/lendManage/components/releaseAlarm.vue @@ -0,0 +1,106 @@ + + + + + + + + {{ '以下档案需要先'+ isRealseOrRecoverBtn +'电子标签警报' }} + + + + + + {{ scope.row.tagType | tidType }} + + + + + + + + {{ scope.row.warnState }} + + + + + + + + + + + + diff --git a/src/views/archivesManage/lendManage/lendConfirm/index.vue b/src/views/archivesManage/lendManage/lendConfirm/index.vue index 78ad6de..0f3f451 100644 --- a/src/views/archivesManage/lendManage/lendConfirm/index.vue +++ b/src/views/archivesManage/lendManage/lendConfirm/index.vue @@ -49,7 +49,7 @@ - + @@ -64,9 +64,9 @@ import CRUD, { presenter } from '@crud/crud' import { lendingCrud } from '../mixins/lending' import delConfirm from '../components/delConfirm' import archiveDetail from '../components/archiveDetail' -import lendDialog from './module/lendDialog' +import releaseAlarm from '../components/releaseAlarm' export default { - components: { pagination, archiveDetail, delConfirm, lendDialog }, + components: { pagination, archiveDetail, delConfirm, releaseAlarm }, mixins: [presenter(), lendingCrud], cruds() { return CRUD({ @@ -147,14 +147,12 @@ export default { if (this.selections.length > 0) { if (this.lineStateVal === 'offline') { // 离线 - this.$refs.lendDialogDom.lendSelections = this.selections - this.$refs.lendDialogDom.getLendTid(0) + this.$refs.releaseAlarmDom.lendSelections = this.selections + this.$refs.releaseAlarmDom.getLendTid(0) } else { // 在线 const params = this.selections.map(item => item.orderNo) - console.log(this.selections) - console.log(params) - this.handleConfirmLend(params, this.selections) + this.confirmLendOrReturn(0, params, this.selections) } this.$emit('getSelections', null) } diff --git a/src/views/archivesManage/lendManage/lendConfirm/module/lendDialog.vue b/src/views/archivesManage/lendManage/lendConfirm/module/lendDialog.vue deleted file mode 100644 index 9757a5a..0000000 --- a/src/views/archivesManage/lendManage/lendConfirm/module/lendDialog.vue +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - 以下档案需要先解除电子标签警报 - - - - - - {{ scope.row.tagType | tidType }} - - - - - - - - {{ scope.row.warnState }} - - - - - - - - - - - - diff --git a/src/views/archivesManage/lendManage/mixins/lending.js b/src/views/archivesManage/lendManage/mixins/lending.js index 77801bd..89f64f0 100644 --- a/src/views/archivesManage/lendManage/mixins/lending.js +++ b/src/views/archivesManage/lendManage/mixins/lending.js @@ -62,6 +62,7 @@ export const lendingCrud = { return 'cell-lend no-lend ' } }, + // 获取部门list getDepart() { FetchFindAllSubsetById({ id: 'BA3910917510B181160A9A' }).then(data => { this.departOptions = data @@ -79,6 +80,7 @@ export const lendingCrud = { archiveDetailDom.getBillDetails() }) }, + // 判断当前借阅规则 getBorrowRule() { FetchInitBorrowRule().then(data => { if (data) { @@ -86,28 +88,31 @@ export const lendingCrud = { } }) }, - handleConfirmLend(params, selections) { - FetchBillBorrowConfirm(params).then(data => { - if (data === selections.length) { - this.$message.success('借阅成功 ' + data + ' 条数据' + ' ' + '借阅失败0条数据') - this.lendFormVisible = false - this.crud.refresh() - } - }) - }, - handleConfirmReturn(params, selections) { - FetchArchivesReturnConfirm(params).then(data => { - if (data === selections.length) { - this.$message.success('归还成功 ' + data + ' 条数据' + ' ' + '归还失败0条数据') - this.crud.refresh() - this.returnVisible = false - } - }) + // 借出确认 / 归还确认 + confirmLendOrReturn(type, params, selections) { + if (type === 0) { + FetchBillBorrowConfirm(params).then(data => { + if (data === selections.length) { + this.$message.success('借阅成功 ' + data + ' 条数据' + ' ' + '借阅失败0条数据') + this.releaseAlarmVisible = false + this.crud.refresh() + } + }) + } else { + FetchArchivesReturnConfirm(params).then(data => { + if (data === selections.length) { + this.$message.success('归还成功 ' + data + ' 条数据' + ' ' + '归还失败0条数据') + this.releaseAlarmVisible = false + this.crud.refresh() + } + }) + } }, + // 解除/恢复中关闭icon不可操作 handleCancle() { - this.lendFormVisible = !!this.btnDisabled - this.returnVisible = !!this.btnDisabled + this.releaseAlarmVisible = !!this.btnDisabled }, + // 解除/恢复 状态style cellWarn({ row, columnIndex }) { if ((row.warnState === '未解除' || row.warnState === '未恢复') && columnIndex === 4) { return 'no-clear' @@ -117,12 +122,16 @@ export const lendingCrud = { return 'fail-clear' } }, - async fn() { + // 写epc + async writeEPC(ase) { + this.flagNum++ + this.ase = ase + this.btnDisabled = true + this.unbindWarnLoading = true return new Promise(async(resolve, reject) => { const params = { op: 'RFID_WriteEPC', sDevID: this.devId, EAS: this.ase, Type: this.tipTable[this.tipIndex].tagType, Code: this.tipTable[this.tipIndex].archivesId, Tid: this.tipTable[this.tipIndex].tid } let writeRes = await RFID.writeEPC(params) writeRes = JSON.parse(writeRes) - console.log(writeRes) if (writeRes.code === '0') { if (this.ase === 0) { this.tipTable[this.tipIndex].warnState = '已解除' @@ -134,7 +143,6 @@ export const lendingCrud = { this.tipIndex = this.tipIndex + 1 if (this.tipIndex !== this.tipTable.length) { this.flagNum = 0 - this.flagNum++ this.btnDisabled = true this.unbindWarnLoading = true clearTimeout(this.timer) @@ -146,107 +154,79 @@ export const lendingCrud = { } }, 2000) } else { - const index = this.tipTable.findIndex((item) => item.warnState === '解除失败') - if (index === -1) { - if (this.ase === 0) { - const params = this.lendSelections.map(item => item.orderNo) - this.handleConfirmLend(params, this.lendSelections) - } else { - const params = this.selections.map(item => item.id) - this.handleConfirmReturn(params, this.lendSelections) - } - } else { - console.log('you') - } - } - // resolve() - } else if (writeRes.code === '-1') { - console.log('tipIndex', this.tipIndex) - console.log('flagNum', this.flagNum) - console.log('length', this.tipTable.length) - if (this.flagNum >= 3) { - if (this.ase === 0) { - this.tipTable[this.tipIndex].warnState = '解除失败' - } else { - this.tipTable[this.tipIndex].warnState = '恢复失败' - } - this.btnDisabled = false - this.unbindWarnLoading = false - this.tipIndex = this.tipIndex + 1 - this.flagNum = 0 - this.flagNum++ - this.$message({ - message: writeRes.message, - type: 'error' - }) - } - if (this.tipIndex !== this.tipTable.length) { - this.btnDisabled = true - this.unbindWarnLoading = true clearTimeout(this.timer) - this.timer = setTimeout(() => { - if (this.ase === 0) { - resolve(this.writeEPC(0)) + setTimeout(() => { + const index = this.tipTable.findIndex((item) => item.warnState === '解除失败' || item.warnState === '恢复失败') + if (index === -1) { + let params + if (this.ase === 0) { + params = this.lendSelections.map(item => item.orderNo) + } else { + params = this.lendSelections.map(item => item.id) + } + this.confirmLendOrReturn(this.ase, params, this.lendSelections) } else { - resolve(this.writeEPC(1)) + this.alarmErrorTip() } }, 2000) } + // resolve() + } else if (writeRes.code === '-1') { + this.releaseAlarmErrorHandle(resolve, '标签损坏或丢失,需要用户自主去解除或恢复电子标签绑定') // reject() } else if (writeRes.code === '-1000') { - console.log('eas', this.ase) - if (this.flagNum >= 3) { - if (this.ase === 0) { - this.tipTable[this.tipIndex].warnState = '解除失败' - } else { - this.tipTable[this.tipIndex].warnState = '恢复失败' - } - this.btnDisabled = false - this.unbindWarnLoading = false - this.tipIndex = this.tipIndex + 1 - this.flagNum = 0 - this.flagNum++ - // this.$message({ - // message: '读写器超时未响应', - // type: 'error' - // }) - } - if (this.tipIndex !== this.tipTable.length) { - this.btnDisabled = true - this.unbindWarnLoading = true - clearTimeout(this.timer) - this.timer = setTimeout(() => { - console.log('eas111', this.ase) - if (this.ase === 0) { - resolve(this.writeEPC(0)) - } else { - resolve(this.writeEPC(1)) - } - }, 2000) - } else { - const findErrorArray = this.tipTable.map((item) => item.warnState === '解除失败' || item.warnState === '恢复失败') - if (findErrorArray.length === this.tipTable.length) { - if (this.ase === 0) { - this.lendFormVisible = false - this.crud.refresh() - this.$message.error('解除成功0条数据' + ' ' + '归还失败' + this.tipTable.length + '条数据') - } else { - this.crud.refresh() - this.returnVisible = false - this.$message.error('恢复成功0条数据' + ' ' + '恢复失败' + this.tipTable.length + '条数据') - } - } - } + this.releaseAlarmErrorHandle(resolve, '读写器超时未响应') // reject() } }) }, - async writeEPC(ase) { - this.flagNum++ - this.ase = ase - this.btnDisabled = true - this.unbindWarnLoading = true - this.fn() + // 只要有一条未解除/恢复成功即errorTip + alarmErrorTip() { + if (this.ase === 0) { + this.$message.error('借阅成功0条数据' + ' ' + '借阅失败' + this.lendSelections.length + '条数据') + } else { + this.$message.error('归还成功0条数据' + ' ' + '归还失败' + this.lendSelections.length + '条数据') + } + this.releaseAlarmVisible = false + this.crud.refresh() + }, + // 写epc不成功时的操作提示 -1 / -1000 + releaseAlarmErrorHandle(resolve, message) { + if (this.flagNum >= 3) { + if (this.ase === 0) { + this.tipTable[this.tipIndex].warnState = '解除失败' + } else { + this.tipTable[this.tipIndex].warnState = '恢复失败' + } + this.btnDisabled = false + this.unbindWarnLoading = false + this.tipIndex = this.tipIndex + 1 + this.flagNum = 0 + this.$message({ + message: message, + type: 'error' + }) + } + if (this.tipIndex !== this.tipTable.length) { + this.btnDisabled = true + this.unbindWarnLoading = true + clearTimeout(this.timer) + this.timer = setTimeout(() => { + if (this.ase === 0) { + resolve(this.writeEPC(0)) + } else { + resolve(this.writeEPC(1)) + } + }, 2000) + } else { + clearTimeout(this.timer) + this.timer = setTimeout(() => { + const findErrorArray = this.tipTable.map((item) => item.warnState === '解除失败' || item.warnState === '恢复失败') + if (findErrorArray.length === this.tipTable.length) { + this.alarmErrorTip() + } + }, 2000) + } } } } diff --git a/src/views/archivesManage/lendManage/returnArchives/index.vue b/src/views/archivesManage/lendManage/returnArchives/index.vue index eb6493a..0126da9 100644 --- a/src/views/archivesManage/lendManage/returnArchives/index.vue +++ b/src/views/archivesManage/lendManage/returnArchives/index.vue @@ -57,7 +57,7 @@ - + @@ -71,9 +71,9 @@ import rrOperation from '@crud/RR.operation' import CRUD, { presenter } from '@crud/crud' import { lendingCrud } from '../mixins/lending' import archiveDetail from '../components/archiveDetail' -import returnDialog from './module/returnDialog' +import releaseAlarm from '../components/releaseAlarm' export default { - components: { pagination, rrOperation, archiveDetail, returnDialog }, + components: { pagination, rrOperation, archiveDetail, releaseAlarm }, mixins: [presenter(), lendingCrud], cruds() { return CRUD({ @@ -120,12 +120,12 @@ export default { if (this.selections.length > 0) { if (this.lineStateVal === 'offline') { // 离线 - this.$refs.returnDialogDom.lendSelections = this.selections - this.$refs.returnDialogDom.getLendTid(1) + this.$refs.releaseAlarmDom.lendSelections = this.selections + this.$refs.releaseAlarmDom.getLendTid(1) } else { // 在线 const params = this.selections.map(item => item.id) - this.handleConfirmReturn(params, this.selections) + this.confirmLendOrReturn(1, params, this.selections) } } } diff --git a/src/views/archivesManage/lendManage/returnArchives/module/returnDialog.vue b/src/views/archivesManage/lendManage/returnArchives/module/returnDialog.vue deleted file mode 100644 index dd3e7d9..0000000 --- a/src/views/archivesManage/lendManage/returnArchives/module/returnDialog.vue +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - 以下档案需要先恢复电子标签警报 - - - - - - {{ scope.row.tagType | tidType }} - - - - - - - - {{ scope.row.warnState }} - - - - - - - - - - - -
{{ '以下档案需要先'+ isRealseOrRecoverBtn +'电子标签警报' }}
以下档案需要先解除电子标签警报
以下档案需要先恢复电子标签警报