上传文件组件,增加修改名称功能
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user