zjxpcyc 6 yıl önce
ebeveyn
işleme
6582c4c91e

+ 1
- 0
.editorconfig Dosyayı Görüntüle

@@ -7,3 +7,4 @@ indent_size = 2
7 7
 end_of_line = lf
8 8
 insert_final_newline = true
9 9
 trim_trailing_whitespace = true
10
+semi = false

+ 4
- 1
.eslintrc.js Dosyayı Görüntüle

@@ -25,6 +25,9 @@ module.exports = {
25 25
     'generator-star-spacing': 'off',
26 26
     // allow debugger during development
27 27
     'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
28
-    'comma-dangle': 0
28
+    'comma-dangle': 0,
29
+
30
+    // 这个规则让人蛋疼
31
+    'space-before-function-paren': 0
29 32
   }
30 33
 }

+ 3
- 4
package-lock.json Dosyayı Görüntüle

@@ -12173,10 +12173,9 @@
12173 12173
       "dev": true
12174 12174
     },
12175 12175
     "prettier": {
12176
-      "version": "1.14.3",
12177
-      "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.14.3.tgz",
12178
-      "integrity": "sha512-qZDVnCrnpsRJJq5nSsiHCE3BYMED2OtsI+cmzIzF1QIfqm5ALf8tEJcO27zV1gKNKRPdhjO0dNWnrzssDQ1tFg==",
12179
-      "dev": true
12176
+      "version": "1.15.3",
12177
+      "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.15.3.tgz",
12178
+      "integrity": "sha512-gAU9AGAPMaKb3NNSUUuhhFAS7SCO4ALTN4nRIn6PJ075Qd28Yn2Ig2ahEJWdJwJmlEBTUfC7mMUSFy8MwsOCfg=="
12180 12179
     },
