zjxpcyc 6 years ago
parent
commit
782657229d

+ 8
- 9
src/pages/system/library/books/stockchange.vue View File

6
           <el-input v-model="book.BookName" :style="{ width: '200px' }" :disabled="true"></el-input>
6
           <el-input v-model="book.BookName" :style="{ width: '200px' }" :disabled="true"></el-input>
7
         </el-form-item>
7
         </el-form-item>
8
         <el-form-item label="总库存" prop="InStockTotal">
8
         <el-form-item label="总库存" prop="InStockTotal">
9
-          <el-input v-model="book.InStockTotal" :style="{ width: '200px' }" :disabled="true"></el-input>
9
+          <el-input v-model="book.InStock" :style="{ width: '200px' }" :disabled="true"></el-input>
10
         </el-form-item>
10
         </el-form-item>
11
         <el-form-item label="剩余库存" prop="InStockAfter">
11
         <el-form-item label="剩余库存" prop="InStockAfter">
12
           <el-input-number v-model="formData.InStockAfter" :min="0" :style="{ width: '200px' }" ></el-input-number>
12
           <el-input-number v-model="formData.InStockAfter" :min="0" :style="{ width: '200px' }" ></el-input-number>
33
         <el-pagination
33
         <el-pagination
34
           layout="prev, pager, next"
34
           layout="prev, pager, next"
35
           :current-page="page"
35
           :current-page="page"
36
-          :total="1000"
36
+          :total="pagenum"
37
           @current-change="pageChange">
37
           @current-change="pageChange">
38
         </el-pagination>
38
         </el-pagination>
39
       </div>
39
       </div>
71
       book: s => s.detail,
71
       book: s => s.detail,
72
       list: s => s.stock.list,
72
       list: s => s.stock.list,
73
       page: s => s.stock.page,
73
       page: s => s.stock.page,
74
+      pagenum: s => s.stock.pagenum,
74
     })
75
     })
75
   },
76
   },
