update 完成表单中上传控件的使用
This commit is contained in:
@@ -104,15 +104,25 @@ export default {
|
||||
if (record) {
|
||||
const fileList = !!record.houseInfo.facadePhoto ? record.houseInfo.facadePhoto.split(',') : [];
|
||||
for (let i = 0; i < fileList.length; i++) {
|
||||
const file = await PreviewFile(fileList[i]);
|
||||
const base64 = await BlobToBase64(file);
|
||||
facadePhoto.push({
|
||||
uid: fileList[i],
|
||||
response: fileList[i], // 用于和新上传的文件一同回传
|
||||
name: file.name,
|
||||
url: base64,
|
||||
status: 'done',
|
||||
});
|
||||
try {
|
||||
const file = await PreviewFile(fileList[i]);
|
||||
const base64 = await BlobToBase64(file);
|
||||
facadePhoto.push({
|
||||
uid: fileList[i],
|
||||
response: fileList[i], // 用于和新上传的文件一同回传
|
||||
name: file.name,
|
||||
url: base64,
|
||||
status: 'done',
|
||||
});
|
||||
} catch {
|
||||
const { data: file } = await this.$api.sysFileInfoDetail({ id: fileList[i] });
|
||||
facadePhoto.push({
|
||||
uid: fileList[i],
|
||||
response: '文件已丢失',
|
||||
name: file.fileOriginName,
|
||||
status: 'error',
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
defaultForm.houseInfo.facadePhoto = facadePhoto;
|
||||
|
||||
@@ -173,15 +173,25 @@ export default {
|
||||
const fileList =
|
||||
!form.houseInfo[key] || form.houseInfo[key].length == 0 ? [] : form.houseInfo[key].split(',');
|
||||
for (let i = 0; i < fileList.length; i++) {
|
||||
const file = await PreviewFile(fileList[i]);
|
||||
const base64 = await BlobToBase64(file);
|
||||
fileValue.push({
|
||||
uid: fileList[i],
|
||||
response: fileList[i], // 用于和新上传的文件一同回传
|
||||
name: file.name,
|
||||
url: base64,
|
||||
status: 'done',
|
||||
});
|
||||
try {
|
||||
const file = await PreviewFile(fileList[i]);
|
||||
const base64 = await BlobToBase64(file);
|
||||
fileValue.push({
|
||||
uid: fileList[i],
|
||||
response: fileList[i], // 用于和新上传的文件一同回传
|
||||
name: file.name,
|
||||
url: base64,
|
||||
status: 'done',
|
||||
});
|
||||
} catch {
|
||||
const { data: file } = await this.$api.sysFileInfoDetail({ id: fileList[i] });
|
||||
fileValue.push({
|
||||
uid: fileList[i],
|
||||
response: '文件已丢失',
|
||||
name: file.fileOriginName,
|
||||
status: 'error',
|
||||
});
|
||||
}
|
||||
}
|
||||
form.houseInfo[key] = fileValue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user