12181 12180
     "pretty": {
12182 12181
       "version": "2.0.0",

+ 238
- 0
src/pages/system/library/books/detail.vue Dosyayı Görüntüle

@@ -0,0 +1,238 @@
1
+<template>
2
+  <div class="subPage edit-book" :style="{ padding: '20px' }">
3
+    <el-form :model="formData" :rules="rules" ref="ruleForm" label-width="100px" :style="{ width: '600px' }">
4
+      <div v-if="!active">
5
+        <el-form-item label="条形码" prop="BookBarcode">
6
+          <el-input v-model="formData.BookBarcode" :style="{ width: '200px' }"></el-input>
7
+        </el-form-item>
8
+        <el-form-item :style="{ paddingTop: '20px' }">
9
+          <el-button type="primary" @click="nextStep()">下一步</el-button>
10
+        </el-form-item>
11
+      </div>
12
+      <div v-else>
13
+        <el-form-item label="条形码">
14
+          <el-input v-model="formData.BookBarcode" :style="{ width: '200px' }" :disabled="true"></el-input>
15
+        </el-form-item>
16
+        <el-form-item label="案场" prop="CaseId">
17
+          <el-select v-model="formData.CaseId" placeholder="请选择案场">
18
+            <el-option
19
+              v-for="item in cases"
20
+              :key="item.CaseId"
21
+              :label="item.CaseName"
22
+              :value="item.CaseId"
23
+              @change="filterTypes"
24
+            ></el-option>
25
+          </el-select>
26
+        </el-form-item>
27
+        <el-form-item label="图片" prop="BookImg">
28
+          <el-upload
29
+            class="avatar-uploader"
30
+            action=""
31
+            :show-file-list="false"
32
+            :on-success="uploadSuccess"
33
+            :before-upload="toolClass.beforeUpload"
34
+            :http-request="toolClass.upload"
35
+          >
36
+            <img v-if="formData.BookImg" :src="formData.BookImg + '?x-oss-process=style/compress-rotate'" class="avatar">
37
+            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
38
+          </el-upload>
39
+        </el-form-item>
40
+        <el-form-item label="书名" prop="BookName">
41
+          <el-input v-model="formData.BookName" :style="{ width: '200px' }"></el-input>
42
+        </el-form-item>
43
+        <el-form-item label="分类" prop="BookTypeId">
44
+          <el-select v-model="formData.BookTypeId" placeholder="请选择分类">
45
+            <el-option
46
+              v-for="item in types"
47
+              :key="item.BookTypeId"
48
+              :label="item.BookTypeName"
49
+              :value="item.BookTypeId"
50
+            ></el-option>
51
+          </el-select>
52
+        </el-form-item>
53
+        <el-form-item label="作者" prop="Author">
54
+          <el-input v-model="formData.Author" :style="{ width: '200px' }"></el-input>
55
+        </el-form-item>
56
+        <el-form-item label="出版社" prop="Publisher">
57
+          <el-input v-model="formData.Publisher" :style="{ width: '200px' }"></el-input>
58
+        </el-form-item>
59
+        <el-form-item label="价格" prop="Price">
60
+          <el-input-number v-model="formData.Price" :precision="2" controls-position="right" :style="{ width: '200px' }"></el-input-number>
61
+        </el-form-item>
62
+        <el-form-item label="总数量" prop="InStock">
63
+          <el-input-number v-model="formData.InStock" controls-position="right" :style="{ width: '200px' }"></el-input-number>
64
+        </el-form-item>
65
+        <el-form-item label="借阅时间" prop="BorrowDays">
66
+          <el-input-number v-model="formData.BorrowDays" controls-position="right" :style="{ width: '200px' }"></el-input-number>
67
+          <span> /天</span>
68
+        </el-form-item>
69
+        <el-form-item label="图书描述" prop="BookDescription">
70
+          <el-input type="textarea" rows="4" v-model="formData.BookDescription" :style="{ width: '400px' }"></el-input>
71
+        </el-form-item>
72
+        <el-form-item :style="{ paddingTop: '40px' }">
73
+          <el-button type="primary" @click="submit()">保存</el-button>
74
+          <el-button @click="$router.back()">取消</el-button>
75
+        </el-form-item>
76
+      </div>
77
+    </el-form>
78
+  </div>
79
+</template>
80
+
81
+<script>
82
+import { createNamespacedHelpers, mapState } from 'vuex'
83
+
84
+const {
85
+  mapState: mapLibSate,
86
+  mapActions,
87
+  mapMutations
88
+} = createNamespacedHelpers('library')
89
+
90
+export default {
91
+  name: 'bookDetail',
92
+  data() {
93
+    return {
94
+      active: 0,
95
+      rules: {
96
+        BookBarcode: [{ required: true, message: '请录入条形码', trigger: 'blur' }],
97
+        BookName: [{ required: true, message: '请输入图书名称', trigger: 'blur' }],
98
+        // BookImg: [{ required: true, message: '请上传图片', trigger: 'change' }],
99
+        CaseId: [{ required: true, message: '请选择一个案场', trigger: 'change' }],
100
+        BookTypeId: [{ required: true, message: '请选择一个分类', trigger: 'change' }],
101
+        InStock: [{ required: true, message: '请设置总数量', trigger: 'change' }],
102
+        BorrowDays: [{ required: true, message: '请设置借阅时间', trigger: 'change' }],
103
+      },
104
+      formData: {},
105
+    }
106
+  },
107
+  created() {
108
+    const id = this.$route.params.id
109
+    if (id) {
110
+      this.active = 1
111
+
112
+      this.getInfo({
113
+        BookId: id
114
+      }).catch(err => {
115
+        this.$message({
116
+          showClose: true,
117
+          message: err,
118
+          type: 'error'
119
+        })
120
+      })
121
+    } else {
122
+      this.active = 0
123
+    }
124
+  },
125
+  computed: {
126
+    ...mapState({
127
+      cases: x => x.app.cases.list,
128
+      defaultCase: x => x.app.cases.default,
129
+      orgid: x => x.app.user.OrgId
130
+    }),
131
+    ...mapLibSate({
132
+      detail: s => s.detail,
133
+      types: s => s.type.list,
134
+    }),
135
+  },
136
+  watch: {
137
+    detail: {
138
+      handler (nv, ov) {
139
+        if (nv.BookId === this.formData.BookId) {
140
+          return
141
+        }
142
+
143
+        let CaseId = nv.CaseId
144
+        if (!CaseId) {
145
+          CaseId = this.defaultCase
146
+        }
147
+
148
+        this.formData = { ...nv, CaseId }
149
+        // this.mergeDetail(nv)
150
+      },
151
+      immediate: true,
152
+    },
153
+    formData: {
154
+      handler (nv) {
155
+        this.mergeDetail(nv)
156
+      },
157
+      deep: true,
158
+    },
159
+  },
160
+  methods: {
161
+    ...mapMutations({
162
+      mergeDetail: 'mergeBookDetail'
163
+    }),
164
+    ...mapActions({
165
+      getInfo: 'getBookDetail',
166
+      getTypeList: 'getTypeList',
167
+      updateDetail: 'updateBookDetail'
168
+    }),
169
+
170
+    nextStep() {
171
+      if (!this.formData.BookBarcode) {
172
+        this.$message({
173
+          showClose: true,
174
+          message: '请录入条形码',
175
+          type: 'error'
176
+        })
177
+        return
178
+      }
179
+
180
+      this.$confirm('条形码一旦输入将不能改变!', '请确认条形码正确', {
181
+        confirmButtonText: '已确认',
182
+        cancelButtonText: '取消',
183
+        type: 'warning'
184
+      })
185
+        .then(() => {
186
+          this.active = 1
187
+        })
188
+        .catch(x => x)
189
+    },
190
+
191
+    uploadSuccess(res) {
192
+      this.formData.BookImg = res.result.url
193
+    },
194
+
195
+    filterTypes(val) {
196
+      const CaseId = val
197
+      this.getTypeList({ page: 0, CaseId, pagesize: 10000 })
198
+    },
199
+
200
+    submit() {
201
+      this.$refs.ruleForm.validate(valid => {
202
+        if (valid) {
203
+          this.updateDetail()
204
+            .then(() => {
205
+              this.$message({
206
+                showClose: true,
207
+                message: '更新或编辑成功',
208
+                type: 'success'
209
+              })
210
+            })
211
+            .catch(err => {
212
+              this.$message({
213
+                showClose: true,
214
+                message: err,
215
+                type: 'error'
216
+              })
217
+            })
218
+        } else {
219
+          this.$message({
220
+            showClose: true,
221
+            message: '表单填写错误',
222
+            type: 'error'
223
+          })
224
+          return false
225
+        }
226
+      })
227
+    }
228
+  }
229
+}
230
+</script>
231
+
232
+<style lang="scss">
233
+.edit-book  {
234
+  .el-input__inner {
235
+    text-align: left;
236
+  }
237
+}
238
+</style>

+ 19
- 0
src/pages/system/library/books/index.vue Dosyayı Görüntüle

@@ -0,0 +1,19 @@
1
+<template>
2
+  <div class="mainPage">
3
+    <router-view></router-view>
4
+  </div>
5
+</template>
6
+
7
+<script>
8
+export default {
9
+  name: '',
10
+  data () {
11
+    return {}
12
+  },
13
+  components: {}
14
+}
15
+</script>
16
+
17
+<!-- Add "scoped" attribute to limit CSS to this component only -->
18
+<style lang="scss" scoped>
19
+</style>

+ 278
- 0
src/pages/system/library/books/list.vue Dosyayı Görüntüle

@@ -0,0 +1,278 @@
1
+<template>
2
+  <div class="subPage" :style="{ padding: '20px' }">
3
+    <div>
4
+      <el-form inline>
5
+        <el-form-item label="案场">
6
+          <el-select v-model="caseId" size="medium" placeholder="请选择案场" @change="filterList">
7
+            <el-option
8
+              v-for="item in cases"
9
+              :key="item.CaseId"
10
+              :label="item.CaseName"
11
+              :value="item.CaseId"
12
+            ></el-option>
13
+          </el-select>
14
+        </el-form-item>
15
+        <el-form-item label="条码">
16
+          <el-input v-model="bookBarcode"></el-input>
17
+        </el-form-item>
18
+        <el-form-item label="书名">
19
+          <el-input v-model="bookName"></el-input>
20
+        </el-form-item>
21
+        <el-form-item :style="{ float: 'right' }">
22
+          <el-button type="primary" size="medium">搜索</el-button>
23
+        </el-form-item>
24
+      </el-form>
25
+    </div>
26
+    <div>
27
+      <el-button plain @click="editBook()" size="medium">图书录入</el-button>
28
+      <el-button plain @click="showBatchInput()" size="medium">批量导入</el-button>
29
+      <el-button type="text" size="medium">点击下载导入模板</el-button>
30
+      <div :style="{ margin: '10px 0' }">
31
+        <el-table :data="list" border style="width: 100%">
32
+          <el-table-column label="图片" width="250">
33
+            <template slot-scope="scope">
34
+              <img width="150" :src="scope.row.BookImg" alt>
35
+            </template>
36
+          </el-table-column>
37
+          <el-table-column prop="BookBarcode" label="条码"></el-table-column>
38
+          <el-table-column prop="BookName" label="书名"></el-table-column>
39
+          <el-table-column label="案场">
40
+            <template slot-scope="scope">
41
+              <span>{{ getCaseName(scope.row.CaseId) }}</span>
42
+            </template>
43
+          </el-table-column>
44
+          <el-table-column label="分类">
45
+            <template slot-scope="scope">
46
+              <span>{{ getTypeName(scope.row.BookTypeId) }}</span>
47
+            </template>
48
+          </el-table-column>
49
+          <el-table-column label="价格">
50
+            <template slot-scope="scope">
51
+              <span>{{ formatPrice(scope.row.Price) }}</span>
52
+            </template>
53
+          </el-table-column>
54
+          <el-table-column prop="BorrowDays" label="借阅(天)"></el-table-column>
55
+          <el-table-column prop="InStock" label="总数量"></el-table-column>
56
+          <el-table-column prop="LeftNum" label="借出"></el-table-column>
57
+          <el-table-column label="预约">
58
+            <template slot-scope="scope">
59
+              <span>{{ getReserveNum(scope.row) }}</span>
60
+            </template>
61
+          </el-table-column>
62
+          <el-table-column label="录入时间">
63
+            <template slot-scope="scope">
64
+              <span>{{ toolClass.dateFormat(scope.row.CreateDate) }}</span>
65
+            </template>
66
+          </el-table-column>
67
+          <el-table-column fixed="right" label="操作" width="150">
68
+            <template slot-scope="scope">
69
+              <div>
70
+                <el-button type="text" @click="changeStock(scope.row)" size="small">盘点</el-button>
71
+                <el-button @click="setRecommend(scope.row)" type="text" size="small">{{ scope.row.IsRecommend === 1 ? '取消推荐' : '设为推荐' }}</el-button>
72
+              </div>
73
+              <div>
74
+                <el-button @click="editBook(scope.row)" type="text" size="small">编辑</el-button>
75
+                <el-button @click="removeBook(scope.row)" type="text" size="small">删除</el-button>
76
+              </div>
77
+            </template>
78
+          </el-table-column>
79
+        </el-table>
80
+        <el-pagination
81
+          layout="prev, pager, next"
82
+          :current-page="page"
83
+          :total="1000"
84
+          @current-change="pageChange"
85
+        ></el-pagination>
86
+      </div>
87
+    </div>
88
+  </div>
89
+</template>
90
+
91
+<script>
92
+import { createNamespacedHelpers, mapState } from 'vuex'
93
+
94
+const { mapState: mapLibSate, mapActions } = createNamespacedHelpers('library')
95
+
96
+export default {
97
+  name: 'bookList',
98
+  data() {
99
+    return {
100
+      caseId: '',
101
+      bookBarcode: '',
102
+      bookName: '',
103
+      inputRef: window.document.createElement('input')
104
+    }
105
+  },
106
+  computed: {
107
+    ...mapState({
108
+      cases: x => x.app.cases.list,
109
+      defaultCase: x => x.app.cases.default,
110
+      orgid: x => x.app.user.OrgId
111
+    }),
112
+    ...mapLibSate({
113
+      list: s => s.list,
114
+      page: s => s.page,
115
+      types: s => s.type.list
116
+    })
117
+  },
118
+  created() {
119
+    this.inputRef.type = 'file'
120
+    // https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types
121
+    this.inputRef.accept = 'application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
122
+    this.inputRef.addEventListener('change', this.importBatch.bind(this))
123
+
124
+    this.filterList()
125
+  },
126
+  methods: {
127
+    ...mapActions({
128
+      getList: 'getBookList',
129
+      getTypeList: 'getTypeList',
130
+      deleteBook: 'deleteBook',
131
+      setBookRecommend: 'setBookRecommend'
132
+    }),
133
+
134
+    // 查询过滤
135
+    filterList({ page = 0 } = {}) {
136
+      const caseId = this.caseId || this.defaultCase
137
+      this.getTypeList({ page: 0, pagesize: 1000, CaseId: caseId })
138
+
139
+      this.getList({
140
+        page,
141
+        CaseId: caseId,
142
+        BookBarcode: this.bookBarcode,
143
+        BookName: this.bookName
144
+      }).catch(err => {
145
+        this.$message({
146
+          showClose: true,
147
+          message: err,
148
+          type: 'error'
149
+        })
150
+      })
151
+    },
152
+
153
+    // 分页过滤
154
+    pageChange(page) {
155
+      this.filterList({ page })
156
+    },
157
+
158
+    // 删除图书
159
+    removeBook({ BookId: id }) {
160
+      this.$confirm('确认删除此数据?', '提示', {
161
+        confirmButtonText: '确定',
162
+        cancelButtonText: '取消',
163
+        type: 'warning'
164
+      })
165
+        .then(() => {
166
+          this.deleteBook({
167
+            BookId: id
168
+          })
169
+            .then(() => {
170
+              this.$message({
171
+                showClose: true,
172
+                message: '删除成功',
173
+                type: 'success'
174
+              })
175
+            })
176
+            .catch(err => {
177
+              this.$message({
178
+                showClose: true,
179
+                message: err,
180
+                type: 'error'
181
+              })
182
+            })
183
+        })
184
+        .catch(x => x)
185
+    },
186
+
187
+    // 跳转到编辑
188
+    editBook({ BookId: id } = {}) {
189
+      this.$router.push({ name: 'libraryEdit', params: { id } })
190
+    },
191
+
192
+    // 设为/取消推荐
193
+    setRecommend(book) {
194
+      const tipMsg = book.IsRecommend === 1 ? '确定取消推荐?' : '确认设置为推荐?'
195
+
196
+      this.$confirm(tipMsg, '提示', {
197
+        confirmButtonText: '是',
198
+        cancelButtonText: '否',
199
+        type: 'warning'
200
+      })
201
+        .then(() => {
202
+          this.setBookRecommend(book)
203
+            .then(() => {
204
+              this.$message({
205
+                showClose: true,
206
+                message: '设置成功',
207
+                type: 'success'
208
+              })
209
+            })
210
+            .catch(err => {
211
+              this.$message({
212
+                showClose: true,
213
+                message: err,
214
+                type: 'error'
215
+              })
216
+            })
217
+        })
218
+        .catch(x => x)
219
+    },
220
+
221
+    // 批量导入
222
+    showBatchInput() {
223
+      if (!this.caseId) {
224
+        this.$message({
225
+          showClose: true,
226
+          message: '请选择案场',
227
+          type: 'error'
228
+        })
229
+
230
+        return
231
+      }
232
+
233
+      this.$confirm('批量导入将可能有较长的耗时, 是否继续?', '提示', {
234
+        confirmButtonText: '确定',
235
+        cancelButtonText: '取消',
236
+        type: 'warning'
237
+      })
238
+        .then(() => this.inputRef.click())
239
+        .catch(x => x)
240
+    },
241
+    importBatch(e) {
242
+      // 需要指定案场
243
+      const caseName = this.getCaseName(this.caseId)
244
+
245
+      this.$confirm(`数据将被导入至【${caseName}】案场, 是否继续?`, '提示', {
246
+        confirmButtonText: '确定',
247
+        cancelButtonText: '取消',
248
+        type: 'warning'
249
+      })
250
+        .then(() => {
251
+          // TODO
252
+          // const file = e.target.files[0];
253
+        })
254
+        .catch(x => x)
255
+    },
256
+
257
+    getCaseName(id) {
258
+      return (this.cases.filter(x => x.CaseId === id)[0] || {}).CaseName
259
+    },
260
+
261
+    getTypeName(id) {
262
+      return (this.types.filter(x => x.BookTypeId === id)[0] || {}).BookTypeName
263
+    },
264
+
265
+    formatPrice(price) {
266
+      return window.Number(price).toFixed(2)
267
+    },
268
+
269
+    getReserveNum({ InStock, LeftNum, BorrowNum } = {}) {
270
+      return InStock - LeftNum - BorrowNum
271
+    },
272
+
273
+    changeStock({ BookId: id }) {
274
+      this.$router.push({ name: 'stockChange', params: { id } })
275
+    },
276
+  }
277
+}
278
+</script>

+ 137
- 0
src/pages/system/library/books/stockchange.vue Dosyayı Görüntüle

@@ -0,0 +1,137 @@
1
+<template>
2
+  <div class="subPage" :style="{ padding: '20px' }">
3
+    <div>
4
+      <el-form label-width="100px" >
5
+        <el-form-item label="名称" prop="BookName">
6
+          <el-input v-model="book.BookName" :style="{ width: '200px' }" :disabled="true"></el-input>
7
+        </el-form-item>
8
+        <el-form-item label="总库存" prop="InStockTotal">
9
+          <el-input v-model="book.InStockTotal" :style="{ width: '200px' }" :disabled="true"></el-input>
10
+        </el-form-item>
11
+        <el-form-item label="剩余库存" prop="InStockAfter">
12
+          <el-input-number v-model="formData.InStockAfter" :min="0" :style="{ width: '200px' }" ></el-input-number>
13
+        </el-form-item>
14
+        <el-form-item label="盘点备注" prop="ChangeReason">
15
+          <el-input type="textarea" rows="4" v-model="formData.ChangeReason" :style="{ width: '500px' }" ></el-input>
16
+        </el-form-item>
17
+      </el-form>
18
+    </div>
19
+    <div>
20
+      <div :style="{ margin: '10px 0' }">
21
+        <el-table :data="list" border style="width: 100%">
22
+          <el-table-column prop="InStockTotal" label="总库存"></el-table-column>
23
+          <el-table-column prop="InStockBefore" label="盘点前剩余库存"></el-table-column>
24
+          <el-table-column prop="InStockAfter" label="盘点后剩余库存"></el-table-column>
25
+          <el-table-column label="盘点时间">
26
+            <template slot-scope="scope">
27
+              <span>{{ toolClass.dateFormat(scope.row.ChangeDate) }}</span>
28
+            </template>
29
+          </el-table-column>
30
+          <el-table-column prop="ChangeReason" label="盘点备注"></el-table-column>
31
+          <el-table-column prop="ChangeUserName" label="操作人"></el-table-column>
32
+        </el-table>
33
+        <el-pagination
34
+          layout="prev, pager, next"
35
+          :current-page="page"
36
+          :total="1000"
37
+          @current-change="pageChange">
38
+        </el-pagination>
39
+      </div>
40
+      <div>
41
+          <el-button type="primary" @click="submit()">保存</el-button>
42
+          <el-button @click="$router.back()">取消</el-button>
43
+      </div>
44
+    </div>
45
+  </div>
46
+</template>
47
+
48
+<script>
49
+import { createNamespacedHelpers, mapState } from 'vuex'
50
+
51
+const {
52
+  mapState: mapLibSate,
53
+  mapActions
54
+} = createNamespacedHelpers('library')
55
+
56
+export default {
57
+  name: 'stockChange',
58
+  data() {
59
+    return {
60
+      bookId: '',
61
+      formData: {},
62
+    }
63
+  },
64
+  computed: {
65
+    ...mapState({
66
+      cases: x => x.app.cases.list,
67
+      defaultCase: x => x.app.cases.default,
68
+      orgid: x => x.app.user.OrgId,
69
+    }),
70
+    ...mapLibSate({
71
+      book: s => s.detail,
72
+      list: s => s.stock.list,
73
+      page: s => s.stock.page,
74
+    })
75
+  },
76
+  created() {
77
+    this.bookId = this.$route.params.id
78
+    this.filterList()
79
+    this.getBook({ BookId: this.bookId }).then(() => {
80
+      this.formData = {
81
+        BookId: this.book.BookId,
82
+        InStockAfter: this.book.LeftNum,
83
+        CaseId: this.book.CaseId,
84
+        OrgId: this.book.OrgId,
85
+        ChangeReason: '',
86
+        InStockTotal: this.book.InStock,
87
+      }
88
+    }).catch((err) => {
89
+      this.$message({
90
+        showClose: true,
91
+        message: err,
92
+        type: 'error'
93
+      })
94
+    })
95
+  },
96
+  methods: {
97
+    ...mapActions({
98
+      getList: 'getStockList',
99
+      getBook: 'getBookDetail',
100
+      setChange: 'setStockChange',
101
+    }),
102
+
103
+    filterList({ page = 0 } = {}) {
104
+      this.getList({
105
+        page,
106
+        BookId: this.bookId
107
+      }).catch(err => {
108
+        this.$message({
109
+          showClose: true,
110
+          message: err,
111
+          type: 'error'
112
+        })
113
+      })
114
+    },
115
+
116
+    submit() {
117
+      this.setChange(this.formData).then(() => {
118
+        this.$message({
119
+          showClose: true,
120
+          message: '库存盘点成功',
121
+          type: 'success'
122
+        })
123
+      }).catch(err => {
124
+        this.$message({
125
+          showClose: true,
126
+          message: err,
127
+          type: 'error'
128
+        })
129
+      })
130
+    },
131
+
132
+    pageChange(page) {
133
+      this.filterList({ page })
134
+    },
135
+  }
136
+}
137
+</script>

+ 177
- 0
src/pages/system/library/books/types/detail.vue Dosyayı Görüntüle

@@ -0,0 +1,177 @@
1
+<template>
2
+  <div class="subPage" :style="{ padding: '20px' }">
3
+    <el-form :model="formData" :rules="rules" ref="ruleForm" label-width="100px" :style="{ width: '600px' }">
4
+      <el-form-item label="案场" prop="CaseId">
5
+        <el-select v-model="formData.CaseId" placeholder="请选择案场">
6
+          <el-option
7
+            v-for="item in cases"
8
+            :key="item.CaseId"
9
+            :label="item.CaseName"
10
+            :value="item.CaseId"
11
+          ></el-option>
12
+        </el-select>
13
+      </el-form-item>
14
+      <el-form-item label="图片" prop="BookTypeImg">
15
+        <el-upload
16
+          class="avatar-uploader"
17
+          action=""
18
+          :show-file-list="false"
19
+          :on-success="uploadSuccess"
20
+          :before-upload="toolClass.beforeUpload"
21
+          :http-request="toolClass.upload"
22
+        >
23
+          <img v-if="formData.BookTypeImg" :src="formData.BookTypeImg + '?x-oss-process=style/compress-rotate'" class="avatar">
24
+          <i v-else class="el-icon-plus avatar-uploader-icon"></i>
25
+        </el-upload>
26
+      </el-form-item>
27
+      <el-form-item label="名称" prop="BookTypeName">
28
+        <el-input v-model="formData.BookTypeName" :style="{ width: '200px' }"></el-input>
29
+      </el-form-item>
30
+      <el-form-item :style="{ paddingTop: '40px' }">
31
+        <el-button type="primary" @click="submit()">立即创建</el-button>
32
+        <el-button @click="$router.back()">取消</el-button>
33
+      </el-form-item>
34
+    </el-form>
35
+  </div>
36
+</template>
37
+
38
+<script>
39
+import { createNamespacedHelpers, mapState } from 'vuex'
40
+
41
+const {
42
+  mapState: mapLibSate,
43
+  mapActions,
44
+  mapMutations
45
+} = createNamespacedHelpers('library')
46
+
47
+export default {
48
+  name: 'bookType',
49
+  data() {
50
+    return {
51
+      rules: {
52
+        BookTypeName: [
53
+          { required: true, message: '请输入分类名称', trigger: 'blur' },
54
+          { min: 1, max: 5, message: '长度在 1 到 5 个字符', trigger: 'blur' }
55
+        ],
56
+        BookTypeImg: [{ required: true, message: '请上传图片', trigger: 'change' }],
57
+        CaseId: [{ required: true, message: '请选择一个案场', trigger: 'change' }]
58
+      },
59
+      formData: {},
60
+    }
61
+  },
62
+  created() {
63
+    const id = this.$route.params.id
64
+    if (id) {
65
+      this.getInfo({
66
+        BookTypeId: id
67
+      }).catch(err => {
68
+        this.$message({
69
+          showClose: true,
70
+          message: err,
71
+          type: 'error'
72
+        })
73
+      })
74
+    }
75
+  },
76
+  computed: {
77
+    ...mapState({
78
+      cases: x => x.app.cases.list,
79
+      defaultCase: x => x.app.cases.default,
80
+      orgid: x => x.app.user.OrgId
81
+    }),
82
+    ...mapLibSate({
83
+      detail: s => s.type.detail,
84
+    }),
85
+    // formData: {
86
+    //   get: function() {
87
+    //     if (this.detail && this.detail.BookTypeId) {
88
+    //       return this.detail
89
+    //     }
90
+
91
+    //     return {
92
+    //       BookTypeId: '',
93
+    //       BookTypeName: '',
94
+    //       BookTypeImg: '',
95
+    //       CaseId: this.defaultCase,
96
+    //       OrgId: this.orgid,
97
+    //       Status: 1,
98
+    //       CreateDate: new Date()
99
+    //     }
100
+    //   },
101
+    //   set: function(val) {
102
+    //     console.log(val)
103
+    //     this.mergeDetail(val)
104
+    //   }
105
+    // }
106
+  },
107
+  watch: {
108
+    detail: {
109
+      handler (nv, ov) {
110
+        if (nv.BookTypeId === this.formData.BookTypeId) {
111
+          return
112
+        }
113
+
114
+        let CaseId = nv.CaseId
115
+        if (!CaseId) {
116
+          CaseId = this.defaultCase
117
+        }
118
+
119
+        this.formData = { ...nv, CaseId }
120
+        // this.mergeDetail(nv)
121
+      },
122
+      immediate: true,
123
+    },
124
+    formData: {
125
+      handler (nv) {
126
+        this.mergeDetail(nv)
127
+      },
128
+      deep: true,
129
+    },
130
+  },
131
+  methods: {
132
+    ...mapMutations({
133
+      mergeDetail: 'mergeTypeDetail'
134
+    }),
135
+    ...mapActions({
136
+      getInfo: 'getTypeDetail',
137
+      updateDetail: 'updateTypeDetail'
138
+    }),
139
+
140
+    uploadSuccess(res) {
141
+      this.formData.BookTypeImg = res.result.url
142
+    },
143
+
144
+    submit() {
145
+      this.$refs.ruleForm.validate(valid => {
146
+        if (valid) {
147
+          this.updateDetail()
148
+            .then(() => {
149
+              this.$message({
150
+                showClose: true,
151
+                message: '更新或编辑分类成功',
152
+                type: 'success'
153
+              })
154
+            })
155
+            .catch(err => {
156
+              this.$message({
157
+                showClose: true,
158
+                message: err,
159
+                type: 'error'
160
+              })
161
+            })
162
+        } else {
163
+          this.$message({
164
+            showClose: true,
165
+            message: '表单填写错误',
166
+            type: 'error'
167
+          })
168
+          return false
169
+        }
170
+      })
171
+    }
172
+  }
173
+}
174
+</script>
175
+
176
+<style lang="scss" scoped>
177
+</style>

+ 139
- 0
src/pages/system/library/books/types/list.vue Dosyayı Görüntüle

@@ -0,0 +1,139 @@
1
+<template>
2
+  <div class="subPage" :style="{ padding: '20px' }">
3
+    <div>
4
+      <el-form inline>
5
+        <el-form-item label="案场">
6
+          <el-select v-model="caseId" size="medium" placeholder="请选择案场" @change="filterList">
7
+            <el-option
8
+              v-for="item in cases"
9
+              :key="item.CaseId"
10
+              :label="item.CaseName"
11
+              :value="item.CaseId"
12
+            ></el-option>
13
+          </el-select>
14
+        </el-form-item>
15
+        <el-form-item :style="{ float: 'right' }">
16
+          <el-button type="primary" size="medium">搜索</el-button>
17
+        </el-form-item>
18
+      </el-form>
19
+    </div>
20
+    <div>
21
+      <el-button plain @click="editType()" size="medium">新增分类</el-button>
22
+      <div :style="{ margin: '10px 0' }">
23
+        <el-table :data="list" border style="width: 100%">
24
+          <el-table-column label="图片" width="250">
25
+            <template slot-scope="scope">
26
+              <img width="150" :src="scope.row.BookTypeImg" alt>
27
+            </template>
28
+          </el-table-column>
29
+          <el-table-column prop="BookTypeName" label="名称"></el-table-column>
30
+          <el-table-column label="案场" width="200">
31
+            <template slot-scope="scope">
32
+              <span>{{ getCaseName(scope.row.CaseId) }}</span>
33
+            </template>
34
+          </el-table-column>
35
+          <el-table-column prop="Nums" label="图书数量"></el-table-column>
36
+          <el-table-column fixed="right" label="操作" width="150">
37
+            <template slot-scope="scope">
38
+              <el-button @click="editType(scope.row)" type="text" size="small">编辑</el-button>
39
+              <el-button @click="removeType(scope.row)" type="text" size="small">删除</el-button>
40
+            </template>
41
+          </el-table-column>
42
+        </el-table>
43
+        <el-pagination
44
+          layout="prev, pager, next"
45
+          :current-page="page"
46
+          :total="1000"
47
+          @current-change="pageChange">
48
+        </el-pagination>
49
+      </div>
50
+    </div>
51
+  </div>
52
+</template>
53
+
54
+<script>
55
+import { createNamespacedHelpers, mapState } from 'vuex'
56
+
57
+const {
58
+  mapState: mapLibSate,
59
+  mapActions
60
+} = createNamespacedHelpers('library')
61
+
62
+export default {
63
+  name: 'bookTypeList',
64
+  data() {
65
+    return {
66
+      caseId: ''
67
+    }
68
+  },
69
+  computed: {
70
+    ...mapState({
71
+      cases: x => x.app.cases.list,
72
+      defaultCase: x => x.app.cases.default,
73
+      orgid: x => x.app.user.OrgId,
74
+    }),
75
+    ...mapLibSate({
76
+      list: s => s.type.list,
77
+      page: s => s.type.page,
78
+    })
79
+  },
80
+  created() {
81
+    this.filterList()
82
+  },
83
+  methods: {
84
+    ...mapActions({
85
+      getList: 'getTypeList',
86
+      deleteType: 'deleteType'
87
+    }),
88
+
89
+    filterList({ page = 0 } = {}) {
90
+      this.getList({
91
+        page,
92
+        CaseId: this.caseId || this.defaultCase
93
+      }).catch(err => {
94
+        this.$message({
95
+          showClose: true,
96
+          message: err,
97
+          type: 'error'
98
+        })
99
+      })
100
+    },
101
+
102
+    pageChange(page) {
103
+      this.filterList({ page })
104
+    },
105
+
106
+    removeType({ BookTypeId: id }) {
107
+      this.$confirm('确认删除此数据?', '提示', {
108
+        confirmButtonText: '确定',
109
+        cancelButtonText: '取消',
110
+        type: 'warning'
111
+      }).then(() => {
112
+        this.deleteType({
113
+          BookTypeId: id
114
+        }).then(() => {
115
+          this.$message({
116
+            showClose: true,
117
+            message: '删除成功',
118
+            type: 'success'
119
+          })
120
+        }).catch((err) => {
121
+          this.$message({
122
+            showClose: true,
123
+            message: err,
124
+            type: 'error'
125
+          })
126
+        })
127
+      }).catch(x => x)
128
+    },
129
+
130
+    editType({ BookTypeId: id } = {}) {
131
+      this.$router.push({ name: 'libraryTypeEdit', params: { id } })
132
+    },
133
+
134
+    getCaseName(id) {
135
+      return (this.cases.filter(x => x.CaseId === id)[0] || {}).CaseName
136
+    }
137
+  }
138
+}
139
+</script>

+ 178
- 0
src/pages/system/library/borrow/bookreturn.vue Dosyayı Görüntüle

@@ -0,0 +1,178 @@
1
+<template>
2
+  <div class="subPage edit-book" :style="{ padding: '20px' }">
3
+    <div v-if="active">
4
+      <el-form>
5
+        <el-form-item>
6
+          <el-input v-model="customerInfo" placeholder="会员手机号或条形码" :style="{ width: '200px' }"></el-input>
7
+        </el-form-item>
8
+        <el-form-item :style="{ paddingTop: '20px' }">
9
+          <el-button type="primary" @click="nextStep()">下一步</el-button>
10
+        </el-form-item>
11
+      </el-form>
12
+    </div>
13
+    <div v-else>
14
+
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>
33
+
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
+      <!-- 可借阅列表 -->
48
+      <el-table :data="list" border style="width: 100%">
49
+        <el-table-column prop="BookBarcode" label="条形码"></el-table-column>
50
+        <el-table-column prop="BookName" label="书名"></el-table-column>
51
+        <el-table-column prop="BookTypeName" label="分类"></el-table-column>
52
+        <el-table-column prop="ReturnDate" label="规定归还日期"></el-table-column>
53
+        <el-table-column prop="LeftNum" label="逾期天数"></el-table-column>
54
+      </el-table>
55
+
56
+      <div :style="{ paddingTop: '40px' }">
57
+        <el-button type="primary" @click="submit()">立即借阅</el-button>
58
+        <el-button @click="$router.back()">取消</el-button>
59
+      </div>
60
+    </div>
61
+  </div>
62
+</template>
63
+
64
+<script>
65
+import { createNamespacedHelpers, mapState } from 'vuex'
66
+
67
+const {
68
+  mapState: mapLibSate,
69
+  mapActions,
70
+} = createNamespacedHelpers('library')
71
+
72
+export default {
73
+  name: 'bookReturn',
74
+  data() {
75
+    return {
76
+      active: 0,
77
+      customerInfo: '',
78
+      borrowHistory: {},
79
+      formData: {},
80
+      selectList: [],
81
+    }
82
+  },
83
+  created() {
84
+    const id = this.$route.params.id
85
+    if (id) {
86
+      this.active = 1
87
+
88
+      this.getInfo({
89
+        BookId: id
90
+      }).catch(err => {
91
+        this.$message({
92
+          showClose: true,
93
+          message: err,
94
+          type: 'error'
95
+        })
96
+      })
97
+    } else {
98
+      this.active = 0
99
+    }
100
+  },
101
+  computed: {
102
+    ...mapState({
103
+      cases: x => x.app.cases.list,
104
+      defaultCase: x => x.app.cases.default,
105
+      orgid: x => x.app.user.OrgId
106
+    }),
107
+    ...mapLibSate({
108
+      list: s => s.borrow.list,
109
+      borrowHistory: s => s.borrow.history,
110
+    }),
111
+  },
112
+  methods: {
113
+    ...mapActions({
114
+      getBorrowHistory: 'getBorrowHistory',
115
+      getList: 'getBorrowList',
116
+      borrowBooks: 'borrowBooks'
117
+    }),
118
+
119
+    nextStep() {
120
+      if (!this.customerInfo) {
121
+        this.$message({
122
+          showClose: true,
123
+          message: '请录入会员手机号或条形码',
124
+          type: 'error'
125
+        })
126
+        return
127
+      }
128
+
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'
136
+        })
137
+      })
138
+    },
139
+
140
+    search() {
141
+      this.getBorrowList(this.formData).catch(err => {
142
+        this.$message({
143
+          showClose: true,
144
+          message: err,
145
+          type: 'error'
146
+        })
147
+      })
148
+    },
149
+
150
+    submit() {
151
+      this.$confirm('确定借阅此书?', '提示', {
152
+        confirmButtonText: '确定',
153
+        cancelButtonText: '取消',
154
+        type: 'warning'
155
+      })
156
+        .then(() => {
157
+          this.borrowBooks(this.selectList).then(() => {
158
+            this.$message({
159
+              showClose: true,
160
+              message: '借阅成功',
161
+              type: 'success'
162
+            })
163
+          }).catch(err => {
164
+            this.$message({
165
+              showClose: true,
166
+              message: err,
167
+              type: 'error'
168
+            })
169
+          })
170
+        })
171
+        .catch(x => x)
172
+    },
173
+  }
174
+}
175
+</script>
176
+
177
+<style lang="scss">
178
+</style>

