From 015a63a48b034249400afd5bcbcd7f57e2280d1b Mon Sep 17 00:00:00 2001 From: zyn Date: Wed, 24 Jan 2024 15:41:26 +0800 Subject: [PATCH] =?UTF-8?q?feature:=20=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E6=B7=BB=E5=8A=A0=E6=9B=B4=E5=90=8D=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzwlComponents/UploadFormItem.vue | 99 ++++++++++++++++++- 1 file changed, 98 insertions(+), 1 deletion(-) diff --git a/src/components/hzwlComponents/UploadFormItem.vue b/src/components/hzwlComponents/UploadFormItem.vue index d35849758..e34615f83 100644 --- a/src/components/hzwlComponents/UploadFormItem.vue +++ b/src/components/hzwlComponents/UploadFormItem.vue @@ -60,13 +60,59 @@ :on-success="onSuccess" :on-preview="onPreview" :on-remove="removeOneFile" - :show-file-list="true" + :show-file-list="false" >

点击或拖拽上传文件

+ + + + + @@ -120,6 +166,13 @@ export default { fileMadel: false, fileList: [], // 用于el-upload FileList: [], // 用于回显 + + openModifyFileNameDialog: false, + modifyFile: { + fileName: '', + fileId: '' + }, + modifyFileNameLoading: false } }, created () { @@ -234,6 +287,42 @@ export default { this.$preview(attId) } }, + handleRemoveFile (file) { + const fileList = [] + this.FileList.forEach(item => { + if (item.id !== file.id) { + fileList.push(item) + } + }) + this.removeOneFile(file, fileList) + }, + handleModifyName (file) { + this.modifyFile.fileName = file.name + this.modifyFile.fileId = file.id + this.openModifyFileNameDialog = true + }, + handleModifyNameSubmite () { + this.modifyFileNameLoading = true + this.$http.get('att/attFile/updateFileName', this.modifyFile, { + _this: this + }, res => { + if(res.ok) { + this.modifyFileNameLoading = false + this.openModifyFileNameDialog = false + this.FileList.forEach(item => { + if(item.id === this.modifyFile.fileId) { + item.name = this.modifyFile.fileName + } + }) + const ids = this.FileList.map(item => item.id).join(',') + const names = this.FileList.map(item => item.name).join(',') + this.$emit('update:ids', ids) + this.$emit('update:names', names) + } + }, e => { + this.modifyFileNameLoading = false + }) + }, } } @@ -250,4 +339,12 @@ export default { background: #fff3f3; z-index: 9; } +.el-upload-list__item .el-icon-edit{ + position: absolute; + top: 5px; + right: 25px; + cursor: pointer; + opacity: .75; + color: #606266; +}