物资厂家文件上传
This commit is contained in:
parent
7a080291fc
commit
de858331a0
|
|
@ -15,13 +15,23 @@ export const downloadFile = ({ fileData, fileType, fileName }) => {
|
|||
|
||||
// 通用a链接下载
|
||||
export const downloadFileByUrl = (url) => {
|
||||
const link = document.createElement('a')
|
||||
link.href = url
|
||||
link.setAttribute('download', '')
|
||||
link.style.display = 'none'
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
URL.revokeObjectURL(link.href)
|
||||
document.body.removeChild(link)
|
||||
const link = document.createElement('a');
|
||||
link.href = url; // 设置文件 URL
|
||||
link.download = ''; // 提供下载提示
|
||||
document.body.appendChild(link); // 将链接添加到 DOM
|
||||
link.click(); // 模拟点击下载
|
||||
document.body.removeChild(link); // 下载后移除链接
|
||||
}
|
||||
|
||||
// pdf、doc、docx等文件下载
|
||||
export const downloadFileData = ({ fileName, fileUrl }) => {
|
||||
const link = document.createElement('a')
|
||||
link.setAttribute('download', '')
|
||||
link.style.display = 'none'
|
||||
link.href = fileUrl
|
||||
link.download = fileName
|
||||
document.body.appendChild(link)
|
||||
link.click();
|
||||
// URL.revokeObjectURL(link.href)
|
||||
document.body.removeChild(link)
|
||||
}
|
||||
|
|
@ -232,7 +232,7 @@
|
|||
<script>
|
||||
import { getListFacturer,getFacturerDetail,editFacturer,addFacturer,delFacturer } from "@/api/ma/supplier";
|
||||
import { imgUpLoadThree, fileUpLoad } from '@/api/system/upload'
|
||||
import { downloadFile,downloadFileByUrl } from '@/utils/download'
|
||||
import { downloadFile,downloadFileData } from '@/utils/download'
|
||||
import { getToken } from '@/utils/auth'
|
||||
export default {
|
||||
name: "supplier",
|
||||
|
|
@ -423,7 +423,7 @@
|
|||
downloadFile({ fileName: file.name, fileData: file.raw, fileType: 'application/vnd.ms-excel;charset=utf-8' })
|
||||
}else if(file.status === 'success'){
|
||||
|
||||
downloadFileByUrl( file.url )
|
||||
downloadFileData( { fileName: file.name, fileUrl: file.url } )
|
||||
// downloadFileData({ fileName: file.name,fileUrl:file.url })
|
||||
}
|
||||
},
|
||||
|
|
@ -529,14 +529,13 @@
|
|||
if (valid) {
|
||||
if (this.form.supplierId != undefined) {
|
||||
const reqData = new FormData();
|
||||
if(this.businessLicenseListTemp.length!=0){
|
||||
await this.getImaUpload(),
|
||||
await this.editFacturerTemp(this.form);
|
||||
}else{
|
||||
await this.editFacturerTemp(this.form);
|
||||
}
|
||||
|
||||
editFacturer(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.showHouse = false;
|
||||
this.getList();
|
||||
this.businessLicenseListTemp=[];
|
||||
this.delBusinessFileIdList=[];
|
||||
});
|
||||
} else {
|
||||
if(this.businessLicenseListTemp.length!=0){
|
||||
await this.getImaUpload(),
|
||||
|
|
@ -573,7 +572,18 @@
|
|||
this.getList();
|
||||
this.businessLicenseListTemp=[];
|
||||
this.businessLicenseFileList=[];
|
||||
this.delBusinessFileIdList=[];
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
async editFacturerTemp(form){
|
||||
this.form.bmFileInfos=this.businessLicenseFileList
|
||||
editFacturer(form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.showHouse = false;
|
||||
this.getList();
|
||||
this.businessLicenseListTemp=[];
|
||||
this.businessLicenseFileList=[];
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue