完善设备添加逻辑,新增鉴权模式选择
This commit is contained in:
parent
cf3de1855d
commit
ad2d412373
@ -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,
|
||||
|
||||
@ -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;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@ -223,7 +223,8 @@
|
||||
"readingMode": "ReadingMode",
|
||||
"deviceType": "DeviceType",
|
||||
"deviceThingModelName": "ThingModelInfoManage",
|
||||
"lifeInfoName": "Life Cycle"
|
||||
"lifeInfoName": "Life Cycle",
|
||||
"encryptionType": "Authentication Mode"
|
||||
},
|
||||
"thingModelInfos": {
|
||||
"FiledType": "FiledType",
|
||||
|
||||
@ -216,7 +216,8 @@
|
||||
"deviceType": "设备类型",
|
||||
"readingMode": "抄读模式",
|
||||
"deviceThingModelName": "设备物模型名称",
|
||||
"lifeInfoName": "生命周期"
|
||||
"lifeInfoName": "生命周期",
|
||||
"encryptionType": "设备鉴权模式"
|
||||
},
|
||||
"thingModelInfos": {
|
||||
"FiledType": "物模型类型",
|
||||
|
||||
@ -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">
|
||||
|
||||
@ -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',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user