上传文件组件,增加修改名称功能

This commit is contained in:
hanshaozhuang
2022-06-30 09:16:20 +08:00
parent 16e775db44
commit d21c1a3d23
3 changed files with 10 additions and 3 deletions
+8 -3
View File
@@ -251,18 +251,19 @@ export default {
}
},
methods: {
// 删除
handleRemoveFile(file){
console.log('file = ', file)
const index = this.$refs.importFileAboutStand.uploadFiles.findIndex(e => e.response.data.id === file.response.data.id);
console.log('index = ', index)
this.$refs.importFileAboutStand.uploadFiles.splice(index, 1);
this.showFileList.splice(index, 1)
},
// 修改
handleModifyName(file) {
this.modifyFile.fileName = file.name
this.modifyFile.fileId = file.response.data.id
this.openModifyFileNameDialog = true
},
// 修改dialog-确认
handleModifyNameSubmite(){
this.modifyFileNameLoading = true
this.$http.get('att/attFile/updateFileName', this.modifyFile, {
@@ -271,7 +272,11 @@ export default {
if(res.ok){
this.modifyFileNameLoading = false
this.openModifyFileNameDialog = false
// TODO 查修改成功后 回显新的 名称
this.showFileList.forEach(item=>{
if(item.response.data.id === this.modifyFile.fileId){
item.name = this.modifyFile.fileName
}
})
}
}, e => {
this.modifyFileNameLoading = false