mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-10-26 20:57:11 +08:00
新增:新增系统管理/部门管理/查询列表功能,并将所有描述字段名从 notes 调整为 description,将部分前端方法名前缀从 query 调整为 get,以及去除部分冗余代码
This commit is contained in:
2
continew-admin-ui/components.d.ts
vendored
2
continew-admin-ui/components.d.ts
vendored
@@ -24,6 +24,7 @@ declare module '@vue/runtime-core' {
|
||||
ACol: typeof import('@arco-design/web-vue')['Col']
|
||||
AConfigProvider: typeof import('@arco-design/web-vue')['ConfigProvider']
|
||||
ADescriptions: typeof import('@arco-design/web-vue')['Descriptions']
|
||||
ADescriptionsItem: typeof import('@arco-design/web-vue')['DescriptionsItem']
|
||||
ADivider: typeof import('@arco-design/web-vue')['Divider']
|
||||
ADoption: typeof import('@arco-design/web-vue')['Doption']
|
||||
ADrawer: typeof import('@arco-design/web-vue')['Drawer']
|
||||
@@ -46,6 +47,7 @@ declare module '@vue/runtime-core' {
|
||||
AListItemMeta: typeof import('@arco-design/web-vue')['ListItemMeta']
|
||||
AMenu: typeof import('@arco-design/web-vue')['Menu']
|
||||
AMenuItem: typeof import('@arco-design/web-vue')['MenuItem']
|
||||
AModal: typeof import('@arco-design/web-vue')['Modal']
|
||||
AOption: typeof import('@arco-design/web-vue')['Option']
|
||||
APopover: typeof import('@arco-design/web-vue')['Popover']
|
||||
ARadio: typeof import('@arco-design/web-vue')['Radio']
|
||||
|
||||
@@ -47,7 +47,7 @@ export interface LoginLogListRes {
|
||||
list: LoginLogRecord[];
|
||||
total: number;
|
||||
}
|
||||
export function queryLoginLogList(params: LoginLogParams) {
|
||||
export function getLoginLogList(params: LoginLogParams) {
|
||||
return axios.get<LoginLogListRes>('/monitor/log/login', {
|
||||
params,
|
||||
paramsSerializer: (obj) => {
|
||||
@@ -66,7 +66,7 @@ export interface OperationLogListRes {
|
||||
list: OperationLogRecord[];
|
||||
total: number;
|
||||
}
|
||||
export function queryOperationLogList(params: OperationLogParams) {
|
||||
export function getOperationLogList(params: OperationLogParams) {
|
||||
return axios.get<OperationLogListRes>('/monitor/log/operation', {
|
||||
params,
|
||||
paramsSerializer: (obj) => {
|
||||
@@ -85,7 +85,7 @@ export interface SystemLogListRes {
|
||||
list: SystemLogRecord[];
|
||||
total: number;
|
||||
}
|
||||
export function querySystemLogList(params: SystemLogParams) {
|
||||
export function getSystemLogList(params: SystemLogParams) {
|
||||
return axios.get<SystemLogListRes>('/monitor/log/system', {
|
||||
params,
|
||||
paramsSerializer: (obj) => {
|
||||
@@ -94,6 +94,6 @@ export function querySystemLogList(params: SystemLogParams) {
|
||||
});
|
||||
}
|
||||
|
||||
export function querySystemLogDetail(logId: string) {
|
||||
export function getSystemLogDetail(logId: string) {
|
||||
return axios.get<SystemLogDetailRecord>(`/monitor/log/system/${logId}`);
|
||||
}
|
||||
@@ -21,7 +21,7 @@ export interface OnlineUserListRes {
|
||||
total: number;
|
||||
}
|
||||
|
||||
export function queryOnlineUserList(params: OnlineUserParams) {
|
||||
export function getOnlineUserList(params: OnlineUserParams) {
|
||||
return axios.get<OnlineUserListRes>('/monitor/online/user', {
|
||||
params,
|
||||
paramsSerializer: (obj) => {
|
||||
|
||||
30
continew-admin-ui/src/api/system/dept.ts
Normal file
30
continew-admin-ui/src/api/system/dept.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import axios from 'axios';
|
||||
|
||||
import qs from 'query-string';
|
||||
|
||||
export interface DeptRecord {
|
||||
deptId: string;
|
||||
deptName: string;
|
||||
parentId: string;
|
||||
deptSort: number;
|
||||
description: string;
|
||||
status: number;
|
||||
updateUserString: string;
|
||||
updateTime: string;
|
||||
children: Array<DeptRecord>,
|
||||
}
|
||||
|
||||
export interface DeptParams extends Partial<DeptRecord> {
|
||||
page: number;
|
||||
size: number;
|
||||
sort: Array<string>;
|
||||
}
|
||||
|
||||
export function getDeptList(params: DeptParams) {
|
||||
return axios.get<DeptRecord[]>('/system/dept', {
|
||||
params,
|
||||
paramsSerializer: (obj) => {
|
||||
return qs.stringify(obj);
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -8,6 +8,8 @@ import localeMonitor from '@/views/dashboard/monitor/locale/en-US';
|
||||
import localeDataAnalysis from '@/views/visualization/data-analysis/locale/en-US';
|
||||
import localeMultiDAnalysis from '@/views/visualization/multi-dimension-data-analysis/locale/en-US';
|
||||
|
||||
import localeDept from '@/views/system/dept/locale/en-US';
|
||||
|
||||
import localeOnlineUser from '@/views/monitor/online/locale/en-US';
|
||||
import localeLoginLog from '@/views/monitor/log/login/locale/en-US';
|
||||
import localeOperationLog from '@/views/monitor/log/operation/locale/en-US';
|
||||
@@ -39,6 +41,7 @@ export default {
|
||||
'menu.server.workplace': 'Workplace-Server',
|
||||
'menu.server.monitor': 'Monitor-Server',
|
||||
'menu.visualization': 'Data Visualization',
|
||||
'menu.system': 'System management',
|
||||
'menu.monitor': 'Monitor',
|
||||
'menu.list': 'List',
|
||||
'menu.form': 'Form',
|
||||
@@ -58,6 +61,8 @@ export default {
|
||||
...localeDataAnalysis,
|
||||
...localeMultiDAnalysis,
|
||||
|
||||
...localeDept,
|
||||
|
||||
...localeOnlineUser,
|
||||
...localeLoginLog,
|
||||
...localeOperationLog,
|
||||
|
||||
@@ -8,6 +8,8 @@ import localeMonitor from '@/views/dashboard/monitor/locale/zh-CN';
|
||||
import localeDataAnalysis from '@/views/visualization/data-analysis/locale/zh-CN';
|
||||
import localeMultiDAnalysis from '@/views/visualization/multi-dimension-data-analysis/locale/zh-CN';
|
||||
|
||||
import localeDept from '@/views/system/dept/locale/zh-CN';
|
||||
|
||||
import localeOnlineUser from '@/views/monitor/online/locale/zh-CN';
|
||||
import localeLoginLog from '@/views/monitor/log/login/locale/zh-CN';
|
||||
import localeOperationLog from '@/views/monitor/log/operation/locale/zh-CN';
|
||||
@@ -39,6 +41,7 @@ export default {
|
||||
'menu.server.workplace': '工作台-服务端',
|
||||
'menu.server.monitor': '实时监控-服务端',
|
||||
'menu.visualization': '数据可视化',
|
||||
'menu.system': '系统管理',
|
||||
'menu.monitor': '系统监控',
|
||||
'menu.list': '列表页',
|
||||
'menu.form': '表单页',
|
||||
@@ -58,6 +61,8 @@ export default {
|
||||
...localeDataAnalysis,
|
||||
...localeMultiDAnalysis,
|
||||
|
||||
...localeDept,
|
||||
|
||||
...localeOnlineUser,
|
||||
...localeLoginLog,
|
||||
...localeOperationLog,
|
||||
|
||||
@@ -9,7 +9,7 @@ const EXCEPTION: AppRouteRecordRaw = {
|
||||
locale: 'menu.exception',
|
||||
requiresAuth: true,
|
||||
icon: 'icon-exclamation-circle',
|
||||
order: 7,
|
||||
order: 8,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ const FORM: AppRouteRecordRaw = {
|
||||
locale: 'menu.form',
|
||||
icon: 'icon-settings',
|
||||
requiresAuth: true,
|
||||
order: 4,
|
||||
order: 5,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ const LIST: AppRouteRecordRaw = {
|
||||
locale: 'menu.list',
|
||||
requiresAuth: true,
|
||||
icon: 'icon-list',
|
||||
order: 3,
|
||||
order: 4,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ const Monitor: AppRouteRecordRaw = {
|
||||
locale: 'menu.monitor',
|
||||
requiresAuth: true,
|
||||
icon: 'icon-computer',
|
||||
order: 2,
|
||||
order: 3,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ const PROFILE: AppRouteRecordRaw = {
|
||||
locale: 'menu.profile',
|
||||
requiresAuth: true,
|
||||
icon: 'icon-file',
|
||||
order: 5,
|
||||
order: 6,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ const RESULT: AppRouteRecordRaw = {
|
||||
locale: 'menu.result',
|
||||
icon: 'icon-check-circle',
|
||||
requiresAuth: true,
|
||||
order: 6,
|
||||
order: 7,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
|
||||
28
continew-admin-ui/src/router/routes/modules/system.ts
Normal file
28
continew-admin-ui/src/router/routes/modules/system.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { DEFAULT_LAYOUT } from '../base';
|
||||
import { AppRouteRecordRaw } from '../types';
|
||||
|
||||
const System: AppRouteRecordRaw = {
|
||||
path: '/system',
|
||||
name: 'system',
|
||||
component: DEFAULT_LAYOUT,
|
||||
meta: {
|
||||
locale: 'menu.system',
|
||||
requiresAuth: true,
|
||||
icon: 'icon-settings',
|
||||
order: 2,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: '/system/dept',
|
||||
name: 'Dept',
|
||||
component: () => import('@/views/system/dept/index.vue'),
|
||||
meta: {
|
||||
locale: 'menu.system.dept.list',
|
||||
requiresAuth: true,
|
||||
roles: ['*'],
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default System;
|
||||
@@ -9,7 +9,7 @@ const USER: AppRouteRecordRaw = {
|
||||
locale: 'menu.user',
|
||||
icon: 'icon-user',
|
||||
requiresAuth: true,
|
||||
order: 8,
|
||||
order: 9,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@ const useLoginStore = defineStore('user', {
|
||||
phone: undefined,
|
||||
email: '',
|
||||
avatar: undefined,
|
||||
notes: undefined,
|
||||
description: undefined,
|
||||
pwdResetTime: undefined,
|
||||
registrationDate: undefined,
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ export interface UserState {
|
||||
phone?: string;
|
||||
email: string;
|
||||
avatar?: string;
|
||||
notes?: string;
|
||||
description?: string;
|
||||
pwdResetTime?: string;
|
||||
registrationDate?: string;
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref, reactive } from 'vue';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import { queryLoginLogList, LoginLogRecord, LoginLogParams } from '@/api/monitor/log';
|
||||
import { getLoginLogList, LoginLogRecord, LoginLogParams } from '@/api/monitor/log';
|
||||
import { Pagination } from '@/types/global';
|
||||
import { PaginationProps } from '@arco-design/web-vue';
|
||||
import type { SelectOptionData } from '@arco-design/web-vue/es/select/interface';
|
||||
@@ -171,7 +171,7 @@
|
||||
) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const { data } = await queryLoginLogList(params);
|
||||
const { data } = await getLoginLogList(params);
|
||||
renderData.value = data.list;
|
||||
pagination.current = params.page;
|
||||
pagination.total = data.total;
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref, reactive } from 'vue';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import { queryOperationLogList, OperationLogRecord, OperationLogParams } from '@/api/monitor/log';
|
||||
import { getOperationLogList, OperationLogRecord, OperationLogParams } from '@/api/monitor/log';
|
||||
import { Pagination } from '@/types/global';
|
||||
import { PaginationProps } from '@arco-design/web-vue';
|
||||
import type { SelectOptionData } from '@arco-design/web-vue/es/select/interface';
|
||||
@@ -181,7 +181,7 @@
|
||||
) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const { data } = await queryOperationLogList(params);
|
||||
const { data } = await getOperationLogList(params);
|
||||
renderData.value = data.list;
|
||||
pagination.current = params.page;
|
||||
pagination.total = data.total;
|
||||
|
||||
@@ -227,9 +227,9 @@
|
||||
import { computed, ref, reactive } from 'vue';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import {
|
||||
querySystemLogDetail,
|
||||
getSystemLogDetail,
|
||||
SystemLogDetailRecord,
|
||||
querySystemLogList,
|
||||
getSystemLogList,
|
||||
SystemLogRecord,
|
||||
SystemLogParams,
|
||||
} from '@/api/monitor/log';
|
||||
@@ -352,7 +352,7 @@
|
||||
) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const { data } = await querySystemLogList(params);
|
||||
const { data } = await getSystemLogList(params);
|
||||
renderData.value = data.list;
|
||||
pagination.current = params.page;
|
||||
pagination.total = data.total;
|
||||
@@ -373,7 +373,7 @@
|
||||
visible.value = true;
|
||||
detailLoading.value = true;
|
||||
try {
|
||||
const { data } = await querySystemLogDetail(logId);
|
||||
const { data } = await getSystemLogDetail(logId);
|
||||
renderDetailData.value = data;
|
||||
} finally {
|
||||
detailLoading.value = false;
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
import { computed, ref, reactive } from 'vue';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import { queryOnlineUserList, OnlineUserRecord, OnlineUserParams, kickout } from '@/api/monitor/online';
|
||||
import { getOnlineUserList, OnlineUserRecord, OnlineUserParams, kickout } from '@/api/monitor/online';
|
||||
import { Pagination } from '@/types/global';
|
||||
import { PaginationProps } from '@arco-design/web-vue';
|
||||
import type { TableColumnData } from '@arco-design/web-vue/es/table/interface';
|
||||
@@ -83,7 +83,6 @@
|
||||
const queryFormRef = ref<FormInstance>();
|
||||
const queryFormData = ref({
|
||||
nickname: '',
|
||||
status: undefined,
|
||||
loginTime: [],
|
||||
});
|
||||
|
||||
@@ -159,7 +158,7 @@
|
||||
) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const { data } = await queryOnlineUserList(params);
|
||||
const { data } = await getOnlineUserList(params);
|
||||
renderData.value = data.list;
|
||||
pagination.current = params.page;
|
||||
pagination.total = data.total;
|
||||
|
||||
182
continew-admin-ui/src/views/system/dept/index.vue
Normal file
182
continew-admin-ui/src/views/system/dept/index.vue
Normal file
@@ -0,0 +1,182 @@
|
||||
<template>
|
||||
<div class="container">
|
||||
<Breadcrumb :items="['menu.system', 'menu.system.dept.list']" />
|
||||
<a-card class="general-card">
|
||||
<a-row :gutter="20">
|
||||
<a-col>
|
||||
<!-- 工具栏 -->
|
||||
<div class="head-container">
|
||||
<a-form ref="queryFormRef" :model="queryFormData" layout="inline">
|
||||
<a-form-item field="deptName" hide-label>
|
||||
<a-input
|
||||
v-model="queryFormData.deptName"
|
||||
placeholder="输入部门名称搜索"
|
||||
allow-clear
|
||||
style="width: 150px;"
|
||||
@press-enter="toQuery"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item field="status" hide-label>
|
||||
<a-select
|
||||
v-model="queryFormData.status"
|
||||
:options="statusOptions"
|
||||
placeholder="状态搜索"
|
||||
allow-clear
|
||||
style="width: 150px;"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-button type="primary" @click="toQuery">
|
||||
<template #icon>
|
||||
<icon-search />
|
||||
</template>
|
||||
查询
|
||||
</a-button>
|
||||
<a-button @click="resetQuery">
|
||||
<template #icon>
|
||||
<icon-refresh />
|
||||
</template>
|
||||
重置
|
||||
</a-button>
|
||||
</a-form>
|
||||
</div>
|
||||
|
||||
<!-- 表格渲染 -->
|
||||
<a-table
|
||||
:columns="columns"
|
||||
:data="renderData"
|
||||
:pagination="false"
|
||||
:default-expand-all-rows="true"
|
||||
:hide-expand-button-on-empty="true"
|
||||
ref="tableRef"
|
||||
row-key="deptId"
|
||||
:bordered="false"
|
||||
:stripe="true"
|
||||
:loading="loading"
|
||||
size="large"
|
||||
>
|
||||
<template #status="{ record }">
|
||||
<a-switch v-model="record.status" :checked-value="1" :unchecked-value="2" />
|
||||
</template>
|
||||
</a-table>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import { Message, TableInstance } from '@arco-design/web-vue';
|
||||
import { getDeptList, DeptRecord, DeptParams } from '@/api/system/dept';
|
||||
import type { TableColumnData } from '@arco-design/web-vue/es/table/interface';
|
||||
import { FormInstance } from '@arco-design/web-vue/es/form';
|
||||
import { SelectOptionData } from '@arco-design/web-vue/es/select/interface';
|
||||
|
||||
const { loading, setLoading } = useLoading(true);
|
||||
const tableRef = ref<TableInstance>();
|
||||
const queryFormRef = ref<FormInstance>();
|
||||
const queryFormData = ref({
|
||||
deptName: '',
|
||||
status: undefined,
|
||||
});
|
||||
const statusOptions = computed<SelectOptionData[]>(() => [
|
||||
{
|
||||
label: '启用',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: '禁用',
|
||||
value: 2,
|
||||
},
|
||||
]);
|
||||
|
||||
// 查询
|
||||
const toQuery = () => {
|
||||
fetchData({
|
||||
...queryFormData.value,
|
||||
} as unknown as DeptParams);
|
||||
};
|
||||
|
||||
// 重置
|
||||
const resetQuery = async () => {
|
||||
await queryFormRef.value?.resetFields();
|
||||
await fetchData();
|
||||
};
|
||||
|
||||
const renderData = ref<DeptRecord[]>([]);
|
||||
const columns = computed<TableColumnData[]>(() => [
|
||||
{
|
||||
title: '部门名称',
|
||||
dataIndex: 'deptName',
|
||||
},
|
||||
{
|
||||
title: '部门排序',
|
||||
dataIndex: 'deptSort',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
slotName: 'status',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '描述',
|
||||
dataIndex: 'description',
|
||||
},
|
||||
{
|
||||
title: '修改人',
|
||||
dataIndex: 'updateUserString',
|
||||
},
|
||||
{
|
||||
title: '修改时间',
|
||||
dataIndex: 'updateTime',
|
||||
},
|
||||
]);
|
||||
|
||||
// 分页查询列表
|
||||
const fetchData = async (
|
||||
params: DeptParams = { page: 1, size: 10, sort: ['parentId,asc', 'deptSort,asc', 'createTime,desc'] }
|
||||
) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const { data } = await getDeptList(params);
|
||||
renderData.value = data;
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
setTimeout(function() {
|
||||
tableRef.value?.expandAll();
|
||||
}, 0);
|
||||
};
|
||||
fetchData();
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'Dept',
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.container {
|
||||
padding: 0 20px 20px 20px;
|
||||
}
|
||||
|
||||
.general-card {
|
||||
padding-top: 25px;
|
||||
}
|
||||
|
||||
.head-container {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
:deep(.arco-table-th) {
|
||||
&:last-child {
|
||||
.arco-table-th-item-title {
|
||||
margin-left: 16px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
3
continew-admin-ui/src/views/system/dept/locale/en-US.ts
Normal file
3
continew-admin-ui/src/views/system/dept/locale/en-US.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export default {
|
||||
'menu.system.dept.list': 'Department management',
|
||||
};
|
||||
3
continew-admin-ui/src/views/system/dept/locale/zh-CN.ts
Normal file
3
continew-admin-ui/src/views/system/dept/locale/zh-CN.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export default {
|
||||
'menu.system.dept.list': '部门管理',
|
||||
};
|
||||
@@ -46,7 +46,7 @@
|
||||
import { computed, ref, reactive } from 'vue';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import { useLoginStore } from '@/store';
|
||||
import { queryOperationLogList, OperationLogRecord, OperationLogParams } from '@/api/monitor/log';
|
||||
import { getOperationLogList, OperationLogRecord, OperationLogParams } from '@/api/monitor/log';
|
||||
import { Pagination } from '@/types/global';
|
||||
import type { TableColumnData } from '@arco-design/web-vue/es/table/interface';
|
||||
import { PaginationProps } from "@arco-design/web-vue";
|
||||
@@ -109,7 +109,7 @@
|
||||
) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const { data } = await queryOperationLogList(params);
|
||||
const { data } = await getOperationLogList(params);
|
||||
renderData.value = data.list;
|
||||
pagination.current = params.page;
|
||||
pagination.total = data.total;
|
||||
|
||||
@@ -171,7 +171,7 @@
|
||||
captchaBtnNameKey.value = t('userCenter.securitySettings.updateEmail.form.reSendCaptcha');
|
||||
captchaDisable.value = false;
|
||||
}
|
||||
}, 1000)
|
||||
}, 1000);
|
||||
}
|
||||
} catch (err) {
|
||||
resetCaptcha();
|
||||
|
||||
Reference in New Issue
Block a user