| | |
| | | // 新增图片 |
| | | async afterRead(event) { |
| | | // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式 |
| | | let lists = [].concat(event.file) |
| | | let fileListLen = this.fileList.length |
| | | lists.map((item) => { |
| | | this.fileList.push({ |
| | | ...item, |
| | | status: 'success', |
| | | message: '上传中' |
| | | uploadImage(event.file[0].url,this.isHk).then(res=>{ |
| | | console.log(res) |
| | | this.fileList.push(res); |
| | | }) |
| | | }) |
| | | for (let i = 0; i < lists.length; i++) { |
| | | |
| | | const result = await this.uploadFilePromise(lists[i].url) |
| | | let item = this.fileList[fileListLen] |
| | | this.fileList.splice(fileListLen, 1, Object.assign(item, { |
| | | status: result.status, |
| | | message: result.status == 'success' ? '上传成功' : '上传失败', |
| | | urls: result.url |
| | | })) |
| | | fileListLen++ |
| | | } |
| | | // let lists = [].concat(event.file) |
| | | // let fileListLen = this.fileList.length |
| | | // lists.map((item) => { |
| | | // this.fileList.push({ |
| | | // ...item, |
| | | // status: 'success', |
| | | // message: '上传中' |
| | | // }) |
| | | // }) |
| | | // for (let i = 0; i < lists.length; i++) { |
| | | // |
| | | // const result = await this.uploadFilePromise(lists[i].url) |
| | | // let item = this.fileList[fileListLen] |
| | | // this.fileList.splice(fileListLen, 1, Object.assign(item, { |
| | | // status: result.status, |
| | | // message: result.status == 'success' ? '上传成功' : '上传失败', |
| | | // urls: result.url |
| | | // })) |
| | | // fileListLen++ |
| | | // } |
| | | }, |
| | | |
| | | uploadFilePromise(url) { |
| | |
| | | |
| | | this.$refs.uForm.validate().then(res => { |
| | | if (res) { |
| | | var urls = this.fileList.map(item => item.urls).join(','); |
| | | var urls = this.fileList.map(item => item.url).join(','); |
| | | this.form.feeVoucherUrl = urls |
| | | this.form.dispatchOrderId = this.newForm.dispatchId |
| | | this.form.driverId = this.newForm.driverId |