Browse Source

借阅管理 整理

master
xuhuajiao 3 years ago
parent
commit
d012002bab
  1. 106
      src/views/archivesManage/lendManage/components/releaseAlarm.vue
  2. 14
      src/views/archivesManage/lendManage/lendConfirm/index.vue
  3. 85
      src/views/archivesManage/lendManage/lendConfirm/module/lendDialog.vue
  4. 120
      src/views/archivesManage/lendManage/mixins/lending.js
  5. 12
      src/views/archivesManage/lendManage/returnArchives/index.vue
  6. 80
      src/views/archivesManage/lendManage/returnArchives/module/returnDialog.vue

106
src/views/archivesManage/lendManage/components/releaseAlarm.vue

@ -0,0 +1,106 @@
<template>
<div>
<!-- 离线状态时 -->
<el-dialog ref="dialogTable" title="借出" :visible.sync="releaseAlarmVisible" :close-on-click-modal="false" @close="handleCancle">
<span class="dialog-right-top" />
<span class="dialog-left-bottom" />
<div class="setting-dialog">
<p style="color: #fff; margin: 0 0 20px 40px;">{{ '以下档案需要先'+ isRealseOrRecoverBtn +'电子标签警报' }}</p>
<el-table :key="Math.random()" :data="tipTable" :cell-class-name="cellWarn" height="325px">
<el-table-column type="index" label="序号" align="center" width="80" />
<el-table-column prop="tagType" label="类型" align="center">
<template slot-scope="scope">
<!-- tagType 1 案卷标签 2 盒标签 3 层架位标签 -->
<span class="clear">{{ scope.row.tagType | tidType }}</span>
</template>
</el-table-column>
<el-table-column prop="maintitle" label="题名" align="center" min-width="140" />
<el-table-column prop="tid" label="TID" align="center" min-width="140" />
<el-table-column prop="warnState" label="状态" align="center" min-width="85">
<template slot-scope="scope">
<!-- 已解除-已恢复 / 未解除 - 未恢复 / 解除失败 - 恢复失败 -->
<span class="clear">{{ scope.row.warnState }}</span>
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button v-loading="unbindWarnLoading" type="primary" :disabled="btnDisabled" @click="writeEPC(isRealseOrRecoverType)">{{ isRealseOrRecoverBtn + '报警' }}</el-button>
</div>
</div>
</el-dialog>
</div>
</template>
<script>
import { FetchReadyBorrowShowTid, FetchReadyReturnShowTid } from '@/api/archivesManage/lendManage'
import { lendingCrud } from '../mixins/lending'
import { form } from '@crud/crud'
export default {
mixins: [lendingCrud, form({})],
data() {
return {
releaseAlarmVisible: false,
lendSelections: [],
tipTable: [],
isRealseOrRecoverType: null,
isRealseOrRecoverBtn: ''
}
},
mounted() {
},
methods: {
getLendTid(type) {
if (type === 0) {
this.isRealseOrRecoverType = 0
this.isRealseOrRecoverBtn = '解除'
const params = this.lendSelections.map(item => item.orderNo)
FetchReadyBorrowShowTid(params).then(data => {
if (data) {
// tip archives
this.tipTable = data
this.handleTipData(params, '未解除')
}
})
} else {
this.isRealseOrRecoverType = 1
this.isRealseOrRecoverBtn = '恢复'
const params = this.lendSelections.map(item => item.id)
FetchReadyReturnShowTid(params).then(data => {
if (data) {
// tip
this.tipTable = data
this.handleTipData(params, '未恢复')
}
})
}
},
handleTipData(params, warnInitText) {
if (this.tipTable.length === 0) {
this.releaseAlarmVisible = false
this.confirmLendOrReturn(this.isRealseOrRecoverType, params, this.lendSelections)
} else {
this.releaseAlarmVisible = true
this.tipTable.forEach(item => {
item.warnState = warnInitText
})
this.tipIndex = 0
}
}
}
}
</script>
<style lang="scss" scoped>
@import '~@/assets/styles/lend-manage.scss';
::v-deep .el-dialog{
width: 950px;
}
::v-deep .el-dialog .el-dialog__body{
padding: 20px 0;
}
::v-deep .el-dialog .el-dialog__header .el-dialog__close::before{
position: absolute;
right: -163px;
bottom: -4px;
}
</style>

14
src/views/archivesManage/lendManage/lendConfirm/index.vue

@ -49,7 +49,7 @@
<!-- 分页 -->
<pagination />
<!--借出弹框-->
<lendDialog ref="lendDialogDom" />
<releaseAlarm ref="releaseAlarmDom" />
<!-- 移出确认弹框 -->
<delConfirm ref="delConfirmDom" :list-name="listName" :is-list-type="isListType" />
<!-- 档案详情 -->
@ -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)
}

