From 3ed5068deef1a24cd0d7be9f75589b1dff887bde Mon Sep 17 00:00:00 2001 From: clay <20932067@zju.edu.cn> Date: Sun, 2 Jun 2024 17:37:53 +0800 Subject: [PATCH] =?UTF-8?q?feat=20:=20=E9=9C=80=E6=B1=82=E4=B8=8A=E6=8A=A5?= =?UTF-8?q?fileLie=20=E6=9D=83=E9=99=90=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/AttachmentUpload.vue | 69 ++++++---- .../DetailComponent/SummaryDetail.vue | 55 +++++++- src/components/TagAndFileUpload.vue | 1 + src/views/project-demand/requirement/add.vue | 6 +- .../project-demand/requirement/detail.vue | 121 +++++++++++++----- .../project-demand/requirement/upload.vue | 1 + src/views/project-demand/summary/add.vue | 1 + src/views/project-demand/summary/detail.vue | 6 +- src/views/project-demand/summary/upload.vue | 1 + .../project-management/filing/conclusion.vue | 1 + .../project-management/filing/upload.vue | 1 + .../implementation/check.vue | 1 + .../implementation/phase.vue | 1 + .../implementation/upload.vue | 1 + .../project-management/initiation/apply.vue | 1 + src/views/special-fund/add.vue | 1 + 16 files changed, 206 insertions(+), 62 deletions(-) diff --git a/src/components/AttachmentUpload.vue b/src/components/AttachmentUpload.vue index fa2cc3c..bdbf8aa 100644 --- a/src/components/AttachmentUpload.vue +++ b/src/components/AttachmentUpload.vue @@ -10,7 +10,8 @@ 删除 @@ -69,15 +70,28 @@ const tableConfig = reactive({ align: 'center', showOverflowTooltip: false, currentRender: ({row, index}) => { + let btn = [] + btn.push({label: '下载', func: () => handleDownload(row), type: 'primary'}) + if (row.newFile){ + btn.push({label: '删除', func: () => handleDelete(row), type: 'primary'}) + } return ( -
- handleDownload(row)}>下载 +
+ { + btn.map(item => ( + item.func()} + link + > + {item.label} + + )) + }
) } } - - // deleteOtherFile(row)}>删除 ] }) const rules = reactive({ @@ -91,19 +105,24 @@ const props = defineProps({ showFileList: { type: Boolean, default: false - }, label: { + }, + label: { type: String, default: '项目附件' - }, showTable: { + }, + showTable: { type: Boolean, default: true - }, preview: { + }, + preview: { type: Boolean, default: false - }, otherFileList: { + }, + otherFileList: { type: Array, default: [] - }, formData: { + }, + formData: { type: Array, default: [] } @@ -112,34 +131,34 @@ watch(() => props.showTable, (newVal) => { props.showTable = newVal }, {deep: true}) watch(() => props.otherFileList, (newVal) => { - console.log('newotherFileList',newVal) + console.log('newotherFileList', newVal) if (props.preview) { - if(props.formData.fileList==null){ - allFileList.value=newVal - }else { + if (props.formData.fileList == null) { + allFileList.value = newVal + } else { newVal?.forEach(item => { allFileList.value.push(item) }) } - }else { - allFileList.value=newVal + } else { + allFileList.value = newVal } }, {deep: true}) watch(() => props.formData.fileList, (newVal) => { - console.log('newVal-fileList',newVal) + console.log('newVal-fileList', newVal) if (props.preview) { - newVal?.forEach(item => { - allFileList.value.push(item) - }) + newVal?.forEach(item => { + allFileList.value.push(item) + }) } }, {deep: true}) watch(() => props.formData.singleFile, (newVal) => { - console.log('singleFile',newVal) + console.log('singleFile', newVal) singleFile.value = newVal }, {deep: true}) const getAttachment = (val) => { - isSingleFile.value=true + isSingleFile.value = true emit('getAttachment', val) } const getOtherFile = (val) => { @@ -150,10 +169,10 @@ const deleteAttachment = (val) => { if (res.code === 1000) { ElNotification({ title: '提示', - message:"删除成功", - type:'success' + message: "删除成功", + type: 'success' }) - isSingleFile.value=false + isSingleFile.value = false } }); } diff --git a/src/components/DetailComponent/SummaryDetail.vue b/src/components/DetailComponent/SummaryDetail.vue index 0d98534..845b756 100644 --- a/src/components/DetailComponent/SummaryDetail.vue +++ b/src/components/DetailComponent/SummaryDetail.vue @@ -124,8 +124,9 @@ - + +