From 2fcb54b57661a935cbe650610e31929e4af9dbfd Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 14 Mar 2021 00:58:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E6=96=87=E6=A1=A3=E7=9A=84=20html=E3=80=81word=E3=80=81markdow?= =?UTF-8?q?n=20=E7=9A=84=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/api/infra/dbDoc.js | 16 +++++++ ruoyi-ui/src/main.js | 8 +++- ruoyi-ui/src/utils/ruoyi.js | 15 +++++++ ruoyi-ui/src/views/tool/dbDoc/index.vue | 42 ++++++++++++++++--- .../controller/doc/InfDbDocController.java | 20 +++------ 5 files changed, 81 insertions(+), 20 deletions(-) diff --git a/ruoyi-ui/src/api/infra/dbDoc.js b/ruoyi-ui/src/api/infra/dbDoc.js index de54981d1..015c6d71d 100644 --- a/ruoyi-ui/src/api/infra/dbDoc.js +++ b/ruoyi-ui/src/api/infra/dbDoc.js @@ -8,3 +8,19 @@ export function exportHtml() { responseType: 'blob' }) } + +export function exportWord() { + return request({ + url: '/infra/db-doc/export-word', + method: 'get', + responseType: 'blob' + }) +} + +export function exportMarkdown() { + return request({ + url: '/infra/db-doc/export-markdown', + method: 'get', + responseType: 'blob' + }) +} diff --git a/ruoyi-ui/src/main.js b/ruoyi-ui/src/main.js index 91556bf68..e1f067fa1 100644 --- a/ruoyi-ui/src/main.js +++ b/ruoyi-ui/src/main.js @@ -25,7 +25,10 @@ import { download, handleTree, downloadExcel, - downloadZip + downloadWord, + downloadZip, + downloadHtml, + downloadMarkdown, } from "@/utils/ruoyi"; import Pagination from "@/components/Pagination"; // 自定义表格工具扩展 @@ -48,6 +51,9 @@ Vue.prototype.getDictDataLabel = getDictDataLabel Vue.prototype.DICT_TYPE = DICT_TYPE Vue.prototype.download = download Vue.prototype.downloadExcel = downloadExcel +Vue.prototype.downloadWord = downloadWord +Vue.prototype.downloadHtml = downloadHtml +Vue.prototype.downloadMarkdown = downloadMarkdown Vue.prototype.downloadZip = downloadZip Vue.prototype.handleTree = handleTree diff --git a/ruoyi-ui/src/utils/ruoyi.js b/ruoyi-ui/src/utils/ruoyi.js index 17f235f22..82f8aecc5 100644 --- a/ruoyi-ui/src/utils/ruoyi.js +++ b/ruoyi-ui/src/utils/ruoyi.js @@ -120,11 +120,26 @@ export function downloadExcel(data, fileName) { download0(data, fileName, 'application/vnd.ms-excel'); } +// 下载 Word 方法 +export function downloadWord(data, fileName) { + download0(data, fileName, 'application/msword'); +} + // 下载 Zip 方法 export function downloadZip(data, fileName) { download0(data, fileName, 'application/zip'); } +// 下载 Html 方法 +export function downloadHtml(data, fileName) { + download0(data, fileName, 'text/html'); +} + +// 下载 Markdown 方法 +export function downloadMarkdown(data, fileName) { + download0(data, fileName, 'text/markdown'); +} + function download0(data, fileName, mineType) { // 创建 blob let blob = new Blob([data], {type: mineType}); diff --git a/ruoyi-ui/src/views/tool/dbDoc/index.vue b/ruoyi-ui/src/views/tool/dbDoc/index.vue index e0c71564b..274d1372e 100644 --- a/ruoyi-ui/src/views/tool/dbDoc/index.vue +++ b/ruoyi-ui/src/views/tool/dbDoc/index.vue @@ -1,10 +1,21 @@