From 20849314db0875abbfc2190a4db1f00ff21c524f Mon Sep 17 00:00:00 2001 From: hongchao <3228015117@qq.com> Date: Tue, 29 Jul 2025 18:19:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=9B=9E=E6=98=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lease/apply/component/addToolsApply.vue | 56 ++++--------------- 1 file changed, 12 insertions(+), 44 deletions(-) diff --git a/src/views/material/lease/apply/component/addToolsApply.vue b/src/views/material/lease/apply/component/addToolsApply.vue index c3f73681..0ec84f6a 100644 --- a/src/views/material/lease/apply/component/addToolsApply.vue +++ b/src/views/material/lease/apply/component/addToolsApply.vue @@ -185,6 +185,7 @@ :file-list="maForm.bmFileInfos" :show-file-list="true" :auto-upload="true" + :headers="headers" :key="uploadKey" :limit="5" list-type="picture-card" @@ -193,6 +194,7 @@ :class="{ disabledFbs: uploadDisabled }" :on-preview="picturePreviewFbs" :on-remove="handleRemoveElectricianImgList" + :on-success="handleFileSuccess" > @@ -505,6 +507,7 @@ export default { // url: process.env.VUE_APP_BASE_API + '/file/upload' // }, uploadUrl: process.env.VUE_APP_BASE_API + "/file/upload", // 上传的图片服务器地址 + headers: { Authorization: 'Bearer ' + getToken() } }; }, computed: { @@ -825,6 +828,7 @@ export default { if (this.maForm.bmFileInfos?.length > 0) { this.isFileFbs = true } + console.log("xxxxxxxxxxxx",this.maForm.bmFileInfos) // this.loading = false; }); @@ -904,7 +908,7 @@ export default { if (this.isEdit) { this.maForm.leaseUnitId = this.maForm.unitId; this.maForm.leaseProjectId = this.maForm.projectId; - console.log("编辑"); + console.log("编辑",this.maForm.bmFileInfos); this.loading = true; updateApplyInfo({ leaseApplyDetailsList: this.equipmentList, @@ -1000,7 +1004,7 @@ export default { // 文件上传成功处理 handleFileSuccess(response, file, fileList) { if (response.code == 200) { - if (this.taskId == "") { + this.uploadKey = Date.now() //新增逻辑 // console.log(response) // console.log(this.rowData) @@ -1010,51 +1014,13 @@ export default { taskType: "0", name: response.data.name, url: response.data.url, + fileUrl:response.data.url, modelId: this.rowData.typeId, fileType: this.rowData.fileType, // "dictLabel": this.rowData.dictLabel, }; - //根据文件上传返回更新文件管理弹窗内容 - let index = this.fileDataList.findIndex( - (v) => v.fileType == this.rowData.fileType - ); - this.fileDataList[index].name = response.data.name; - this.fileDataList[index].url = response.data.url; - //判断当前上传的文件是否已上传过-再往机具类型数据中插入 - if (this.rowData.bmFileInfos.length > 0) { - let index2 = this.rowData.bmFileInfos.findIndex( - (v) => v.fileType == this.rowData.fileType - ); - if (index2 > -1) { - //相同类型文件重复上传-替换 - this.rowData.bmFileInfos.splice(index2, 0, obj); - } else { - //不存在相同类型文件-添加 - this.rowData.bmFileInfos.push(obj); - } - } else { - this.rowData.bmFileInfos.push(obj); - } - } else { - //编辑逻辑 - let param = { - taskId: this.taskId, - taskType: "0", - name: response.data.name, - url: response.data.url, - modelId: this.rowData.typeId, - fileType: this.rowData.fileType, - // "dictLabel": this.rowData.dictLabel, - }; - uploadPurchaseFile(param) - .then((response) => { - this.$modal.msgSuccess("上传成功"); - this.getFileData(); - }) - .catch(() => { - this.$modal.msgError("上传失败"); - }); - } + this.maForm.bmFileInfos.push(obj); + } }, @@ -1105,6 +1071,7 @@ export default { //委托书文件 handleChangeBusinessList(file, fileList) { + this.uploadKey = Date.now() const fileListTemp = fileList.filter(item => { return item.uid != file.uid }); @@ -1142,7 +1109,8 @@ export default { } }); - this.maForm.bmFileInfos = fileList; + console.log("jjjjjjjjjjjj",fileList) + // this.maForm.bmFileInfos = fileList; console.log('🚀 ~ handleChangeBusinessList ~ this.bmFileInfos:', this.bmFileInfos) // 手动触发表单验证 this.$refs.maForm.validateField('bmFileInfos');