+ 182
- 0
src/pages/system/library/borrow/borrow.vue Dosyayı Görüntüle

@@ -0,0 +1,182 @@
1
+<template>
2
+  <div class="subPage edit-book" :style="{ padding: '20px' }">
3
+    <div v-if="active">
4
+      <el-form>
5
+        <el-form-item>
6
+          <el-input v-model="customerInfo" placeholder="会员手机号或条形码" :style="{ width: '200px' }"></el-input>
7
+        </el-form-item>
8
+        <el-form-item :style="{ paddingTop: '20px' }">
9
+          <el-button type="primary" @click="nextStep()">下一步</el-button>
10
+        </el-form-item>
11
+      </el-form>
12
+    </div>
13
+    <div v-else>
14
+
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>
33
+
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
+      <!-- 可借阅列表 -->
48
+      <el-table :data="list" border style="width: 100%" @selection-change="x => selectList = x">
49
+        <el-table-column
50
+          type="selection"
51
+          width="55">
52
+        </el-table-column>
53
+        <el-table-column prop="BookBarcode" label="条形码"></el-table-column>
54
+        <el-table-column prop="BookName" label="书名"></el-table-column>
55
+        <el-table-column prop="BookTypeName" label="分类"></el-table-column>
56
+        <el-table-column prop="LeftNum" label="可借数量"></el-table-column>
57
+        <el-table-column prop="BorrowDays" label="规定借阅天数"></el-table-column>
58
+      </el-table>
59
+
60
+      <div :style="{ paddingTop: '40px' }">
61
+        <el-button type="primary" @click="submit()">立即借阅</el-button>
62
+        <el-button @click="$router.back()">取消</el-button>
63
+      </div>
64
+    </div>
65
+  </div>
66
+</template>
67
+
68
+<script>
69
+import { createNamespacedHelpers, mapState } from 'vuex'
70
+
71
+const {
72
+  mapState: mapLibSate,
73
+  mapActions,
74
+} = createNamespacedHelpers('library')
75
+
76
+export default {
77
+  name: 'bookBorrow',
78
+  data() {
79
+    return {
80
+      active: 0,
81
+      customerInfo: '',
82
+      borrowHistory: {},
83
+      formData: {},
84
+      selectList: [],
85
+    }
86
+  },
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
+  computed: {
106
+    ...mapState({
107
+      cases: x => x.app.cases.list,
108
+      defaultCase: x => x.app.cases.default,
109
+      orgid: x => x.app.user.OrgId
110
+    }),
111
+    ...mapLibSate({
112
+      list: s => s.borrow.list,
113
+      borrowHistory: s => s.borrow.history,
114
+    }),
115
+  },
116
+  methods: {
117
+    ...mapActions({
118
+      getBorrowHistory: 'getBorrowHistory',
119
+      getList: 'getBorrowList',
120
+      borrowBooks: 'borrowBooks'
121
+    }),
122
+
123
+    nextStep() {
124
+      if (!this.customerInfo) {
125
+        this.$message({
126
+          showClose: true,
127
+          message: '请录入会员手机号或条形码',
128
+          type: 'error'
129
+        })
130
+        return
131
+      }
132
+
133
+      this.getBorrowHistory({ customerInfo: this.customerInfo }).then(() => {
134
+        this.active = 1
135
+      }).catch(err => {
136
+        this.$message({
137
+          showClose: true,
138
+          message: err,
139
+          type: 'error'
140
+        })
141
+      })
142
+    },
143
+
144
+    search() {
145
+      this.getBorrowList(this.formData).catch(err => {
146
+        this.$message({
147
+          showClose: true,
148
+          message: err,
149
+          type: 'error'
150
+        })
151
+      })
152
+    },
153
+
154
+    submit() {
155
+      this.$confirm('确定借阅此书?', '提示', {
156
+        confirmButtonText: '确定',
157
+        cancelButtonText: '取消',
158
+        type: 'warning'
159
+      })
160
+        .then(() => {
161
+          this.borrowBooks(this.selectList).then(() => {
162
+            this.$message({
163
+              showClose: true,
164
+              message: '借阅成功',
165
+              type: 'success'
166
+            })
167
+          }).catch(err => {
168
+            this.$message({
169
+              showClose: true,
170
+              message: err,
171
+              type: 'error'
172
+            })
173
+          })
174
+        })
175
+        .catch(x => x)
176
+    },
177
+  }
178
+}
179
+</script>
180
+
181
+<style lang="scss">
182
+</style>

