haiwei-ui 1.0.95 → 1.0.96
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -274,9 +274,24 @@
|
|
|
274
274
|
|
|
275
275
|
/**上传成功 */
|
|
276
276
|
onUploadSuccess(response, file, fileList) {
|
|
277
|
-
|
|
277
|
+
// 检查响应格式
|
|
278
|
+
if (response && response.code === 1) {
|
|
278
279
|
this.fileInfo = response.data.basicInfo
|
|
279
|
-
this.parseResult =
|
|
280
|
+
this.parseResult = {
|
|
281
|
+
basicInfo: response.data.basicInfo,
|
|
282
|
+
columns: response.data.headers.map((header, index) => ({
|
|
283
|
+
name: `col${index}`,
|
|
284
|
+
label: header.name,
|
|
285
|
+
width: 120
|
|
286
|
+
})),
|
|
287
|
+
previewData: response.data.data.map(row => {
|
|
288
|
+
const obj = {}
|
|
289
|
+
response.data.headers.forEach((header, colIndex) => {
|
|
290
|
+
obj[`col${colIndex}`] = row[colIndex]
|
|
291
|
+
})
|
|
292
|
+
return obj
|
|
293
|
+
})
|
|
294
|
+
}
|
|
280
295
|
this.initColumnMapping()
|
|
281
296
|
this._success('文件上传成功')
|
|
282
297
|
} else {
|
|
@@ -371,9 +386,24 @@
|
|
|
371
386
|
const path = 'admin/excel/parseexcel'.replace(/^\//, '')
|
|
372
387
|
this.$http.post(baseURL + path, formData, config)
|
|
373
388
|
.then(response => {
|
|
374
|
-
|
|
389
|
+
// 检查响应格式
|
|
390
|
+
if (response.data && response.data.code === 1) {
|
|
375
391
|
this.fileInfo = response.data.data.basicInfo
|
|
376
|
-
this.parseResult =
|
|
392
|
+
this.parseResult = {
|
|
393
|
+
basicInfo: response.data.data.basicInfo,
|
|
394
|
+
columns: response.data.data.headers.map((header, index) => ({
|
|
395
|
+
name: `col${index}`,
|
|
396
|
+
label: header.name,
|
|
397
|
+
width: 120
|
|
398
|
+
})),
|
|
399
|
+
previewData: response.data.data.data.map(row => {
|
|
400
|
+
const obj = {}
|
|
401
|
+
response.data.data.headers.forEach((header, colIndex) => {
|
|
402
|
+
obj[`col${colIndex}`] = row[colIndex]
|
|
403
|
+
})
|
|
404
|
+
return obj
|
|
405
|
+
})
|
|
406
|
+
}
|
|
377
407
|
this.initColumnMapping()
|
|
378
408
|
this._success('文件解析成功')
|
|
379
409
|
} else {
|