diff --git a/packages/scripts/bin.ts b/packages/scripts/bin.ts old mode 100644 new mode 100755 diff --git a/src/constants/business.ts b/src/constants/business.ts index c2a6b97..09c51ec 100644 --- a/src/constants/business.ts +++ b/src/constants/business.ts @@ -1,5 +1,10 @@ import { transformRecordToOption } from '@/utils/common'; +export const yesOrNoRecord: Record = { + '0': 'common.yesOrNo.no', + '1': 'common.yesOrNo.yes' +}; + export const enableStatusRecord: Record = { '1': 'page.manage.common.status.enable', '2': 'page.manage.common.status.disable' @@ -32,3 +37,8 @@ export const podsType: Record 1: 'page.pods.type.client', 2: 'page.pods.type.server' }; + +export const idGeneratorModeRecord: Record = { + '1': 'page.groupConfig.idMode.segment', + '2': 'page.groupConfig.idMode.idWorker' +}; diff --git a/src/locales/langs/en-us.ts b/src/locales/langs/en-us.ts index abd46e4..2716601 100644 --- a/src/locales/langs/en-us.ts +++ b/src/locales/langs/en-us.ts @@ -175,7 +175,8 @@ const local: App.I18n.Schema = { exception: 'Exception', exception_403: '403', exception_404: '404', - exception_500: '500' + exception_500: '500', + 'group-config': 'Group Config' }, page: { common: { @@ -339,8 +340,31 @@ const local: App.I18n.Schema = { keyword: 'Please enter name/uniqueId', uniqueId: 'Please enter Unique ID' }, - addNamespace: 'Add Namespaces', - editNamespace: 'Edit Namespaces' + addNamespace: 'Add Namespace', + editNamespace: 'Edit Namespace' + }, + groupConfig: { + title: 'Group Config List', + namespaceId: 'Namespace ID', + groupName: 'Name', + groupStatus: 'Status', + idGeneratorMode: 'ID Generator Mode', + version: 'Version', + groupPartition: 'Parition', + initScene: 'Initial Scene', + bucketIndex: 'Bucket', + updateDt: 'Update Time', + description: 'Description', + form: { + namespaceId: 'Please enter namespace ID', + groupName: 'Please enter group name' + }, + idMode: { + idWorker: 'Id Workder', + segment: 'Segment' + }, + addGroupConfig: 'Add Group Config', + editGroupConfig: 'Edit Group Config' }, function: { tab: { diff --git a/src/locales/langs/zh-cn.ts b/src/locales/langs/zh-cn.ts index 4d96ee3..fc778d3 100644 --- a/src/locales/langs/zh-cn.ts +++ b/src/locales/langs/zh-cn.ts @@ -158,6 +158,7 @@ const local: App.I18n.Schema = { 'function_super-page': '超级管理员可见', pods: '在线机器', namepase: '命名空间', + 'group-config': '组管理', manage: '系统管理', manage_user: '用户管理', notify: '告警通知', @@ -338,6 +339,29 @@ const local: App.I18n.Schema = { addNamespace: '新增命名空间', editNamespace: '编辑命名空间' }, + groupConfig: { + title: '组管理', + namespaceId: '命名空间ID', + groupName: '组名称', + groupStatus: '状态', + idGeneratorMode: 'ID生成模式', + version: '版本', + groupPartition: '分区', + initScene: '初始化场景', + bucketIndex: 'Bucket', + updateDt: '更新时间', + description: '描述', + form: { + namespaceId: '请选择命名空间ID', + groupName: '请输入组名称' + }, + idMode: { + idWorker: '雪花算法', + segment: '号段模式' + }, + addGroupConfig: '新增组管理', + editGroupConfig: '编辑组管理' + }, function: { tab: { tabOperate: { diff --git a/src/router/elegant/imports.ts b/src/router/elegant/imports.ts index 0b8b7da..e4f0114 100644 --- a/src/router/elegant/imports.ts +++ b/src/router/elegant/imports.ts @@ -28,6 +28,7 @@ export const views: Record Promise import("@/views/function/super-page/index.vue"), function_tab: () => import("@/views/function/tab/index.vue"), "function_toggle-auth": () => import("@/views/function/toggle-auth/index.vue"), + "group-config": () => import("@/views/group-config/index.vue"), home: () => import("@/views/home/index.vue"), manage_menu: () => import("@/views/manage/menu/index.vue"), manage_role: () => import("@/views/manage/role/index.vue"), diff --git a/src/router/elegant/routes.ts b/src/router/elegant/routes.ts index ba7970a..bd41999 100644 --- a/src/router/elegant/routes.ts +++ b/src/router/elegant/routes.ts @@ -170,6 +170,15 @@ export const generatedRoutes: GeneratedRoute[] = [ } ] }, + { + name: 'group-config', + path: '/group-config', + component: 'layout.base$view.group-config', + meta: { + title: 'group-config', + i18nKey: 'route.group-config' + } + }, { name: 'home', path: '/home', diff --git a/src/router/elegant/transform.ts b/src/router/elegant/transform.ts index c06a2d1..1e57a01 100644 --- a/src/router/elegant/transform.ts +++ b/src/router/elegant/transform.ts @@ -161,6 +161,7 @@ const routeMap: RouteMap = { "function_super-page": "/function/super-page", "function_tab": "/function/tab", "function_toggle-auth": "/function/toggle-auth", + "group-config": "/group-config", "home": "/home", "login": "/login/:module(pwd-login)?", "manage": "/manage", diff --git a/src/service/api/group-config.ts b/src/service/api/group-config.ts new file mode 100644 index 0000000..d1d349a --- /dev/null +++ b/src/service/api/group-config.ts @@ -0,0 +1,28 @@ +import { request } from '../request'; + +/** get groupConfig list */ +export function fetchGetGroupConfigList(params?: Api.GroupConfig.GroupConfigSearchParams) { + return request({ + url: '/group/list', + method: 'get', + params + }); +} + +/** add groupConfig */ +export function fetchAddGroupConfig(data: Api.GroupConfig.GroupConfig) { + return request({ + url: '/group', + method: 'post', + data + }); +} + +/** edit namespace */ +export function fetchEditGroupConfig(data: Api.GroupConfig.GroupConfig) { + return request({ + url: '/group', + method: 'put', + data + }); +} diff --git a/src/service/api/index.ts b/src/service/api/index.ts index 97411d7..2cf2cc1 100644 --- a/src/service/api/index.ts +++ b/src/service/api/index.ts @@ -5,3 +5,4 @@ export * from './dashboard'; export * from './namespace'; export * from './system-manage'; export * from './notify'; +export * from './group-config'; diff --git a/src/typings/api.d.ts b/src/typings/api.d.ts index e9eb2cc..9ea9704 100644 --- a/src/typings/api.d.ts +++ b/src/typings/api.d.ts @@ -38,6 +38,14 @@ declare namespace Api { */ type EnableStatus = '1' | '2'; + /** + * yes/no status + * + * - "0": no + * - "1": yes + */ + type YesOrNo = '0' | '1'; + /** common record */ type CommonRecord = { /** record id */ @@ -271,6 +279,44 @@ declare namespace Api { type NamespaceList = Common.PaginatingQueryRecord; } + namespace GroupConfig { + type CommonSearchParams = Pick; + + type IdGeneratorModeType = '1' | '2'; + + /** groupConfig */ + type GroupConfig = Common.CommonRecord<{ + /** 命名空间id */ + namespaceId: string; + /** 组名 */ + groupName: string; + /** 组描述 */ + description: string; + /** token */ + token: string; + /** 组状态 0、未启用 1、启用 */ + groupStatus: Api.Common.EnableStatus; + /** 版本号 */ + version: number; + /** 分区 */ + groupPartition: number; + /** 唯一id生成模式 默认号段模式 */ + idGeneratorMode: IdGeneratorModeType; + /** 是否初始化场景 0:否 1:是 */ + initScene: Api.Common.YesOrNo; + /** bucket */ + bucketIndex: number; + }>; + + /** groupConfig search params */ + type GroupConfigSearchParams = CommonType.RecordNullable< + Pick & CommonSearchParams + >; + + /** groupConfig list */ + type GroupConfigList = Common.PaginatingQueryRecord; + } + /** * namespace SystemManage * diff --git a/src/typings/app.d.ts b/src/typings/app.d.ts index 2cdf9f8..407b748 100644 --- a/src/typings/app.d.ts +++ b/src/typings/app.d.ts @@ -513,6 +513,30 @@ declare namespace App { addNamespace: string; editNamespace: string; }; + groupConfig: { + title: string; + namespaceId: string; + groupName: string; + description: string; + // token: string; + groupStatus: string; + version: string; + groupPartition: string; + idGeneratorMode: string; + initScene: string; + bucketIndex: string; + updateDt: string; + form: { + namespaceId: string; + groupName: string; + }; + idMode: { + idWorker: string; + segment: string; + }; + addGroupConfig: string; + editGroupConfig: string; + }; function: { tab: { tabOperate: { diff --git a/src/typings/elegant-router.d.ts b/src/typings/elegant-router.d.ts index 61c3ae4..021ab4d 100644 --- a/src/typings/elegant-router.d.ts +++ b/src/typings/elegant-router.d.ts @@ -35,6 +35,7 @@ declare module "@elegant-router/types" { "function_super-page": "/function/super-page"; "function_tab": "/function/tab"; "function_toggle-auth": "/function/toggle-auth"; + "group-config": "/group-config"; "home": "/home"; "login": "/login/:module(pwd-login)?"; "manage": "/manage"; @@ -68,7 +69,7 @@ declare module "@elegant-router/types" { /** * custom route key - */ + */ export type CustomRouteKey = Extract< RouteKey, | "root" @@ -81,7 +82,7 @@ declare module "@elegant-router/types" { /** * the generated route key - */ + */ export type GeneratedRouteKey = Exclude; /** @@ -94,6 +95,7 @@ declare module "@elegant-router/types" { | "500" | "about" | "function" + | "group-config" | "home" | "login" | "manage" @@ -132,6 +134,7 @@ declare module "@elegant-router/types" { | "function_super-page" | "function_tab" | "function_toggle-auth" + | "group-config" | "home" | "manage_menu" | "manage_role" @@ -218,7 +221,7 @@ declare module "@elegant-router/types" { component: `view.${K}`; } : never; - + /** * the center level route */ @@ -241,7 +244,7 @@ declare module "@elegant-router/types" { children: (CenterLevelRoute> | LastLevelRoute>)[]; } : never; - + /** * the custom first level route */ diff --git a/src/views/group-config/index.vue b/src/views/group-config/index.vue new file mode 100644 index 0000000..7781965 --- /dev/null +++ b/src/views/group-config/index.vue @@ -0,0 +1,190 @@ + + + + + diff --git a/src/views/group-config/modules/groupConfig-operate-drawer.vue b/src/views/group-config/modules/groupConfig-operate-drawer.vue new file mode 100644 index 0000000..e03e1d2 --- /dev/null +++ b/src/views/group-config/modules/groupConfig-operate-drawer.vue @@ -0,0 +1,105 @@ + + + + + diff --git a/src/views/group-config/modules/groupConfig-search.vue b/src/views/group-config/modules/groupConfig-search.vue new file mode 100644 index 0000000..044f648 --- /dev/null +++ b/src/views/group-config/modules/groupConfig-search.vue @@ -0,0 +1,63 @@ + + + + +