完善OneNET产品的添加
This commit is contained in:
parent
fffc4e8551
commit
62ce737dea
@ -67,6 +67,13 @@ export const ActionApiDescriptionModelSchema = {
|
||||
type: 'boolean',
|
||||
nullable: true
|
||||
},
|
||||
authorizeDatas: {
|
||||
type: 'array',
|
||||
items: {
|
||||
'$ref': '#/components/schemas/AuthorizeDataApiDescriptionModel'
|
||||
},
|
||||
nullable: true
|
||||
},
|
||||
implementFrom: {
|
||||
type: 'string',
|
||||
nullable: true
|
||||
@ -451,6 +458,21 @@ export const AuthTypeEnumSchema = {
|
||||
type: 'string'
|
||||
} as const;
|
||||
|
||||
export const AuthorizeDataApiDescriptionModelSchema = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
policy: {
|
||||
type: 'string',
|
||||
nullable: true
|
||||
},
|
||||
roles: {
|
||||
type: 'string',
|
||||
nullable: true
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
} as const;
|
||||
|
||||
export const BatchCreateDeviceAggregationInputSchema = {
|
||||
required: ['addressList', 'ioTPlatform', 'ioTPlatformProductId'],
|
||||
type: 'object',
|
||||
@ -462,14 +484,6 @@ export const BatchCreateDeviceAggregationInputSchema = {
|
||||
},
|
||||
description: '设备地址不能为空'
|
||||
},
|
||||
deviceInfos: {
|
||||
type: 'array',
|
||||
items: {
|
||||
'$ref': '#/components/schemas/OpenApiDeviceInfoInput'
|
||||
},
|
||||
description: '设备信息',
|
||||
nullable: true
|
||||
},
|
||||
ioTPlatform: {
|
||||
'$ref': '#/components/schemas/IoTPlatformTypeEnum'
|
||||
},
|
||||
@ -2869,7 +2883,7 @@ export const DeviceThingModeCommandTypeEnumSchema = {
|
||||
} as const;
|
||||
|
||||
export const DeviceThingModelCommandInfoCreateInputSchema = {
|
||||
required: ['commandName', 'deviceThingModelId', 'issueCommand', 'propertyArray'],
|
||||
required: ['commandName', 'commandType', 'deviceThingModelId', 'issueCommand', 'propertyArray'],
|
||||
type: 'object',
|
||||
properties: {
|
||||
deviceThingModelId: {
|
||||
@ -2893,6 +2907,14 @@ export const DeviceThingModelCommandInfoCreateInputSchema = {
|
||||
type: 'string'
|
||||
},
|
||||
description: '指令设备端物模型的属性名称集合,JSON格式字符串数组,一个指令的返回报文包含多个属性标识的数据'
|
||||
},
|
||||
commandType: {
|
||||
'$ref': '#/components/schemas/DeviceThingModeCommandTypeEnum'
|
||||
},
|
||||
operateCommandType: {
|
||||
type: 'integer',
|
||||
description: '待下发的操作指令类型,,例如阀控操作时,是拉闸还是合闸',
|
||||
format: 'int32'
|
||||
}
|
||||
},
|
||||
additionalProperties: false,
|
||||
@ -3105,7 +3127,7 @@ export const DeviceThingModelCommandInfoPageInputSchema = {
|
||||
} as const;
|
||||
|
||||
export const DeviceThingModelCommandInfoUpdateInputSchema = {
|
||||
required: ['commandName', 'deviceThingModelId', 'id', 'issueCommand', 'propertyArray'],
|
||||
required: ['commandName', 'commandType', 'deviceThingModelId', 'id', 'issueCommand', 'propertyArray'],
|
||||
type: 'object',
|
||||
properties: {
|
||||
deviceThingModelId: {
|
||||
@ -3130,6 +3152,14 @@ export const DeviceThingModelCommandInfoUpdateInputSchema = {
|
||||
},
|
||||
description: '指令设备端物模型的属性名称集合,JSON格式字符串数组,一个指令的返回报文包含多个属性标识的数据'
|
||||
},
|
||||
commandType: {
|
||||
'$ref': '#/components/schemas/DeviceThingModeCommandTypeEnum'
|
||||
},
|
||||
operateCommandType: {
|
||||
type: 'integer',
|
||||
description: '待下发的操作指令类型,,例如阀控操作时,是拉闸还是合闸',
|
||||
format: 'int32'
|
||||
},
|
||||
id: {
|
||||
type: 'string',
|
||||
format: 'uuid'
|
||||
@ -3562,6 +3592,14 @@ export const DeviceThingModelPropertyInfoDtoSchema = {
|
||||
type: 'string',
|
||||
description: '物模型属性或者事件类型名称',
|
||||
nullable: true
|
||||
},
|
||||
operateTypeList: {
|
||||
type: 'array',
|
||||
items: {
|
||||
'$ref': '#/components/schemas/SelectResult'
|
||||
},
|
||||
description: '属性的操作类型列表',
|
||||
nullable: true
|
||||
}
|
||||
},
|
||||
additionalProperties: false,
|
||||
@ -6441,6 +6479,11 @@ export const IoTPlatformThingModelExtensionDtoSchema = {
|
||||
description: '物联网平台中对应的产品物模型属性或者事件名称',
|
||||
nullable: true
|
||||
},
|
||||
ioTPlatformRawFieldDataType: {
|
||||
type: 'string',
|
||||
description: '物联网平台中子元素对应的数据类型,子元素数据据类型映射直接使用此字段',
|
||||
nullable: true
|
||||
},
|
||||
standardFieldName: {
|
||||
type: 'string',
|
||||
description: '管理后台产品标准的物模型属性或者事件名称',
|
||||
@ -7287,6 +7330,9 @@ export const MultiTenancyInfoDtoSchema = {
|
||||
properties: {
|
||||
isEnabled: {
|
||||
type: 'boolean'
|
||||
},
|
||||
userSharingStrategy: {
|
||||
'$ref': '#/components/schemas/TenantUserSharingStrategy'
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
@ -7921,7 +7967,7 @@ export const OneNetAccountModifyInputSchema = {
|
||||
} as const;
|
||||
|
||||
export const OneNetProductInfoInsertInputSchema = {
|
||||
required: ['communicationAddress', 'ioTPlatformProductId', 'oneNETAccountId', 'productAccesskey'],
|
||||
required: ['ioTPlatformProductId', 'oneNETAccountId', 'productAccesskey'],
|
||||
type: 'object',
|
||||
properties: {
|
||||
oneNETAccountId: {
|
||||
@ -7940,9 +7986,9 @@ export const OneNetProductInfoInsertInputSchema = {
|
||||
description: '产品访问密钥'
|
||||
},
|
||||
communicationAddress: {
|
||||
minLength: 1,
|
||||
type: 'string',
|
||||
description: '通讯服务地址'
|
||||
description: '通讯服务地址',
|
||||
nullable: true
|
||||
},
|
||||
communicationAddressTLS: {
|
||||
type: 'string',
|
||||
@ -8015,7 +8061,7 @@ export const OneNetProductInfoListInputSchema = {
|
||||
} as const;
|
||||
|
||||
export const OneNetProductInfoModifyInputSchema = {
|
||||
required: ['communicationAddress', 'ioTPlatformProductId', 'oneNETAccountId', 'productAccesskey'],
|
||||
required: ['ioTPlatformProductId', 'oneNETAccountId', 'productAccesskey'],
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: {
|
||||
@ -8039,9 +8085,9 @@ export const OneNetProductInfoModifyInputSchema = {
|
||||
description: '产品访问密钥'
|
||||
},
|
||||
communicationAddress: {
|
||||
minLength: 1,
|
||||
type: 'string',
|
||||
description: '通讯服务地址'
|
||||
description: '通讯服务地址',
|
||||
nullable: true
|
||||
},
|
||||
communicationAddressTLS: {
|
||||
type: 'string',
|
||||
@ -11410,6 +11456,11 @@ export const TenantDtoPagedResultDtoSchema = {
|
||||
additionalProperties: false
|
||||
} as const;
|
||||
|
||||
export const TenantUserSharingStrategySchema = {
|
||||
enum: ['Isolated', 'Shared'],
|
||||
type: 'string'
|
||||
} as const;
|
||||
|
||||
export const ThingModelIdentifierTypeEnumSchema = {
|
||||
enum: ['TAG', 'FIELD', 'ATTRIBUTE'],
|
||||
type: 'string',
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -17,6 +17,7 @@ export type ActionApiDescriptionModel = {
|
||||
parameters?: Array<ParameterApiDescriptionModel> | null;
|
||||
returnValue?: ReturnValueApiDescriptionModel;
|
||||
allowAnonymous?: (boolean) | null;
|
||||
authorizeDatas?: Array<AuthorizeDataApiDescriptionModel> | null;
|
||||
implementFrom?: (string) | null;
|
||||
};
|
||||
|
||||
@ -168,6 +169,11 @@ export type ApplicationSettingConfigurationDto = {
|
||||
} | null;
|
||||
};
|
||||
|
||||
export type AuthorizeDataApiDescriptionModel = {
|
||||
policy?: (string) | null;
|
||||
roles?: (string) | null;
|
||||
};
|
||||
|
||||
export type AuthTypeEnum = 'FeatureStringAuth' | 'SM9Auth' | 'CertificateAuth' | 'IMEIAuth' | 'SM2Auth' | 'IPv6IdentityAuth' | 'HttpBasicAuth' | 'HttpDigestAuth';
|
||||
|
||||
/**
|
||||
@ -178,10 +184,6 @@ export type BatchCreateDeviceAggregationInput = {
|
||||
* 设备地址不能为空
|
||||
*/
|
||||
addressList: Array<(string)>;
|
||||
/**
|
||||
* 设备信息
|
||||
*/
|
||||
deviceInfos?: Array<OpenApiDeviceInfoInput> | null;
|
||||
ioTPlatform: IoTPlatformTypeEnum;
|
||||
/**
|
||||
* 集中器在物联网平台中对应的产品Id
|
||||
@ -1676,6 +1678,11 @@ export type DeviceThingModelCommandInfoCreateInput = {
|
||||
* 指令设备端物模型的属性名称集合,JSON格式字符串数组,一个指令的返回报文包含多个属性标识的数据
|
||||
*/
|
||||
propertyArray: Array<(string)>;
|
||||
commandType: DeviceThingModeCommandTypeEnum;
|
||||
/**
|
||||
* 待下发的操作指令类型,,例如阀控操作时,是拉闸还是合闸
|
||||
*/
|
||||
operateCommandType?: number;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -1823,6 +1830,11 @@ export type DeviceThingModelCommandInfoUpdateInput = {
|
||||
* 指令设备端物模型的属性名称集合,JSON格式字符串数组,一个指令的返回报文包含多个属性标识的数据
|
||||
*/
|
||||
propertyArray: Array<(string)>;
|
||||
commandType: DeviceThingModeCommandTypeEnum;
|
||||
/**
|
||||
* 待下发的操作指令类型,,例如阀控操作时,是拉闸还是合闸
|
||||
*/
|
||||
operateCommandType?: number;
|
||||
id: string;
|
||||
};
|
||||
|
||||
@ -2090,6 +2102,10 @@ export type DeviceThingModelPropertyInfoDto = {
|
||||
* 物模型属性或者事件类型名称
|
||||
*/
|
||||
filedTypeName?: (string) | null;
|
||||
/**
|
||||
* 属性的操作类型列表
|
||||
*/
|
||||
operateTypeList?: Array<SelectResult> | null;
|
||||
};
|
||||
|
||||
export type DeviceThingModelPropertyInfoDtoPagedResultDto = {
|
||||
@ -3397,6 +3413,10 @@ export type IoTPlatformThingModelExtensionDto = {
|
||||
* 物联网平台中对应的产品物模型属性或者事件名称
|
||||
*/
|
||||
ioTPlatformRawFieldName?: (string) | null;
|
||||
/**
|
||||
* 物联网平台中子元素对应的数据类型,子元素数据据类型映射直接使用此字段
|
||||
*/
|
||||
ioTPlatformRawFieldDataType?: (string) | null;
|
||||
/**
|
||||
* 管理后台产品标准的物模型属性或者事件名称
|
||||
*/
|
||||
@ -3950,6 +3970,7 @@ export type ModuleExtensionDto = {
|
||||
|
||||
export type MultiTenancyInfoDto = {
|
||||
isEnabled?: boolean;
|
||||
userSharingStrategy?: TenantUserSharingStrategy;
|
||||
};
|
||||
|
||||
export type MyProfileOutput = {
|
||||
@ -4342,7 +4363,7 @@ export type OneNetProductInfoInsertInput = {
|
||||
/**
|
||||
* 通讯服务地址
|
||||
*/
|
||||
communicationAddress: string;
|
||||
communicationAddress?: (string) | null;
|
||||
/**
|
||||
* TLS通讯服务地址
|
||||
*/
|
||||
@ -4418,7 +4439,7 @@ export type OneNetProductInfoModifyInput = {
|
||||
/**
|
||||
* 通讯服务地址
|
||||
*/
|
||||
communicationAddress: string;
|
||||
communicationAddress?: (string) | null;
|
||||
/**
|
||||
* TLS通讯服务地址
|
||||
*/
|
||||
@ -6348,6 +6369,8 @@ export type TenantDtoPagedResultDto = {
|
||||
totalCount?: number;
|
||||
};
|
||||
|
||||
export type TenantUserSharingStrategy = 'Isolated' | 'Shared';
|
||||
|
||||
/**
|
||||
* 设备物模型标识符类型枚举
|
||||
*/
|
||||
@ -8636,6 +8659,26 @@ export type PostAggregationWorkshopReceiveWorkshopProductionInfoAsyncResponse =
|
||||
|
||||
export type PostAggregationWorkshopReceiveWorkshopProductionInfoAsyncError = unknown;
|
||||
|
||||
export type PostAggregationWorkshopReceiveWorkshopProductionBatchInfoAsyncData = {
|
||||
query?: {
|
||||
input?: OpenApiRequest;
|
||||
};
|
||||
};
|
||||
|
||||
export type PostAggregationWorkshopReceiveWorkshopProductionBatchInfoAsyncResponse = (HttpDataResult);
|
||||
|
||||
export type PostAggregationWorkshopReceiveWorkshopProductionBatchInfoAsyncError = unknown;
|
||||
|
||||
export type PostAggregationWorkshopReceiveWorkshopQueryDeviceInfoAsyncData = {
|
||||
query?: {
|
||||
input?: OpenApiRequest;
|
||||
};
|
||||
};
|
||||
|
||||
export type PostAggregationWorkshopReceiveWorkshopQueryDeviceInfoAsyncResponse = (HttpDataResult);
|
||||
|
||||
export type PostAggregationWorkshopReceiveWorkshopQueryDeviceInfoAsyncError = unknown;
|
||||
|
||||
export type PostAggregationWorkshopGetProductListAsyncData = {
|
||||
query?: {
|
||||
/**
|
||||
|
||||
@ -182,17 +182,11 @@ export const addProductFormSchema: any = computed(() => [
|
||||
component: 'Input',
|
||||
fieldName: 'communicationAddress',
|
||||
label: $t('abp.OneNETManagement.CommunicationAddress'),
|
||||
rules: z.string().min(1, {
|
||||
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.OneNETManagement.CommunicationAddress')}`,
|
||||
}),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'communicationAddressTLS',
|
||||
label: $t('abp.OneNETManagement.CommunicationAddressTLS'),
|
||||
rules: z.string().min(1, {
|
||||
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.OneNETManagement.CommunicationAddressTLS')}`,
|
||||
}),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
@ -337,17 +331,11 @@ export const editProductFormSchemaEdit: any = computed(() => [
|
||||
component: 'Input',
|
||||
fieldName: 'communicationAddress',
|
||||
label: $t('abp.OneNETManagement.CommunicationAddress'),
|
||||
rules: z.string().min(1, {
|
||||
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.OneNETManagement.CommunicationAddress')}`,
|
||||
}),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'communicationAddressTLS',
|
||||
label: $t('abp.OneNETManagement.CommunicationAddressTLS'),
|
||||
rules: z.string().min(1, {
|
||||
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.OneNETManagement.CommunicationAddressTLS')}`,
|
||||
}),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
|
||||
@ -8,6 +8,7 @@ import { message as Message, Tag } from 'ant-design-vue';
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
getCommonGetSelectList,
|
||||
postDeviceThingModelManagementCommandCreateAsync,
|
||||
postDeviceThingModelManagementCommandDeleteAsync,
|
||||
postDeviceThingModelManagementCommandFindByIdAsync,
|
||||
@ -28,6 +29,19 @@ const deviceModelName = ref<string>('');
|
||||
|
||||
const editRow: Record<string, any> = ref({});
|
||||
const propertyOptions = ref<Array<{ label: string; value: string }>>([]);
|
||||
const DEFAULT_COMMAND_TYPE = '1';
|
||||
const OPERATE_COMMAND_TYPE = '2';
|
||||
|
||||
function normalizeCommandType(value: unknown): string {
|
||||
if (value === null || value === undefined || value === '') {
|
||||
return DEFAULT_COMMAND_TYPE;
|
||||
}
|
||||
return String(value);
|
||||
}
|
||||
|
||||
function isOperateCommandType(value: unknown): boolean {
|
||||
return normalizeCommandType(value) === OPERATE_COMMAND_TYPE;
|
||||
}
|
||||
|
||||
// 指令列表
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
@ -137,6 +151,7 @@ const [CommandFormModal, commandFormModalApi] = useVbenModal({
|
||||
});
|
||||
if (data) {
|
||||
const values: any = { ...data };
|
||||
values.commandType = normalizeCommandType(values.commandType);
|
||||
// 处理 propertyArray 字段
|
||||
if (values.propertyArray) {
|
||||
if (typeof values.propertyArray === 'string') {
|
||||
@ -152,6 +167,9 @@ const [CommandFormModal, commandFormModalApi] = useVbenModal({
|
||||
} else {
|
||||
values.propertyArray = [];
|
||||
}
|
||||
if (!isOperateCommandType(values.commandType)) {
|
||||
values.operateCommandType = undefined;
|
||||
}
|
||||
commandFormApi.setValues(values);
|
||||
}
|
||||
} catch (error) {
|
||||
@ -204,6 +222,58 @@ const [CommandForm, commandFormApi] = useVbenForm({
|
||||
},
|
||||
layout: 'horizontal',
|
||||
schema: [
|
||||
{
|
||||
component: 'ApiSelect',
|
||||
fieldName: 'commandType',
|
||||
label: '指令类型',
|
||||
defaultValue: DEFAULT_COMMAND_TYPE,
|
||||
rules: z.preprocess(
|
||||
(v) => normalizeCommandType(v),
|
||||
z.string().min(1, '请选择指令类型'),
|
||||
),
|
||||
componentProps: {
|
||||
api: getCommonGetSelectList,
|
||||
params: {
|
||||
query: {
|
||||
typeName: 'DeviceThingModeCommandTypeEnum',
|
||||
},
|
||||
},
|
||||
labelField: 'value',
|
||||
valueField: 'key',
|
||||
optionsPropName: 'options',
|
||||
immediate: true,
|
||||
allowClear: false,
|
||||
placeholder: '请选择指令类型',
|
||||
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 [];
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'InputNumber',
|
||||
fieldName: 'operateCommandType',
|
||||
label: '操作类型',
|
||||
dependencies: {
|
||||
triggerFields: ['commandType'],
|
||||
show(values: any) {
|
||||
return isOperateCommandType(values.commandType);
|
||||
},
|
||||
},
|
||||
componentProps: {
|
||||
min: 0,
|
||||
precision: 0,
|
||||
placeholder: `${$t('common.pleaseInput')}操作类型`,
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'commandName',
|
||||
@ -260,6 +330,9 @@ const [CommandForm, commandFormApi] = useVbenForm({
|
||||
function openAddCommandModal() {
|
||||
editRow.value = {};
|
||||
commandFormModalApi.open();
|
||||
nextTick(() => {
|
||||
commandFormApi.setValues({ commandType: DEFAULT_COMMAND_TYPE });
|
||||
});
|
||||
}
|
||||
|
||||
// 打开编辑指令弹窗
|
||||
@ -275,8 +348,25 @@ async function submitCommand() {
|
||||
if (!valid) return;
|
||||
|
||||
const formValues = await commandFormApi.getValues();
|
||||
const commandType = normalizeCommandType(formValues.commandType);
|
||||
if (
|
||||
isOperateCommandType(commandType) &&
|
||||
(formValues.operateCommandType === null ||
|
||||
formValues.operateCommandType === undefined ||
|
||||
formValues.operateCommandType === '')
|
||||
) {
|
||||
Message.warning('请选择操作类型');
|
||||
return;
|
||||
}
|
||||
|
||||
const fetchParams: any = {
|
||||
...formValues,
|
||||
commandType,
|
||||
...(isOperateCommandType(commandType)
|
||||
? {
|
||||
operateCommandType: Number(formValues.operateCommandType),
|
||||
}
|
||||
: { operateCommandType: undefined }),
|
||||
deviceThingModelId: deviceThingModelId.value,
|
||||
// 确保 propertyArray 是数组格式
|
||||
propertyArray: Array.isArray(formValues.propertyArray)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user