完善设备添加逻辑,新增鉴权模式选择

This commit is contained in:
ChenYi 2026-06-11 17:19:25 +08:00
parent cf3de1855d
commit ad2d412373
6 changed files with 104 additions and 2 deletions

View File

@ -497,6 +497,9 @@ export const BatchCreateDeviceAggregationInputSchema = {
},
deviceType: {
'$ref': '#/components/schemas/DeviceTypeEnum'
},
encryptionType: {
'$ref': '#/components/schemas/DeviceAuthenticationModeEnum'
}
},
additionalProperties: false,
@ -1528,6 +1531,9 @@ export const CreateDeviceAggregationInputSchema = {
},
deviceType: {
'$ref': '#/components/schemas/DeviceTypeEnum'
},
encryptionType: {
'$ref': '#/components/schemas/DeviceAuthenticationModeEnum'
}
},
additionalProperties: false,

View File

@ -191,6 +191,7 @@ export type BatchCreateDeviceAggregationInput = {
ioTPlatformProductId: string;
deviceSourceType?: DeviceSourceTypeEnum;
deviceType?: DeviceTypeEnum;
encryptionType?: DeviceAuthenticationModeEnum;
};
/**
@ -407,6 +408,7 @@ export type CreateDeviceAggregationInput = {
ioTPlatformProductId: string;
deviceSourceType?: DeviceSourceTypeEnum;
deviceType?: DeviceTypeEnum;
encryptionType?: DeviceAuthenticationModeEnum;
};
/**

View File

@ -223,7 +223,8 @@
"readingMode": "ReadingMode",
"deviceType": "DeviceType",
"deviceThingModelName": "ThingModelInfoManage",
"lifeInfoName": "Life Cycle"
"lifeInfoName": "Life Cycle",
"encryptionType": "Authentication Mode"
},
"thingModelInfos": {
"FiledType": "FiledType",

View File

@ -216,7 +216,8 @@
"deviceType": "设备类型",
"readingMode": "抄读模式",
"deviceThingModelName": "设备物模型名称",
"lifeInfoName": "生命周期"
"lifeInfoName": "生命周期",
"encryptionType": "设备鉴权模式"
},
"thingModelInfos": {
"FiledType": "物模型类型",

View File

@ -330,6 +330,15 @@ function setDeviceLifeInfo(row: Record<string, any>, lifeInfo: number) {
row.lifeInfo = lifeInfo;
}
function getEncryptionTypeTagColor(encryptionType: unknown): string {
const type = Number(encryptionType);
if (type === 1) return 'blue';
if (type === 2) return 'green';
if (encryptionType === 'PerProductTypeSecret') return 'blue';
if (encryptionType === 'PerDeviceSecret') return 'green';
return 'default';
}
//
const upgradeRow: Record<string, any> = ref({});
@ -2599,6 +2608,7 @@ async function submitBatchAdd() {
addressList,
ioTPlatform: formValues.ioTPlatform,
ioTPlatformProductId,
EncryptionType: formValues.EncryptionType,
};
try {
@ -2997,6 +3007,12 @@ const toolbarActions = computed(() => [
)
" />
</template>
<template #encryptionTypeName="{ row }">
<component :is="h(Tag, { color: getEncryptionTypeTagColor(row.encryptionType) }, () =>
row.encryptionTypeName || '-',
)
" />
</template>
<template #action="{ row }">
<div style="display: flex; gap: 8px; align-items: center">

View File

@ -136,6 +136,12 @@ export const tableSchema: any = computed((): VxeGridProps['columns'] => [
title: $t('abp.deviceInfos.deviceType'),
minWidth: '150',
},
{
field: 'encryptionTypeName',
title: $t('abp.deviceInfos.encryptionType'),
minWidth: '150',
slots: { default: 'encryptionTypeName' },
},
{
field: 'deviceName',
title: $t('abp.deviceInfos.deviceName'),
@ -269,6 +275,41 @@ export const addDeviceFormSchema: any = computed(() => [
message: `${$t('common.pleaseSelect')}${$t('abp.deviceInfos.deviceType')}`,
}),
},
{
component: 'ApiSelect',
fieldName: 'EncryptionType',
label: $t('abp.deviceInfos.encryptionType'),
componentProps: {
api: getCommonGetSelectList,
params: {
query: {
typeName: 'DeviceAuthenticationModeEnum',
},
},
labelField: 'value',
valueField: 'key',
optionsPropName: 'options',
immediate: true,
allowClear: true,
placeholder:
$t('common.pleaseSelect') + $t('abp.deviceInfos.encryptionType'),
afterFetch: (res: any) => {
if (Array.isArray(res)) {
return res;
}
if (res && Array.isArray(res.items)) {
return res.items;
}
if (res && Array.isArray(res.data)) {
return res.data;
}
return [];
},
},
rules: z.string().min(1, {
message: `${$t('common.pleaseSelect')}${$t('abp.deviceInfos.encryptionType')}`,
}),
},
{
component: 'ApiSelect',
fieldName: 'ioTPlatform',
@ -835,6 +876,41 @@ export const batchAddDeviceFormSchema: any = computed(() => [
message: `${$t('common.pleaseInput')}${$t('abp.deviceInfos.deviceAddress')}`,
}),
},
{
component: 'ApiSelect',
fieldName: 'EncryptionType',
label: $t('abp.deviceInfos.encryptionType'),
componentProps: {
api: getCommonGetSelectList,
params: {
query: {
typeName: 'DeviceAuthenticationModeEnum',
},
},
labelField: 'value',
valueField: 'key',
optionsPropName: 'options',
immediate: true,
allowClear: true,
placeholder:
$t('common.pleaseSelect') + $t('abp.deviceInfos.encryptionType'),
afterFetch: (res: any) => {
if (Array.isArray(res)) {
return res;
}
if (res && Array.isArray(res.items)) {
return res.items;
}
if (res && Array.isArray(res.data)) {
return res.data;
}
return [];
},
},
rules: z.string().min(1, {
message: `${$t('common.pleaseSelect')}${$t('abp.deviceInfos.encryptionType')}`,
}),
},
{
component: 'ApiSelect',
fieldName: 'ioTPlatform',