+ 19
- 0
src/pages/system/library/borrow/index.vue Dosyayı Görüntüle

@@ -0,0 +1,19 @@
1
+<template>
2
+  <div class="mainPage">
3
+    <router-view></router-view>
4
+  </div>
5
+</template>
6
+
7
+<script>
8
+export default {
9
+  name: '',
10
+  data () {
11
+    return {}
12
+  },
13
+  components: {}
14
+}
15
+</script>
16
+
17
+<!-- Add "scoped" attribute to limit CSS to this component only -->
18
+<style lang="scss" scoped>
19
+</style>

+ 19
- 0
src/pages/system/library/index.vue Dosyayı Görüntüle

@@ -0,0 +1,19 @@
1
+<template>
2
+  <div class="mainPage">
3
+    <router-view></router-view>
4
+  </div>
5
+</template>
6
+
7
+<script>
8
+export default {
9
+  name: '',
10
+  data () {
11
+    return {}
12
+  },
13
+  components: {}
14
+}
15
+</script>
16
+
17
+<!-- Add "scoped" attribute to limit CSS to this component only -->
18
+<style lang="scss" scoped>
19
+</style>

+ 50
- 0
src/pages/system/page.js Dosyayı Görüntüle

@@ -135,6 +135,16 @@ import luckyDrawManager from './luckyDrawManager/index' // 抽奖管理
135 135
 import luckyDrawList from './luckyDrawManager/luckyDrawList/index' // 抽奖记录列表
