|
@@ -115,7 +115,7 @@ export default {
|
115
|
115
|
bookBarcode: '',
|
116
|
116
|
bookName: '',
|
117
|
117
|
},
|
118
|
|
- inputRef: window.document.createElement('input'),
|
|
118
|
+ inputRef: undefined,
|
119
|
119
|
showDialog: false,
|
120
|
120
|
}
|
121
|
121
|
},
|
|
@@ -141,12 +141,7 @@ export default {
|
141
|
141
|
},
|
142
|
142
|
},
|
143
|
143
|
created() {
|
144
|
|
- this.inputRef.type = 'file'
|
145
|
|
- // https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types
|
146
|
|
- this.inputRef.accept = 'application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
147
|
|
- this.inputRef.addEventListener('change', this.importBatch.bind(this))
|
148
|
|
-
|
149
|
|
- // this.filterList()
|
|
144
|
+ this.resetInputRef()
|
150
|
145
|
},
|
151
|
146
|
beforeRouteLeave (to, from, next) {
|
152
|
147
|
this.resetStore('list')
|
|
@@ -164,6 +159,17 @@ export default {
|
164
|
159
|
batchImport: 'batchImport',
|
165
|
160
|
}),
|
166
|
161
|
|
|
162
|
+ resetInputRef() {
|
|
163
|
+ const ipt = window.document.createElement('input')
|
|
164
|
+
|
|
165
|
+ ipt.type = 'file'
|
|
166
|
+ // https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types
|
|
167
|
+ ipt.accept = 'application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
|
168
|
+ ipt.addEventListener('change', this.importBatch.bind(this))
|
|
169
|
+
|
|
170
|
+ this.inputRef = ipt
|
|
171
|
+ },
|
|
172
|
+
|
167
|
173
|
// 查询过滤
|
168
|
174
|
filterList({ page = 0 } = {}) {
|
169
|
175
|
const caseId = this.caseId || this.defaultCase
|
|
@@ -277,6 +283,7 @@ export default {
|
277
|
283
|
this.showDialog = true
|
278
|
284
|
},
|
279
|
285
|
importBatch(e) {
|
|
286
|
+ this.resetInputRef()
|
280
|
287
|
this.showDialog = false
|
281
|
288
|
|
282
|
289
|
// 需要指定案场
|
|
@@ -308,13 +315,11 @@ export default {
|
308
|
315
|
|
309
|
316
|
this.batchImport(data).then(() => {
|
310
|
317
|
loadding.close()
|
311
|
|
-
|
312
|
|
- this.$confirm(`数据导入完成, 点击【确定】刷新页面`, '提示', {
|
313
|
|
- confirmButtonText: '确定',
|
314
|
|
- cancelButtonText: '取消',
|
315
|
|
- type: 'warning'
|
316
|
|
- }).then(() => {
|
317
|
|
- window.location.reload()
|
|
318
|
+ this.filterList()
|
|
319
|
+ this.$message({
|
|
320
|
+ showClose: true,
|
|
321
|
+ message: '数据导入完成',
|
|
322
|
+ type: 'success'
|
318
|
323
|
})
|
319
|
324
|
}).catch((err) => {
|
320
|
325
|
loadding.close()
|