|
@@ -309,17 +309,44 @@ export default {
|
|
|
|
|
|
},
|
|
|
handleChange(info) {
|
|
|
- // console.log(info)
|
|
|
- this.loadDisabled = false
|
|
|
- this.$message.success('文件导入成功,异步创建中,请稍后查看...')
|
|
|
+ console.log(info)
|
|
|
+ let fileList = [...info.fileList];
|
|
|
+
|
|
|
+ // 1. Limit the number of uploaded files
|
|
|
+ // Only to show two recent uploaded files, and old ones will be replaced by the new
|
|
|
+ fileList = fileList.slice(-2);
|
|
|
+
|
|
|
+ // 2. read from response and show file link
|
|
|
+ fileList = fileList.map(file => {
|
|
|
+ if (file.response) {
|
|
|
+ // Component will show file.url as link
|
|
|
+ file.url = file.response.url;
|
|
|
+ }
|
|
|
+ return file;
|
|
|
+ });
|
|
|
+ if(fileList.length>0){
|
|
|
+ this.fileList = [
|
|
|
+ {
|
|
|
+ ...fileList[fileList.length-1]
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }else{
|
|
|
+ this.fileList=[]
|
|
|
+ }
|
|
|
+ // this.loadDisabled = false
|
|
|
+ // this.$message.success('文件导入成功,异步创建中,请稍后查看...')
|
|
|
if (info.file.status !== 'uploading') {
|
|
|
console.log(info.file, info.fileList)
|
|
|
}
|
|
|
if (info.file.status === 'done') {
|
|
|
- this.$message.success(`${info.file.name} 上传成功`)
|
|
|
+
|
|
|
this.loadDisabled = false
|
|
|
- this.attachmentName=info.file.response.result.attachmentName || ''
|
|
|
- this.attachmentUrl=info.file.response.result.attachmentUrl || ''
|
|
|
+ if(info.file.response.code==0){
|
|
|
+ this.$message.success(info.file.response.message)
|
|
|
+ }else{
|
|
|
+ this.$message.error(info.file.response.message)
|
|
|
+ }
|
|
|
+
|
|
|
} else if (info.file.status === 'error') {
|
|
|
this.$message.error(`${info.file.name}上传失败`)
|
|
|
this.loadDisabled = false
|