85
src/views/archivesManage/lendManage/lendConfirm/module/lendDialog.vue

@ -1,85 +0,0 @@
<template>
<div>
<!-- 离线状态时 -->
<el-dialog ref="dialogTable" title="借出" :visible.sync="lendFormVisible" :close-on-click-modal="false" @close="handleCancle">
<span class="dialog-right-top" />
<span class="dialog-left-bottom" />
<div class="setting-dialog">
<p style="color: #fff; margin: 0 0 20px 40px;">以下档案需要先解除电子标签警报</p>
<el-table :key="Math.random()" :data="tipTable" :cell-class-name="cellWarn" height="325px">
<el-table-column type="index" label="序号" align="center" width="80" />
<el-table-column prop="tagType" label="类型" align="center">
<template slot-scope="scope">
<!-- tagType 1 案卷标签 2 盒标签 3 层架位标签 -->
<span class="clear">{{ scope.row.tagType | tidType }}</span>
</template>
</el-table-column>
<el-table-column prop="maintitle" label="题名" align="center" min-width="140" />
<el-table-column prop="tid" label="TID" align="center" min-width="140" />
<el-table-column prop="warnState" label="状态" align="center" min-width="85">
<template slot-scope="scope">
<!-- 已解除 / 未解除 / 解除失败 -->
<span class="clear">{{ scope.row.warnState }}</span>
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button v-loading="unbindWarnLoading" type="primary" :disabled="btnDisabled" @click="writeEPC(0)">解除警报</el-button>
</div>
</div>
</el-dialog>
</div>
</template>
<script>
import { FetchReadyBorrowShowTid } from '@/api/archivesManage/lendManage'
import { lendingCrud } from '../../mixins/lending'
import { form } from '@crud/crud'
export default {
mixins: [lendingCrud, form({})],
data() {
return {
lendFormVisible: false,
lendSelections: [],
tipTable: []
}
},
mounted() {
},
methods: {
getLendTid() {
const params = this.lendSelections.map(item => item.orderNo)
FetchReadyBorrowShowTid(params).then(data => {
if (data) {
this.tipTable = data.archives
if (this.tipTable.length === 0) {
this.lendFormVisible = false
this.handleConfirmLend(params, this.lendSelections)
} else {
this.lendFormVisible = true
this.tipTable.forEach(item => {
item.warnState = '未解除'
})
this.tipIndex = 0
}
}
})
}
}
}
</script>
<style lang="scss" scoped>
@import '~@/assets/styles/lend-manage.scss';
::v-deep .el-dialog{
width: 950px;
}
::v-deep .el-dialog .el-dialog__body{
padding: 20px 0;
}
::v-deep .el-dialog .el-dialog__header .el-dialog__close::before{
position: absolute;
right: -163px;
bottom: -4px;
}
</style>

120
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) {
// 借出确认 / 归还确认
confirmLendOrReturn(type, params, selections) {
if (type === 0) {
FetchBillBorrowConfirm(params).then(data => {
if (data === selections.length) {
this.$message.success('借阅成功 ' + data + ' 条数据' + ' ' + '借阅失败0条数据')
this.lendFormVisible = false
this.releaseAlarmVisible = false
this.crud.refresh()
}
})
},
handleConfirmReturn(params, selections) {
} else {
FetchArchivesReturnConfirm(params).then(data => {
if (data === selections.length) {
this.$message.success('归还成功 ' + data + ' 条数据' + ' ' + '归还失败0条数据')
this.releaseAlarmVisible = false
this.crud.refresh()
this.returnVisible = false
}
})
}
},
// 解除/恢复中关闭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,55 +154,44 @@ export const lendingCrud = {
}
}, 2000)
} else {
const index = this.tipTable.findIndex((item) => item.warnState === '解除失败')
clearTimeout(this.timer)
setTimeout(() => {
const index = this.tipTable.findIndex((item) => item.warnState === '解除失败' || item.warnState === '恢复失败')
if (index === -1) {
let params
if (this.ase === 0) {
const params = this.lendSelections.map(item => item.orderNo)
this.handleConfirmLend(params, this.lendSelections)
params = this.lendSelections.map(item => item.orderNo)
} else {
const params = this.selections.map(item => item.id)
this.handleConfirmReturn(params, this.lendSelections)
params = this.lendSelections.map(item => item.id)
}
this.confirmLendOrReturn(this.ase, params, this.lendSelections)
} else {
console.log('you')
this.alarmErrorTip()
}
}, 2000)
}
// 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.releaseAlarmErrorHandle(resolve, '标签损坏或丢失,需要用户自主去解除或恢复电子标签绑定')
// reject()
} else if (writeRes.code === '-1000') {
this.releaseAlarmErrorHandle(resolve, '读写器超时未响应')
// reject()
}
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(() => {
},
// 只要有一条未解除/恢复成功即errorTip
alarmErrorTip() {
if (this.ase === 0) {
resolve(this.writeEPC(0))
this.$message.error('借阅成功0条数据' + ' ' + '借阅失败' + this.lendSelections.length + '条数据')
} else {
resolve(this.writeEPC(1))
this.$message.error('归还成功0条数据' + ' ' + '归还失败' + this.lendSelections.length + '条数据')
}
}, 2000)
}
// reject()
} else if (writeRes.code === '-1000') {
console.log('eas', this.ase)
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 = '解除失败'
@ -205,18 +202,16 @@ export const lendingCrud = {
this.unbindWarnLoading = false
this.tipIndex = this.tipIndex + 1
this.flagNum = 0
this.flagNum++
// this.$message({
// message: '读写器超时未响应',
// type: 'error'
// })
this.$message({
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 {
@ -224,29 +219,14 @@ export const lendingCrud = {
}
}, 2000)
} else {
clearTimeout(this.timer)
this.timer = setTimeout(() => {
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.alarmErrorTip()
}
}, 2000)
}
}
// reject()
}
})
},
async writeEPC(ase) {
this.flagNum++
this.ase = ase
this.btnDisabled = true
this.unbindWarnLoading = true
this.fn()
}
}
}

