zjxpcyc 6 år sedan
förälder
incheckning
7e23a24792
1 ändrade filer med 19 tillägg och 14 borttagningar
  1. 19
    14
      src/pages/system/library/books/list.vue

+ 19
- 14
src/pages/system/library/books/list.vue Visa fil

115
         bookBarcode: '',
115
         bookBarcode: '',
116
         bookName: '',
116
         bookName: '',
117
       },
117
       },
118
-      inputRef: window.document.createElement('input'),
118
+      inputRef: undefined,
119
       showDialog: false,
119
       showDialog: false,
120
     }
120
     }
121
   },
121
   },
141
     },
141
     },
142
   },
142
   },
143
   created() {
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
   beforeRouteLeave (to, from, next) {
146
   beforeRouteLeave (to, from, next) {
152
     this.resetStore('list')
147
     this.resetStore('list')
164
       batchImport: 'batchImport',
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
     filterList({ page = 0 } = {}) {
174
     filterList({ page = 0 } = {}) {
169
       const caseId = this.caseId || this.defaultCase
175
       const caseId = this.caseId || this.defaultCase
277
       this.showDialog = true
283
       this.showDialog = true
278
     },
284
     },
279
     importBatch(e) {
285
     importBatch(e) {
286
+      this.resetInputRef()
280
       this.showDialog = false
287
       this.showDialog = false
281
 
288
 
282
       // 需要指定案场
289
       // 需要指定案场
308
 
315
 
309
           this.batchImport(data).then(() => {
316
           this.batchImport(data).then(() => {
310
             loadding.close()
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
           }).catch((err) => {
324
           }).catch((err) => {
320
             loadding.close()
325
             loadding.close()