diff --git a/ReadMe.md b/ReadMe.md index 8e07fe7..c092c9a 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -261,7 +261,7 @@ docker compose up -d - [x] 系统监控后端返回403停止请求 - [x] 优化用户配置权限逻辑,配置后热更新逻辑等 - [x] 完善后端注释,有需要添加ReadMe文档 -- [ ] Redis中获取活跃用户 +- [x] 获取Redis中活跃用户 ## 前后端接口规范 diff --git a/src/api/v1/system/adminUser.ts b/src/api/v1/system/adminUser.ts index c6fadd4..88882b8 100644 --- a/src/api/v1/system/adminUser.ts +++ b/src/api/v1/system/adminUser.ts @@ -110,3 +110,8 @@ export const updateUserinfo = (data: any) => { export const updateUserPassword = (data: any) => { return http.request>('put', 'user/private/update/password', { data }, { headers: { 'Content-Type': 'multipart/form-data' } }); }; + +/* 查询缓存中的已登录的用户 */ +export const getCacheLoggedInPage = (data: any) => { + return http.request>('get', `user/getCacheUserPage/${data.currentPage}/${data.pageSize}`, { data }); +}; diff --git a/src/components/Table/Userinfo/UserinfoDialog.vue b/src/components/Table/Userinfo/UserinfoDialog.vue index bbcfe4b..4ed4c6e 100644 --- a/src/components/Table/Userinfo/UserinfoDialog.vue +++ b/src/components/Table/Userinfo/UserinfoDialog.vue @@ -1,8 +1,8 @@ + + diff --git a/src/views/monitor/logged-in/utils/columns.ts b/src/views/monitor/logged-in/utils/columns.ts new file mode 100644 index 0000000..92ff5d8 --- /dev/null +++ b/src/views/monitor/logged-in/utils/columns.ts @@ -0,0 +1,25 @@ +import { $t } from '@/plugins/i18n'; + +export const columns: TableColumnList = [ + { + type: 'index', + index: (index: number) => index + 1, + label: $t("index"), + width: 60, + }, + { label: $t('adminUser_nickname'), prop: 'nickname', minWidth: 120 }, + { label: $t('adminUser_username'), prop: 'username', slot: 'username', minWidth: 120 }, + { label: $t('adminUser_email'), prop: 'email', minWidth: 120 }, + { label: $t('adminUser_phone'), prop: 'phone', minWidth: 120 }, + { label: $t('adminUser_summary'), prop: 'personDescription', minWidth: 150 }, + { label: $t('lastLoginIp'), prop: 'ipAddress', minWidth: 100 }, + { label: $t('lastLoginIpAddress'), prop: 'ipRegion', minWidth: 100 }, + { label: $t('expires'), prop: 'expires', minWidth: 120 }, + { label: $t('readMeDay'), prop: 'readMeDay', width: 100 }, + { + label: $t('table.operation'), + fixed: 'right', + width: 120, + slot: 'operation', + }, +]; diff --git a/src/views/monitor/scheduler-execute-log/utils/columns.ts b/src/views/monitor/scheduler-execute-log/utils/columns.ts index 1f54608..bf710e1 100644 --- a/src/views/monitor/scheduler-execute-log/utils/columns.ts +++ b/src/views/monitor/scheduler-execute-log/utils/columns.ts @@ -7,7 +7,7 @@ export const columns: TableColumnList = [ { type: 'index', index: (index: number) => index + 1, - label: '序号', + label: $t("index"), width: 60, }, // 任务名称 diff --git a/src/views/monitor/user-login-log/utils/columns.ts b/src/views/monitor/user-login-log/utils/columns.ts index d2392ba..2876e83 100644 --- a/src/views/monitor/user-login-log/utils/columns.ts +++ b/src/views/monitor/user-login-log/utils/columns.ts @@ -7,7 +7,7 @@ export const columns: TableColumnList = [ { type: 'index', index: (index: number) => index + 1, - label: '序号', + label: $t("index"), width: 60, }, // 用户名 diff --git a/src/views/scheduler/schedulers-group/utils/columns.ts b/src/views/scheduler/schedulers-group/utils/columns.ts index 82d7d2f..2a71eea 100644 --- a/src/views/scheduler/schedulers-group/utils/columns.ts +++ b/src/views/scheduler/schedulers-group/utils/columns.ts @@ -7,7 +7,7 @@ export const columns: TableColumnList = [ { type: 'index', index: (index: number) => index + 1, - label: '序号', + label: $t("index"), width: 60, }, // 分组名称 diff --git a/src/views/scheduler/schedulers/utils/columns.ts b/src/views/scheduler/schedulers/utils/columns.ts index 6eed3bb..269ea69 100644 --- a/src/views/scheduler/schedulers/utils/columns.ts +++ b/src/views/scheduler/schedulers/utils/columns.ts @@ -6,7 +6,7 @@ export const columns: TableColumnList = [ { type: 'index', index: (index: number) => index + 1, - label: '序号', + label: $t("index"), width: 60, }, // 任务名称 diff --git a/src/views/system/dept/utils/hooks.ts b/src/views/system/dept/utils/hooks.ts index 637cccc..432fffc 100644 --- a/src/views/system/dept/utils/hooks.ts +++ b/src/views/system/dept/utils/hooks.ts @@ -18,7 +18,7 @@ export async function onSearch() { } /** 添加部门 */ -export function onAdd(parentId: number = 0) { +export function onAdd(parentId: string = '0') { addDialog({ title: `${$t('addNew')}${$t('dept')}`, props: { diff --git a/src/views/system/files/components/files-dialog.vue b/src/views/system/files/components/files-dialog.vue index dd12b56..083118c 100644 --- a/src/views/system/files/components/files-dialog.vue +++ b/src/views/system/files/components/files-dialog.vue @@ -3,7 +3,7 @@ import { onMounted, ref } from 'vue'; import { FormInstance, genFileId, UploadProps, UploadRawFile } from 'element-plus'; import { addRules, FormProps, uploadRules } from '@/views/system/files/utils'; import { $t } from '@/plugins/i18n'; -import { useFilesStore } from '@/store/monitor/files'; +import { useFilesStore } from '@/store/system/files'; import { UploadFilled } from '@element-plus/icons-vue'; const props = withDefaults(defineProps(), { @@ -28,10 +28,7 @@ const upload = ref(); const form = ref(props.formInline); const filesStore = useFilesStore(); -/** - * * 修改时替换之前文件 - * @param files - */ +/* 修改时替换之前文件 */ const handleExceed: UploadProps['onExceed'] = (files) => { upload.value!.clearFiles(); const file = files[0] as UploadRawFile; diff --git a/src/views/system/files/index.vue b/src/views/system/files/index.vue index eb96fcb..5da26dc 100644 --- a/src/views/system/files/index.vue +++ b/src/views/system/files/index.vue @@ -5,7 +5,7 @@ import { PureTableBar } from '@/components/RePureTableBar'; import { selectUserinfo } from '@/components/Table/Userinfo/columns'; import { $t } from '@/plugins/i18n'; import { hasAuth } from '@/router/utils'; -import { useFilesStore } from '@/store/monitor/files'; +import { useFilesStore } from '@/store/system/files'; import { auth, columns, onAdd, onDelete, onDeleteBatch, onDownload, onDownloadBatch, onSearch, onUpdate, selectRows } from '@/views/system/files/utils'; import PureTable from '@pureadmin/table'; import { FormInstance } from 'element-plus'; diff --git a/src/views/system/files/utils/hooks.tsx b/src/views/system/files/utils/hooks.tsx index 15a0830..123fd3f 100644 --- a/src/views/system/files/utils/hooks.tsx +++ b/src/views/system/files/utils/hooks.tsx @@ -1,7 +1,7 @@ import { addDialog } from '@/components/ReDialog/index'; import FilesDialog from '@/views/system/files/components/files-dialog.vue'; -import { useFilesStore } from '@/store/monitor/files'; -import { h, ref, VNode } from 'vue'; +import { useFilesStore } from '@/store/system/files'; +import { h, ref } from 'vue'; import { messageBox } from '@/utils/message'; import type { FormItemProps } from '@/views/system/files/utils/types'; import { $t } from '@/plugins/i18n'; @@ -11,7 +11,7 @@ import type { UploadFiles } from 'element-plus'; // 选择的row列表 export const selectRows = ref([]); -export const formRef = ref(null); +export const formRef = ref(); const filesStore = useFilesStore(); /** 搜索初始化系统文件 */ @@ -28,17 +28,29 @@ export function onAdd() { props: { formInline: { + filename: undefined, + fileType: undefined, filepath: undefined, downloadCount: 0, files: [], - isAdd: false, + isUpload: false, }, }, draggable: true, fullscreenIcon: true, closeOnClickModal: false, contentRenderer: () => { - const dialog = h(FilesDialog, {}, []); + const dialog = h(FilesDialog, { + ref: formRef, + formInline: { + filename: undefined, + fileType: undefined, + filepath: undefined, + downloadCount: 0, + files: [], + isUpload: false, + }, + }); formRef.value = dialog; return dialog; }, @@ -83,7 +95,17 @@ export function onUpdate(row: any) { fullscreenIcon: true, closeOnClickModal: false, contentRenderer: () => { - const dialog = h(FilesDialog, { ref: formRef }, []); + const dialog = h(FilesDialog, { + ref: formRef, + formInline: { + filename: row.filename, + fileType: row.fileType, + filepath: row.filepath, + downloadCount: row.downloadCount, + isUpload: true, + files: undefined, + }, + }); formRef.value = dialog; return dialog; }, diff --git a/src/views/system/menu/utils/modules/hooks.tsx b/src/views/system/menu/utils/modules/hooks.tsx index 3032b95..fcb115d 100644 --- a/src/views/system/menu/utils/modules/hooks.tsx +++ b/src/views/system/menu/utils/modules/hooks.tsx @@ -40,8 +40,8 @@ function onAdd(parentId: any = 0) { icon: '', id: '', extraIcon: '', - enterTransition: 'fade-transform', - leaveTransition: 'fade-transform', + enterTransition: '', + leaveTransition: '', activePath: '', redirect: '', roles: [], @@ -58,7 +58,35 @@ function onAdd(parentId: any = 0) { draggable: true, closeOnClickModal: false, fullscreenIcon: true, - contentRenderer: () => h(EditForm, { ref: dialogFormRef }), + contentRenderer: () => + h(EditForm, { + ref: dialogFormRef, + formInline: { + menuType: 0, + higherMenuOptions: formatHigherMenuOptions(cloneDeep(menuStore.datalist)), + parentId, + title: '', + name: '', + path: '', + component: '', + rank: 99, + icon: '', + id: '', + extraIcon: '', + enterTransition: '', + leaveTransition: '', + activePath: '', + redirect: '', + roles: [], + frameSrc: '', + frameLoading: true, + keepAlive: false, + hiddenTag: false, + fixedTag: false, + showLink: true, + showParent: true, + }, + }), beforeSure: (done, { options }) => { const menuFormRef = dialogFormRef.value.menuFormRef; const curData = options.props.formInline as FormItemProps; @@ -115,7 +143,36 @@ function onUpdate(row?: FormItemProps) { fullscreen: deviceDetection(), fullscreenIcon: true, closeOnClickModal: false, - contentRenderer: () => h(EditForm, { ref: dialogFormRef }), + contentRenderer: () => + h(EditForm, { + ref: dialogFormRef, + formInline: { + id: row?.id, + menuType: row?.menuType, + higherMenuOptions: formatHigherMenuOptions(cloneDeep(menuStore.datalist)), + parentId: row?.parentId, + title: row?.title, + name: row?.name, + path: row?.path, + component: row?.component, + rank: row?.rank, + icon: row?.icon, + frameSrc: row?.frameSrc, + extraIcon: row?.extraIcon, + // 因为要使用动画需要在前面加上 animate__ 修改时需要手动去除 + enterTransition: row?.enterTransition?.replace('animate__', ''), + // 因为要使用动画需要在前面加上 animate__ 修改时需要手动去除 + leaveTransition: row?.leaveTransition?.replace('animate__', ''), + activePath: row?.activePath, + frameLoading: row?.frameLoading, + keepAlive: row?.keepAlive, + hiddenTag: row?.hiddenTag, + fixedTag: row?.fixedTag, + showLink: row?.showLink, + showParent: row?.showParent, + redirect: row?.redirect, + }, + }), beforeSure: (done, { options }) => { const menuFormRef = dialogFormRef.value.menuFormRef; const curData = options.props.formInline as FormItemProps; diff --git a/src/views/system/permission/index.vue b/src/views/system/permission/index.vue index 8fae727..1ff0286 100644 --- a/src/views/system/permission/index.vue +++ b/src/views/system/permission/index.vue @@ -175,7 +175,7 @@ onMounted(() => { - 更多操作 + {{ $t('more_actions') }}