136 136
 import luckyDrawShareList from './luckyDrawManager/luckyDrawShareList/index' // 抽奖分享记录列表
137 137
 
138
+import LibraryManager from './library/books' // 图书管理
139
+import LibraryTypeList from './library/books/types/list' // 图书分类
140
+import LibraryTypeEdit from './library/books/types/detail' // 分类编辑
141
+import LibraryList from './library/books/list' // 图书列表
142
+import LibraryEdit from './library/books/detail' // 图书编辑
143
+import StockChange from './library/books/stockchange' // 图书编辑
144
+
145
+import BorrowManager from './library/borrow' // 借阅管理
146
+import BorrowBooks from './library/borrow/borrow' // 借阅管理
147
+
138 148
 export default {
139 149
   router: [
140 150
     {
@@ -726,6 +736,46 @@ export default {
726 736
           component: luckyDrawShareList,
727 737
           children: []
728 738
         }],
739
+      }, { // 图书管理
740
+        path: 'library',
741
+        name: 'library',
742
+        component: LibraryManager,
743
+        children: [{ // 分类
744
+          path: 'type-manager',
745
+          name: 'libraryType',
746
+          component: LibraryTypeList,
747
+          children: []
748
+        }, { // 分类管理
749
+          path: 'type/:id?',
750
+          name: 'libraryTypeEdit',
751
+          component: LibraryTypeEdit,
752
+          children: []
753
+        }, { // 图书列表
754
+          path: 'book-manage',
755
+          name: 'libraryList',
756
+          component: LibraryList,
757
+          children: []
758
+        },{ // 图书编辑
759
+          path: 'book/:id?',
760
+          name: 'libraryEdit',
761
+          component: LibraryEdit,
762
+          children: []
763
+        },{ // 库存盘点
764
+          path: 'stock/:id',
765
+          name: 'stockChange',
766
+          component: StockChange,
767
+          children: []
768
+        }],
769
+      },{ // 借阅管理
770
+        path: 'borrow',
771
+        name: 'borrow',
772
+        component: BorrowManager,
773
+        children: [{ // 图书借阅
774
+          path: 'books',
775
+          name: 'borrowBooks',
776
+          component: BorrowBooks,
777
+          children: []
778
+        }]
729 779
       }]
