From 21c38dbce0b0b8bb1bc6ffb203611f0508d271b7 Mon Sep 17 00:00:00 2001 From: smallbun <2689170096@qq.com> Date: Wed, 13 Sep 2023 22:10:12 +0800 Subject: [PATCH] =?UTF-8?q?:zap:=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/console-fe/config/routes.ts | 55 ++++++++----------- .../src/main/console-fe/src/locales/zh-CN.ts | 1 + .../UserGroupDetail/UserGroupDetail.tsx | 3 + .../components/AddUserGroup/AddUserGroup.tsx | 3 + .../components/AppBasic/AppBasic.tsx | 55 +++++++++++-------- .../src/pages/app/AppConfig/data.d.ts | 1 + .../src/pages/app/AppConfig/locales/zh-CN.ts | 4 +- .../src/pages/app/AppCreate/AppCreate.tsx | 9 ++- .../src/pages/app/AppCreate/locales/zh-CN.ts | 1 + .../src/pages/app/AppGroup/AppGroup.tsx | 26 +++++++-- .../src/pages/app/AppGroup/locales/zh-CN.ts | 4 +- .../src/pages/app/AppList/AppList.tsx | 22 +++++--- .../components/MailTemplate/MailTemplate.tsx | 3 +- .../main/console-fe/src/services/upload.ts | 4 +- .../pojo/result/AppGroupListResult.java | 2 +- 15 files changed, 117 insertions(+), 76 deletions(-) diff --git a/eiam-console/src/main/console-fe/config/routes.ts b/eiam-console/src/main/console-fe/config/routes.ts index c5094337..be244eef 100644 --- a/eiam-console/src/main/console-fe/config/routes.ts +++ b/eiam-console/src/main/console-fe/config/routes.ts @@ -139,39 +139,28 @@ export default [ name: 'app', icon: 'AppstoreOutlined', path: '/app', - routes: [ - // 应用列表 - { - path: '/app', - redirect: '/app/list', - }, - // 应用列表 - { - name: 'list', - path: '/app/list', - component: './app/AppList', - }, - //创建应用 - { - name: 'create', - path: '/app/list/create', - hideInMenu: true, - component: './app/AppCreate', - }, - //应用配置 - { - name: 'config', - path: '/app/list/config', - hideInMenu: true, - component: './app/AppConfig', - }, - // 应用分组 - { - name: 'group', - path: '/app/group', - component: './app/AppGroup', - }, - ], + component: './app/AppList', + }, + //创建应用 + { + name: 'app.create', + path: '/app/create', + hideInMenu: true, + component: './app/AppCreate', + }, + //应用配置 + { + name: 'app.config', + path: '/app/config', + hideInMenu: true, + component: './app/AppConfig', + }, + //应用分组 + { + name: 'app.group', + path: '/app/group', + hideInMenu: true, + component: './app/AppGroup', }, //行为审计 { diff --git a/eiam-console/src/main/console-fe/src/locales/zh-CN.ts b/eiam-console/src/main/console-fe/src/locales/zh-CN.ts index 6de41692..f74dc73f 100644 --- a/eiam-console/src/main/console-fe/src/locales/zh-CN.ts +++ b/eiam-console/src/main/console-fe/src/locales/zh-CN.ts @@ -98,6 +98,7 @@ export default { 'custom.selected.item': '项', 'custom.unchecked': '暂未选中', 'custom.search_button': '搜索', + 'custom.upload': '上传', ...menu, ...component, ...pages, diff --git a/eiam-console/src/main/console-fe/src/pages/account/UserGroupDetail/UserGroupDetail.tsx b/eiam-console/src/main/console-fe/src/pages/account/UserGroupDetail/UserGroupDetail.tsx index fee130d5..6cc303e0 100644 --- a/eiam-console/src/main/console-fe/src/pages/account/UserGroupDetail/UserGroupDetail.tsx +++ b/eiam-console/src/main/console-fe/src/pages/account/UserGroupDetail/UserGroupDetail.tsx @@ -108,6 +108,9 @@ export default () => { label={intl.formatMessage({ id: 'pages.account.user_group_detail.pro_descriptions.name', })} + fieldProps={{ + maxLength: 8, + }} copyable /> . */ -import { updateApp } from '@/services/app'; +import { getAllAppGroupList, updateApp } from '@/services/app'; import { ProCard, ProDescriptions } from '@ant-design/pro-components'; import { useAsyncEffect } from 'ahooks'; @@ -67,10 +67,11 @@ const AppBasic = (props: { appId: string }) => { */ const onSave = async (key: React.Key | React.Key[], record: GetApp): Promise => { //调用接口修改 - let params: Record = { + let params: Record = { id: record.id, name: record.name, remark: record.remark, + groupIds: record.groupIds, }; if (uploadIconUrl) { params = { ...params, icon: uploadIconUrl }; @@ -208,6 +209,22 @@ const AppBasic = (props: { appId: string }) => { ], }} /> + { + const { success, data } = await getAllAppGroupList({}, {}, {}); + if (success && data) { + return data.map((i) => { + return { label: i.name, value: i.id }; + }); + } + return []; + }} + fieldProps={{ rows: 2, maxLength: 20, maxTagCount: 'responsive', mode: 'multiple' }} + copyable={false} + /> { }} /> + - {app?.clientId && ( - <> - - - - )} { dataIndex="remark" label={intl.formatMessage({ id: 'pages.app.config.basic.remark' })} valueType={'textarea'} - fieldProps={{ rows: 2, maxLength: 20 }} + fieldProps={{ rows: 2, maxLength: 200 }} copyable={false} /> diff --git a/eiam-console/src/main/console-fe/src/pages/app/AppConfig/data.d.ts b/eiam-console/src/main/console-fe/src/pages/app/AppConfig/data.d.ts index 6e31e932..d831bc79 100644 --- a/eiam-console/src/main/console-fe/src/pages/app/AppConfig/data.d.ts +++ b/eiam-console/src/main/console-fe/src/pages/app/AppConfig/data.d.ts @@ -37,6 +37,7 @@ export type GetApp = { authorizationType: string; enabled: boolean; remark: string; + groupIds: string[]; }; /** diff --git a/eiam-console/src/main/console-fe/src/pages/app/AppConfig/locales/zh-CN.ts b/eiam-console/src/main/console-fe/src/pages/app/AppConfig/locales/zh-CN.ts index ea83818f..e7a7e5d2 100644 --- a/eiam-console/src/main/console-fe/src/pages/app/AppConfig/locales/zh-CN.ts +++ b/eiam-console/src/main/console-fe/src/pages/app/AppConfig/locales/zh-CN.ts @@ -16,10 +16,12 @@ * along with this program. If not, see . */ export default { - 'pages.app.config.basic': '基本配置', + 'pages.app.config.basic': '基本信息', 'pages.app.config.basic.name': '应用名称', 'pages.app.config.basic.name.rule.0.message': '应用名称为必填项', 'pages.app.config.basic.icon': '应用图标', + 'pages.app.config.basic.icon.rule.0.message': '应用图标为必填项', + 'pages.app.config.basic.icon.rule.1.message': '应用图标上传失败', 'pages.app.config.basic.icon.desc.1': '必须为 PNG/JPG 格式', 'pages.app.config.basic.icon.desc.2': '建议使用 256 * 256 像素方形图标', 'pages.app.config.basic.enabled': '应用状态', diff --git a/eiam-console/src/main/console-fe/src/pages/app/AppCreate/AppCreate.tsx b/eiam-console/src/main/console-fe/src/pages/app/AppCreate/AppCreate.tsx index a2e044fc..b97c1299 100644 --- a/eiam-console/src/main/console-fe/src/pages/app/AppCreate/AppCreate.tsx +++ b/eiam-console/src/main/console-fe/src/pages/app/AppCreate/AppCreate.tsx @@ -108,7 +108,7 @@ const CreateApp = (props: { onOk: () => { successModal.destroy(); history.push( - `/app/list/config?id=${result.id}&name=${values.name}&protocol=${protocol}`, + `/app/config?id=${result.id}&name=${values.name}&protocol=${protocol}`, ); }, }); @@ -131,9 +131,12 @@ const CreateApp = (props: { ]} /> { setLoading(true); const { success, data } = await getAllAppGroupList({}, {}, {}).finally(() => { diff --git a/eiam-console/src/main/console-fe/src/pages/app/AppCreate/locales/zh-CN.ts b/eiam-console/src/main/console-fe/src/pages/app/AppCreate/locales/zh-CN.ts index f8aada6b..ee5d0be8 100644 --- a/eiam-console/src/main/console-fe/src/pages/app/AppCreate/locales/zh-CN.ts +++ b/eiam-console/src/main/console-fe/src/pages/app/AppCreate/locales/zh-CN.ts @@ -24,6 +24,7 @@ export default { 'pages.app.create.header_title': '标准协议', 'pages.app.create.modal_form.title': '添加应用', 'pages.app.create.modal_form.name': '应用名称', + 'pages.app.create.modal_form.group': '应用分组', 'pages.app.create.modal_form.name.placeholder': '请输入应用名称', 'pages.app.create.modal_form.name.message': '应用名称为必填项', 'pages.app.create.modal_form.name.rule.0': '应用名称为必填项', diff --git a/eiam-console/src/main/console-fe/src/pages/app/AppGroup/AppGroup.tsx b/eiam-console/src/main/console-fe/src/pages/app/AppGroup/AppGroup.tsx index 5def7cd0..8f812461 100644 --- a/eiam-console/src/main/console-fe/src/pages/app/AppGroup/AppGroup.tsx +++ b/eiam-console/src/main/console-fe/src/pages/app/AppGroup/AppGroup.tsx @@ -23,7 +23,7 @@ import { useRef, useState } from 'react'; import CreateModal from './components/CreateModal'; import UpdateModal from './components/UpdateModal'; import { createAppGroup, removeAppGroup, updateAppGroup } from './service'; -import { useIntl } from '@@/exports'; +import { history, useIntl } from '@@/exports'; import { getAppGroupList } from '@/services/app'; export default () => { @@ -73,7 +73,7 @@ export default () => { )} {record.type === 'default' && ( - + {intl.formatMessage({ id: 'pages.app_group.list.column.type.default', })} @@ -108,10 +108,15 @@ export default () => { setId(record.id); setUpdateModalOpen(true); }} + style={{ + pointerEvents: record.type === 'default' ? 'none' : 'auto', + ...(record.type === 'default' ? { opacity: 0.2 } : {}), + }} > {intl.formatMessage({ id: 'app.update' })} , { cancelText={intl.formatMessage({ id: 'app.no' })} key="delete" > - + {intl.formatMessage({ id: 'app.delete' })} , @@ -144,7 +157,12 @@ export default () => { ]; return ( - + { + history.push('/app'); + }} + > columns={columns} actionRef={actionRef} diff --git a/eiam-console/src/main/console-fe/src/pages/app/AppGroup/locales/zh-CN.ts b/eiam-console/src/main/console-fe/src/pages/app/AppGroup/locales/zh-CN.ts index e0e8145e..4faf48dd 100644 --- a/eiam-console/src/main/console-fe/src/pages/app/AppGroup/locales/zh-CN.ts +++ b/eiam-console/src/main/console-fe/src/pages/app/AppGroup/locales/zh-CN.ts @@ -17,13 +17,15 @@ */ export default { 'pages.app_group.list.create': '创建分组', + 'pages.app_group.list.desc': + '应用分组管理是一种将多个应用程序或功能按照一定的逻辑或相关性进行组织和管理的方法。通过应用分组,可以更有效地管理大量应用程序,提供更好的用户体验。', 'pages.app_group.list.column.name': '分组名称', 'pages.app_group.list.column.code': '分组编码', 'pages.app_group.list.column.create_time': '创建时间', 'pages.app_group.list.column.remark': '备注', 'pages.app_group.list.column.app_count': '应用数量', 'pages.app_group.list.column.type': '分组类型', - 'pages.app_group.list.column.type.default': '系统默认', + 'pages.app_group.list.column.type.default': '内置', 'pages.app_group.list.column.type.custom': '自定义', 'pages.app_group.list.column.option': '操作', 'pages.app_group.list.actions.popconfirm.delete': '您确定要删除此应用分组?', diff --git a/eiam-console/src/main/console-fe/src/pages/app/AppList/AppList.tsx b/eiam-console/src/main/console-fe/src/pages/app/AppList/AppList.tsx index e6f29f57..9c0b617d 100644 --- a/eiam-console/src/main/console-fe/src/pages/app/AppList/AppList.tsx +++ b/eiam-console/src/main/console-fe/src/pages/app/AppList/AppList.tsx @@ -16,7 +16,7 @@ * along with this program. If not, see . */ import { getAllAppGroupList, getAppList } from '@/services/app'; -import { PlusOutlined, QuestionCircleOutlined } from '@ant-design/icons'; +import { PlusOutlined, QuestionCircleOutlined, GroupOutlined } from '@ant-design/icons'; import type { ActionType } from '@ant-design/pro-components'; import { PageContainer, ProList } from '@ant-design/pro-components'; import { App, Avatar, Button, Popconfirm, Space, Tag } from 'antd'; @@ -86,12 +86,21 @@ export default () => { key={'create'} type="primary" onClick={() => { - history.push('/app/list/create'); + history.push('/app/create'); }} > {intl.formatMessage({ id: 'pages.app.list.tool_bar_render.add_app' })} , + , ]} metas={{ title: { @@ -102,7 +111,7 @@ export default () => { { history.push( - `/app/list/config?id=${row.id}&protocol=${row.protocol}&name=${row.name}`, + `/app/config?id=${row.id}&protocol=${row.protocol}&name=${row.name}`, ); }} > @@ -177,7 +186,7 @@ export default () => { key="config" onClick={() => { history.push( - `/app/list/config?id=${row.id}&protocol=${row.protocol}&name=${row.name}`, + `/app/config?id=${row.id}&protocol=${row.protocol}&name=${row.name}`, ); }} > @@ -213,15 +222,12 @@ export default () => { , ], }, - status: { + groupId: { // 自己扩展的字段,主要用于筛选,不在列表中显示 title: intl.formatMessage({ id: 'pages.app.list.metas.group', }), valueType: 'select', - fieldProps: { - mode: 'multiple', - }, request: async () => { const { success, data } = await getAllAppGroupList({}, {}, {}); if (success && data) { diff --git a/eiam-console/src/main/console-fe/src/pages/setting/Message/components/MailTemplate/MailTemplate.tsx b/eiam-console/src/main/console-fe/src/pages/setting/Message/components/MailTemplate/MailTemplate.tsx index 01e81683..5314ed80 100644 --- a/eiam-console/src/main/console-fe/src/pages/setting/Message/components/MailTemplate/MailTemplate.tsx +++ b/eiam-console/src/main/console-fe/src/pages/setting/Message/components/MailTemplate/MailTemplate.tsx @@ -48,7 +48,7 @@ export default (props: { visible: boolean }) => { async function getList() { setLoading(true); // 加载列表 - const { success, result } = await getMailTemplateList(); + const { success, result } = await getMailTemplateList({}); if (success) { setDataSource(result); } @@ -76,6 +76,7 @@ export default (props: { visible: boolean }) => { * 浏览 * * @param browseTitle + * @param browseContent */ const browseOnClick = (browseTitle: string, browseContent: string) => { setTitle({`${browseTitle}`}); diff --git a/eiam-console/src/main/console-fe/src/services/upload.ts b/eiam-console/src/main/console-fe/src/services/upload.ts index caa1cb49..00ffd21c 100644 --- a/eiam-console/src/main/console-fe/src/services/upload.ts +++ b/eiam-console/src/main/console-fe/src/services/upload.ts @@ -22,14 +22,16 @@ import { request } from '@umijs/max'; * 上传文件 * @param file * @param fileName + * @param onUploadProgress * @returns */ export async function uploadFile( file: string | RcFile | Blob, fileName?: string, + onUploadProgress?: (progressEvent: ProgressEvent) => void, ): Promise> { const formData = new FormData(); formData.append('file', file); if (fileName) formData.append('fileName', fileName); - return request('/api/v1/storage/upload', { method: 'POST', data: formData }); + return request('/api/v1/storage/upload', { method: 'POST', data: formData, onUploadProgress }); } diff --git a/eiam-portal/src/main/java/cn/topiam/employee/portal/pojo/result/AppGroupListResult.java b/eiam-portal/src/main/java/cn/topiam/employee/portal/pojo/result/AppGroupListResult.java index 7add0ef0..f9982fff 100644 --- a/eiam-portal/src/main/java/cn/topiam/employee/portal/pojo/result/AppGroupListResult.java +++ b/eiam-portal/src/main/java/cn/topiam/employee/portal/pojo/result/AppGroupListResult.java @@ -41,7 +41,7 @@ public class AppGroupListResult implements Serializable { * 应用分组ID */ @Schema(description = "应用分组ID") - private String id; + private String id; /** * 应用分组名称