From b231cded217bd7c5fcf3dbbc62d57c3aeb3bc7bc Mon Sep 17 00:00:00 2001 From: dhb52 Date: Sat, 20 Apr 2024 16:34:30 +0800 Subject: [PATCH] =?UTF-8?q?feat(sj=5F1.0.0):=20=E5=AE=8C=E6=88=90[?= =?UTF-8?q?=E7=BB=84=E7=AE=A1=E7=90=86]CRUD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/locales/langs/en-us.ts | 10 +- src/locales/langs/zh-cn.ts | 10 +- src/service/api/group-config.ts | 10 +- src/typings/api.d.ts | 16 +- src/typings/app.d.ts | 10 +- src/views/group-config/index.vue | 10 +- .../modules/groupConfig-operate-drawer.vue | 155 +++++++++++++++++- 7 files changed, 195 insertions(+), 26 deletions(-) diff --git a/src/locales/langs/en-us.ts b/src/locales/langs/en-us.ts index 992f0d5..38b00b0 100644 --- a/src/locales/langs/en-us.ts +++ b/src/locales/langs/en-us.ts @@ -353,6 +353,7 @@ const local: App.I18n.Schema = { title: 'Group Config List', namespaceId: 'Namespace ID', groupName: 'Name', + token: 'Token', groupStatus: 'Status', idGeneratorMode: 'ID Generator Mode', version: 'Version', @@ -362,8 +363,13 @@ const local: App.I18n.Schema = { updateDt: 'Update Time', description: 'Description', form: { - namespaceId: 'Please enter namespace ID', - groupName: 'Please enter group name' + groupName: 'Please enter group name', + token: 'Please enter Token', + groupStatus: 'Group status', + description: 'Please enter description', + idGeneratorMode: 'Please select ID generator mode', + groupPartition: 'Please select Group partition', + initScene: 'Initialized scene' }, idMode: { idWorker: 'Id Workder', diff --git a/src/locales/langs/zh-cn.ts b/src/locales/langs/zh-cn.ts index 7c74222..6eaa172 100644 --- a/src/locales/langs/zh-cn.ts +++ b/src/locales/langs/zh-cn.ts @@ -349,6 +349,7 @@ const local: App.I18n.Schema = { title: '组管理', namespaceId: '命名空间ID', groupName: '组名称', + token: 'Token', groupStatus: '状态', idGeneratorMode: 'ID生成模式', version: '版本', @@ -358,8 +359,13 @@ const local: App.I18n.Schema = { updateDt: '更新时间', description: '描述', form: { - namespaceId: '请选择命名空间ID', - groupName: '请输入组名称' + groupName: '请输入组名称', + token: 'Token', + groupStatus: '状态', + description: '描述', + idGeneratorMode: 'ID生成模式', + groupPartition: '分区', + initScene: '初始化场景' }, idMode: { idWorker: '雪花算法', diff --git a/src/service/api/group-config.ts b/src/service/api/group-config.ts index 34b6f3c..11909c5 100644 --- a/src/service/api/group-config.ts +++ b/src/service/api/group-config.ts @@ -26,7 +26,7 @@ export function fetchAddGroupConfig(data: Api.GroupConfig.GroupConfig) { }); } -/** edit namespace */ +/** edit groupConfig */ export function fetchEditGroupConfig(data: Api.GroupConfig.GroupConfig) { return request({ url: '/group', @@ -34,3 +34,11 @@ export function fetchEditGroupConfig(data: Api.GroupConfig.GroupConfig) { data }); } + +/** get partition table list */ +export function fetchGetPartitionTableList() { + return request({ + url: '/group/partition-table/list', + method: 'get' + }); +} diff --git a/src/typings/api.d.ts b/src/typings/api.d.ts index d30e493..97e8902 100644 --- a/src/typings/api.d.ts +++ b/src/typings/api.d.ts @@ -315,12 +315,16 @@ declare namespace Api { namespace GroupConfig { type CommonSearchParams = Pick; - type IdGeneratorModeType = '1' | '2'; + type IdGeneratorModeType = 1 | 2; + + type GroupStatusType = 0 | 1; + + type YesOrNoType = 0 | 1; /** groupConfig */ type GroupConfig = Common.CommonRecord<{ /** 命名空间id */ - namespaceId: string; + namespaceId?: string; /** 组名 */ groupName: string; /** 组描述 */ @@ -328,17 +332,17 @@ declare namespace Api { /** token */ token: string; /** 组状态 0、未启用 1、启用 */ - groupStatus: Api.Common.EnableStatus; + groupStatus: GroupStatusType; /** 版本号 */ - version: number; + version?: number; /** 分区 */ groupPartition: number; /** 唯一id生成模式 默认号段模式 */ idGeneratorMode: IdGeneratorModeType; /** 是否初始化场景 0:否 1:是 */ - initScene: Api.Common.YesOrNo; + initScene: YesOrNoType; /** bucket */ - bucketIndex: number; + bucketIndex?: number; }>; /** groupConfig search params */ diff --git a/src/typings/app.d.ts b/src/typings/app.d.ts index 923a861..207a6c3 100644 --- a/src/typings/app.d.ts +++ b/src/typings/app.d.ts @@ -524,7 +524,7 @@ declare namespace App { namespaceId: string; groupName: string; description: string; - // token: string; + token: string; groupStatus: string; version: string; groupPartition: string; @@ -533,8 +533,14 @@ declare namespace App { bucketIndex: string; updateDt: string; form: { - namespaceId: string; groupName: string; + token: string; + groupStatus: string; + description: string; + groupPartition: string; + idGeneratorMode: string; + initScene: string; + // bucketIndex: string; }; idMode: { idWorker: string; diff --git a/src/views/group-config/index.vue b/src/views/group-config/index.vue index 6494fe3..f8695a8 100644 --- a/src/views/group-config/index.vue +++ b/src/views/group-config/index.vue @@ -4,7 +4,7 @@ import { fetchGetGroupConfigList } from '@/service/api'; import { $t } from '@/locales'; import { useAppStore } from '@/store/modules/app'; import { useTable, useTableOperate } from '@/hooks/common/table'; -import { enableStatusRecord, idGeneratorModeRecord, yesOrNoRecord } from '@/constants/business'; +import { groupConfigIdModeRecord, groupConfigStatusRecord, yesOrNoRecord } from '@/constants/business'; import GroupConfigOperateDrawer from './modules/groupConfig-operate-drawer.vue'; import GroupConfigSearch from './modules/groupConfig-search.vue'; @@ -46,12 +46,12 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP return null; } - const tagMap: Record = { + const tagMap: Record = { 1: 'success', - 2: 'warning' + 0: 'warning' }; - const label = $t(enableStatusRecord[row.groupStatus!]); + const label = $t(groupConfigStatusRecord[row.groupStatus!]); return {label}; } @@ -66,7 +66,7 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP return null; } - const label = $t(idGeneratorModeRecord[row.idGeneratorMode!]); + const label = $t(groupConfigIdModeRecord[row.idGeneratorMode!]); return {label}; } diff --git a/src/views/group-config/modules/groupConfig-operate-drawer.vue b/src/views/group-config/modules/groupConfig-operate-drawer.vue index 9e566b0..a4ee63c 100644 --- a/src/views/group-config/modules/groupConfig-operate-drawer.vue +++ b/src/views/group-config/modules/groupConfig-operate-drawer.vue @@ -1,7 +1,10 @@