730 780
     },
731 781
   ],

+ 1
- 0
src/store/index.js Dosyayı Görüntüle

@@ -41,6 +41,7 @@ export const modules = {
41 41
   activityLuckDraw: () => require('./activityManager/luckDraw').default,
42 42
   activityFlashbuy: () => require('./activityManager/flashbuy').default,
43 43
   calendar: () => require('./activityManager/calendar').default,
44
+  library: () => require('./library').default,
44 45
 }
45 46
 
46 47
 Object.keys(modules).forEach((modKey) => {

+ 149
- 0
src/store/library/index.js Dosyayı Görüntüle

@@ -0,0 +1,149 @@
1
+// import ajax from '../../util/ajax'
2
+// import api from '../../util/api'
3
+
4
+export default {
5
+  namespaced: true,
6
+
7
+  state: {
8
+    page: 0,
9
+    list: [
10
+      {
11
+        BookId: '1',
12
+        BookTypeId: '1',
13
+        BookName: '遮天',
14
+        BookBarcode: '123456',
15
+        BookImg: 'http://jingcheng-resourceplat.oss-cn-shanghai.aliyuncs.com/upload/135230460466.png',
16
+        Author: '辰东',
17
+        Publisher: '南京出版社',
18
+        Price: 90.00,
19
+        InStock: 10,
20
+        LeftNum: 2,
21
+        BorrowNum: 5,
22
+        BorrowDays: 7,
23
+        BookDescription: '《遮天》是一部古典仙侠类型的网络小说',
24
+        CaseId: '1',
25
+        OrgId: '1',
26
+        CreateDate: new Date(),
27
+        IsRecommend: 1,
28
+        Status: 1,
29
+      },
30
+    ],
31
+    detail: {},
32
+    type: {
33
+      page: 0,
34
+      list: [
35
+        {
36
+          BookTypeId: '1',
37
+          BookTypeName: '测试',
38
+          BookTypeImg: 'http://jingcheng-resourceplat.oss-cn-shanghai.aliyuncs.com/upload/135230460466.png',
39
+          CaseId: '1',
40
+          OrgId: '1',
41
+          Nums: 100,
42
+          Status: 1,
43
+          CreateDate: new Date()
44
+        }
45
+      ],
46
+      detail: {
47
+        BookTypeId: '',
48
+        BookTypeName: '',
49
+        BookTypeImg: '',
50
+        CaseId: '',
51
+        OrgId: '1',
52
+        Status: 1,
53
+        CreateDate: new Date()},
54
+    },
55
+    stock: {
56
+      list: [
57
+        {
58
+          RecordId: '1',
59
+          BookId: '1',
60
+          InStockTotal: 20,
61
+          InStockBefore: 8,
62
+          InStockAfter: 10,
63
+          ChangeReason: '补库存',
64
+          ChangeDate: new Date(),
65
+          ChangeUser: '1',
66
+          ChangeUserName: 'admin',
67
+          CaseId: '1',
68
+          OrgId: '1',
69
+        }
70
+      ],
71
+      detail: {},
72
+    },
73
+    borrow: {
74
+      list: [],
75
+      history: {},
76
+    },
77
+    bookReturn: {
78
+      list: [],
79
+    },
80
+  },
81
+  mutations: {
82
+    mergeTypeDetail(state, payload) {
83
+      state.type.detail = payload || {}
84
+
85
+      if (payload && payload.BookTypeId) {
86
+        state.type.list = (state.type.list || []).map(x => x.BookTypeId === payload.BookTypeId ? payload : x)
87
+      }
88
+    },
89
+    mergeBookDetail(state, payload) {
90
+      state.detail = payload || {}
91
+
92
+      if (payload && payload.BookId) {
93
+        state.list = (state.list || []).map(x => x.BookId === payload.BookId ? payload : x)
94
+      }
95
+    },
96
+  },
97
+  actions: {
98
+    getTypeList({ commit }, payload) {
99
+      return new Promise((resolve, reject) => {
100
+
101
+      })
102
+    },
103
+    getTypeDetail({ commit }, payload) {
104
+      return new Promise((resolve, reject) => {
105
+
106
+      })
107
+    },
108
+    updateTypeDetail({ commit }, payload) {
109
+      return new Promise((resolve, reject) => {
110
+
111
+      })
112
+    },
113
+    deleteType({ commit }, payload) {
114
+      return new Promise((resolve, reject) => {
115
+
116
+      })
117
+    },
118
+    getBookList({ commit }, payload) {
119
+      return new Promise((resolve, reject) => {
120
+
121
+      })
122
+    },
123
+    getBookDetail({ commit }, payload) {
124
+      return new Promise((resolve, reject) => {
125
+
126
+      })
127
+    },
128
+    updateBookDetail({ commit }, payload) {
129
+      return new Promise((resolve, reject) => {
130
+
131
+      })
132
+    },
133
+    deleteBook({ commit }, payload) {
134
+      return new Promise((resolve, reject) => {
135
+
136
+      })
137
+    },
138
+    setBookRecommend({ commit }, payload) {
139
+      return new Promise((resolve, reject) => {
140
+
141
+      })
142
+    },
143
+    getStockList({ commit }, payload) {
144
+      return new Promise((resolve, reject) => {
145
+
146
+      })
147
+    },
148
+  },
149
+}