diff --git a/src/api/base/project.js b/src/api/base/project.js index 5cf5ba7..fc3c739 100644 --- a/src/api/base/project.js +++ b/src/api/base/project.js @@ -37,8 +37,8 @@ export function updateProject(data) { 'decrypt': 'decrypt', 'Content-Type': 'multipart/form-data' }, - url: '/bracelet/project', - method: 'put', + url: '/bracelet/project/update', + method: 'post', data: data }) } diff --git a/src/views/base/project/index.vue b/src/views/base/project/index.vue index 017b27c..60a34b7 100644 --- a/src/views/base/project/index.vue +++ b/src/views/base/project/index.vue @@ -118,6 +118,7 @@ action="#" :limit="5" :file-list="fileList" + :key="uploadKey" :show-file-list="true" :auto-upload="false" list-type="picture-card" @@ -168,6 +169,7 @@ export default { dicts: ['sys_normal_disable'], data() { return { + uploadKey: Date.now(), // 遮罩层 loading: true, // 选中数组 @@ -320,6 +322,7 @@ export default { }, // 取消按钮 cancel() { + this.uploadKey = Date.now(); this.open = false; this.fileList=[]; this.reset(); @@ -356,6 +359,7 @@ export default { }, /** 新增按钮操作 */ handleAdd() { + this.uploadKey = Date.now(); this.fileList = [] this.reset(); this.open = true; @@ -364,6 +368,7 @@ export default { /** 修改按钮操作 */ handleUpdate(row) { this.fileList = [] + this.delFileIdList = [] this.reset(); const projectId = row.projectId getProject(projectId).then(response => { @@ -377,7 +382,7 @@ export default { // response.data.fileList = []; this.open = true; this.title = "修改项目"; - + this.uploadKey = Date.now(); }); }, // 图片上传 @@ -435,13 +440,13 @@ export default { }, //提交时循环fileList 获取raw文件 getFileData() { - const file = [] + const fileTwo = [] this.fileList.forEach(item => { if (item?.hasOwnProperty('raw')) { - file.push(item.raw) + fileTwo.push(item.raw) } }) - return { file } + return { fileTwo } }, /** 提交按钮 */ submitForm() { @@ -449,29 +454,40 @@ export default { if (valid) { if (this.form.projectId != undefined) { const reqData = new FormData(); - this.form.delFileIdList = this.delFileIdList; - reqData.append('params', JSON.stringify(this.form)) - const { file } = this.getFileData() - file.forEach(item => { + const forTemp = {'projectId': this.form.projectId,'projectDepartName': this.form.projectDepartName,'projectHeadName': this.form.projectHeadName,'contactInformation': this.form.contactInformation,'remarks': this.form.remarks}; + reqData.append('params', JSON.stringify(forTemp)); + // this.form.delFileIdList = this.delFileIdList; + this.delFileIdList.forEach(item => { + reqData.append('delFileIdList', item) + }); + // reqData.append('params', JSON.stringify(this.form)) + const { fileTwo } = this.getFileData() + fileTwo.forEach(item => { reqData.append('file', item) }) + console.log(reqData) updateProject(reqData).then(response => { this.$modal.msgSuccess("修改成功"); this.open = false; + this.delFileIdList = []; this.fileList=[]; + this.uploadKey = Date.now(); this.getList(); }); } else { - console.log(this.form) const reqData = new FormData() - reqData.append('params', JSON.stringify(this.form)) - const { file } = this.getFileData() - file.forEach(item => { + const forTemp = {'projectId': this.form.projectId,'projectDepartName': this.form.projectDepartName,'projectHeadName': this.form.projectHeadName,'contactInformation': this.form.contactInformation,'remarks': this.form.remarks}; + reqData.append('params', JSON.stringify(forTemp)) + const { fileTwo } = this.getFileData() + fileTwo.forEach(item => { reqData.append('file', item) }) addProject(reqData).then(response => { this.$modal.msgSuccess("新增成功"); this.open = false; + this.fileList=[]; + this.delFileIdList = []; + this.uploadKey = Date.now(); this.getList(); }); } diff --git a/src/views/base/staff/index.vue b/src/views/base/staff/index.vue index 5d852cf..129476b 100644 --- a/src/views/base/staff/index.vue +++ b/src/views/base/staff/index.vue @@ -128,7 +128,7 @@ @@ -401,6 +401,7 @@ import { listPerson, addPerson, editPerson, getPersonInfo, delPerson, exportPers import { downloadFile,downloadFileData } from '@/utils/download' import { getToken } from '@/utils/auth' import uploadFile from '../../components/uploadFile.vue' +import _ from 'lodash'; export default { name: "Post", dicts: ['sys_normal_disable','sys_user_sex','post_type'], @@ -796,6 +797,7 @@ export default { } }) this.delHighFileIdList.push(this.highImgList[sum].fileId) + console.log(this.delHighFileIdList) this.highImgList.splice(sum, 1) }, handleRemoveElectricianImgList(file, fileList) { @@ -1006,7 +1008,7 @@ export default { this.$refs.upload.submit(); }, //打开证书上传 - openCertificate(row){ + openCertificate:_.debounce(function(row){ this.title = "证书上传"; this.memberId = row.id; this.highImgList = []; @@ -1077,7 +1079,7 @@ export default { this.showCertificate = true; }); - }, + },300), //关闭证书上传 cancelCertificate(){