zjxpcyc 6 lat temu
rodzic
commit
ecedad88f8

+ 57
- 63
src/pages/system/library/borrow/bookreturn.vue Wyświetl plik

@@ -11,9 +11,8 @@
11 11
       </el-form>
12 12
     </div>
13 13
     <div v-else>
14
-
15 14
       <!-- 用户信息区 -->
16
-      <el-form label-width="100px">
15
+      <el-form label-width="120px" inline :style="{ width: '100%' }">
17 16
         <el-form-item label="姓名">
18 17
           <span>{{ borrowHistory.CustomerName }}</span>
19 18
         </el-form-item>
@@ -31,30 +30,25 @@
31 30
         </el-form-item>
32 31
       </el-form>
33 32
 
34
-      <!-- 过滤条件 -->
35
-      <el-form inline>
36
-        <el-form-item label="条形码">
37
-          <el-input v-model="formData.BookBarcode" :style="{ width: '200px' }" :disabled="true"></el-input>
38
-        </el-form-item>
39
-        <el-form-item label="书名" prop="BookName">
40
-          <el-input v-model="formData.BookName" :style="{ width: '200px' }"></el-input>
41
-        </el-form-item>
42
-        <el-form-item :style="{ float: 'right' }">
43
-          <el-button type="primary" @click="search()">搜索</el-button>
44
-        </el-form-item>
45
-      </el-form>
46
-
47 33
       <!-- 可借阅列表 -->
48 34
       <el-table :data="list" border style="width: 100%">
49 35
         <el-table-column prop="BookBarcode" label="条形码"></el-table-column>
50 36
         <el-table-column prop="BookName" label="书名"></el-table-column>
51 37
         <el-table-column prop="BookTypeName" label="分类"></el-table-column>
52 38
         <el-table-column prop="ReturnDate" label="规定归还日期"></el-table-column>
53
-        <el-table-column prop="LeftNum" label="逾期天数"></el-table-column>
39
+        <el-table-column label="逾期天数">
40
+          <template slot-scope="scope">
41
+            <span>{{ diffToday(scope.row.ReturnDate) }}</span>
42
+          </template>
43
+        </el-table-column>
44
+        <el-table-column fixed="right" label="操作" width="150">
45
+          <template slot-scope="scope">
46
+            <el-button @click="isBookReturn(scope.row)" type="text" size="small">归还</el-button>
47
+          </template>
48
+        </el-table-column>
54 49
       </el-table>
55 50
 
56 51
       <div :style="{ paddingTop: '40px' }">
57
-        <el-button type="primary" @click="submit()">立即借阅</el-button>
58 52
         <el-button @click="$router.back()">取消</el-button>
59 53
       </div>
60 54
     </div>
@@ -64,20 +58,14 @@
64 58
 <script>
65 59
 import { createNamespacedHelpers, mapState } from 'vuex'
66 60
 
67
-const {
68
-  mapState: mapLibSate,
69
-  mapActions,
70
-} = createNamespacedHelpers('library')
61
+const { mapState: mapLibSate, mapActions } = createNamespacedHelpers('library')
71 62
 