76
   created() {
77
   created() {
77
     this.bookId = this.$route.params.id
78
     this.bookId = this.$route.params.id
79
+
78
     this.filterList()
80
     this.filterList()
79
-    this.getBook({ BookId: this.bookId }).then(() => {
81
+    this.getBook({ id: this.bookId }).then(() => {
80
       this.formData = {
82
       this.formData = {
81
         BookId: this.book.BookId,
83
         BookId: this.book.BookId,
82
         InStockAfter: this.book.LeftNum,
84
         InStockAfter: this.book.LeftNum,
84
         OrgId: this.book.OrgId,
86
         OrgId: this.book.OrgId,
85
         ChangeReason: '',
87
         ChangeReason: '',
86
         InStockTotal: this.book.InStock,
88
         InStockTotal: this.book.InStock,
89
+        InStockBefore: this.book.LeftNum,
87
       }
90
       }
88
     }).catch((err) => {
91
     }).catch((err) => {
89
       this.$message({
92
       this.$message({
103
     filterList({ page = 0 } = {}) {
106
     filterList({ page = 0 } = {}) {
104
       this.getList({
107
       this.getList({
105
         page,
108
         page,
106
-        BookId: this.bookId
109
+        bookId: this.bookId
107
       }).catch(err => {
110
       }).catch(err => {
108
         this.$message({
111
         this.$message({
109
           showClose: true,
112
           showClose: true,
115
 
118
 
116
     submit() {
119
     submit() {
117
       this.setChange(this.formData).then(() => {
120
       this.setChange(this.formData).then(() => {
118
-        this.$message({
119
-          showClose: true,
120
-          message: '库存盘点成功',
121
-          type: 'success'
122
-        })
121
+        this.$alert('库存盘点成功').then(() => window.location.reload())
123
       }).catch(err => {
122
       }).catch(err => {
124
         this.$message({
123
         this.$message({
125
           showClose: true,
124
           showClose: true,

+ 1
- 1
src/pages/system/library/borrow/bookreturn.vue View File

77
       orgid: x => x.app.user.OrgId
77
       orgid: x => x.app.user.OrgId
78
     }),
78
     }),
79
     ...mapLibSate({
79
     ...mapLibSate({
80
-      list: s => s.bookReturn.list,
80
+      list: s => s.list,
81
       borrowHistory: s => s.borrow.history
81
       borrowHistory: s => s.borrow.history
82
     })
82
     })
83
   },
83
   },

+ 15
- 3
src/pages/system/library/borrow/borrow.vue View File

49
           <el-input ref="barcode" v-model="formData.barcode" :style="{ width: '200px' }"></el-input>
49
           <el-input ref="barcode" v-model="formData.barcode" :style="{ width: '200px' }"></el-input>
50
         </el-form-item>
50
         </el-form-item>
51
         <el-form-item label="书名">
51
         <el-form-item label="书名">
52
-          <el-input v-model="formData.bookname" :style="{ width: '200px' }"></el-input>
52
+          <el-input v-model="formData.name" :style="{ width: '200px' }"></el-input>
53
         </el-form-item>
53
         </el-form-item>
54
         <el-form-item :style="{ float: 'right' }">
54
         <el-form-item :style="{ float: 'right' }">
55
           <el-button type="primary" @click="search()">搜索</el-button>
55
           <el-button type="primary" @click="search()">搜索</el-button>
91
     return {
91
     return {
92
       active: 0,
92
       active: 0,
93
       customerInfo: '',
93
       customerInfo: '',
94
-      formData: { caseid: '', barcode: '', bookname: '' },
94
+      formData: { caseid: '', barcode: '', name: '' },
95
       selectList: [],
95
       selectList: [],
96
     }
96
     }
97
   },
97
   },
102
       orgid: x => x.app.user.OrgId
102
       orgid: x => x.app.user.OrgId
103
     }),
103
     }),
104
     ...mapLibSate({
104
     ...mapLibSate({
105
-      list: s => s.borrow.list,
105
+      list: s => s.list,
106
       borrowHistory: s => s.borrow.history,
106
       borrowHistory: s => s.borrow.history,
107
     }),
107
     }),
108
   },
108
   },
142
     },
142
     },
143
 
143
 
144
     search() {
144
     search() {
145
+      // 必须选案场
145
       if (!this.formData.caseid) {
146
       if (!this.formData.caseid) {
146
         this.$message({
147
         this.$message({
147
           showClose: true,
148
           showClose: true,
152
         return
153
         return
153
       }
154
       }
154
 
155
 
156
+      // 先扫码或者输入图书名称
157
+      if (!this.formData.barcode && !this.formData.name) {
158
+        this.$message({
159
+          showClose: true,
160
+          message: '请先扫码或者输入图书名称',
161
+          type: 'error'
162
+        })
163
+
164
+        return
165
+      }
166
+
155
       this.getList({
167
       this.getList({
156
         ...this.formData,
168
         ...this.formData,
157
         // customerphone: this.borrowHistory.Phone,
169
         // customerphone: this.borrowHistory.Phone,

+ 33
- 3
src/store/library/index.js View File

130
     deleteBookList (state, payload = {}) {
130
     deleteBookList (state, payload = {}) {
131
       state.list = state.list.filter(x => x.BookId !== payload.BookId)
131
       state.list = state.list.filter(x => x.BookId !== payload.BookId)
132
     },
132
     },
133
+    setStockList (state, payload = []) {
134
+      const { list, pagenum } = payload || {}
135
+      if (!!list) { // eslint-disable-line
136
+        state.stock.list = list
137
+        state.stock.pagenum = pagenum
138
+      } else {
139
+        state.stock.list = []
140
+        state.stock.pagenum = 0
141
+      }
142
+    },
133
   },
143
   },
134
   actions: {
144
   actions: {
135
     cancelBorrow ({ commit }, payload) { // 取消预约
145
     cancelBorrow ({ commit }, payload) { // 取消预约
258
           .catch(({ message }) => reject(message))
268
           .catch(({ message }) => reject(message))
259
       })
269
       })
260
     },
270
     },
261
-    getStockList ({ commit }, payload) {
262
-      return new Promise((resolve, reject) => {
271
+    getStockList ({ commit }, payload = {}) {
272
+      const { bookId, ...queryData } = payload
263
 
273
 
274
+      return new Promise((resolve, reject) => {
275
+        ajax({
276
+          ...api.book.inStock,
277
+          urlData: { bookId },
278
+          queryData,
279
+        }).then((x) => {
280
+          commit('setStockList', x)
281
+          resolve(x)
282
+        })
283
+          .catch(({ message }) => reject(message))
284
+      })
285
+    },
286
+    setStockChange ({ commit }, payload = {}) {
287
+      return new Promise((resolve, reject) => {
288
+        ajax({
289
+          ...api.book.changeStock,
290
+          data: payload,
291
+        }).then(() => {
292
+          resolve()
293
+        })
294
+          .catch(({ message }) => reject(message))
264
       })
295
       })
265
     },
296
     },
266
     batchImport(_, payload) {
297
     batchImport(_, payload) {
295
         ajax({
326
         ajax({
296
           ...api.book.borrow,
327
           ...api.book.borrow,
297
           urlData: payload,
328
           urlData: payload,
298
-          urlData: { ...payload },
299
         }).then(() => {
329
         }).then(() => {
300
           resolve()
330
           resolve()
301
         })
331
         })

+ 8
- 0
src/util/api.js View File

1013
       method: 'put',
1013
       method: 'put',
1014
       url: `${baseUrl}${common}/book/borrow/:bookIds/:customerId`
1014
       url: `${baseUrl}${common}/book/borrow/:bookIds/:customerId`
1015
     },
1015
     },
1016
+    inStock: {
1017
+      method: 'get',
1018
+      url: `${baseUrl}${common}/book/instock/:bookId`
1019
+    },
1020
+    changeStock: {
1021
+      method: 'post',
1022
+      url: `${baseUrl}${common}/book/change`
1023
+    },
1016
   },
1024
   },
1017
 }
1025
 }
1018
 export default $api
1026
 export default $api