物资类型导出修改

This commit is contained in:
jjLv 2024-10-28 17:53:00 +08:00
parent da7888a9d8
commit 9e90d6d352
2 changed files with 44 additions and 32 deletions

View File

@ -180,7 +180,7 @@
<el-upload <el-upload
class = "upload-demo" class = "upload-demo"
action="#" action="#"
:file-list="businessLicenseList" :file-list="businessLicenseListTemp"
:show-file-list="true" :show-file-list="true"
:auto-upload="false" :auto-upload="false"
list-type="picture-card" list-type="picture-card"
@ -291,7 +291,8 @@
}, },
fileList:[], fileList:[],
businessLicenseList:[], businessLicenseFileList:[],
businessLicenseListTemp:[],
delBusinessFileIdList:[], delBusinessFileIdList:[],
// //
dialogImageUrl: '', dialogImageUrl: '',
@ -316,7 +317,7 @@
//1 //1
uploadDisabled() { uploadDisabled() {
return this.businessLicenseList.length > 2 return this.businessLicenseListTemp.length > 2
}, },
}, },
created() { created() {
@ -326,7 +327,7 @@
//fileList raw //fileList raw
getFileData() { getFileData() {
const fileTwo = [] const fileTwo = []
this.businessLicenseList.forEach(item => { this.businessLicenseListTemp.forEach(item => {
if (item?.hasOwnProperty('raw')) { if (item?.hasOwnProperty('raw')) {
fileTwo.push(item.raw) fileTwo.push(item.raw)
} }
@ -336,13 +337,13 @@
// //
async imgUpLoadTwoAll(param, name, index) { async imgUpLoadTwoAll(param, name, index) {
console.log(param, 'image')
param.type = 'ma' param.type = 'ma'
await imgUpLoadTwo(param) imgUpLoadTwo(param)
.then((res) => { .then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.imageUrl = res.data.url let obj = {'name':res.data.name,'url':res.data.url}
this.businessLicenseList.push(this.imageUrl); console.log('obj',obj)
this.businessLicenseFileList.push(obj);
} else { } else {
// this.$msgError(res.msg) // this.$msgError(res.msg)
this.$modal.msgError(res.msg) this.$modal.msgError(res.msg)
@ -368,14 +369,14 @@
}, },
handleRemoveElectricianImgList(file, fileList) { handleRemoveElectricianImgList(file, fileList) {
let sum = 0 let sum = 0
this.businessLicenseList.forEach((item, index) => { this.businessLicenseListTemp.forEach((item, index) => {
if (item.uid == file.uid) { if (item.uid == file.uid) {
sum = index sum = index
} }
}) })
this.businessLicenseList.splice(sum, 1) this.businessLicenseListTemp.splice(sum, 1)
}, },
isImage(file){ isImage(file){
@ -444,8 +445,8 @@
this.urlTemp = require('../../../../assets/file.png'); this.urlTemp = require('../../../../assets/file.png');
} }
}), });
this.businessLicenseList = fileList; this.businessLicenseListTemp = fileList;
}, },
async getList() { async getList() {
@ -488,8 +489,8 @@
}, },
//** */ //** */
async submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(async valid => {
if (valid) { if (valid) {
if (this.form.supplierId != undefined) { if (this.form.supplierId != undefined) {
const reqData = new FormData(); const reqData = new FormData();
@ -498,34 +499,43 @@
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.showHouse = false; this.showHouse = false;
this.getList(); this.getList();
this.businessLicenseList=[]; this.businessLicenseListTemp=[];
this.delBusinessFileIdList=[]; this.delBusinessFileIdList=[];
}); });
} else { } else {
const reqData = new FormData() await this.getImaUpload(),
const {fileTwo} = this.getFileData() console.log('businessLicenseFileList',this.businessLicenseFileList)
fileTwo.forEach(async item=>{ this.form.businessLicenseFileList=this.businessLicenseFileList
let obj={file: item}; await this.addFacturerTemp();
await this.imgUpLoadTwoAll(obj,name,name);
})
this.form.businessLicenseList=this.businessLicenseList
addFacturer(this.form).then(async response => {
this.$modal.msgSuccess("新增成功");
this.showHouse = false;
await this.getList();
this.businessLicenseList=[];
this.delBusinessFileIdList=[];
});
} }
} }
}); });
}, },
async getImaUpload(){
const reqData = new FormData()
const {fileTwo} = this.getFileData()
fileTwo.forEach( item=>{
let obj={file: item};
this.imgUpLoadTwoAll(obj,name,name);
})
},
async addFacturerTemp(form){
addFacturer(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.showHouse = false;
this.getList();
this.businessLicenseListTemp=[];
this.businessLicenseFileList=[];
this.delBusinessFileIdList=[];
});
},
// //
cancel() { cancel() {
this.showHouse = false; this.showHouse = false;
this.businessLicenseList=[]; this.businessLicenseFileList=[];
this.reset(); this.reset();
}, },

View File

@ -1000,8 +1000,10 @@ export default {
// }, // },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
let queryTemp = this.queryParams;
queryTemp.level = 0;
this.download('/material/ma_type/export', { this.download('/material/ma_type/export', {
...this.queryParams ...queryTemp
}, `物资类型信息_${new Date().getTime()}.xlsx`) }, `物资类型信息_${new Date().getTime()}.xlsx`)
}, },
/* 树节点操作 */ /* 树节点操作 */