20250228-多级分类选择框 #IBPM4Q
This commit is contained in:
parent
8c8476dbba
commit
b501b20a14
@ -83,6 +83,14 @@ export const groupConfigStatusRecord: Record<Api.GroupConfig.GroupStatusType, Ap
|
|||||||
0: 'common.status.disable',
|
0: 'common.status.disable',
|
||||||
1: 'common.status.enable'
|
1: 'common.status.enable'
|
||||||
};
|
};
|
||||||
|
// 网站类别
|
||||||
|
export const groupConfigTypeRecord: Record<number, App.I18n.I18nKey> = {
|
||||||
|
1: 'page.groupConfig.typeDict.government',
|
||||||
|
2: 'page.groupConfig.typeDict.usMilitary',
|
||||||
|
3: 'page.groupConfig.typeDict.usNavy',
|
||||||
|
}
|
||||||
|
export const groupConfigTypeOptions = transformRecordToNumberOption(groupConfigTypeRecord);
|
||||||
|
|
||||||
export const groupConfigStatusOptions = transformRecordToNumberOption(groupConfigStatusRecord, true);
|
export const groupConfigStatusOptions = transformRecordToNumberOption(groupConfigStatusRecord, true);
|
||||||
|
|
||||||
export const groupConfigIdModeRecord: Record<Api.GroupConfig.IdGeneratorModeType, App.I18n.I18nKey> = {
|
export const groupConfigIdModeRecord: Record<Api.GroupConfig.IdGeneratorModeType, App.I18n.I18nKey> = {
|
||||||
|
@ -497,6 +497,8 @@ const local: App.I18n.Schema = {
|
|||||||
detail: 'Group Detail',
|
detail: 'Group Detail',
|
||||||
namespaceId: 'Namespace ID',
|
namespaceId: 'Namespace ID',
|
||||||
groupName: 'Group Name',
|
groupName: 'Group Name',
|
||||||
|
// 网站类别
|
||||||
|
type: 'Type',
|
||||||
token: 'Token',
|
token: 'Token',
|
||||||
groupStatus: 'Status',
|
groupStatus: 'Status',
|
||||||
idGeneratorMode: 'ID Generator Mode',
|
idGeneratorMode: 'ID Generator Mode',
|
||||||
@ -510,6 +512,8 @@ const local: App.I18n.Schema = {
|
|||||||
retryConfig: 'RetryConfig',
|
retryConfig: 'RetryConfig',
|
||||||
form: {
|
form: {
|
||||||
groupName: 'Please enter group name',
|
groupName: 'Please enter group name',
|
||||||
|
// 网站类别
|
||||||
|
type: 'Please select type',
|
||||||
token: 'Please enter token',
|
token: 'Please enter token',
|
||||||
groupStatus: 'Please select group status',
|
groupStatus: 'Please select group status',
|
||||||
description: 'Please enter description',
|
description: 'Please enter description',
|
||||||
@ -521,6 +525,12 @@ const local: App.I18n.Schema = {
|
|||||||
groupNameRule:
|
groupNameRule:
|
||||||
'Group name: Must be between 1 and 64 characters in length. Format: numbers, letters, underscores, or hyphens.'
|
'Group name: Must be between 1 and 64 characters in length. Format: numbers, letters, underscores, or hyphens.'
|
||||||
},
|
},
|
||||||
|
// 网站类别
|
||||||
|
typeDict: {
|
||||||
|
government: 'Government',
|
||||||
|
usMilitary: 'U.S. Military',
|
||||||
|
usNavy: 'U.S. Navy'
|
||||||
|
},
|
||||||
idMode: {
|
idMode: {
|
||||||
idWorker: 'Id Workder',
|
idWorker: 'Id Workder',
|
||||||
segment: 'Segment'
|
segment: 'Segment'
|
||||||
|
@ -506,6 +506,8 @@ const local: App.I18n.Schema = {
|
|||||||
detail: '组详情',
|
detail: '组详情',
|
||||||
namespaceId: '命名空间ID',
|
namespaceId: '命名空间ID',
|
||||||
groupName: '网站名称',
|
groupName: '网站名称',
|
||||||
|
// 网站类别
|
||||||
|
type: '分类',
|
||||||
token: 'Token',
|
token: 'Token',
|
||||||
groupStatus: '状态',
|
groupStatus: '状态',
|
||||||
idGeneratorMode: 'ID生成模式',
|
idGeneratorMode: 'ID生成模式',
|
||||||
@ -519,6 +521,8 @@ const local: App.I18n.Schema = {
|
|||||||
retryConfig: '重试配置',
|
retryConfig: '重试配置',
|
||||||
form: {
|
form: {
|
||||||
groupName: '请输入网站名称',
|
groupName: '请输入网站名称',
|
||||||
|
// 网站类别
|
||||||
|
type: '分类',
|
||||||
token: 'Token',
|
token: 'Token',
|
||||||
groupStatus: '状态',
|
groupStatus: '状态',
|
||||||
description: '描述',
|
description: '描述',
|
||||||
@ -529,6 +533,12 @@ const local: App.I18n.Schema = {
|
|||||||
collapseRetry: '重试配置',
|
collapseRetry: '重试配置',
|
||||||
groupNameRule: '网站名称: 仅支持长度为:1~64位字符.格式为:数字、字母、下划线、短横线。'
|
groupNameRule: '网站名称: 仅支持长度为:1~64位字符.格式为:数字、字母、下划线、短横线。'
|
||||||
},
|
},
|
||||||
|
// 网站类别
|
||||||
|
typeDict: {
|
||||||
|
government: '政府部门',
|
||||||
|
usMilitary: '美国军方',
|
||||||
|
usNavy: '美国海军'
|
||||||
|
},
|
||||||
idMode: {
|
idMode: {
|
||||||
idWorker: '雪花算法',
|
idWorker: '雪花算法',
|
||||||
segment: '号段模式'
|
segment: '号段模式'
|
||||||
|
2
src/typings/api.d.ts
vendored
2
src/typings/api.d.ts
vendored
@ -383,6 +383,8 @@ declare namespace Api {
|
|||||||
groupName: string;
|
groupName: string;
|
||||||
/** 组描述 */
|
/** 组描述 */
|
||||||
description: string;
|
description: string;
|
||||||
|
/** 网站类别 */
|
||||||
|
type: number;
|
||||||
/** token */
|
/** token */
|
||||||
token: string;
|
token: string;
|
||||||
/** 组状态 0、未启用 1、启用 */
|
/** 组状态 0、未启用 1、启用 */
|
||||||
|
@ -6,7 +6,7 @@ import { fetchDeleteGroup, fetchGetGroupConfigList, fetchUpdateGroupStatus } fro
|
|||||||
import { $t } from '@/locales';
|
import { $t } from '@/locales';
|
||||||
import { useAppStore } from '@/store/modules/app';
|
import { useAppStore } from '@/store/modules/app';
|
||||||
import { useTable, useTableOperate } from '@/hooks/common/table';
|
import { useTable, useTableOperate } from '@/hooks/common/table';
|
||||||
import { groupConfigIdModeRecord, yesOrNoRecord } from '@/constants/business';
|
import { groupConfigIdModeRecord, groupConfigTypeRecord, yesOrNoRecord } from '@/constants/business';
|
||||||
import { tagColor } from '@/utils/common';
|
import { tagColor } from '@/utils/common';
|
||||||
import StatusSwitch from '@/components/common/status-switch.vue';
|
import StatusSwitch from '@/components/common/status-switch.vue';
|
||||||
import { useAuth } from '@/hooks/business/auth';
|
import { useAuth } from '@/hooks/business/auth';
|
||||||
@ -55,15 +55,19 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// key: 'type',
|
key: 'type',
|
||||||
// title: '分类',
|
title: $t('page.groupConfig.type'),
|
||||||
// align: 'center',
|
align: 'center',
|
||||||
// width: 200,
|
width: 200,
|
||||||
// render: () => {
|
render: row => {
|
||||||
// return <p>政府部门/美国军方/美国海军</p>;
|
if (row.type === null) {
|
||||||
// }
|
return null;
|
||||||
// },
|
}
|
||||||
|
// const label = $t(groupConfigTypeRecord[row.type!]);
|
||||||
|
return <p>政府部门/美国军方/美国海军</p>;
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: 'groupStatus',
|
key: 'groupStatus',
|
||||||
title: $t('page.groupConfig.groupStatus'),
|
title: $t('page.groupConfig.groupStatus'),
|
||||||
|
@ -4,7 +4,12 @@ import { useClipboard } from '@vueuse/core';
|
|||||||
import { useFormRules, useNaiveForm } from '@/hooks/common/form';
|
import { useFormRules, useNaiveForm } from '@/hooks/common/form';
|
||||||
import { $t } from '@/locales';
|
import { $t } from '@/locales';
|
||||||
import { translateOptions, translateOptions2 } from '@/utils/common';
|
import { translateOptions, translateOptions2 } from '@/utils/common';
|
||||||
import { groupConfigIdModeOptions, groupConfigStatusOptions, groupConfigYesOrNoOptions } from '@/constants/business';
|
import {
|
||||||
|
groupConfigIdModeOptions,
|
||||||
|
groupConfigStatusOptions,
|
||||||
|
groupConfigTypeOptions,
|
||||||
|
groupConfigYesOrNoOptions
|
||||||
|
} from '@/constants/business';
|
||||||
import { fetchAddGroupConfig, fetchEditGroupConfig, fetchGetPartitionTableList } from '@/service/api/group';
|
import { fetchAddGroupConfig, fetchEditGroupConfig, fetchGetPartitionTableList } from '@/service/api/group';
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
@ -43,17 +48,26 @@ const title = computed(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const partitionList = ref<string[]>([]);
|
const partitionList = ref<string[]>([]);
|
||||||
|
// 网站类别
|
||||||
type Model = Pick<
|
type Model = Pick<
|
||||||
Api.GroupConfig.GroupConfig,
|
Api.GroupConfig.GroupConfig,
|
||||||
'id' | 'groupName' | 'token' | 'groupStatus' | 'description' | 'idGeneratorMode' | 'initScene' | 'groupPartition'
|
| 'id'
|
||||||
|
| 'groupName'
|
||||||
|
| 'type'
|
||||||
|
| 'token'
|
||||||
|
| 'groupStatus'
|
||||||
|
| 'description'
|
||||||
|
| 'idGeneratorMode'
|
||||||
|
| 'initScene'
|
||||||
|
| 'groupPartition'
|
||||||
>;
|
>;
|
||||||
|
|
||||||
const model: Model = reactive(createDefaultModel());
|
const model: Model = reactive(createDefaultModel());
|
||||||
|
// 网站类别
|
||||||
function createDefaultModel(): Model {
|
function createDefaultModel(): Model {
|
||||||
return {
|
return {
|
||||||
groupName: '',
|
groupName: '',
|
||||||
|
type: 1,
|
||||||
token: import.meta.env.VITE_APP_DEFAULT_TOKEN || '',
|
token: import.meta.env.VITE_APP_DEFAULT_TOKEN || '',
|
||||||
groupStatus: 1,
|
groupStatus: 1,
|
||||||
description: '',
|
description: '',
|
||||||
@ -62,10 +76,10 @@ function createDefaultModel(): Model {
|
|||||||
groupPartition: 0
|
groupPartition: 0
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
// 网站类别
|
||||||
type RuleKey = Extract<
|
type RuleKey = Extract<
|
||||||
keyof Model,
|
keyof Model,
|
||||||
'groupName' | 'token' | 'groupStatus' | 'idGeneratorMode' | 'initScene' | 'groupPartition'
|
'groupName' | 'type' | 'token' | 'groupStatus' | 'idGeneratorMode' | 'initScene' | 'groupPartition'
|
||||||
>;
|
>;
|
||||||
|
|
||||||
const rules = {
|
const rules = {
|
||||||
@ -77,6 +91,7 @@ const rules = {
|
|||||||
message: $t('page.groupConfig.form.groupNameRule')
|
message: $t('page.groupConfig.form.groupNameRule')
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
type: [defaultRequiredRule],
|
||||||
token: [defaultRequiredRule],
|
token: [defaultRequiredRule],
|
||||||
groupStatus: [defaultRequiredRule],
|
groupStatus: [defaultRequiredRule],
|
||||||
idGeneratorMode: [defaultRequiredRule],
|
idGeneratorMode: [defaultRequiredRule],
|
||||||
@ -192,6 +207,14 @@ async function handleCopy(source: string) {
|
|||||||
:disabled="props.operateType === 'edit'"
|
:disabled="props.operateType === 'edit'"
|
||||||
/>
|
/>
|
||||||
</NFormItem>
|
</NFormItem>
|
||||||
|
<!-- 网站类别 -->
|
||||||
|
<NFormItem :label="$t('page.groupConfig.type')" path="idGeneratorMode">
|
||||||
|
<NSelect
|
||||||
|
v-model:value="model.type"
|
||||||
|
:placeholder="$t('page.groupConfig.form.type')"
|
||||||
|
:options="translateOptions(groupConfigTypeOptions)"
|
||||||
|
/>
|
||||||
|
</NFormItem>
|
||||||
<NFormItem :label="$t('page.groupConfig.groupStatus')" path="groupStatus">
|
<NFormItem :label="$t('page.groupConfig.groupStatus')" path="groupStatus">
|
||||||
<NRadioGroup v-model:value="model.groupStatus" name="groupStatus">
|
<NRadioGroup v-model:value="model.groupStatus" name="groupStatus">
|
||||||
<NSpace>
|
<NSpace>
|
||||||
|
Loading…
Reference in New Issue
Block a user