diff --git a/src/views/material/ma/supplier/index.vue b/src/views/material/ma/supplier/index.vue index 23cf4695..501442ac 100644 --- a/src/views/material/ma/supplier/index.vue +++ b/src/views/material/ma/supplier/index.vue @@ -180,7 +180,7 @@ 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(); }, diff --git a/src/views/material/ma/type/index.vue b/src/views/material/ma/type/index.vue index 35fc2440..f439daf3 100644 --- a/src/views/material/ma/type/index.vue +++ b/src/views/material/ma/type/index.vue @@ -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`) }, /* 树节点操作 */