【前端】智能库房综合管理系统前端项目
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.

157 lines
5.3 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <template>
  2. <div class="to-lend">
  3. <div class="head-container head-archives clearfix">
  4. <div class="archives-crud">
  5. <el-button v-permission="permission.add" size="mini" icon="el-icon-plus" @click="crud.toAdd">
  6. 新增
  7. </el-button>
  8. <el-button v-permission="permission.edit" size="mini" icon="el-icon-edit" :disabled="crud.selections.length !== 1" @click="crud.toEdit(crud.selections[0])">
  9. 修改
  10. </el-button>
  11. <el-button v-permission="permission.del" icon="el-icon-delete" size="mini" :loading="crud.delAllLoading" :disabled="!crud.selections.length" @click="toDelete(crud.selections)">删除</el-button>
  12. </div>
  13. <div class="head-search">
  14. <el-input v-model="lendQuery[lendSelect]" clearable size="small" placeholder="请输入关键词" style="width: 300px;" class="input-prepend filter-item" @clear="crud.toQuery" @blur="crud.toQuery" @keyup.enter.native="crud.toQuery">
  15. <el-select slot="prepend" v-model="lendSelect" style="width: 100px">
  16. <el-option
  17. v-for="item in queryOption"
  18. :key="item.value"
  19. :label="item.label"
  20. :value="item.value"
  21. />
  22. </el-select>
  23. </el-input>
  24. <rrOperation />
  25. </div>
  26. </div>
  27. <!--表格渲染-->
  28. <el-table
  29. ref="table"
  30. :data="crud.data"
  31. style="min-width: 100%"
  32. height="calc(100vh - 356px)"
  33. @selection-change="crud.selectionChangeHandler"
  34. @row-click="clickRowHandler"
  35. >
  36. <el-table-column type="selection" align="center" width="55" />
  37. <el-table-column type="index" align="center" label="序号" width="100" />
  38. <el-table-column prop="borrowerName" align="center" label="借阅人" min-width="85" />
  39. <el-table-column prop="department" align="center" label="所属部门" min-width="85" />
  40. <el-table-column prop="cardType" align="center" label="证件类型" min-width="85" />
  41. <el-table-column prop="idcard" align="center" label="证件号码" min-width="140" />
  42. <el-table-column prop="phone" align="center" label="电话号码" min-width="120" />
  43. <el-table-column prop="create_time" align="center" label="操作时间" min-width="120">
  44. <template slot-scope="scope">
  45. <div>{{ scope.row.create_time | parseTime }}</div>
  46. </template>
  47. </el-table-column>
  48. </el-table>
  49. <!-- 借阅者增加模态框 -->
  50. <addBorrower ref="addBorrowerDom" />
  51. <!-- 删除模态框 -->
  52. <el-dialog title="确认删除" :visible.sync="deleteVisible">
  53. <span class="dialog-right-top" />
  54. <span class="dialog-left-bottom" />
  55. <div class="setting-dialog">
  56. <p><span style="color:#fff;">您确定要删除当前借阅人信息吗</span></p>
  57. <div slot="footer" class="dialog-footer">
  58. <el-button type="primary" @click.native="handleDelConfirm(crud.selections)">确定</el-button>
  59. </div>
  60. </div>
  61. </el-dialog>
  62. <!-- 分页 -->
  63. <pagination />
  64. </div>
  65. </template>
  66. <script>
  67. import CRUD, { presenter, crud } from '@crud/crud'
  68. import crudMethod from '@/api/archivesManage/lendManage'
  69. import { lendingCrud } from '../mixins/lending'
  70. import pagination from '@crud/Pagination'
  71. import rrOperation from '@crud/RR.operation'
  72. import addBorrower from './module/addBorrower.vue'
  73. export default {
  74. name: 'BorrowerManage',
  75. components: { pagination, rrOperation, addBorrower },
  76. mixins: [presenter(), crud(), lendingCrud],
  77. cruds() {
  78. return CRUD({
  79. url: 'api/borrow/initBorrower',
  80. crudMethod: { ...crudMethod },
  81. title: '借阅者',
  82. optShow: {
  83. add: true,
  84. edit: true,
  85. del: true,
  86. download: false,
  87. group: false
  88. },
  89. sort: ['create_time,desc']
  90. })
  91. },
  92. data() {
  93. return {
  94. permission: {
  95. add: ['admin', 'borrowerManage:add'],
  96. edit: ['admin', 'borrowerManage:edit'],
  97. del: ['admin', 'borrowerManage:del']
  98. },
  99. editFormVisible: false,
  100. deleteVisible: false,
  101. deleteData: {},
  102. queryOption: [
  103. { value: 'query', label: '借阅人' },
  104. { value: 'phone', label: '电话号码' }
  105. ]
  106. }
  107. },
  108. mounted() {
  109. },
  110. methods: {
  111. // 获取数据前的处理
  112. [CRUD.HOOK.beforeRefresh]() {
  113. this.crud.query.query = null
  114. this.crud.query.phone = null
  115. this.crud.query[this.lendSelect] = this.lendQuery[this.lendSelect]
  116. },
  117. [CRUD.HOOK.beforeSubmit]() {
  118. delete this.crud.form.borrowerNamePy
  119. delete this.crud.form.create_by
  120. delete this.crud.form.create_time
  121. delete this.crud.form.isDelete
  122. delete this.crud.form.update_by
  123. delete this.crud.form.update_time
  124. },
  125. clickRowHandler(row) {
  126. this.$refs.table.toggleRowSelection(row)
  127. },
  128. handleDelConfirm() {
  129. this.deleteVisible = false
  130. this.crud.delAllLoading = true
  131. this.crud.doDelete(this.deleteData).then(() => {
  132. this.$message({
  133. message: '删除成功',
  134. type: 'success'
  135. })
  136. })
  137. },
  138. toDelete(data) {
  139. this.deleteData = data
  140. this.deleteVisible = true
  141. }
  142. }
  143. }
  144. </script>
  145. <style lang="scss" scoped>
  146. @import "~@/assets/styles/archives-manage.scss";
  147. .head-archives{
  148. padding: 20px;
  149. }
  150. ::v-deep .input-prepend .el-input__inner {
  151. padding-left: 100px;
  152. }
  153. </style>