zjxpcyc 6 年前
父节点
当前提交
ecedad88f8
共有 2 个文件被更改,包括 63 次插入63 次删除
  1. 57
    63
      src/pages/system/library/borrow/bookreturn.vue
  2. 6
    0
      src/pages/system/page.js

+ 57
- 63
src/pages/system/library/borrow/bookreturn.vue 查看文件

11
       </el-form>
11
       </el-form>
12
     </div>
12
     </div>
13
     <div v-else>
13
     <div v-else>
14
-
15
       <!-- 用户信息区 -->
14
       <!-- 用户信息区 -->
16
-      <el-form label-width="100px">
15
+      <el-form label-width="120px" inline :style="{ width: '100%' }">
17
         <el-form-item label="姓名">
16
         <el-form-item label="姓名">
18
           <span>{{ borrowHistory.CustomerName }}</span>
17
           <span>{{ borrowHistory.CustomerName }}</span>
19
         </el-form-item>
18
         </el-form-item>
31
         </el-form-item>
30
         </el-form-item>
32
       </el-form>
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
       <el-table :data="list" border style="width: 100%">
34
       <el-table :data="list" border style="width: 100%">
49
         <el-table-column prop="BookBarcode" label="条形码"></el-table-column>
35
         <el-table-column prop="BookBarcode" label="条形码"></el-table-column>
50
         <el-table-column prop="BookName" label="书名"></el-table-column>
36
         <el-table-column prop="BookName" label="书名"></el-table-column>
51
         <el-table-column prop="BookTypeName" label="分类"></el-table-column>
37
         <el-table-column prop="BookTypeName" label="分类"></el-table-column>
52
         <el-table-column prop="ReturnDate" label="规定归还日期"></el-table-column>
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
       </el-table>
49
       </el-table>
55
 
50
 
56
       <div :style="{ paddingTop: '40px' }">
51
       <div :style="{ paddingTop: '40px' }">
57
-        <el-button type="primary" @click="submit()">立即借阅</el-button>
58
         <el-button @click="$router.back()">取消</el-button>
52
         <el-button @click="$router.back()">取消</el-button>
59
       </div>
53
       </div>
60
     </div>
54
     </div>
64
 <script>
58
 <script>
65
 import { createNamespacedHelpers, mapState } from 'vuex'
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
 export default {
63
 export default {
73
   name: 'bookReturn',
64
   name: 'bookReturn',
74
   data() {
65
   data() {
75
     return {
66
     return {
76
       active: 0,
67
       active: 0,
77
-      customerInfo: '',
78
-      borrowHistory: {},
79
-      formData: {},
80
-      selectList: [],
68
+      customerInfo: ''
81
     }
69
     }
82
   },
70
   },
83
   created() {
71
   created() {
85
     if (id) {
73
     if (id) {
86
       this.active = 1
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
         this.$message({
85
         this.$message({
92
           showClose: true,
86
           showClose: true,
93
           message: err,
87
           message: err,
105
       orgid: x => x.app.user.OrgId
99
       orgid: x => x.app.user.OrgId
106
     }),
100
     }),
107
     ...mapLibSate({
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
   methods: {
106
   methods: {
113
     ...mapActions({
107
     ...mapActions({
114
       getBorrowHistory: 'getBorrowHistory',
108
       getBorrowHistory: 'getBorrowHistory',
115
-      getList: 'getBorrowList',
116
-      borrowBooks: 'borrowBooks'
109
+      getList: 'getReturnList',
110
+      returnBook: 'returnBook'
117
     }),
111
     }),
118
 
112
 
119
     nextStep() {
113
     nextStep() {
126
         return
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
         confirmButtonText: '确定',
138
         confirmButtonText: '确定',
153
         cancelButtonText: '取消',
139
         cancelButtonText: '取消',
154
         type: 'warning'
140
         type: 'warning'
155
       })
141
       })
156
         .then(() => {
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
         .catch(x => x)
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
 </script>
169
 </script>

+ 6
- 0
src/pages/system/page.js 查看文件

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