物资类型导出修改

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

View File

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