|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<a-modal
|
|
|
:title="modalTitle"
|
|
|
- :width="640"
|
|
|
+ :width="900"
|
|
|
:visible="visible"
|
|
|
:confirmLoading="confirmLoading"
|
|
|
@cancel="handleCancel"
|
|
@@ -17,6 +17,14 @@
|
|
|
</a-upload>
|
|
|
</a-form-item>
|
|
|
</a-form>
|
|
|
+ <title-divider title="导入结果" width="90px"></title-divider>
|
|
|
+ <a-table
|
|
|
+ :data-source="data"
|
|
|
+ :columns="columns"
|
|
|
+ bordered
|
|
|
+ tableLayout="auto"
|
|
|
+ rowKey="id">
|
|
|
+ </a-table>
|
|
|
<p style="color: red">注意事项:<br/>
|
|
|
1:请确保文件中对应设备新号已经设置<br/>
|
|
|
2:请确保保养对应的设备部位、指定的人员员均已在系统中设置<br/>
|
|
@@ -41,7 +49,27 @@ export default {
|
|
|
form: this.$form.createForm(this),
|
|
|
visible: false,
|
|
|
type: null,
|
|
|
- fileList: []
|
|
|
+ fileList: [],
|
|
|
+ // 表头
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ title: '编号',
|
|
|
+ dataIndex: 'id'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '文件名',
|
|
|
+ dataIndex: 'name'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '状态',
|
|
|
+ dataIndex: 'status'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '原因',
|
|
|
+ dataIndex: 'reason'
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ data: []
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
@@ -89,16 +117,28 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
const formData = new FormData()
|
|
|
- //循环添加到formData中
|
|
|
+ // 循环添加到formData中
|
|
|
this.fileList.forEach(function (file) {
|
|
|
formData.append('files', file, file.name)
|
|
|
})
|
|
|
importCheckStandard(formData)
|
|
|
.then((res) => {
|
|
|
- this.$message.success(res.data)
|
|
|
- this.handleCancel(values)
|
|
|
+ // 循环添加到formData中
|
|
|
+ const resultArr = res.data.split(';')
|
|
|
+ const result = []
|
|
|
+ for (let i = 0; i < resultArr.length; i++) {
|
|
|
+ const r = resultArr[i]
|
|
|
+ if (r.indexOf('成功') === 0) {
|
|
|
+ result.push({ id: i, name: r, status: '成功' })
|
|
|
+ } else if (r.indexOf('失败') === 0) {
|
|
|
+ result.push({ id: i, name: r, status: '失败', reason: r.split(':')[2] })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.$message.success('导入结束,请查看结果表格')
|
|
|
+ this.data = result
|
|
|
+ // this.handleCancel(values)
|
|
|
this.BaseTool.ListForm.clearOneList(this)
|
|
|
- this.BaseTool.ListForm.pushOneListAddMore(this, res.data)
|
|
|
+ // this.BaseTool.ListForm.pushOneListAddMore(this, res.data)
|
|
|
}).catch(() => {
|
|
|
this.confirmLoading = false
|
|
|
})
|
|
@@ -108,6 +148,7 @@ export default {
|
|
|
this.visible = false
|
|
|
this.confirmLoading = false
|
|
|
this.fileList = []
|
|
|
+ this.data = []
|
|
|
this.form.resetFields()
|
|
|
this.storeId = null
|
|
|
this.$emit('ok', values)
|