diff --git a/frontend/src/App.vue b/frontend/src/App.vue index c4dc390a69..cf038a28f2 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -18,10 +18,13 @@ import { watchStyle, watchTheme, setFavicon } from '@/utils/theme'; import { GetPlatformIconUrl } from '@/api/requrls/setting/config'; import { useUserStore } from '@/store'; + import { useRouter } from 'vue-router'; + import { WorkbenchRouteEnum } from './enums/routeEnum'; const appStore = useAppStore(); const userStore = useUserStore(); const licenseStore = useLicenseStore(); + const router = useRouter(); const { currentLocale } = useLocale(); const locale = computed(() => { @@ -61,7 +64,15 @@ console.log(error); } }); - onMounted(() => { - userStore.isLogin(); + const checkIsLogin = async () => { + const isLogin = await userStore.isLogin(); + const isLoginPage = window.location.hash === '#/login'; + if (isLoginPage && isLogin) { + // 当前页面为登录页面,且已经登录,跳转到首页 + router.push(WorkbenchRouteEnum.WORKBENCH); + } + }; + onMounted(async () => { + await checkIsLogin(); }); diff --git a/frontend/src/api/http/checkStatus.ts b/frontend/src/api/http/checkStatus.ts index 988580a3a7..4b19b56226 100644 --- a/frontend/src/api/http/checkStatus.ts +++ b/frontend/src/api/http/checkStatus.ts @@ -5,15 +5,19 @@ import useUser from '@/hooks/useUser'; export default function checkStatus(status: number, msg: string, errorMessageMode: ErrorMessageMode = 'message'): void { const { t } = useI18n(); - const { logout } = useUser(); + const { logout, setSalt, isLoginPage } = useUser(); let errMessage = ''; switch (status) { case 400: errMessage = `${msg}`; break; case 401: { - errMessage = msg || t('api.errMsg401'); - logout(); + setSalt(msg); + if (!isLoginPage()) { + // 不是登录页再调用logout + logout(); + errMessage = t('api.errMsg401'); + } break; } case 403: diff --git a/frontend/src/api/http/index.ts b/frontend/src/api/http/index.ts index 43a1339424..274d7b14a8 100644 --- a/frontend/src/api/http/index.ts +++ b/frontend/src/api/http/index.ts @@ -155,7 +155,6 @@ const transform: AxiosTransform = { } catch (e) { throw new Error(e as unknown as string); } - checkStatus(error?.response?.status, msg, errorMessageMode); return Promise.reject(error); }, diff --git a/frontend/src/api/modules/setting/usergroup.ts b/frontend/src/api/modules/setting/usergroup.ts index ea6352e2c0..59ded2fb31 100644 --- a/frontend/src/api/modules/setting/usergroup.ts +++ b/frontend/src/api/modules/setting/usergroup.ts @@ -1,65 +1,85 @@ import MSR from '@/api/http/index'; -import { - updateUserGroupU, - getUserGroupU, - addUserGroupU, - deleteUserGroupU, - getGlobalUSettingUrl, - editGlobalUSettingUrl, - postUserByUserGroupUrl, - deleteUserFromUserGroupUrl, - getUserListUrl, - addUserToUserGroupUrl, -} from '@/api/requrls/setting/usergroup'; +import * as ugUrl from '@/api/requrls/setting/usergroup'; import { TableQueryParams, CommonList } from '@/models/common'; -import { UserGroupItem, UserGroupAuthSetting, SaveGlobalUSettingData, UserTableItem } from '@/models/setting/usergroup'; +import { + UserGroupItem, + SystemUserGroupParams, + OrgUserGroupParams, + UserGroupAuthSetting, + SaveGlobalUSettingData, + UserTableItem, +} from '@/models/setting/usergroup'; -export function updateOrAddUserGroup(data: Partial) { +// 系统-创建或修改用户组 +export function updateOrAddUserGroup(data: SystemUserGroupParams) { return MSR.post({ - url: data.id ? updateUserGroupU : addUserGroupU, + url: data.id ? ugUrl.updateUserGroupU : ugUrl.addUserGroupU, + data, + }); +} +// 组织-创建或修改用户组 +export function updateOrAddOrgUserGroup(data: OrgUserGroupParams) { + return MSR.post({ + url: data.id ? ugUrl.updateOrgUserGroupU : ugUrl.addOrgUserGroupU, data, }); } -export function updateSocpe(data: Partial) { +export function updateSocpe(data: Partial) { return MSR.post({ - url: updateUserGroupU, + url: ugUrl.updateUserGroupU, data, }); } - +// 系统-获取用户组列表 export function getUserGroupList() { - return MSR.get({ url: getUserGroupU }); + return MSR.get({ url: ugUrl.getUserGroupU }); +} +// 组织-获取用户组列表 +export function getOrgUserGroupList(organizationId: string) { + return MSR.get({ url: `${ugUrl.getOrgUserGroupU}${organizationId}` }); +} +// 系统-删除用户组 +export function deleteUserGroup(id: string) { + return MSR.get({ url: `${ugUrl.deleteUserGroupU}${id}` }); } -export function deleteUserGroup(id: string) { - return MSR.get({ url: `${deleteUserGroupU}${id}` }); +// 组织-删除用户组 +export function deleteOrgUserGroup(id: string) { + return MSR.get({ url: `${ugUrl.deleteOrgUserGroupU}${id}` }); } export function getUsergroupInfo(id: string) { - return MSR.get({ url: `${getUserGroupU}${id}` }); + return MSR.get({ url: `${ugUrl.getUserGroupU}${id}` }); } +// 系统-获取用户组对应的权限配置 export function getGlobalUSetting(id: string) { - return MSR.get({ url: `${getGlobalUSettingUrl}${id}` }); + return MSR.get({ url: `${ugUrl.getGlobalUSettingUrl}${id}` }); +} +// 组织-获取用户组对应的权限配置 +export function getOrgUSetting(id: string) { + return MSR.get({ url: `${ugUrl.getOrgUSettingUrl}${id}` }); } +// 系统-编辑用户组对应的权限配置 export function saveGlobalUSetting(data: SaveGlobalUSettingData) { - return MSR.post({ url: editGlobalUSettingUrl, data }); + return MSR.post({ url: ugUrl.editGlobalUSettingUrl, data }); +} + +// 组织-编辑用户组对应的权限配置 +export function saveOrgUSetting(data: SaveGlobalUSettingData) { + return MSR.post({ url: ugUrl.editOrgUSettingUrl, data }); } export function postUserByUserGroup(data: TableQueryParams) { - return MSR.post>({ url: postUserByUserGroupUrl, data }); + return MSR.post>({ url: ugUrl.postUserByUserGroupUrl, data }); } export function deleteUserFromUserGroup(id: string) { - return MSR.get({ url: `${deleteUserFromUserGroupUrl}${id}` }); -} - -export function getUserList() { - return MSR.get({ url: getUserListUrl }); + return MSR.get({ url: `${ugUrl.deleteUserFromUserGroupUrl}${id}` }); } export function addUserToUserGroup(data: { roleId: string; userIds: string[] }) { - return MSR.post({ url: addUserToUserGroupUrl, data }); + return MSR.post({ url: ugUrl.addUserToUserGroupUrl, data }); } diff --git a/frontend/src/api/requrls/setting/organizationAndProject.ts b/frontend/src/api/requrls/setting/organizationAndProject.ts index bfe6653254..a795c84456 100644 --- a/frontend/src/api/requrls/setting/organizationAndProject.ts +++ b/frontend/src/api/requrls/setting/organizationAndProject.ts @@ -31,7 +31,7 @@ export const postModifyProjectUrl = '/system/project/update'; // 获取项目列表 export const postProjectTableUrl = '/system/project/page'; // 获取项目成员 -export const postProjectMemberUrl = '/system/project/member/list'; +export const postProjectMemberUrl = '/system/project/member-list'; // 添加项目 export const postAddProjectUrl = '/system/project/add'; // 添加项目成员 @@ -45,7 +45,7 @@ export const getProjectInfoUrl = '/system/project/get/'; // 删除项目 export const getDeleteProjectUrl = '/system/project/delete/'; // 系统-组织及项目,获取用户下拉选项 -export const getUserByOrgOrProjectUrl = '/system/user/get-option/'; +export const getUserByOrgOrProjectUrl = '/system/organization/get-option/'; // 启用项目 export const getEnableProjectUrl = '/system/project/enable/'; // 禁用项目 diff --git a/frontend/src/api/requrls/setting/usergroup.ts b/frontend/src/api/requrls/setting/usergroup.ts index a54df0ab51..8ade9f41f9 100644 --- a/frontend/src/api/requrls/setting/usergroup.ts +++ b/frontend/src/api/requrls/setting/usergroup.ts @@ -19,5 +19,26 @@ export const postUserByUserGroupUrl = `/user/role/relation/global/list`; export const addUserToUserGroupUrl = `/user/role/relation/global/add`; /** 删除用户组用户 */ export const deleteUserFromUserGroupUrl = `/user/role/relation/global/delete/`; -/** 获取所有用户 */ -export const getUserListUrl = '/system/user/list'; + +// 组织下的用户组 + +export const updateOrgUserGroupU = `/user/role/organization/update`; +/** 编辑用户组对应的权限配置 */ +export const editOrgUSettingUrl = `/user/role/organization/permission/update`; +/** 添加用户组 */ +export const addOrgUserGroupU = `/user/role/organization/add`; +/** 获取用户组对应的权限配置 */ +export const getOrgUSettingUrl = `/user/role/organization/permission/setting/`; +/** 获取用户组 */ +export const getOrgUserGroupU = `/user/role/organization/list/`; +/** 获取单个用户组信息 */ +export const getOrgUsergroupInfoU = `/user/role/organization/get/`; +/** 删除用户组 */ +export const deleteOrgUserGroupU = `/user/role/organization/delete/`; + +/** 根据用户组获取用户列表 */ +export const postOrgUserByUserGroupUrl = `/user/role/relation/organization/list`; +/** 创建用户组添加用户 */ +export const addOrgUserToUserGroupUrl = `/user/role/relation/organization/add`; +/** 删除用户组用户 */ +export const deleteOrgUserFromUserGroupUrl = `/user/role/relation/organization/delete/`; diff --git a/frontend/src/components/business/ms-user-selector/index.vue b/frontend/src/components/business/ms-user-selector/index.vue index 6bacf3c967..32bd3512b4 100644 --- a/frontend/src/components/business/ms-user-selector/index.vue +++ b/frontend/src/components/business/ms-user-selector/index.vue @@ -100,4 +100,3 @@ } ); -@/api/modules/setting/organizationAndProject diff --git a/frontend/src/config/pathMap.ts b/frontend/src/config/pathMap.ts index 1a11788aca..bc21e2ebd5 100644 --- a/frontend/src/config/pathMap.ts +++ b/frontend/src/config/pathMap.ts @@ -128,6 +128,20 @@ export const pathMap = [ permission: [], level: MENU_LEVEL[1], }, + { + key: 'SETTING_ORGANIZATION_USER_ROLE', // 系统设置-组织-用户组 + locale: 'menu.settings.organization.userGroup', + route: RouteEnum.SETTING_ORGANIZATION_USER_GROUP, + permission: [], + level: MENU_LEVEL[1], + }, + { + key: 'SETTING_ORGANIZATION_PROJECT', // 系统设置-组织-项目 + locale: 'menu.settings.organization.project', + route: RouteEnum.SETTING_ORGANIZATION_PROJECT, + permission: [], + level: MENU_LEVEL[1], + }, { key: 'SETTING_ORGANIZATION_SERVICE', // 系统设置-组织-服务集成 locale: 'menu.settings.organization.serviceIntegration', diff --git a/frontend/src/enums/routeEnum.ts b/frontend/src/enums/routeEnum.ts index 8cfbe2314b..22a615be67 100644 --- a/frontend/src/enums/routeEnum.ts +++ b/frontend/src/enums/routeEnum.ts @@ -46,6 +46,8 @@ export enum SettingRouteEnum { SETTING_SYSTEM_PLUGIN_MANAGEMENT = 'settingSystemPluginManagement', SETTING_ORGANIZATION = 'settingOrganization', SETTING_ORGANIZATION_MEMBER = 'settingOrganizationMember', + SETTING_ORGANIZATION_USER_GROUP = 'settingOrganizationUserGroup', + SETTING_ORGANIZATION_PROJECT = 'settingOrganizationProject', SETTING_ORGANIZATION_SERVICE = 'settingOrganizationService', SETTING_ORGANIZATION_LOG = 'settingOrganizationLog', } diff --git a/frontend/src/hooks/useUser.ts b/frontend/src/hooks/useUser.ts index bb8edd7afd..247c1dfabe 100644 --- a/frontend/src/hooks/useUser.ts +++ b/frontend/src/hooks/useUser.ts @@ -21,7 +21,17 @@ export default function useUser() { }); }; + const setSalt = (salt: string) => { + userStore.setSalt(salt); + }; + + const isLoginPage = () => { + return router.currentRoute.value.name === 'login'; + }; + return { logout, + setSalt, + isLoginPage, }; } diff --git a/frontend/src/locale/en-US/common.ts b/frontend/src/locale/en-US/common.ts index 48f1573462..b26c027b07 100644 --- a/frontend/src/locale/en-US/common.ts +++ b/frontend/src/locale/en-US/common.ts @@ -43,4 +43,5 @@ export default { 'common.unSaveLeaveTitle': 'Leave this page?', 'common.unSaveLeaveContent': 'The system may not save your changes', 'common.leave': 'Leave', + 'common.rename': 'Rename', }; diff --git a/frontend/src/locale/en-US/index.ts b/frontend/src/locale/en-US/index.ts index 5eb22a1dc1..77e17ff85b 100644 --- a/frontend/src/locale/en-US/index.ts +++ b/frontend/src/locale/en-US/index.ts @@ -42,6 +42,8 @@ export default { 'menu.settings.system.log': 'System Log', 'menu.settings.organization': 'Organization', 'menu.settings.organization.member': 'Member', + 'menu.settings.organization.userGroup': 'User Group', + 'menu.settings.organization.project': 'Project', 'menu.settings.organization.serviceIntegration': 'Service Integration', 'menu.settings.organization.log': 'Org Log', 'navbar.action.locale': 'Switch to English', diff --git a/frontend/src/locale/zh-CN/common.ts b/frontend/src/locale/zh-CN/common.ts index a34d36e3a8..91627b65d0 100644 --- a/frontend/src/locale/zh-CN/common.ts +++ b/frontend/src/locale/zh-CN/common.ts @@ -43,4 +43,5 @@ export default { 'common.unSaveLeaveTitle': '离开此页面?', 'common.unSaveLeaveContent': '系统可能不会保存你所做的更改', 'common.leave': '离开', + 'common.rename': '重命名', }; diff --git a/frontend/src/locale/zh-CN/index.ts b/frontend/src/locale/zh-CN/index.ts index 77b0c239d0..804ba13382 100644 --- a/frontend/src/locale/zh-CN/index.ts +++ b/frontend/src/locale/zh-CN/index.ts @@ -41,6 +41,8 @@ export default { 'menu.settings.system.log': '系统日志', 'menu.settings.organization': '组织', 'menu.settings.organization.member': '成员', + 'menu.settings.organization.userGroup': '用户组', + 'menu.settings.organization.project': '项目', 'menu.settings.organization.serviceIntegration': '服务集成', 'menu.settings.organization.log': '组织日志', 'navbar.action.locale': '切换为中文', diff --git a/frontend/src/models/setting/usergroup.ts b/frontend/src/models/setting/usergroup.ts index a73176674a..34d62d05d2 100644 --- a/frontend/src/models/setting/usergroup.ts +++ b/frontend/src/models/setting/usergroup.ts @@ -40,6 +40,18 @@ export interface UserGroupItem { pos: number; } +export interface SystemUserGroupParams { + id?: string; // 组ID + name?: string; // 名称 + scopeId?: string; // 组织ID + type?: string; // 组类型:SYSTEM | PROJECT | ORGANIZATION +} +export interface OrgUserGroupParams { + id?: string; // 组ID + name: string; + scopeId: string; // 组织ID +} + export interface UserGroupPermissionItem { id: string; name: string; diff --git a/frontend/src/router/routes/modules/setting.ts b/frontend/src/router/routes/modules/setting.ts index 42295fa369..e48a51f621 100644 --- a/frontend/src/router/routes/modules/setting.ts +++ b/frontend/src/router/routes/modules/setting.ts @@ -148,6 +148,26 @@ const Setting: AppRouteRecordRaw = { isTopMenu: true, }, }, + { + path: 'usergroup', + name: SettingRouteEnum.SETTING_ORGANIZATION_USER_GROUP, + component: () => import('@/views/setting/organization/usergroup/orgUserGroup.vue'), + meta: { + locale: 'menu.settings.organization.userGroup', + roles: ['*'], + isTopMenu: true, + }, + }, + { + path: 'project', + name: SettingRouteEnum.SETTING_ORGANIZATION_PROJECT, + component: () => import('@/views/setting/organization/project/orgProject.vue'), + meta: { + locale: 'menu.settings.organization.project', + roles: ['*'], + isTopMenu: true, + }, + }, { path: 'serviceIntegration', name: SettingRouteEnum.SETTING_ORGANIZATION_SERVICE, diff --git a/frontend/src/store/index.ts b/frontend/src/store/index.ts index 5a0c2beee7..dd2fdd4ca4 100644 --- a/frontend/src/store/index.ts +++ b/frontend/src/store/index.ts @@ -4,10 +4,9 @@ import useAppStore from './modules/app'; import useVisitStore from './modules/app/visit'; import useUserStore from './modules/user'; import { debouncePlugin } from './plugins'; -import useUserGroupStore from './modules/setting/usergroup'; import useTableStore from './modules/ms-table'; const pinia = createPinia().use(debouncePlugin).use(piniaPluginPersistedstate); -export { useAppStore, useUserStore, useVisitStore, useUserGroupStore, useTableStore }; +export { useAppStore, useUserStore, useVisitStore, useTableStore }; export default pinia; diff --git a/frontend/src/store/modules/setting/usergroup.ts b/frontend/src/store/modules/setting/organization/usergroup.ts similarity index 80% rename from frontend/src/store/modules/setting/usergroup.ts rename to frontend/src/store/modules/setting/organization/usergroup.ts index d9a4856b76..606979c4ad 100644 --- a/frontend/src/store/modules/setting/usergroup.ts +++ b/frontend/src/store/modules/setting/organization/usergroup.ts @@ -1,7 +1,7 @@ import { defineStore } from 'pinia'; -import { UserGroupState } from './types'; +import { UserGroupState } from '../types'; -const useUserGroupStore = defineStore('userGroup', { +const useOrgUserGroupStore = defineStore('orgUserGroup', { state: (): UserGroupState => ({ currentName: '', currentTitle: '', @@ -27,4 +27,4 @@ const useUserGroupStore = defineStore('userGroup', { }, }); -export default useUserGroupStore; +export default useOrgUserGroupStore; diff --git a/frontend/src/store/modules/setting/project/usergroup.ts b/frontend/src/store/modules/setting/project/usergroup.ts new file mode 100644 index 0000000000..ef67bd9784 --- /dev/null +++ b/frontend/src/store/modules/setting/project/usergroup.ts @@ -0,0 +1,30 @@ +import { defineStore } from 'pinia'; +import { UserGroupState } from '../types'; + +const useProjectUserGroupStore = defineStore('projectUserGroup', { + state: (): UserGroupState => ({ + currentName: '', + currentTitle: '', + currentId: '', + currentType: '', + currentInternal: false, + collapse: true, + }), + getters: { + userGroupInfo(state: UserGroupState): UserGroupState { + return state; + }, + }, + actions: { + // 设置当前用户组信息 + setInfo(partial: Partial) { + this.$patch(partial); + }, + // 设置用户组菜单开启关闭 + setCollapse(collapse: boolean) { + this.collapse = collapse; + }, + }, +}); + +export default useProjectUserGroupStore; diff --git a/frontend/src/store/modules/setting/system/usergroup.ts b/frontend/src/store/modules/setting/system/usergroup.ts new file mode 100644 index 0000000000..5fc16ea424 --- /dev/null +++ b/frontend/src/store/modules/setting/system/usergroup.ts @@ -0,0 +1,30 @@ +import { defineStore } from 'pinia'; +import { UserGroupState } from '../types'; + +const useSystemUserGroupStore = defineStore('systemUserGroup', { + state: (): UserGroupState => ({ + currentName: '', + currentTitle: '', + currentId: '', + currentType: '', + currentInternal: false, + collapse: true, + }), + getters: { + userGroupInfo(state: UserGroupState): UserGroupState { + return state; + }, + }, + actions: { + // 设置当前用户组信息 + setInfo(partial: Partial) { + this.$patch(partial); + }, + // 设置用户组菜单开启关闭 + setCollapse(collapse: boolean) { + this.collapse = collapse; + }, + }, +}); + +export default useSystemUserGroupStore; diff --git a/frontend/src/store/modules/user/index.ts b/frontend/src/store/modules/user/index.ts index 0c6b9b81de..fef4be42a3 100644 --- a/frontend/src/store/modules/user/index.ts +++ b/frontend/src/store/modules/user/index.ts @@ -8,7 +8,6 @@ import { useI18n } from '@/hooks/useI18n'; import type { LoginData } from '@/models/user'; import type { UserState } from './types'; -import { Message } from '@arco-design/web-vue'; const useUserStore = defineStore('user', { // 开启数据持久化 @@ -30,6 +29,7 @@ const useUserStore = defineStore('user', { accountId: undefined, certification: undefined, role: '', + salt: '', }), getters: { @@ -100,12 +100,15 @@ const useUserStore = defineStore('user', { if (appStore.currentOrgId === '') { appStore.setCurrentOrgId(res.lastOrganizationId || ''); } + return true; } catch (err) { - const { t } = useI18n(); - Message.error(t('message.loginExpired')); - this.logoutCallBack(); + return false; } }, + // 加盐 + setSalt(salt: string) { + this.$patch({ salt }); + }, }, }); diff --git a/frontend/src/store/modules/user/types.ts b/frontend/src/store/modules/user/types.ts index a75da21a76..eaa283f842 100644 --- a/frontend/src/store/modules/user/types.ts +++ b/frontend/src/store/modules/user/types.ts @@ -17,4 +17,6 @@ export interface UserState { certification?: number; role: RoleType; lastOrganizationId?: string; + // 盐 + salt: string; } diff --git a/frontend/src/views/login/components/login-form.vue b/frontend/src/views/login/components/login-form.vue index bc71d05a43..8de0cb38b8 100644 --- a/frontend/src/views/login/components/login-form.vue +++ b/frontend/src/views/login/components/login-form.vue @@ -62,8 +62,8 @@ import useLoading from '@/hooks/useLoading'; import { setLoginExpires } from '@/utils/auth'; import { GetLoginLogoUrl } from '@/api/requrls/setting/config'; - import type { LoginData } from '@/models/user'; + import { WorkbenchRouteEnum } from '@/enums/routeEnum'; const router = useRouter(); const { t } = useI18n(); @@ -121,7 +121,7 @@ const { redirect, ...othersQuery } = router.currentRoute.value.query; setLoginExpires(); router.push({ - name: (redirect as string) || 'settingSystemUser', + name: (redirect as string) || WorkbenchRouteEnum.WORKBENCH, query: { ...othersQuery, }, diff --git a/frontend/src/views/setting/organization/project/components/addProjectModal.vue b/frontend/src/views/setting/organization/project/components/addProjectModal.vue new file mode 100644 index 0000000000..776ff5a9e7 --- /dev/null +++ b/frontend/src/views/setting/organization/project/components/addProjectModal.vue @@ -0,0 +1,187 @@ + + + +@/api/modules/setting/organizationAndProject diff --git a/frontend/src/views/setting/organization/project/components/addUserModal.vue b/frontend/src/views/setting/organization/project/components/addUserModal.vue new file mode 100644 index 0000000000..e9d77e9370 --- /dev/null +++ b/frontend/src/views/setting/organization/project/components/addUserModal.vue @@ -0,0 +1,104 @@ + + + + + +@/api/modules/setting/organizationAndProject diff --git a/frontend/src/views/setting/organization/project/components/userDrawer.vue b/frontend/src/views/setting/organization/project/components/userDrawer.vue new file mode 100644 index 0000000000..1f44b8502a --- /dev/null +++ b/frontend/src/views/setting/organization/project/components/userDrawer.vue @@ -0,0 +1,164 @@ + + + +@/api/modules/setting/organizationAndProject diff --git a/frontend/src/views/setting/organization/project/locale/en-US.ts b/frontend/src/views/setting/organization/project/locale/en-US.ts new file mode 100644 index 0000000000..cd71d924e9 --- /dev/null +++ b/frontend/src/views/setting/organization/project/locale/en-US.ts @@ -0,0 +1,74 @@ +export default { + 'system.organization.create': 'Create', + 'system.organization.cancel': 'Cancel', + 'system.organization.add': 'Add', + 'system.organization.delete': 'Delete', + 'system.organization.edit': 'Edit', + 'system.organization.save': 'Save', + 'system.organization.end': 'End', + 'system.organization.removeName': 'Confirm to remove {name} this user', + 'system.organization.removeTip': 'After removal, the organization permission will be lost', + 'system.organization.addMember': 'Add Member', + 'system.organization.addMemberPlaceholder': 'Please select member', + 'system.organization.addMemberRequired': 'Please select member', + 'system.organization.searchPlaceholder': 'Please enter the organization name to query', + 'system.organization.addOrganization': 'Add organization', + 'system.organization.createOrganization': 'Create organization', + 'system.organization.organizationName': 'Organization name', + 'system.organization.organizationNamePlaceholder': + 'Please enter the organization name, which cannot be duplicated with other organization names', + 'system.organization.organizationNameRequired': 'Organization name cannot be empty', + 'system.organization.organizationNameDuplicate': 'Already have {name} please change', + 'system.organization.organizationAdmin': 'Organization administrator', + 'system.organization.organizationAdminPlaceholder': + 'The organization administrator defaults to the person who created the organization', + 'system.organization.description': 'Description', + 'system.organization.descriptionPlaceholder': 'Please describe the organization', + 'system.organization.ID': 'ID', + 'system.organization.name': 'Name', + 'system.organization.member': 'Member', + 'system.organization.project': 'Project', + 'system.organization.status': 'Status', + 'system.organization.creator': 'Creator', + 'system.organization.createTime': 'Create Time', + 'system.organization.operation': 'Operation', + 'system.organization.organizationCount': 'Organization({count})', + 'system.organization.projectCount': 'Project({count})', + 'system.organization.projectName': 'Project({name})', + 'system.project.name': 'Project name', + 'system.organization.userName': 'Name', + 'system.organization.email': 'Email', + 'system.organization.phone': 'Phone', + 'system.organization.addSuccess': 'Add success', + 'system.organization.deleteName': 'Are you sure to delete {name}', + 'system.organization.deleteTip': + 'Delete the organization and delete the project data under that organization together. Please be cautious!', + 'system.organization.revokeDeleteToolTip': 'The organization will be deleted automatically after 30 days', + 'system.organization.createOrganizationSuccess': 'Create organization success', + 'system.organization.enableTitle': 'Start organization', + 'system.organization.endTitle': 'Close organization', + 'system.organization.enableContent': 'The organization after opening is displayed in the organization switching list', + 'system.organization.endContent': + 'The organization after closing is not displayed in the organization switching list', + 'system.organization.updateOrganization': 'Update organization', + 'system.organization.updateOrganizationSuccess': 'Update organization success', + 'system.organization.createProject': 'Create project', + 'system.organization.subordinateOrg': 'Subordinate organization', + 'system.project.revokeDeleteTitle': 'Confirm revoke {name} ?', + 'system.project.enableTitle': 'Start project', + 'system.project.endTitle': 'Close project', + 'system.project.enableContent': 'The project after opening is displayed in the organization switching list', + 'system.project.endContent': 'The project after closing is not displayed in the project switching list', + 'system.project.projectNamePlaceholder': + 'Please enter the project name, which cannot be duplicated with other project names', + 'system.project.updateProject': 'Update project', + 'system.project.createProject': 'Create project', + 'system.project.affiliatedOrg': 'Affiliated organization', + 'system.project.affiliatedOrgPlaceholder': 'Please select affiliated organization', + 'system.project.projectAdmin': 'Project administrator', + 'system.project.projectAdminPlaceholder': 'The project administrator defaults to the person who created the project', + 'system.project.moduleSetting': 'Module setting', + 'system.project.projectNameRequired': 'Project name cannot be empty', + 'system.project.createTip': 'After the project is enabled, it will be displayed in the project switching list', + 'system.project.affiliatedOrgRequired': 'Affiliated organization cannot be empty', +}; diff --git a/frontend/src/views/setting/organization/project/locale/zh-CN.ts b/frontend/src/views/setting/organization/project/locale/zh-CN.ts new file mode 100644 index 0000000000..36149933aa --- /dev/null +++ b/frontend/src/views/setting/organization/project/locale/zh-CN.ts @@ -0,0 +1,69 @@ +export default { + 'system.organization.create': '创建', + 'system.organization.cancel': '取消', + 'system.organization.add': '添加', + 'system.organization.delete': '删除', + 'system.organization.edit': '编辑', + 'system.organization.save': '保存', + 'system.organization.end': '结束', + 'system.organization.removeName': '确认移除 {name} 这个用户吗', + 'system.organization.removeTip': '移除后,将失去组织权限', + 'system.organization.addMember': '添加成员', + 'system.organization.addMemberPlaceholder': '请选择成员', + 'system.organization.addMemberRequired': '请选择成员', + 'system.organization.searchPlaceholder': '请输入组织名称回车查询', + 'system.organization.addOrganization': '添加组织', + 'system.organization.createOrganization': '创建组织', + 'system.organization.organizationName': '组织名称', + 'system.organization.organizationNamePlaceholder': '请输入组织名称,不可与其他组织名称重复', + 'system.organization.organizationNameRequired': '组织名称不能为空', + 'system.organization.organizationNameDuplicate': '已有 {name} 请更改', + 'system.organization.organizationAdmin': '组织管理员', + 'system.organization.organizationAdminPlaceholder': '默认选择创建组织人为组织管理员', + 'system.organization.description': '描述', + 'system.organization.descriptionPlaceholder': '请对组织进行描述', + 'system.organization.ID': 'ID', + 'system.organization.name': '名称', + 'system.organization.member': '成员', + 'system.organization.project': '项目', + 'system.organization.status': '状态', + 'system.organization.creator': '创建人', + 'system.organization.createTime': '创建时间', + 'system.organization.operation': '操作', + 'system.organization.organizationCount': '组织({count})', + 'system.organization.projectCount': '项目({count})', + 'system.organization.projectName': '项目({name})', + 'system.project.name': '项目名称', + 'system.organization.userName': '姓名', + 'system.organization.email': '邮箱', + 'system.organization.phone': '手机', + 'system.organization.addSuccess': '添加成功', + 'system.organization.deleteName': '确认删除 {name} 这个组织吗', + 'system.organization.deleteTip': '删除组织同时将该组织下的项目数据一起删除,请谨慎操作!', + 'system.organization.revokeDeleteToolTip': '该组织将与 30 天后自动删除', + 'system.organization.createOrganizationSuccess': '创建组织成功', + 'system.organization.enableTitle': '开启组织', + 'system.organization.endTitle': '关闭组织', + 'system.organization.enableContent': '开启后的组织展示在组织切换列表', + 'system.organization.endContent': '关闭后的组织不展示在组织切换列表', + 'system.organization.updateOrganization': '更新组织', + 'system.organization.updateOrganizationSuccess': '更新组织成功', + 'system.organization.createProject': '创建项目', + 'system.organization.subordinateOrg': '所属组织', + 'system.project.revokeDeleteTitle': '确认恢复 {name} 这个项目吗?', + 'system.project.enableTitle': '开启项目', + 'system.project.endTitle': '关闭项目', + 'system.project.enableContent': '开启后的项目展示在项目切换列表', + 'system.project.endContent': '关闭后的项目不展示在项目切换列表', + 'system.project.projectNamePlaceholder': '请输入项目名称,不可与其他项目名称重复', + 'system.project.updateProject': '更新项目', + 'system.project.createProject': '创建项目', + 'system.project.affiliatedOrg': '所属组织', + 'system.project.affiliatedOrgPlaceholder': '请选择所属组织', + 'system.project.projectAdmin': '项目管理员', + 'system.project.projectAdminPlaceholder': '默认选择创建项目人为项目管理员', + 'system.project.moduleSetting': '模块设置', + 'system.project.projectNameRequired': '项目名称不能为空', + 'system.project.createTip': '项目启用后,将展示在项目切换列表', + 'system.project.affiliatedOrgRequired': '所属组织不能为空', +}; diff --git a/frontend/src/views/setting/organization/project/orgProject.vue b/frontend/src/views/setting/organization/project/orgProject.vue new file mode 100644 index 0000000000..64748526e6 --- /dev/null +++ b/frontend/src/views/setting/organization/project/orgProject.vue @@ -0,0 +1,290 @@ + + + + + diff --git a/frontend/src/views/setting/organization/usergroup/components/addOrUpdateUserGroupPopup.vue b/frontend/src/views/setting/organization/usergroup/components/addOrUpdateUserGroupPopup.vue new file mode 100644 index 0000000000..d4dd8f0a52 --- /dev/null +++ b/frontend/src/views/setting/organization/usergroup/components/addOrUpdateUserGroupPopup.vue @@ -0,0 +1,121 @@ + + + diff --git a/frontend/src/views/setting/organization/usergroup/components/addUserModal.vue b/frontend/src/views/setting/organization/usergroup/components/addUserModal.vue new file mode 100644 index 0000000000..f0e8b8907f --- /dev/null +++ b/frontend/src/views/setting/organization/usergroup/components/addUserModal.vue @@ -0,0 +1,101 @@ + + + + + diff --git a/frontend/src/views/setting/organization/usergroup/components/authTable.vue b/frontend/src/views/setting/organization/usergroup/components/authTable.vue new file mode 100644 index 0000000000..01197c38bb --- /dev/null +++ b/frontend/src/views/setting/organization/usergroup/components/authTable.vue @@ -0,0 +1,322 @@ + + + + + +@/store/modules/setting/system/usergroup diff --git a/frontend/src/views/setting/organization/usergroup/components/index.vue b/frontend/src/views/setting/organization/usergroup/components/index.vue new file mode 100644 index 0000000000..16d79ce069 --- /dev/null +++ b/frontend/src/views/setting/organization/usergroup/components/index.vue @@ -0,0 +1,284 @@ + + + + + diff --git a/frontend/src/views/setting/organization/usergroup/components/userTable.vue b/frontend/src/views/setting/organization/usergroup/components/userTable.vue new file mode 100644 index 0000000000..ea80b8b0e8 --- /dev/null +++ b/frontend/src/views/setting/organization/usergroup/components/userTable.vue @@ -0,0 +1,99 @@ + + + diff --git a/frontend/src/views/setting/organization/usergroup/orgUserGroup.vue b/frontend/src/views/setting/organization/usergroup/orgUserGroup.vue new file mode 100644 index 0000000000..d54457d011 --- /dev/null +++ b/frontend/src/views/setting/organization/usergroup/orgUserGroup.vue @@ -0,0 +1,148 @@ + + + + + +@/store/modules/setting/system/usergroup diff --git a/frontend/src/views/setting/system/organizationAndProject/components/systemProject.vue b/frontend/src/views/setting/system/organizationAndProject/components/systemProject.vue index 5cdcaa7d77..0b498d565c 100644 --- a/frontend/src/views/setting/system/organizationAndProject/components/systemProject.vue +++ b/frontend/src/views/setting/system/organizationAndProject/components/systemProject.vue @@ -4,7 +4,7 @@ {{ record.name }} @@ -252,7 +252,7 @@ type: 'error', cancelText: t('common.cancel'), title: t('system.project.revokeDeleteTitle', { name: record.name }), - content: t('system.organization.enableContent'), + content: t('system.project.enableContent'), okText: t('common.revokeDelete'), onBeforeOk: async () => { try { diff --git a/frontend/src/views/setting/system/organizationAndProject/components/userDrawer.vue b/frontend/src/views/setting/system/organizationAndProject/components/userDrawer.vue index 1f44b8502a..d1a2bcc3bb 100644 --- a/frontend/src/views/setting/system/organizationAndProject/components/userDrawer.vue +++ b/frontend/src/views/setting/system/organizationAndProject/components/userDrawer.vue @@ -114,7 +114,12 @@ }; const fetchData = async () => { - setLoadListParams({ organizationId: props.organizationId }); + if (props.organizationId) { + setLoadListParams({ organizationId: props.organizationId }); + } + if (props.projectId) { + setLoadListParams({ projectId: props.projectId }); + } await loadList(); }; @@ -161,4 +166,3 @@ } ); -@/api/modules/setting/organizationAndProject diff --git a/frontend/src/views/setting/system/organizationAndProject/locale/en-US.ts b/frontend/src/views/setting/system/organizationAndProject/locale/en-US.ts index cd71d924e9..9df5b39f4f 100644 --- a/frontend/src/views/setting/system/organizationAndProject/locale/en-US.ts +++ b/frontend/src/views/setting/system/organizationAndProject/locale/en-US.ts @@ -71,4 +71,5 @@ export default { 'system.project.projectNameRequired': 'Project name cannot be empty', 'system.project.createTip': 'After the project is enabled, it will be displayed in the project switching list', 'system.project.affiliatedOrgRequired': 'Affiliated organization cannot be empty', + 'system.project.revokeDeleteToolTip': 'The project will be deleted automatically after 30 days', }; diff --git a/frontend/src/views/setting/system/organizationAndProject/locale/zh-CN.ts b/frontend/src/views/setting/system/organizationAndProject/locale/zh-CN.ts index 36149933aa..2ca9d7f6c0 100644 --- a/frontend/src/views/setting/system/organizationAndProject/locale/zh-CN.ts +++ b/frontend/src/views/setting/system/organizationAndProject/locale/zh-CN.ts @@ -66,4 +66,5 @@ export default { 'system.project.projectNameRequired': '项目名称不能为空', 'system.project.createTip': '项目启用后,将展示在项目切换列表', 'system.project.affiliatedOrgRequired': '所属组织不能为空', + 'system.project.revokeDeleteToolTip': '该项目将与 30 天后自动删除', }; diff --git a/frontend/src/views/setting/system/usergroup/components/addUserModal.vue b/frontend/src/views/setting/system/usergroup/components/addUserModal.vue index b969a9c669..9e3ed0df29 100644 --- a/frontend/src/views/setting/system/usergroup/components/addUserModal.vue +++ b/frontend/src/views/setting/system/usergroup/components/addUserModal.vue @@ -33,10 +33,9 @@ +@/store/modules/setting/system/usergroup diff --git a/frontend/src/views/setting/system/usergroup/components/index.vue b/frontend/src/views/setting/system/usergroup/components/index.vue index 71c30a6405..bf69086a91 100644 --- a/frontend/src/views/setting/system/usergroup/components/index.vue +++ b/frontend/src/views/setting/system/usergroup/components/index.vue @@ -68,7 +68,7 @@ import useModal from '@/hooks/useModal'; import { Message } from '@arco-design/web-vue'; import popconfirm from './popconfirm.vue'; - import useUserGroupStore from '@/store/modules/setting/usergroup'; + import useUserGroupStore from '@/store/modules/setting/system/usergroup'; import { getUserGroupList, updateOrAddUserGroup, deleteUserGroup } from '@/api/modules/setting/usergroup'; import { characterLimit } from '@/utils'; @@ -174,6 +174,7 @@ Message.success(t('system.user.deleteUserSuccess')); initData(); } catch (error) { + // eslint-disable-next-line no-console console.log(error); } }, @@ -301,4 +302,4 @@ color: var(--color-text-1); } -@/models/setting/usergroup @/api/modules/setting/usergroup +@/models/setting/usergroup @/api/modules/setting/usergroup @/store/modules/setting/system/usergroup diff --git a/frontend/src/views/setting/system/usergroup/components/userTable.vue b/frontend/src/views/setting/system/usergroup/components/userTable.vue index a84ce724a1..f3de849a18 100644 --- a/frontend/src/views/setting/system/usergroup/components/userTable.vue +++ b/frontend/src/views/setting/system/usergroup/components/userTable.vue @@ -16,7 +16,8 @@ import { useI18n } from '@/hooks/useI18n'; import useTable from '@/components/pure/ms-table/useTable'; import MsBaseTable from '@/components/pure/ms-table/base-table.vue'; - import { useUserGroupStore, useTableStore } from '@/store'; + import { useTableStore } from '@/store'; + import useUserGroupStore from '@/store/modules/setting/system/usergroup'; import { watchEffect, ref, watch } from 'vue'; import { postUserByUserGroup, deleteUserFromUserGroup } from '@/api/modules/setting/usergroup'; import { UserTableItem } from '@/models/setting/usergroup'; diff --git a/frontend/src/views/setting/system/usergroup/index.vue b/frontend/src/views/setting/system/usergroup/index.vue index 73d8e098f9..b9d6d11032 100644 --- a/frontend/src/views/setting/system/usergroup/index.vue +++ b/frontend/src/views/setting/system/usergroup/index.vue @@ -48,7 +48,7 @@ import { ref, computed, watchEffect } from 'vue'; import { useI18n } from '@/hooks/useI18n'; import MsCard from '@/components/pure/ms-card/index.vue'; - import useUserGroupStore from '@/store/modules/setting/usergroup'; + import useUserGroupStore from '@/store/modules/setting/system/usergroup'; import UserGroupLeft from './components/index.vue'; import UserTable from './components/userTable.vue'; import AuthTable from './components/authTable.vue'; @@ -145,3 +145,4 @@ } } +@/store/modules/setting/system/usergroup diff --git a/frontend/src/views/setting/system/usergroup/locale/en-US.ts b/frontend/src/views/setting/system/usergroup/locale/en-US.ts index c9ed5e503e..c7a4200f66 100644 --- a/frontend/src/views/setting/system/usergroup/locale/en-US.ts +++ b/frontend/src/views/setting/system/usergroup/locale/en-US.ts @@ -56,6 +56,7 @@ export default { quickAddUser: 'Quick add user', removeName: 'Confirm to remove {name} this user', removeTip: 'After removal, the User Group permission will be lost', + custom: 'Custom user group', }, }, permission: { diff --git a/frontend/src/views/setting/system/usergroup/locale/zh-CN.ts b/frontend/src/views/setting/system/usergroup/locale/zh-CN.ts index 54614ebea5..096b27e399 100644 --- a/frontend/src/views/setting/system/usergroup/locale/zh-CN.ts +++ b/frontend/src/views/setting/system/usergroup/locale/zh-CN.ts @@ -55,6 +55,7 @@ export default { quickAddUser: '快速添加用户', removeName: '确认移除 {name} 这个用户吗', removeTip: '移除后,将失去用户组权限', + custom: '自定义用户组', }, }, permission: {