12
src/views/archivesManage/lendManage/returnArchives/index.vue

@ -57,7 +57,7 @@
</el-table-column>
</el-table>
<!-- 归还失败 -->
<returnDialog ref="returnDialogDom" />
<releaseAlarm ref="releaseAlarmDom" />
<!-- 档案详情 -->
<archiveDetail ref="archiveDetailDom" />
<!-- 分页 -->
@ -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)
}
}
}

80
src/views/archivesManage/lendManage/returnArchives/module/returnDialog.vue

@ -1,80 +0,0 @@
<template>
<div>
<el-dialog ref="dialogTable" title="归还" :visible.sync="returnVisible" :close-on-click-modal="false" @close="handleCancle">
<span class="dialog-right-top" />
<span class="dialog-left-bottom" />
<div class="setting-dialog">
<p style="color:#fff; margin:0 0 20px 40px;">以下档案需要先恢复电子标签警报</p>
<el-table :key="Math.random()" :data="tipTable" :cell-class-name="cellWarn" height="325px">
<el-table-column type="index" label="序号" align="center" width="80" />
<el-table-column prop="tagType" label="类型" align="center">
<template slot-scope="scope">
<!-- tagType 1 案卷标签 2 盒标签 3 层架位标签 -->
<span class="clear">{{ scope.row.tagType | tidType }}</span>
</template>
</el-table-column>
<el-table-column prop="maintitle" label="题名" align="center" min-width="140" />
<el-table-column prop="tid" label="TID" align="center" min-width="140" />
<el-table-column prop="warnState" label="状态" align="center" min-width="85">
<template slot-scope="scope">
<!-- 已解除 / 未解除 / 解除失败 -->
<span class="clear">{{ scope.row.warnState }}</span>
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button v-loading="unbindWarnLoading" :disabled="btnDisabled" @click="writeEPC(1)">恢复警报</el-button>
</div>
</div>
</el-dialog>
</div>
</template>
<script>
import { FetchReadyReturnShowTid } from '@/api/archivesManage/lendManage'
import { lendingCrud } from '../../mixins/lending'
import { form } from '@crud/crud'
export default {
mixins: [lendingCrud, form({})],
data() {
return {
returnVisible: false,
lendSelections: [],
tipTable: []
}
},
methods: {
getLendTid() {
const params = this.lendSelections.map(item => item.id)
FetchReadyReturnShowTid(params).then(data => {
if (data) {
this.tipTable = data
if (this.tipTable.length === 0) {
this.returnVisible = false
this.handleConfirmReturn(params, this.lendSelections)
} else {
this.returnVisible = true
this.tipTable.forEach(item => {
item.warnState = '未恢复'
})
this.tipIndex = 0
}
}
})
}
}
}
</script>
<style lang="scss" scoped>
@import '~@/assets/styles/lend-manage.scss';
::v-deep .el-dialog{
width: 950px;
}
::v-deep .el-dialog .el-dialog__header .el-dialog__close::before{
position: absolute;
right: -163px;
bottom: -4px;
}
</style>
Loading…
Cancel
Save