|
|
|
|
@ -57,10 +57,12 @@ |
|
|
|
|
</el-col> |
|
|
|
|
<el-col :span="12"> |
|
|
|
|
<el-form-item prop="source" label="附件:"> |
|
|
|
|
<el-upload class="upload-demo" action="/smartparkAPP/ld-person-form/upload" :on-preview="handlePreview" |
|
|
|
|
:on-remove="handleRemove" :before-remove="beforeRemove" multiple :limit="6" :on-exceed="handleExceed" |
|
|
|
|
:file-list="fileList" :on-success="handleUploadSuccess" accept=".jpg,.jpeg,.png,.pdf" |
|
|
|
|
:before-upload="beforeAvatarUpload" :disabled="inDialogType == 'details'"> |
|
|
|
|
<!-- action="/smartparkAPP/ld-person-form/upload" --> |
|
|
|
|
<el-upload class="upload-demo" :http-request="customUpload" :on-preview="handlePreview" |
|
|
|
|
:headers="uploadHeaders" :on-remove="handleRemove" :before-remove="beforeRemove" multiple :limit="6" |
|
|
|
|
:on-exceed="handleExceed" :file-list="fileList" :on-success="handleUploadSuccess" |
|
|
|
|
accept=".jpg,.jpeg,.png,.pdf" :before-upload="beforeAvatarUpload" |
|
|
|
|
:disabled="inDialogType == 'details'"> |
|
|
|
|
<el-button size="small" type="primary">点击上传</el-button> |
|
|
|
|
<div slot="tip" class="el-upload__tip">只能上传 jpg/png/pdf 文件,且单个文件不超过 6MB</div> |
|
|
|
|
</el-upload> |
|
|
|
|
@ -296,6 +298,7 @@ import { |
|
|
|
|
getStatistics, |
|
|
|
|
} from "@/api/firstOrder/inbound"; |
|
|
|
|
import { mapGetters } from "vuex"; |
|
|
|
|
import request from '@/router/axios'; // 引入你项目中封装了拦截器的 axios 实例 |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
props: { |
|
|
|
|
@ -375,6 +378,32 @@ export default { |
|
|
|
|
this.sizeForm.userInfoVO = this.userInfo; |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
customUpload(param) { |
|
|
|
|
const formData = new FormData(); |
|
|
|
|
// 注意:后端接收文件的字段名通常是 'file',请根据后端接口要求修改 |
|
|
|
|
formData.append('file', param.file); |
|
|
|
|
|
|
|
|
|
// 使用封装的 request (axios) 发起请求 |
|
|
|
|
// 这样就会自动带上 Header 中的 Token,并经过响应拦截器 |
|
|
|
|
request({ |
|
|
|
|
url: '/smartparkAPP/ld-person-form/upload', // 你的上传接口地址 |
|
|
|
|
method: 'post', |
|
|
|
|
data: formData, |
|
|
|
|
headers: { |
|
|
|
|
'Content-Type': 'multipart/form-data' |
|
|
|
|
} |
|
|
|
|
}).then(res => { |
|
|
|
|
// 模拟 el-upload 的成功回调逻辑 |
|
|
|
|
// 注意:这里需要根据你后端返回的结构,构造一个让 el-upload 认为成功的响应 |
|
|
|
|
// if (res.code === 200 || res.success) { |
|
|
|
|
param.onSuccess(res, param.file); |
|
|
|
|
// } else { |
|
|
|
|
// param.onError(new Error(res.message || '上传失败')); |
|
|
|
|
// } |
|
|
|
|
}).catch(err => { |
|
|
|
|
param.onError(err); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
handleRemove(file, fileList) { |
|
|
|
|
console.log(file, fileList); |
|
|
|
|
this.fileList = fileList; |
|
|
|
|
@ -534,7 +563,7 @@ export default { |
|
|
|
|
const res = await editList(this.id); |
|
|
|
|
const { ldOnePutStorage, ldOnePutStorageDetailList = [] } = |
|
|
|
|
res.data.result || {}; |
|
|
|
|
if(ldOnePutStorage.onePutStorageFilesList&&ldOnePutStorage.onePutStorageFilesList.length>0){ |
|
|
|
|
if (ldOnePutStorage.onePutStorageFilesList && ldOnePutStorage.onePutStorageFilesList.length > 0) { |
|
|
|
|
this.fileList = ldOnePutStorage.onePutStorageFilesList.map(item => { |
|
|
|
|
return { |
|
|
|
|
name: item.fileName || '未知文件', // 必须:显示在列表中的文件名 |
|
|
|
|
|