【前端】智能库房综合管理系统前端项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

167 lines
6.0 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <template>
  2. <div class="lendConfirm-box">
  3. <div class="head-container">
  4. <el-button size="mini" class="iconfont icon-jiechu-fanbai" :disabled="!selections.length" @click="handleLendBtn">借出</el-button>
  5. <el-button size="mini" class="iconfont icon-dengji-fanbai" :disabled="!selections.length" @click="handelReRecord">重新登记</el-button>
  6. <el-button size="mini" class="iconfont icon-yichu-fanbai" :disabled="!selections.length" @click="handleRemove">移出</el-button>
  7. <el-button size="mini" icon="el-icon-download" :disabled="!selections.length" :loading="crud.downloadLoading" @click="downloadApi">导出</el-button>
  8. </div>
  9. <!--表格渲染-->
  10. <el-table
  11. ref="table"
  12. v-loading="crud.loading"
  13. :data="crud.data"
  14. :row-key="getRowKey"
  15. style="min-width: 100%"
  16. @select-all="selectAll"
  17. @selection-change="selectionChangeHandler"
  18. @row-click="clickRowHandler"
  19. @row-dblclick="handleDbClick"
  20. @select="handleCurrentChange"
  21. >
  22. <el-table-column type="selection" :reserve-selection="true" align="center" width="55" />
  23. <el-table-column type="index" label="序号" align="center" width="55" />
  24. <el-table-column prop="orderNo" align="center" label="单据号" min-width="100" />
  25. <el-table-column prop="borrowNum" align="center" label="数量" min-width="50" />
  26. <el-table-column prop="borrowerName" align="center" label="借阅人" min-width="60" />
  27. <el-table-column prop="department" align="center" label="所属部门" min-width="85" />
  28. <el-table-column prop="cardType" align="center" label="证件类型" min-width="85" />
  29. <el-table-column prop="idcard" align="center" label="证件号码" min-width="120" />
  30. <el-table-column prop="phone" align="center" label="电话号码" min-width="85" />
  31. <el-table-column prop="lendDates" align="center" label="借阅时间" min-width="150">
  32. <template slot-scope="scope">
  33. <div>{{ parseTime(scope.row.startTime, '{y}-{m}-{d}') + ' 至 ' + parseTime(scope.row.endTime, '{y}-{m}-{d}') }}</div>
  34. </template>
  35. </el-table-column>
  36. <el-table-column prop="purpose" align="center" label="借阅目的" min-width="70" />
  37. <el-table-column prop="borrowType" align="center" label="借阅状态" min-width="70">
  38. <template slot-scope="scope">
  39. <!-- 待借阅 -->
  40. <span class="cell-lend no-lend" style="width:76px">{{ scope.row.borrowType | borrowStatus }}</span>
  41. </template>
  42. </el-table-column>
  43. <el-table-column prop="createTime" align="center" label="操作时间" min-width="120">
  44. <template slot-scope="scope">
  45. <div>{{ scope.row.createTime | parseTime }}</div>
  46. </template>
  47. </el-table-column>
  48. </el-table>
  49. <!-- 分页 -->
  50. <pagination />
  51. <!--借出弹框-->
  52. <releaseAlarm ref="releaseAlarmDom" />
  53. <!-- 移出确认弹框 -->
  54. <delConfirm ref="delConfirmDom" :list-name="listName" :is-list-type="isListType" />
  55. <!-- 档案详情 -->
  56. <archiveDetail ref="archiveDetailDom" />
  57. </div>
  58. </template>
  59. <script>
  60. import { FetchReRegister } from '@/api/archivesManage/lendManage'
  61. import pagination from '@crud/Pagination'
  62. import CRUD, { presenter } from '@crud/crud'
  63. import { lendingCrud } from '../mixins/lending'
  64. import delConfirm from '../components/delConfirm'
  65. import archiveDetail from '../components/archiveDetail'
  66. import releaseAlarm from '../components/releaseAlarm'
  67. export default {
  68. name: 'LendConfirm',
  69. components: { pagination, archiveDetail, delConfirm, releaseAlarm },
  70. mixins: [presenter(), lendingCrud],
  71. cruds() {
  72. return CRUD({
  73. url: 'api/borrow/initWaitBorrowList',
  74. // crudMethod: caseCrudMethod,
  75. title: '借出确认',
  76. optShow: {
  77. add: false,
  78. edit: false,
  79. del: false,
  80. download: true,
  81. group: false
  82. }
  83. })
  84. },
  85. data() {
  86. return {
  87. selections: [],
  88. listName: '借出确认',
  89. isListType: 2, // 移出框类型判断 待借1 / 借阅2
  90. lendDates: null
  91. }
  92. },
  93. created() {
  94. this.getBorrowRule()
  95. },
  96. methods: {
  97. // table - 全选
  98. selectAll(val) {
  99. this.selections = val
  100. if (this.selections.length === 1) {
  101. this.$emit('getSelections', this.selections[0])
  102. } else {
  103. this.$emit('getSelections', null)
  104. }
  105. },
  106. // 触发单选
  107. handleCurrentChange(selection, row) {
  108. this.selections = selection
  109. if (selection.length === 1) {
  110. this.$emit('getSelections', selection[0])
  111. } else {
  112. this.$emit('getSelections', null)
  113. }
  114. },
  115. clickRowHandler(row) {
  116. this.$refs.table.clearSelection()
  117. this.$refs.table.toggleRowSelection(row)
  118. this.selections = []
  119. this.selections.push(row)
  120. this.$emit('getSelections', row)
  121. },
  122. // 重新登记返回上一级
  123. handelReRecord() {
  124. const params = this.selections.map(item => item.orderNo)
  125. FetchReRegister(params).then(data => {
  126. console.log(data)
  127. if (data) {
  128. this.$message({
  129. message: '重新登记成功',
  130. type: 'success'
  131. })
  132. this.$emit('callBack', { index: 0 })
  133. this.crud.refresh()
  134. }
  135. })
  136. },
  137. // 移出
  138. handleRemove() {
  139. if (this.selections.length > 0) {
  140. this.$refs.delConfirmDom.deleteVisible = true
  141. this.$refs.delConfirmDom.deltSelections = this.selections
  142. }
  143. },
  144. // 借出
  145. handleLendBtn() {
  146. if (this.selections.length > 0) {
  147. if (this.lineStateVal === 'offline') {
  148. // 离线
  149. this.$refs.releaseAlarmDom.lendSelections = this.selections
  150. this.$refs.releaseAlarmDom.getLendTid(0)
  151. } else {
  152. // 在线
  153. const params = this.selections.map(item => item.orderNo)
  154. this.confirmLendOrReturn(0, params, this.selections)
  155. }
  156. this.$refs.table.clearSelection()
  157. this.$emit('getSelections', null)
  158. }
  159. }
  160. }
  161. }
  162. </script>
  163. <style lang="scss" scoped>
  164. @import '~@/assets/styles/lend-manage.scss';
  165. </style>