72 63
 export default {
73 64
   name: 'bookReturn',
74 65
   data() {
75 66
     return {
76 67
       active: 0,
77
-      customerInfo: '',
78
-      borrowHistory: {},
79
-      formData: {},
80
-      selectList: [],
68
+      customerInfo: ''
81 69
     }
82 70
   },
83 71
   created() {
@@ -85,9 +73,15 @@ export default {
85 73
     if (id) {
86 74
       this.active = 1
87 75
 
88
-      this.getInfo({
89
-        BookId: id
90
-      }).catch(err => {
76
+      this.getBorrowHistory({ customerInfo: this.customerInfo }).catch(err => {
77
+        this.$message({
78
+          showClose: true,
79
+          message: err,
80
+          type: 'error'
81
+        })
82
+      })
83
+
84
+      this.getList({ customerInfo: this.customerInfo }).catch(err => {
91 85
         this.$message({
92 86
           showClose: true,
93 87
           message: err,
@@ -105,15 +99,15 @@ export default {
105 99
       orgid: x => x.app.user.OrgId
106 100
     }),
107 101
     ...mapLibSate({
108
-      list: s => s.borrow.list,
109
-      borrowHistory: s => s.borrow.history,
110
-    }),
102
+      list: s => s.bookReturn.list,
103
+      borrowHistory: s => s.borrow.history
104
+    })
111 105
   },
112 106
   methods: {
113 107
     ...mapActions({
114 108
       getBorrowHistory: 'getBorrowHistory',
115
-      getList: 'getBorrowList',
116
-      borrowBooks: 'borrowBooks'
109
+      getList: 'getReturnList',
110
+      returnBook: 'returnBook'
117 111
     }),
118 112
 
119 113
     nextStep() {
@@ -126,50 +120,50 @@ export default {
126 120
         return
127 121
       }
128 122
 
129
-      this.getBorrowHistory({ customerInfo: this.customerInfo }).then(() => {
130
-        this.active = 1
131
-      }).catch(err => {
132
-        this.$message({
133
-          showClose: true,
134
-          message: err,
135
-          type: 'error'
123
+      this.getBorrowHistory({ customerInfo: this.customerInfo })
124
+        .then(() => {
125
+          this.active = 1
136 126
         })
137
-      })
138
-    },
139
-
140
-    search() {
141
-      this.getBorrowList(this.formData).catch(err => {
142
-        this.$message({
143
-          showClose: true,
144
-          message: err,
145
-          type: 'error'
127
+        .catch(err => {
128
+          this.$message({
129
+            showClose: true,
130
+            message: err,
131
+            type: 'error'
132
+          })
146 133
         })
147
-      })
148 134
     },
149 135
 
150
-    submit() {
151
-      this.$confirm('确定借阅此书?', '提示', {
136
+    isBookReturn(book) {
137
+      this.$confirm('确定归还此书?', '提示', {
152 138
         confirmButtonText: '确定',
153 139
         cancelButtonText: '取消',
154 140
         type: 'warning'
155 141
       })
156 142
         .then(() => {
157
-          this.borrowBooks(this.selectList).then(() => {
158
-            this.$message({
159
-              showClose: true,
160
-              message: '借阅成功',
161
-              type: 'success'
143
+          this.returnBook(book)
144
+            .then(() => {
145
+              this.$message({
146
+                showClose: true,
147
+                message: '归还成功',
148
+                type: 'success'
149
+              })
162 150
             })
163
-          }).catch(err => {
164
-            this.$message({
165
-              showClose: true,
166
-              message: err,
167
-              type: 'error'
151
+            .catch(err => {
152
+              this.$message({
153
+                showClose: true,
154
+                message: err,
155
+                type: 'error'
156
+              })
168 157
             })
169
-          })
170 158
         })
171 159
         .catch(x => x)
172 160
     },
161
+
162
+    diffToday(dt) {
163
+      const days =
164
+        (new window.Date().getTime() - dt.getTime()) / (1000 * 60 * 60 * 24)
165
+      return days <= 0 ? 0 : days
166
+    }
173 167
   }
174 168
 }
175 169
 </script>

+ 6
- 0
src/pages/system/page.js Wyświetl plik

@@ -144,6 +144,7 @@ import StockChange from './library/books/stockchange' // 图书编辑
144 144
 
145 145
 import BorrowManager from './library/borrow' // 借阅管理
146 146
 import BorrowBooks from './library/borrow/borrow' // 借阅管理
147
+import ReturnBooks from './library/borrow/bookreturn' // 图书归还
147 148
 
148 149
 export default {
149 150
   router: [
@@ -775,6 +776,11 @@ export default {
775 776
           name: 'borrowBooks',
776 777
           component: BorrowBooks,
777 778
           children: []
779
+        },{ // 图书归还
780
+          path: 'bookreturn',
781
+          name: 'bookReturn',
782
+          component: ReturnBooks,
783
+          children: []
778 784
         }]
779 785
       }]
780 786
     },