appointmentList.vue 5.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <template>
  2. <div class="subPage">
  3. <div class="system-table-search">
  4. <div class="flex-h" style="align-items: flex-start;">
  5. <div class="flex-item flex-h"></div>
  6. <ul style="white-space: normal;">
  7. <li style="margin-bottom: 15px;">
  8. <el-input placeholder="请输入条形码" v-model="postData.barcode"></el-input>
  9. </li>
  10. <li style="margin-bottom: 15px;">
  11. <el-input placeholder="请输入图书名" v-model="postData.bookname"></el-input>
  12. </li>
  13. <li style="margin-bottom: 15px;">
  14. <el-input placeholder="请输入用户名" v-model="postData.customername"></el-input>
  15. </li>
  16. <li style="margin-bottom: 15px;">
  17. <el-input placeholder="请输入手机号" v-model="postData.customerphone"></el-input>
  18. </li>
  19. <li style="margin-bottom: 15px;">
  20. <el-select v-model="CaseId" placeholder="请选择案场">
  21. <el-option key="all" label="所有案场" value="all"></el-option>
  22. <el-option
  23. v-for="item in cases"
  24. :key="item.CaseId"
  25. :label="item.CaseName"
  26. :value="item.CaseId"
  27. ></el-option>
  28. </el-select>
  29. </li>
  30. </ul>
  31. <el-button type="primary" @click="search">搜索</el-button>
  32. </div>
  33. <div class="moreFilter"></div>
  34. </div>
  35. <div class="system-table-box">
  36. <el-table :data="list" stripe style="width: 100%">
  37. <el-table-column label="案场">
  38. <template slot-scope="scope">{{returnCaseName(scope.row.CaseId)}}</template>
  39. </el-table-column>
  40. <el-table-column label="图片" width="128">
  41. <template slot-scope="scope">
  42. <img :src="scope.row.BookImg + '?x-oss-process=style/compress-rotate'" style="height: 64px;">
  43. </template>
  44. </el-table-column>
  45. <el-table-column prop="BookBarcode" label="条形码"></el-table-column>
  46. <el-table-column prop="BookName" label="图书名"></el-table-column>
  47. <el-table-column prop="CustomerName" label="用户名"></el-table-column>
  48. <el-table-column prop="CustomerPhone" label="手机号"></el-table-column>
  49. <el-table-column label="预约时间">
  50. <template slot-scope="scope">{{toolClass.dateFormat(scope.row.ReserveDate)}}</template>
  51. </el-table-column>
  52. <el-table-column label="保留时间">
  53. <template slot-scope="scope">{{toolClass.dateFormat(scope.row.ReserveEndDate)}}</template>
  54. </el-table-column>
  55. <el-table-column label="操作">
  56. <template slot-scope="scope">
  57. <el-button size="mini" type="warning" @click="cancel(scope.row.BookBorrowRecordId)">取消预约</el-button>
  58. </template>
  59. </el-table-column>
  60. </el-table>
  61. <el-pagination
  62. @current-change="handleCurrentChange"
  63. :current-page.sync="postData.page"
  64. :page-size="postData.pagesize"
  65. layout="prev, pager, next, jumper"
  66. :total="total"
  67. ></el-pagination>
  68. </div>
  69. </div>
  70. </template>
  71. <script>
  72. import { createNamespacedHelpers, mapState } from 'vuex'
  73. const { mapState: mapLibSate, mapActions: mapLibActions, mapMutations } = createNamespacedHelpers('library')
  74. export default {
  75. name: 'borrowList',
  76. data () {
  77. return {
  78. total: 1,
  79. postData: {
  80. barcode: '',
  81. bookname: '',
  82. customername: '',
  83. customerphone: '',
  84. borrowstatus: '4',
  85. caseid: '',
  86. page: 1,
  87. pagesize: 10
  88. },
  89. statusList: [{
  90. id: '',
  91. value: ''
  92. }]
  93. }
  94. },
  95. created () {
  96. this.getBorrowList({ ...this.postData }).then((res) => {
  97. this.page = res.page
  98. this.total = res.pagenum
  99. })
  100. },
  101. beforeRouteLeave (to, from, next) {
  102. this.resetStore('borrow.list')
  103. next()
  104. },
  105. computed: {
  106. ...mapState({
  107. cases: x => x.app.cases.list,
  108. defaultCaseId: x => x.app.cases.default,
  109. orgid: x => x.app.user.OrgId
  110. }),
  111. ...mapLibSate({
  112. list: x => x.borrow.list
  113. }),
  114. CaseId: {
  115. get () {
  116. return this.postData.caseid || this.defaultCaseId
  117. },
  118. set (val) {
  119. this.postData.caseid = val
  120. }
  121. }
  122. },
  123. methods: {
  124. ...mapMutations({
  125. resetStore: 'clearData',
  126. }),
  127. ...mapLibActions(['getBorrowList', 'cancelBorrow']),
  128. cancel (id) {
  129. this.$confirm('确认取消预约?', '提示', {
  130. confirmButtonText: '确定',
  131. cancelButtonText: '取消',
  132. type: 'warning'
  133. }).then(() => {
  134. this.cancelBorrow(id).then(() => {
  135. this.getBorrowList({ ...this.postData }).then((res) => {
  136. this.page = res.page
  137. this.total = res.pagenum
  138. })
  139. })
  140. })
  141. },
  142. search () {
  143. this.page = 1
  144. this.getBorrowList({ ...this.postData }).then((res) => {
  145. this.page = res.page
  146. this.total = res.pagenum
  147. })
  148. },
  149. handleCurrentChange (val) {
  150. this.postData.page = val
  151. this.getBorrowList({ ...this.postData }).then((res) => {
  152. this.page = res.page
  153. this.total = res.pagenum
  154. })
  155. },
  156. returnCaseName (id) {
  157. var name = ''
  158. this.cases.map((item) => {
  159. if (item.CaseId === id) name = item.CaseName
  160. })
  161. return name
  162. }
  163. }
  164. }
  165. </script>
  166. <style lang="scss">
  167. </style>