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