zjxpcyc 6 年之前
父節點
當前提交
d989ef3864

+ 2
- 2
config/index.js 查看文件

@@ -13,9 +13,9 @@ module.exports = {
13 13
       '/api': {
14 14
         // target: 'https://dp.huiju360.com.cn/hj_operations',
15 15
         // target: 'http://localhost:8080', //wf
16
-        // target: 'http://127.0.0.1:8080', 
16
+        target: 'http://127.0.0.1:8080', 
17 17
         // target: 'http://192.168.0.11:8080', //ys
18
-        target: 'http://192.168.0.102:8080', //hyq
18
+        // target: 'http://192.168.0.102:8080', //hyq
19 19
         // target: 'http://dev.ycjcjy.com', //frp
20 20
         changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
21 21
         // pathRewrite: {

+ 28
- 18
src/pages/system/library/books/list.vue 查看文件

@@ -25,7 +25,7 @@
25 25
     </div>
26 26
     <div>
27 27
       <el-button plain @click="editBook()" size="medium">图书录入</el-button>
28
-      <el-button plain @click="showDialog = true" size="medium">批量导入</el-button>
28
+      <el-button plain @click="showBatchInput()" size="medium">批量导入</el-button>
29 29
       <div :style="{ margin: '10px 0' }">
30 30
         <el-table :data="list" border style="width: 100%">
31 31
           <el-table-column label="图片" width="128">
@@ -79,7 +79,7 @@
79 79
         <el-pagination
80 80
           layout="prev, pager, next"
81 81
           :current-page="page"
82
-          :total="1000"
82
+          :total="pagenum"
83 83
           @current-change="pageChange"
84 84
         ></el-pagination>
85 85
       </div>
@@ -89,7 +89,7 @@
89 89
       :visible.sync="showDialog"
90 90
       width="50%">
91 91
       <div :style="{ margin: 'auto', width: '80%' }">
92
-        <div><el-button @click="showBatchInput" :style="{ width: '100%' }">上传文件</el-button></div>
92
+        <div><el-button @click="inputRef.click()" :style="{ width: '100%' }">上传文件</el-button></div>
93 93
         <div><el-button type="text" size="medium" :style="{ float: 'right' }">下载导入模板</el-button></div>
94 94
       </div>
95 95
       <span slot="footer" class="dialog-footer">
@@ -102,6 +102,7 @@
102 102
 
103 103
 <script>
104 104
 import { createNamespacedHelpers, mapState } from 'vuex'
105
+import { Loading } from 'element-ui'
105 106
 
106 107
 const { mapState: mapLibSate, mapActions } = createNamespacedHelpers('library')
107 108
 
@@ -125,6 +126,7 @@ export default {
125 126
     ...mapLibSate({
126 127
       list: s => s.list,
127 128
       page: s => s.page,
129
+      pagenum: s => s.pagenum,
128 130
       types: s => s.type.list
129 131
     })
130 132
   },
@@ -148,6 +150,15 @@ export default {
148 150
     // 查询过滤
149 151
     filterList({ page = 0 } = {}) {
150 152
       const caseId = this.caseId || this.defaultCase
153
+      if (!caseId) {
154
+        this.$message({
155
+          showClose: true,
156
+          message: '请选择案场',
157
+          type: 'error'
158
+        })
159
+        return
160
+      }
161
+
151 162
       this.getTypeList({ page: 0, pagesize: 1000, caseid: caseId })
152 163
 
153 164
       this.getList({
@@ -236,24 +247,21 @@ export default {
236 247
     // 批量导入
237 248
     showBatchInput() {
238 249
       if (!this.caseId) {
250
+        this.showDialog = false
251
+
239 252
         this.$message({
240 253
           showClose: true,
241 254
           message: '请选择案场',
242 255
           type: 'error'
243 256
         })
244
-
245 257
         return
246 258
       }
247 259
 
248
-      this.$confirm('批量导入将可能有较长的耗时, 是否继续?', '提示', {
249
-        confirmButtonText: '确定',
250
-        cancelButtonText: '取消',
251
-        type: 'warning'
252
-      })
253
-        .then(() => this.inputRef.click())
254
-        .catch(x => x)
260
+      this.showDialog = true
255 261
     },
256 262
     importBatch(e) {
263
+      this.showDialog = false
264
+
257 265
       // 需要指定案场
258 266
       const caseName = this.getCaseName(this.caseId)
259 267
       const file = e.target.files[0]
@@ -271,12 +279,19 @@ export default {
271 279
         type: 'warning'
272 280
       })
273 281
         .then(() => {
282
+          const loadding = Loading.service({
283
+            lock: true,
284
+            text: '数据导入中, 可能耗时较长, 请耐心等候...'
285
+          })
286
+
274 287
           const data = {
275 288
             caseId: this.caseId,
276 289
             excel: file,
277 290
           }
278 291
 
279 292
           this.batchImport(data).then(() => {
293
+            loadding.close()
294
+
280 295
             this.$confirm(`数据导入完成, 点击【确定】刷新页面`, '提示', {
281 296
               confirmButtonText: '确定',
282 297
               cancelButtonText: '取消',
@@ -285,19 +300,14 @@ export default {
285 300
               window.location.reload()
286 301
             })
287 302
           }).catch((err) => {
303
+            loadding.close()
304
+
288 305
             this.$message({
289 306
               showClose: true,
290 307
               message: err,
291 308
               type: 'error'
292 309
             })
293 310
           })
294
-
295
-          // const loading = this.$loading({
296
-          //   lock: true,
297
-          //   text: '数据导入中, 可能耗时较长, 请稍后 ...',
298
-          // })
299
-
300
-          // window.setTimeout(() => loading.close(), 2000)
301 311
         })
302 312
         .catch(x => x)
303 313
     },

+ 19
- 41
src/pages/system/library/borrow/bookreturn.vue 查看文件

@@ -12,23 +12,25 @@
12 12
     </div>
13 13
     <div v-else>
14 14
       <!-- 用户信息区 -->
15
-      <el-form label-width="120px" inline :style="{ width: '100%' }">
16
-        <el-form-item label="姓名">
17
-          <span>{{ borrowHistory.CustomerName }}</span>
18
-        </el-form-item>
19
-        <el-form-item label="手机号">
20
-          <span>{{ borrowHistory.CustomerPhone }}</span>
21
-        </el-form-item>
22
-        <el-form-item label="在借数量">
23
-          <span>{{ borrowHistory.CustomerPhone }}</span>
24
-        </el-form-item>
25
-        <el-form-item label="逾期数量">
26
-          <span>{{ borrowHistory.CustomerPhone }}</span>
27
-        </el-form-item>
28
-        <el-form-item label="历史是否有逾期">
29
-          <span>{{ borrowHistory.CustomerPhone === 1 ? '是' : '否' }}</span>
30
-        </el-form-item>
31
-      </el-form>
15
+      <div :style="{ marginBottom: '20px', paddingBottom: '20px', borderBottom: '1px solid #eee' }">
16
+        <el-row :gutter="20">
17
+          <el-col :span="4">
18
+            <span>姓名: </span><span>{{ borrowHistory.Name }}</span>
19
+          </el-col>
20
+          <el-col :span="4">
21
+            <span>手机号: </span><span>{{ borrowHistory.Phone }}</span>
22
+          </el-col>
23
+          <el-col :span="4">
24
+            <span>在借数量: </span><span>{{ borrowHistory.BorrowNum }}</span>
25
+          </el-col>
26
+          <el-col :span="4">
27
+            <span>逾期数量: </span><span>{{ borrowHistory.LateNum }}</span>
28
+          </el-col>
29
+          <el-col :span="4">
30
+            <span>历史是否有逾期: </span><span>{{ borrowHistory.IsLate === 'yes' ? '是' : '否' }}</span>
31
+          </el-col>
32
+        </el-row>
33
+      </div>
32 34
 
33 35
       <!-- 可借阅列表 -->
34 36
       <el-table :data="list" border style="width: 100%">
@@ -68,30 +70,6 @@ export default {
68 70
       customerInfo: ''
69 71
     }
70 72
   },
71
-  created() {
72
-    const id = this.$route.params.id
73
-    if (id) {
74
-      this.active = 1
75
-
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 => {
85
-        this.$message({
86
-          showClose: true,
87
-          message: err,
88
-          type: 'error'
89
-        })
90
-      })
91
-    } else {
92
-      this.active = 0
93
-    }
94
-  },
95 73
   computed: {
96 74
     ...mapState({
97 75
       cases: x => x.app.cases.list,

+ 70
- 43
src/pages/system/library/borrow/borrow.vue 查看文件

@@ -13,31 +13,43 @@
13 13
     <div v-else>
14 14
 
15 15
       <!-- 用户信息区 -->
16
-      <el-form label-width="100px">
17
-        <el-form-item label="姓名">
18
-          <span>{{ borrowHistory.CustomerName }}</span>
19
-        </el-form-item>
20
-        <el-form-item label="手机号">
21
-          <span>{{ borrowHistory.CustomerPhone }}</span>
22
-        </el-form-item>
23
-        <el-form-item label="在借数量">
24
-          <span>{{ borrowHistory.CustomerPhone }}</span>
25
-        </el-form-item>
26
-        <el-form-item label="逾期数量">
27
-          <span>{{ borrowHistory.CustomerPhone }}</span>
28
-        </el-form-item>
29
-        <el-form-item label="历史是否有逾期">
30
-          <span>{{ borrowHistory.CustomerPhone === 1 ? '是' : '否' }}</span>
31
-        </el-form-item>
32
-      </el-form>
16
+      <div :style="{ marginBottom: '20px', paddingBottom: '20px', borderBottom: '1px solid #eee' }">
17
+        <el-row :gutter="20">
18
+          <el-col :span="4">
19
+            <span>姓名: </span><span>{{ borrowHistory.Name }}</span>
20
+          </el-col>
21
+          <el-col :span="4">
22
+            <span>手机号: </span><span>{{ borrowHistory.Phone }}</span>
23
+          </el-col>
24
+          <el-col :span="4">
25
+            <span>在借数量: </span><span>{{ borrowHistory.BorrowNum }}</span>
26
+          </el-col>
27
+          <el-col :span="4">
28
+            <span>逾期数量: </span><span>{{ borrowHistory.LateNum }}</span>
29
+          </el-col>
30
+          <el-col :span="4">
31
+            <span>历史是否有逾期: </span><span>{{ borrowHistory.IsLate === 'yes' ? '是' : '否' }}</span>
32
+          </el-col>
33
+        </el-row>
34
+      </div>
33 35
 
34 36
       <!-- 过滤条件 -->
35 37
       <el-form inline>
38
+        <el-form-item label="案场">
39
+          <el-select v-model="formData.caseid" size="medium" placeholder="请选择案场">
40
+            <el-option
41
+              v-for="item in cases"
42
+              :key="item.CaseId"
43
+              :label="item.CaseName"
44
+              :value="item.CaseId"
45
+            ></el-option>
46
+          </el-select>
47
+        </el-form-item>
36 48
         <el-form-item label="条形码">
37
-          <el-input v-model="formData.BookBarcode" :style="{ width: '200px' }" :disabled="true"></el-input>
49
+          <el-input ref="barcode" v-model="formData.barcode" :style="{ width: '200px' }"></el-input>
38 50
         </el-form-item>
39
-        <el-form-item label="书名" prop="BookName">
40
-          <el-input v-model="formData.BookName" :style="{ width: '200px' }"></el-input>
51
+        <el-form-item label="书名">
52
+          <el-input v-model="formData.bookname" :style="{ width: '200px' }"></el-input>
41 53
         </el-form-item>
42 54
         <el-form-item :style="{ float: 'right' }">
43 55
           <el-button type="primary" @click="search()">搜索</el-button>
@@ -79,29 +91,10 @@ export default {
79 91
     return {
80 92
       active: 0,
81 93
       customerInfo: '',
82
-      borrowHistory: {},
83
-      formData: {},
94
+      formData: { caseid: '', barcode: '', bookname: '' },
84 95
       selectList: [],
85 96
     }
86 97
   },
87
-  created() {
88
-    const id = this.$route.params.id
89
-    if (id) {
90
-      this.active = 1
91
-
92
-      this.getInfo({
93
-        BookId: id
94
-      }).catch(err => {
95
-        this.$message({
96
-          showClose: true,
97
-          message: err,
98
-          type: 'error'
99
-        })
100
-      })
101
-    } else {
102
-      this.active = 0
103
-    }
104
-  },
105 98
   computed: {
106 99
     ...mapState({
107 100
       cases: x => x.app.cases.list,
@@ -113,10 +106,17 @@ export default {
113 106
       borrowHistory: s => s.borrow.history,
114 107
     }),
115 108
   },
109
+  watch: {
110
+    defaultCase(nv) {
111
+      if (!this.formData.caseid) {
112
+        this.formData.caseid = nv
113
+      }
114
+    }
115
+  },
116 116
   methods: {
117 117
     ...mapActions({
118 118
       getBorrowHistory: 'getBorrowHistory',
119
-      getList: 'getBorrowList',
119
+      getList: 'getBookList',
120 120
       borrowBooks: 'borrowBooks'
121 121
     }),
122 122
 
@@ -142,7 +142,20 @@ export default {
142 142
     },
143 143
 
144 144
     search() {
145
-      this.getBorrowList(this.formData).catch(err => {
145
+      if (!this.formData.caseid) {
146
+        this.$message({
147
+          showClose: true,
148
+          message: '请选择案场',
149
+          type: 'error'
150
+        })
151
+
152
+        return
153
+      }
154
+
155
+      this.getList({
156
+        ...this.formData,
157
+        // customerphone: this.borrowHistory.Phone,
158
+      }).catch(err => {
146 159
         this.$message({
147 160
           showClose: true,
148 161
           message: err,
@@ -152,13 +165,27 @@ export default {
152 165
     },
153 166
 
154 167
     submit() {
168
+      if (!this.selectList || this.selectList.length === 0) {
169
+        this.$message({
170
+          showClose: true,
171
+          message: '请选择借阅图书',
172
+          type: 'error'
173
+        })
174
+
175
+        return
176
+      }
177
+
155 178
       this.$confirm('确定借阅此书?', '提示', {
156 179
         confirmButtonText: '确定',
157 180
         cancelButtonText: '取消',
158 181
         type: 'warning'
159 182
       })
160 183
         .then(() => {
161
-          this.borrowBooks(this.selectList).then(() => {
184
+          const bookIds = this.selectList.map(({BookId}) => BookId).join(',')
185
+          this.borrowBooks({
186
+            bookIds,
187
+            customerId: this.borrowHistory.CustomerId,
188
+          }).then(() => {
162 189
             this.$message({
163 190
               showClose: true,
164 191
               message: '借阅成功',

+ 31
- 2
src/store/library/index.js 查看文件

@@ -98,6 +98,9 @@ export default {
98 98
         state.list = (state.list || []).map(x => x.BookId === payload.BookId ? payload : x)
99 99
       }
100 100
     },
101
+    mergeHistory (state, payload) {
102
+      state.borrow.history = payload
103
+    },
101 104
     setBorrowList (state, payload) { // 更新借阅记录
102 105
       state.borrow.list = payload
103 106
     },
@@ -210,7 +213,6 @@ export default {
210 213
           ...api.book.list,
211 214
           queryData: payload,
212 215
         }).then((x) => {
213
-          console.log(x)
214 216
           commit('setBookList', x)
215 217
           resolve(x)
216 218
         })
@@ -271,6 +273,33 @@ export default {
271 273
         })
272 274
           .catch(({ message }) => reject(message))
273 275
       })
274
-    }
276
+    },
277
+    getBorrowHistory({ commit }, payload) {
278
+      return new Promise((resolve, reject) => {
279
+        ajax({
280
+          ...api.book.history,
281
+          urlData: payload,
282
+        }).then((res) => {
283
+          if (!!res) { // eslint-disable-line
284
+            commit('mergeHistory', res)
285
+            resolve(res)
286
+          } else {
287
+            reject('未检索到数据') // eslint-disable-line
288
+          }
289
+        })
290
+          .catch(({ message }) => reject(message))
291
+      })
292
+    },
293
+    borrowBooks (_, payload) {
294
+      return new Promise((resolve, reject) => {
295
+        ajax({
296
+          ...api.book.borrow,
297
+          urlData: payload,
298
+        }).then(() => {
299
+          resolve()
300
+        })
301
+          .catch(({ message }) => reject(message))
302
+      })
303
+    },
275 304
   },
276 305
 }

+ 8
- 0
src/util/api.js 查看文件

@@ -1005,6 +1005,14 @@ const $api = {
1005 1005
       method: 'post',
1006 1006
       url: `${baseUrl}${common}/book/excel`
1007 1007
     },
1008
+    history: {
1009
+      method: 'get',
1010
+      url: `${baseUrl}${common}/book/customer/:customerInfo`
1011
+    },
1012
+    borrow: {
1013
+      method: 'put',
1014
+      url: `${baseUrl}${common}/book/borrow/:bookIds/:customerId`
1015
+    },
1008 1016
   },
1009 1017
 }
1010 1018
 export default $api