diff --git a/src/api/attachment/attachment.js b/src/api/attachment/attachment.js new file mode 100644 index 0000000..200f09a --- /dev/null +++ b/src/api/attachment/attachment.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询附件列表 +export function listAttachment(query) { + return request({ + url: '/system/attachment/list', + method: 'get', + params: query + }) +} + +// 查询附件详细 +export function getAttachment(id) { + return request({ + url: '/system/attachment/' + id, + method: 'get' + }) +} + +// 新增附件 +export function addAttachment(data) { + return request({ + url: '/system/attachment', + method: 'post', + data: data + }) +} + +// 修改附件 +export function updateAttachment(data) { + return request({ + url: '/system/attachment', + method: 'put', + data: data + }) +} + +// 删除附件 +export function delAttachment(id) { + return request({ + url: '/system/attachment/' + id, + method: 'delete' + }) +} diff --git a/src/components/FileUpload/optimizeToolUpload.vue b/src/components/FileUpload/optimizeToolUpload.vue new file mode 100644 index 0000000..6429d53 --- /dev/null +++ b/src/components/FileUpload/optimizeToolUpload.vue @@ -0,0 +1,396 @@ + + + diff --git a/src/components/tool-selector/index.vue b/src/components/tool-selector/index.vue index 65b9c9a..fc87c17 100644 --- a/src/components/tool-selector/index.vue +++ b/src/components/tool-selector/index.vue @@ -4,7 +4,9 @@ :visible.sync="visible" :close-on-click-modal="false" width="80%" - append-to-body> + append-to-body + :show-close="false" + >
diff --git a/src/views/document/index.vue b/src/views/document/index.vue index fbc174b..ed37fd8 100644 --- a/src/views/document/index.vue +++ b/src/views/document/index.vue @@ -230,7 +230,7 @@ - + @@ -121,7 +122,7 @@ - +
@@ -135,6 +136,8 @@ import editDocument from "../document/editDocument"; import { Base64 } from 'js-base64'; import iFrame from "@/components/iFrame/index" + import { addCount } from "@/api/tool/downloadCount"; + import { listAttachment } from "@/api/attachment/attachment"; export default { name: 'toolDetail', @@ -150,7 +153,7 @@ data(){ return{ detailActiveName: 'first', - docList: [], + attachmentList: [], queryParams: { pageNum: 1, pageSize: 10, @@ -172,12 +175,13 @@ replyContent: [], detailLoading: false, //详细数据 - detailData:{} + detailData:{}, + attFileType: "zip,rar,7z", } }, created(){ this.getDetail() - this.getDocList() + this.getAttachmentList() this.getDiscussionsList() }, watch: { @@ -187,11 +191,12 @@ } }, methods:{ - getDocList() { + getAttachmentList() { this.loading = true; - this.queryParams.toolId = this.toolDetail.toolId - listDocument(this.queryParams).then(response => { - this.docList = response.rows; + this.$set(this.queryParams,'del',"0") + this.$set(this.queryParams,'businessId',this.toolDetail.toolId) + listAttachment(this.queryParams).then(response => { + this.attachmentList = response.rows; this.total = response.total; this.loading = false; } @@ -202,9 +207,9 @@ }, editDocumentSubmit(){ this.open = false - this.getDocList() + this.getAttachmentList() }, - handlePriew(row){ + handlePreview(row){ this.previewUrl = process.env.VUE_APP_TOOL_TECH_FILE_VIEW_API + '/onlinePreview?url=' + encodeURIComponent(Base64.encode(process.env.VUE_APP_BASE_API + row.docUrl)); this.viewDialogTitle = '文档在线预览' this.viewDialogOpen = true; @@ -225,7 +230,20 @@ handleDownload(row){ let self = this self.loadingDownload = true - this.$download.resource(row.docUrl); + this.$download.resource(row.fileUrl); + + //保存下载记录 + if(row.businessId){ + let formData = { + 'businessId': row.businessId, + 'businessType': 'tool', + 'attId': row.id, + 'attName': row.fileOldName + } + addCount(formData).then(res => { + }); + } + setTimeout(()=>{ self.loadingDownload = false },1000) @@ -391,7 +409,25 @@ }).finally(()=>{ self.detailLoading = false }); - } + }, + previewAuth(row){ + if(row.fileUrl == null || row.fileUrl == '' || row.fileUrl == undefined){ + return false + } + let extension = this.getExtension(row.fileUrl); + const acceptedExtensions = this.attFileType.toLowerCase().split(','); + if(acceptedExtensions.includes(extension)){ + return false + } + return true + }, + getExtension(filePath) { + // 分割字符串,以 '.' 为分隔符 + const parts = filePath.split('.'); + // 取最后一个部分作为后缀名 + const extension = parts.pop(); + return extension; + }, } } diff --git a/src/views/workflowList/addWorkflow/tool_release.vue b/src/views/workflowList/addWorkflow/tool_release.vue index d9b3814..21b703c 100644 --- a/src/views/workflowList/addWorkflow/tool_release.vue +++ b/src/views/workflowList/addWorkflow/tool_release.vue @@ -72,6 +72,25 @@ + @@ -205,40 +224,37 @@
- 上传 + +
- + - - - - - - - - - - - - - - + +