完善设备添加,兼容EMQX类型

This commit is contained in:
ChenYi 2026-06-29 16:01:59 +08:00
parent ad2d412373
commit 363157188d
5 changed files with 298 additions and 53 deletions

View File

@ -2387,7 +2387,7 @@ export const DeviceLoginModelSchema = {
} }
}, },
additionalProperties: false, additionalProperties: false,
description: '设备登录' description: '设备登录EMQX HTTP 认证回调请求体)'
} as const; } as const;
export const DeviceLoginResultSchema = { export const DeviceLoginResultSchema = {
@ -2395,7 +2395,7 @@ export const DeviceLoginResultSchema = {
properties: { properties: {
result: { result: {
type: 'string', type: 'string',
description: '鉴权结果 JiShe.ServicePro.Core.DeviceEMQXLoginResultConsts', description: '鉴权结果 JiShe.ServicePro.EMQXProvider.DeviceEMQXLoginResultConsts',
nullable: true nullable: true
}, },
is_superuser: { is_superuser: {
@ -2405,15 +2405,14 @@ export const DeviceLoginResultSchema = {
client_attrs: { client_attrs: {
type: 'object', type: 'object',
additionalProperties: { additionalProperties: {
type: 'string', type: 'string'
nullable: true
}, },
description: '设备属性(键值均为字符串)', description: '设备属性(键值均为字符串)',
nullable: true nullable: true
} }
}, },
additionalProperties: false, additionalProperties: false,
description: '设备登录结果' description: '设备登录结果EMQX HTTP 认证回调响应体)'
} as const; } as const;
export const DeviceManagementInfoDtoSchema = { export const DeviceManagementInfoDtoSchema = {
@ -2671,6 +2670,62 @@ export const DeviceManagementInfoDtoSchema = {
additionalProperties: false additionalProperties: false
} as const; } as const;
export const DeviceManagementInfoDtoHttpDataResultSchema = {
type: 'object',
properties: {
code: {
'$ref': '#/components/schemas/ResponeResultEnum'
},
msg: {
type: 'string',
description: '详细描述',
nullable: true
},
success: {
type: 'boolean',
description: `是否获取到数据或者逻辑处理成功
`
},
timestamp: {
type: 'integer',
description: '时间戳(毫秒)',
format: 'int64',
readOnly: true
},
nonce: {
type: 'string',
description: '用于计算签名字符的随机串',
nullable: true
},
signature: {
type: 'string',
description: '加密签名,用以校验推送客户端身份合法性,校验方法见实例验证',
nullable: true
},
locationCode: {
type: 'integer',
description: `位置编码,主要用于接口请求逻辑定位
使`,
format: 'int32'
},
extras: {
type: 'string',
description: '扩展信息',
nullable: true
},
data: {
'$ref': '#/components/schemas/DeviceManagementInfoDto'
},
total: {
type: 'integer',
description: '总数',
format: 'int64'
}
},
additionalProperties: false,
description: 'HTTP 请求返回结果'
} as const;
export const DeviceManagementInfoDtoPagedResultDtoSchema = { export const DeviceManagementInfoDtoPagedResultDtoSchema = {
type: 'object', type: 'object',
properties: { properties: {
@ -2689,6 +2744,62 @@ export const DeviceManagementInfoDtoPagedResultDtoSchema = {
additionalProperties: false additionalProperties: false
} as const; } as const;
export const DeviceManagementInfoDtoPagedResultDtoHttpDataResultSchema = {
type: 'object',
properties: {
code: {
'$ref': '#/components/schemas/ResponeResultEnum'
},
msg: {
type: 'string',
description: '详细描述',
nullable: true
},
success: {
type: 'boolean',
description: `是否获取到数据或者逻辑处理成功
`
},
timestamp: {
type: 'integer',
description: '时间戳(毫秒)',
format: 'int64',
readOnly: true
},
nonce: {
type: 'string',
description: '用于计算签名字符的随机串',
nullable: true
},
signature: {
type: 'string',
description: '加密签名,用以校验推送客户端身份合法性,校验方法见实例验证',
nullable: true
},
locationCode: {
type: 'integer',
description: `位置编码,主要用于接口请求逻辑定位
使`,
format: 'int32'
},
extras: {
type: 'string',
description: '扩展信息',
nullable: true
},
data: {
'$ref': '#/components/schemas/DeviceManagementInfoDtoPagedResultDto'
},
total: {
type: 'integer',
description: '总数',
format: 'int64'
}
},
additionalProperties: false,
description: 'HTTP 请求返回结果'
} as const;
export const DeviceMasterSwitchInputSchema = { export const DeviceMasterSwitchInputSchema = {
required: ['id', 'ioTPlatformProductId'], required: ['id', 'ioTPlatformProductId'],
type: 'object', type: 'object',
@ -6884,7 +6995,7 @@ export const IoTPlatformThingModelUpdateInputSchema = {
} as const; } as const;
export const IoTPlatformTypeEnumSchema = { export const IoTPlatformTypeEnumSchema = {
enum: ['CTWing', 'OneNET'], enum: ['CTWing', 'OneNET', 'EMQX'],
type: 'string', type: 'string',
description: '物联网平台类型枚举' description: '物联网平台类型枚举'
} as const; } as const;
@ -8339,6 +8450,20 @@ export const PageDeviceInputSchema = {
type: 'string', type: 'string',
description: '搜索关键字', description: '搜索关键字',
nullable: true nullable: true
},
deviceSourceType: {
'$ref': '#/components/schemas/DeviceSourceTypeEnum'
},
lifeInfo: {
'$ref': '#/components/schemas/DeviceLifeTypeEnum'
},
addressList: {
type: 'array',
items: {
type: 'string'
},
description: '设备地址列表(批量查询)',
nullable: true
} }
}, },
additionalProperties: false additionalProperties: false

File diff suppressed because one or more lines are too long

View File

@ -1322,7 +1322,7 @@ export type DeviceFirmwareInfoDtoPagedResultDto = {
export type DeviceLifeTypeEnum = 'Unspecified' | 'Production' | 'FactoryTest' | 'AgingSource' | 'FactoryDelivery' | 'Running' | 'Maintenance' | 'ReturnToFactory' | 'Deactivated'; export type DeviceLifeTypeEnum = 'Unspecified' | 'Production' | 'FactoryTest' | 'AgingSource' | 'FactoryDelivery' | 'Running' | 'Maintenance' | 'ReturnToFactory' | 'Deactivated';
/** /**
* * EMQX HTTP
*/ */
export type DeviceLoginModel = { export type DeviceLoginModel = {
/** /**
@ -1344,11 +1344,11 @@ export type DeviceLoginModel = {
}; };
/** /**
* * EMQX HTTP
*/ */
export type DeviceLoginResult = { export type DeviceLoginResult = {
/** /**
* JiShe.ServicePro.Core.DeviceEMQXLoginResultConsts * JiShe.ServicePro.EMQXProvider.DeviceEMQXLoginResultConsts
*/ */
result?: (string) | null; result?: (string) | null;
/** /**
@ -1359,7 +1359,7 @@ export type DeviceLoginResult = {
* *
*/ */
client_attrs?: { client_attrs?: {
[key: string]: ((string) | null); [key: string]: (string);
} | null; } | null;
}; };
@ -1521,11 +1521,95 @@ export type DeviceManagementInfoDto = {
finalMainStation?: (string) | null; finalMainStation?: (string) | null;
}; };
/**
* HTTP
*/
export type DeviceManagementInfoDtoHttpDataResult = {
code?: ResponeResultEnum;
/**
*
*/
msg?: (string) | null;
/**
*
*
*/
success?: boolean;
/**
* ()
*/
readonly timestamp?: number;
/**
*
*/
nonce?: (string) | null;
/**
*
*/
signature?: (string) | null;
/**
*
* 使
*/
locationCode?: number;
/**
*
*/
extras?: (string) | null;
data?: DeviceManagementInfoDto;
/**
*
*/
total?: number;
};
export type DeviceManagementInfoDtoPagedResultDto = { export type DeviceManagementInfoDtoPagedResultDto = {
items?: Array<DeviceManagementInfoDto> | null; items?: Array<DeviceManagementInfoDto> | null;
totalCount?: number; totalCount?: number;
}; };
/**
* HTTP
*/
export type DeviceManagementInfoDtoPagedResultDtoHttpDataResult = {
code?: ResponeResultEnum;
/**
*
*/
msg?: (string) | null;
/**
*
*
*/
success?: boolean;
/**
* ()
*/
readonly timestamp?: number;
/**
*
*/
nonce?: (string) | null;
/**
*
*/
signature?: (string) | null;
/**
*
* 使
*/
locationCode?: number;
/**
*
*/
extras?: (string) | null;
data?: DeviceManagementInfoDtoPagedResultDto;
/**
*
*/
total?: number;
};
/** /**
* *
*/ */
@ -3687,7 +3771,7 @@ export type IoTPlatformThingModelUpdateInput = {
/** /**
* *
*/ */
export type IoTPlatformTypeEnum = 'CTWing' | 'OneNET'; export type IoTPlatformTypeEnum = 'CTWing' | 'OneNET' | 'EMQX';
export type IStringValueType = { export type IStringValueType = {
readonly name?: (string) | null; readonly name?: (string) | null;
@ -4626,6 +4710,12 @@ export type PageDeviceInput = {
* *
*/ */
searchKeyword?: (string) | null; searchKeyword?: (string) | null;
deviceSourceType?: DeviceSourceTypeEnum;
lifeInfo?: DeviceLifeTypeEnum;
/**
*
*/
addressList?: Array<(string)> | null;
}; };
/** /**
@ -8784,4 +8874,30 @@ export type PostAggregationWorkshopGetProductListAsyncData = {
export type PostAggregationWorkshopGetProductListAsyncResponse = (HttpDataResult); export type PostAggregationWorkshopGetProductListAsyncResponse = (HttpDataResult);
export type PostAggregationWorkshopGetProductListAsyncError = unknown; export type PostAggregationWorkshopGetProductListAsyncError = unknown;
export type PostAggregationWorkshopReceiveWorkshopQueryDevicePageAsyncData = {
query?: {
/**
*
*/
input?: OpenApiRequest;
};
};
export type PostAggregationWorkshopReceiveWorkshopQueryDevicePageAsyncResponse = (DeviceManagementInfoDtoPagedResultDtoHttpDataResult);
export type PostAggregationWorkshopReceiveWorkshopQueryDevicePageAsyncError = unknown;
export type PostAggregationWorkshopReceiveWorkshopUpdateDeviceLifeInfoAsyncData = {
query?: {
/**
*
*/
input?: OpenApiRequest;
};
};
export type PostAggregationWorkshopReceiveWorkshopUpdateDeviceLifeInfoAsyncResponse = (DeviceManagementInfoDtoHttpDataResult);
export type PostAggregationWorkshopReceiveWorkshopUpdateDeviceLifeInfoAsyncError = unknown;

View File

@ -2579,8 +2579,8 @@ async function submitBatchAdd() {
} }
// //
if (addressList.length > 100) { if (addressList.length > 1000) {
Message.error('设备地址不能超过100行'); Message.error('设备地址不能超过1000行');
return; return;
} }
@ -2645,7 +2645,7 @@ const addressLines = ref(0);
// //
const isOverLineLimit = computed(() => { const isOverLineLimit = computed(() => {
return addressLines.value > 100; return addressLines.value > 1000;
}); });
// //
@ -3279,7 +3279,7 @@ const toolbarActions = computed(() => [
<span v-if="addressLines > 0"> <span v-if="addressLines > 0">
{{ addressLines }} 行设备地址 {{ addressLines }} 行设备地址
<span v-if="isOverLineLimit" style="color: #ff4d4f"> <span v-if="isOverLineLimit" style="color: #ff4d4f">
(超过100行限制) (超过1000行限制)
</span> </span>
</span> </span>
<span v-else> 当前行数: {{ addressLines }} (调试信息) </span> <span v-else> 当前行数: {{ addressLines }} (调试信息) </span>

View File

@ -15,6 +15,17 @@ import {
} from '#/api-client'; } from '#/api-client';
import { $t } from '#/locales'; import { $t } from '#/locales';
// EMQX 平台使用 OneNET 的账号和产品体系,查询账号/产品时需映射为 OneNET 平台类型
const ONENET_PLATFORM_TYPE = 2;
const EMQX_PLATFORM_TYPE = 3;
function getAccountQueryPlatformType(platform: any): number {
const num =
typeof platform === 'string' ? Number.parseInt(platform) : platform;
if (num === EMQX_PLATFORM_TYPE) return ONENET_PLATFORM_TYPE;
return num;
}
export const querySchema = computed(() => [ export const querySchema = computed(() => [
{ {
component: 'Input', component: 'Input',
@ -78,10 +89,7 @@ export const querySchema = computed(() => [
params: platform params: platform
? { ? {
body: { body: {
ioTPlatformType: ioTPlatformType: getAccountQueryPlatformType(platform),
typeof platform === 'string'
? Number.parseInt(platform)
: platform,
}, },
} }
: {}, : {},
@ -375,10 +383,7 @@ export const addDeviceFormSchema: any = computed(() => [
params: platform params: platform
? { ? {
body: { body: {
ioTPlatformType: ioTPlatformType: getAccountQueryPlatformType(platform),
typeof platform === 'string'
? Number.parseInt(platform)
: platform,
}, },
} }
: {}, : {},
@ -441,10 +446,7 @@ export const addDeviceFormSchema: any = computed(() => [
platform && accountId platform && accountId
? { ? {
body: { body: {
ioTPlatformType: ioTPlatformType: getAccountQueryPlatformType(platform),
typeof platform === 'string'
? Number.parseInt(platform)
: platform,
ioTPlatformAccount: accountId, ioTPlatformAccount: accountId,
}, },
} }
@ -633,10 +635,7 @@ export const editDeviceFormSchemaEdit: any = computed(() => [
params: platform params: platform
? { ? {
body: { body: {
ioTPlatformType: ioTPlatformType: getAccountQueryPlatformType(platform),
typeof platform === 'string'
? Number.parseInt(platform)
: platform,
}, },
} }
: {}, : {},
@ -699,10 +698,7 @@ export const editDeviceFormSchemaEdit: any = computed(() => [
platform && accountId platform && accountId
? { ? {
body: { body: {
ioTPlatformType: ioTPlatformType: getAccountQueryPlatformType(platform),
typeof platform === 'string'
? Number.parseInt(platform)
: platform,
ioTPlatformAccount: accountId, ioTPlatformAccount: accountId,
}, },
} }
@ -976,10 +972,7 @@ export const batchAddDeviceFormSchema: any = computed(() => [
params: platform params: platform
? { ? {
body: { body: {
ioTPlatformType: ioTPlatformType: getAccountQueryPlatformType(platform),
typeof platform === 'string'
? Number.parseInt(platform)
: platform,
}, },
} }
: {}, : {},
@ -1042,10 +1035,7 @@ export const batchAddDeviceFormSchema: any = computed(() => [
platform && accountId platform && accountId
? { ? {
body: { body: {
ioTPlatformType: ioTPlatformType: getAccountQueryPlatformType(platform),
typeof platform === 'string'
? Number.parseInt(platform)
: platform,
ioTPlatformAccount: accountId, ioTPlatformAccount: accountId,
}, },
} }
@ -1161,10 +1151,7 @@ export const batchUpgradeDeviceFormSchema: any = computed(() => [
params: platform params: platform
? { ? {
body: { body: {
ioTPlatformType: ioTPlatformType: getAccountQueryPlatformType(platform),
typeof platform === 'string'
? Number.parseInt(platform)
: platform,
}, },
} }
: {}, : {},
@ -1226,10 +1213,7 @@ export const batchUpgradeDeviceFormSchema: any = computed(() => [
platform && accountId platform && accountId
? { ? {
body: { body: {
ioTPlatformType: ioTPlatformType: getAccountQueryPlatformType(platform),
typeof platform === 'string'
? Number.parseInt(platform)
: platform,
ioTPlatformAccount: accountId, ioTPlatformAccount: accountId,
}, },
} }