From c27d7d4e1ee86d7d8b4e6581e7d2ef96717d028d Mon Sep 17 00:00:00 2001 From: xiangheng <11675084@qq.com> Date: Mon, 26 Feb 2024 12:39:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AF=BC=E5=85=A5=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E6=95=B0=E6=8D=AE=E4=B8=8B=E6=A0=87=E4=B8=8D=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/src/api/perms/admin.ts | 7 ++- admin/src/components/upload/index.vue | 16 ++++- .../verifition/Verify/VerifySlide.vue | 2 + .../views/setting/permission/admin/index.vue | 20 +++++- server/admin/system/admin/admin.go | 45 ++++++++++++++ server/admin/system/enter.go | 2 + server/main.go | 1 + server/util/excel/excel_import.go | 61 ++++++++++++------- 8 files changed, 129 insertions(+), 25 deletions(-) diff --git a/admin/src/api/perms/admin.ts b/admin/src/api/perms/admin.ts index 566e56e..66aef9e 100644 --- a/admin/src/api/perms/admin.ts +++ b/admin/src/api/perms/admin.ts @@ -1,6 +1,7 @@ import request from '@/utils/request' import queryString from 'query-string' import { getToken } from '@/utils/auth' +import config from '@/config' // 管理员列表 export function adminLists(params: any) { return request.get({ url: '/system/admin/list', params }) @@ -36,9 +37,13 @@ export function adminListByDeptId(params: any) { return request.get({ url: '/system/admin/ListByDeptId', params }) } +// 导入 +export const adminImportFile = '/system/admin/ImportFile' + // 导出 export function adminExportFile(params: any) { // return request.get({ url: '/system/admin/ExportFile', params }) return (window.location.href = - `/api/admin/system/admin/ExportFile?token=${getToken()}&` + queryString.stringify(params)) + `${config.baseUrl}${config.urlPrefix}/system/admin/ExportFile?token=${getToken()}&` + + queryString.stringify(params)) } diff --git a/admin/src/components/upload/index.vue b/admin/src/components/upload/index.vue index 8f4a5e9..7728e4e 100644 --- a/admin/src/components/upload/index.vue +++ b/admin/src/components/upload/index.vue @@ -49,6 +49,11 @@ import { RequestCodeEnum } from '@/enums/requestEnums' export default defineComponent({ components: {}, props: { + // 上传地址 + url: { + type: String, + default: '' + }, // 上传文件类型 type: { type: String, @@ -79,7 +84,16 @@ export default defineComponent({ setup(props, { emit }) { const userStore = useUserStore() const uploadRefs = shallowRef>() - const action = ref(`${config.baseUrl}${config.urlPrefix}/common/upload/${props.type}`) + let action = '' + if (props.url) { + if (props.url.startsWith('http')) { + action = props.url + } else { + action = `${config.baseUrl}${config.urlPrefix}${props.url}` + } + } else { + action = `${config.baseUrl}${config.urlPrefix}/common/upload/${props.type}` + } const headers = computed(() => ({ token: userStore.token, version: config.version diff --git a/admin/src/components/verifition/Verify/VerifySlide.vue b/admin/src/components/verifition/Verify/VerifySlide.vue index c4d0bf0..208bf1c 100644 --- a/admin/src/components/verifition/Verify/VerifySlide.vue +++ b/admin/src/components/verifition/Verify/VerifySlide.vue @@ -10,6 +10,7 @@ :style="{ width: setSize.imgWidth, height: setSize.imgHeight }" > + 导入 + +