From c646c95c7b1c470fa8fe8c662e3ae5c8ccc2b607 Mon Sep 17 00:00:00 2001 From: dataprince Date: Sun, 3 Dec 2023 09:35:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E2=80=9C=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E2=80=9D=E6=A8=A1=E5=9D=97=EF=BC=8C=E6=95=B4?= =?UTF-8?q?=E5=90=88MinIO?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- flex-ui/src/plugins/download.js | 27 ++++++++++++++++- flex-ui/src/router/index.js | 28 ++++++++++++++++++ flex-ui/src/utils/request.js | 8 +++++ flex-ui/src/views/login.vue | 3 +- pom.xml | 29 ++++++++----------- .../src/main/resources/application-prod.yml | 2 +- ruoyi-common/pom.xml | 1 + ruoyi-common/ruoyi-common-bom/pom.xml | 7 +++++ ruoyi-modules/ruoyi-system/pom.xml | 5 ++++ .../system/SysConfigController.java | 2 +- .../system/service/ISysConfigService.java | 8 +++++ .../service/impl/SysConfigServiceImpl.java | 17 +++++++++++ .../service/impl/SysDeptServiceImpl.java | 3 +- sql/update.sql | 4 ++- 14 files changed, 121 insertions(+), 23 deletions(-) diff --git a/flex-ui/src/plugins/download.js b/flex-ui/src/plugins/download.js index cac7d24..f4149fd 100644 --- a/flex-ui/src/plugins/download.js +++ b/flex-ui/src/plugins/download.js @@ -1,13 +1,38 @@ import axios from 'axios' -import { ElMessage } from 'element-plus' +import {ElLoading, ElMessage} from 'element-plus' import { saveAs } from 'file-saver' import { getToken } from '@/utils/auth' import errorCode from '@/utils/errorCode' import { blobValidate } from '@/utils/ruoyi' +import { globalHeaders } from '@/utils/request'; const baseURL = import.meta.env.VITE_APP_BASE_API export default { + async oss(ossId) { + const url = baseURL + '/resource/oss/download/' + ossId; + let downloadLoadingInstance = ElLoading.service({ text: '正在下载数据,请稍候', background: 'rgba(0, 0, 0, 0.7)' }); + try { + const res = await axios({ + method: 'get', + url: url, + responseType: 'blob', + headers: globalHeaders() + }); + const isBlob = blobValidate(res.data); + if (isBlob) { + const blob = new Blob([res.data], { type: 'application/octet-stream' }); + saveAs(blob, decodeURIComponent(res.headers['download-filename'])); + } else { + this.printErrMsg(res.data); + } + downloadLoadingInstance.close(); + } catch (r) { + console.error(r); + ElMessage.error('下载文件出现错误,请联系管理员!'); + downloadLoadingInstance.close(); + } + }, name(name, isDelete = true) { var url = baseURL + "/common/download?fileName=" + encodeURIComponent(name) + "&delete=" + isDelete axios({ diff --git a/flex-ui/src/router/index.js b/flex-ui/src/router/index.js index 83f2359..108bd91 100644 --- a/flex-ui/src/router/index.js +++ b/flex-ui/src/router/index.js @@ -129,6 +129,20 @@ export const dynamicRoutes = [ } ] }, + { + path: '/system/oss-config', + component: Layout, + hidden: true, + permissions: ['system:oss:list'], + children: [ + { + path: 'index', + component: () => import('@/views/system/oss/config.vue'), + name: 'OssConfig', + meta: { title: '配置管理', activeMenu: '/system/oss', icon: '' } + } + ] + }, { path: '/tool/gen-edit', component: Layout, @@ -142,6 +156,20 @@ export const dynamicRoutes = [ meta: { title: '修改生成配置', activeMenu: '/tool/gen', icon: '' } } ] + }, + { + path: '/check/one-person', + component: Layout, + hidden: true, + permissions: ['check:cadre:list'], + children: [ + { + path: 'index/:cadreId(\\d+)', + component: () => import('@/views/check/oneperson/onePersonAnalysis.vue'), + name: 'onePersonAnalysis', + meta: { title: '个人画像', activeMenu: '/check/oneperson', icon: '' } + } + ] } ] diff --git a/flex-ui/src/utils/request.js b/flex-ui/src/utils/request.js index 6b11269..983a5d9 100644 --- a/flex-ui/src/utils/request.js +++ b/flex-ui/src/utils/request.js @@ -10,8 +10,16 @@ import useUserStore from '@/store/modules/user' let downloadLoadingInstance; // 是否显示重新登录 export let isRelogin = { show: false }; +export const globalHeaders = () => { + return { + Authorization: 'Bearer ' + getToken(), + clientid: import.meta.env.VITE_APP_CLIENT_ID + }; +}; + axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8' +axios.defaults.headers['clientid'] = import.meta.env.VITE_APP_CLIENT_ID; // 创建axios实例 const service = axios.create({ // axios中请求配置有baseURL选项,表示请求URL公共部分 diff --git a/flex-ui/src/views/login.vue b/flex-ui/src/views/login.vue index 2905349..9535b65 100644 --- a/flex-ui/src/views/login.vue +++ b/flex-ui/src/views/login.vue @@ -1,13 +1,14 @@