From db335073928bd0bd3af0d63465dd443e9d32f228 Mon Sep 17 00:00:00 2001 From: BianLzhaoMin <11485688+bianliangzhaomin123@user.noreply.gitee.com> Date: Wed, 19 Nov 2025 13:25:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.js | 38 +++++++----- src/utils/request.js | 34 +++++++++++ .../docCenter/components/rightTable.vue | 58 ++++++++++++++++--- .../docCenter/components/tableCom/addCopy.vue | 19 +++++- 4 files changed, 123 insertions(+), 26 deletions(-) diff --git a/src/main.js b/src/main.js index da01750..e2ca2b6 100644 --- a/src/main.js +++ b/src/main.js @@ -12,25 +12,32 @@ import store from './store' import router from './router' import directive from './directive' // directive import plugins from './plugins' // plugins -import { download } from '@/utils/request' +import { download, downloadGet } from '@/utils/request' import './assets/icons' // icon import './permission' // permission control -import { getDicts } from "@/api/system/dict/data" -import { getConfigKey } from "@/api/system/config" -import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi" +import { getDicts } from '@/api/system/dict/data' +import { getConfigKey } from '@/api/system/config' +import { + parseTime, + resetForm, + addDateRange, + selectDictLabel, + selectDictLabels, + handleTree, +} from '@/utils/ruoyi' // 分页组件 -import Pagination from "@/components/Pagination" +import Pagination from '@/components/Pagination' // 自定义表格工具组件 -import RightToolbar from "@/components/RightToolbar" +import RightToolbar from '@/components/RightToolbar' // 富文本组件 -import Editor from "@/components/Editor" +import Editor from '@/components/Editor' // 文件上传组件 -import FileUpload from "@/components/FileUpload" +import FileUpload from '@/components/FileUpload' // 图片上传组件 -import ImageUpload from "@/components/ImageUpload" +import ImageUpload from '@/components/ImageUpload' // 图片预览组件 -import ImagePreview from "@/components/ImagePreview" +import ImagePreview from '@/components/ImagePreview' // 字典标签组件 import DictTag from '@/components/DictTag' // 字典数据组件 @@ -45,6 +52,7 @@ Vue.prototype.addDateRange = addDateRange Vue.prototype.selectDictLabel = selectDictLabel Vue.prototype.selectDictLabels = selectDictLabels Vue.prototype.download = download +Vue.prototype.downloadGet = downloadGet Vue.prototype.handleTree = handleTree // 全局组件挂载 @@ -70,14 +78,14 @@ DictData.install() */ Vue.use(Element, { - size: Cookies.get('size') || 'medium' // set element-ui default size + size: Cookies.get('size') || 'medium', // set element-ui default size }) Vue.config.productionTip = false new Vue({ - el: '#app', - router, - store, - render: h => h(App) + el: '#app', + router, + store, + render: (h) => h(App), }) diff --git a/src/utils/request.js b/src/utils/request.js index 8a8de19..a160123 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -199,4 +199,38 @@ export function download(url, params, filename, config) { }) } +// 通用下载方法GET请求方式 +export function downloadGet(url, params, filename, config) { + downloadLoadingInstance = Loading.service({ + text: '正在下载数据,请稍候', + spinner: 'el-icon-loading', + background: 'rgba(0, 0, 0, 0.7)', + }) + return service + .get(url, { + params: params, + responseType: 'blob', + ...config, + }) + .then(async (data) => { + const isBlob = blobValidate(data) + if (isBlob) { + const blob = new Blob([data]) + saveAs(blob, filename) + } else { + const resText = await data.text() + const rspObj = JSON.parse(resText) + const errMsg = + errorCode[rspObj.code] || rspObj.msg || errorCode['default'] + Message.error(errMsg) + } + downloadLoadingInstance.close() + }) + .catch((r) => { + console.error(r) + Message.error('下载文件出现错误,请联系管理员!') + downloadLoadingInstance.close() + }) +} + export default service diff --git a/src/views/publicService/docCenter/components/rightTable.vue b/src/views/publicService/docCenter/components/rightTable.vue index de68d05..4482c21 100644 --- a/src/views/publicService/docCenter/components/rightTable.vue +++ b/src/views/publicService/docCenter/components/rightTable.vue @@ -76,6 +76,7 @@ {{ item.label }} @@ -300,7 +304,7 @@ export default { icon: 'el-icon-download', type: 'info', click: this.handleBatchDownload, - component: 'DownloadTags', + // component: 'DownloadTags', }, { label: '共享', @@ -321,7 +325,7 @@ export default { dropdownList: [ { label: '下载', - click: this.handleMove, + click: this.handleBatchDownload_1, }, { label: '移动', @@ -333,11 +337,11 @@ export default { }, { label: '共享', - click: this.handleShare, + click: this.handleShare_1, }, { label: '重命名', - click: this.handleMove, + click: this.handleMove_1, }, { label: '添加副本', @@ -549,10 +553,27 @@ export default { // 将选中的文件转换为下载组件需要的格式 this.selectedFilesForDownload = this.selectedRows.map((row) => ({ id: row.id, - name: row.name, })) - this.dialogConfig.outerTitle = '批量下载' - this.dialogConfig.outerVisible = true + + this.downloadGet( + 'screen/document/downLoad', + { + ids: this.selectedRows.map((row) => row.id).join(','), + }, + `文档_${new Date().getTime()}.zip`, + ) + }, + + // 下载 + handleBatchDownload_1(row) { + console.log(row, 9999) + // this.downloadGet( + // 'screen/document/downLoad', + // { + // id: row.id, + // }, + // `文档_${new Date().getTime()}.zip`, + // ) }, // 共享 @@ -574,6 +595,21 @@ export default { } }, + handleShare_1(row) { + this.selectedFilesForShare = [ + { + id: row.id, + name: row.name, + }, + ] + this.dialogConfig.outerTitle = '共享' + this.dialogConfig.outerVisible = true + this.dialogConfig.outerComponent = 'SharePermissionForm' + this.dialogConfig.outerComponentProps = { + selectedFiles: this.selectedFilesForShare, + } + }, + // 添加副本 handleAddCopy() { if (this.selectedRows.length === 0) { @@ -708,6 +744,12 @@ export default { // 这里可以根据搜索值进行数据筛选 // this.$modal.msgSuccess('搜索功能待实现') }, + + // 处理下拉菜单点击 + handleCommand(command) { + // console.log('下拉菜单点击', command) + command.item.click(command.row) + }, }, } diff --git a/src/views/publicService/docCenter/components/tableCom/addCopy.vue b/src/views/publicService/docCenter/components/tableCom/addCopy.vue index e4d91da..6578fb4 100644 --- a/src/views/publicService/docCenter/components/tableCom/addCopy.vue +++ b/src/views/publicService/docCenter/components/tableCom/addCopy.vue @@ -89,13 +89,23 @@ export default { }, // 添加副本 - async moveDocument(fileId, targetParentId, parentId, parentIds) { + async moveDocument( + fileId, + targetParentId, + parentId, + parentIds, + type, + toType, + publicFolderId, + ) { const params = { id: fileId, - toId: targetParentId, newParentId: targetParentId, - parentId: parentId, + parentId, parentIds: parentIds, + type, + toType, + publicFolderId, } try { const res = await copyDocCenterAPI(params) @@ -129,6 +139,9 @@ export default { this.selectedFolder.id, file.parentId, file.parentIds, + file.type, + this.selectedFolder.type, + file.publicFolderId, ), )