完善平台端物模型

This commit is contained in:
ChenYi 2026-01-26 16:10:34 +08:00
parent f61f46a69b
commit 9197411c7b
6 changed files with 302 additions and 14 deletions

View File

@ -3693,6 +3693,11 @@ export const DeviceUpgradeRecordDtoSchema = {
description: '扩展属性,用于存储自定义字段,JSON格式', description: '扩展属性,用于存储自定义字段,JSON格式',
nullable: true nullable: true
}, },
deviceDataId: {
type: 'string',
description: '设备数据Id',
format: 'uuid'
},
deviceName: { deviceName: {
type: 'string', type: 'string',
description: '设备名称', description: '设备名称',
@ -5958,6 +5963,9 @@ export const IoTPlatformThingModelCreateInputSchema = {
type: 'string', type: 'string',
description: '物模型标识符访问模式 JiShe.ServicePro.Core.DevicePropertyAccessMode', description: '物模型标识符访问模式 JiShe.ServicePro.Core.DevicePropertyAccessMode',
nullable: true nullable: true
},
identifierType: {
'$ref': '#/components/schemas/ThingModelIdentifierTypeEnum'
} }
}, },
additionalProperties: false additionalProperties: false
@ -6101,6 +6109,9 @@ export const IoTPlatformThingModelInfoDtoSchema = {
type: 'string', type: 'string',
description: '物模型标识符访问模式 JiShe.ServicePro.Core.DevicePropertyAccessMode', description: '物模型标识符访问模式 JiShe.ServicePro.Core.DevicePropertyAccessMode',
nullable: true nullable: true
},
identifierType: {
'$ref': '#/components/schemas/ThingModelIdentifierTypeEnum'
} }
}, },
additionalProperties: false, additionalProperties: false,
@ -6178,6 +6189,14 @@ export const IoTPlatformThingModelPageInputSchema = {
type: 'boolean', type: 'boolean',
description: '是否可操作标识符', description: '是否可操作标识符',
nullable: true nullable: true
},
accessMode: {
type: 'string',
description: '物模型标识符访问模式 JiShe.ServicePro.Core.DevicePropertyAccessMode',
nullable: true
},
identifierType: {
'$ref': '#/components/schemas/ThingModelIdentifierTypeEnum'
} }
}, },
additionalProperties: false additionalProperties: false
@ -6246,6 +6265,9 @@ export const IoTPlatformThingModelUpdateInputSchema = {
description: '物模型标识符访问模式 JiShe.ServicePro.Core.DevicePropertyAccessMode', description: '物模型标识符访问模式 JiShe.ServicePro.Core.DevicePropertyAccessMode',
nullable: true nullable: true
}, },
identifierType: {
'$ref': '#/components/schemas/ThingModelIdentifierTypeEnum'
},
id: { id: {
type: 'string', type: 'string',
format: 'uuid' format: 'uuid'
@ -10860,6 +10882,14 @@ export const TenantDtoPagedResultDtoSchema = {
additionalProperties: false additionalProperties: false
} as const; } as const;
export const ThingModelIdentifierTypeEnumSchema = {
enum: [1, 2],
type: 'integer',
description: '设备物模型标识符类型枚举',
format: 'int32',
'说明:': '数据标识符=1,属性标识符=2'
} as const;
export const TimeZoneSchema = { export const TimeZoneSchema = {
type: 'object', type: 'object',
properties: { properties: {

View File

@ -2151,6 +2151,10 @@ export type DeviceUpgradeRecordDto = {
extraProperties?: { extraProperties?: {
[key: string]: unknown; [key: string]: unknown;
} | null; } | null;
/**
* Id
*/
deviceDataId?: string;
/** /**
* *
*/ */
@ -3067,6 +3071,7 @@ export type IoTPlatformThingModelCreateInput = {
* 访 JiShe.ServicePro.Core.DevicePropertyAccessMode * 访 JiShe.ServicePro.Core.DevicePropertyAccessMode
*/ */
accessMode?: (string) | null; accessMode?: (string) | null;
identifierType?: ThingModelIdentifierTypeEnum;
}; };
/** /**
@ -3160,6 +3165,7 @@ export type IoTPlatformThingModelInfoDto = {
* 访 JiShe.ServicePro.Core.DevicePropertyAccessMode * 访 JiShe.ServicePro.Core.DevicePropertyAccessMode
*/ */
accessMode?: (string) | null; accessMode?: (string) | null;
identifierType?: ThingModelIdentifierTypeEnum;
}; };
export type IoTPlatformThingModelInfoDtoPagedResultDto = { export type IoTPlatformThingModelInfoDtoPagedResultDto = {
@ -3208,6 +3214,11 @@ export type IoTPlatformThingModelPageInput = {
* *
*/ */
isOperableIdentifier?: (boolean) | null; isOperableIdentifier?: (boolean) | null;
/**
* 访 JiShe.ServicePro.Core.DevicePropertyAccessMode
*/
accessMode?: (string) | null;
identifierType?: ThingModelIdentifierTypeEnum;
}; };
export type IoTPlatformThingModelUpdateInput = { export type IoTPlatformThingModelUpdateInput = {
@ -3260,6 +3271,7 @@ export type IoTPlatformThingModelUpdateInput = {
* 访 JiShe.ServicePro.Core.DevicePropertyAccessMode * 访 JiShe.ServicePro.Core.DevicePropertyAccessMode
*/ */
accessMode?: (string) | null; accessMode?: (string) | null;
identifierType?: ThingModelIdentifierTypeEnum;
id?: string; id?: string;
}; };
@ -5949,6 +5961,11 @@ export type TenantDtoPagedResultDto = {
totalCount?: number; totalCount?: number;
}; };
/**
*
*/
export type ThingModelIdentifierTypeEnum = 1 | 2;
export type TimeZone = { export type TimeZone = {
iana?: IanaTimeZone; iana?: IanaTimeZone;
windows?: WindowsTimeZone; windows?: WindowsTimeZone;

View File

@ -228,10 +228,12 @@
"StandardFieldDisplayName": "StandardFieldDisplayName", "StandardFieldDisplayName": "StandardFieldDisplayName",
"IsValueNeedConvert": "IsValueNeedConvert", "IsValueNeedConvert": "IsValueNeedConvert",
"AccessMode": "AccessMode", "AccessMode": "AccessMode",
"IdentifierType": "IdentifierType",
"IsOperableIdentifier": "IsOperableIdentifier", "IsOperableIdentifier": "IsOperableIdentifier",
"StandardFieldValueType": "StandardFieldValueType", "StandardFieldValueType": "StandardFieldValueType",
"copyStandardThingModel": "CopyStandardThingModel", "copyStandardThingModel": "CopyStandardThingModel",
"copyAnotherThingModelModal": "CopyAnotherThingModelModal" "copyAnotherThingModelModal": "CopyAnotherThingModelModal",
"ioTPlatformProduct": "IoTPlatformProduct"
}, },
"IoTDBBase": { "IoTDBBase": {
"IoTDataType": "IoTDataType", "IoTDataType": "IoTDataType",

View File

@ -219,12 +219,14 @@
"IoTPlatformRawFieldName": "平台物模型编码", "IoTPlatformRawFieldName": "平台物模型编码",
"StandardFieldName": "标准物模型编码", "StandardFieldName": "标准物模型编码",
"StandardFieldDisplayName": "标准物模型名称", "StandardFieldDisplayName": "标准物模型名称",
"IsValueNeedConvert": "是否需要值类型转换", "IsValueNeedConvert": "是否值类型转换",
"AccessMode": "访问模式", "AccessMode": "访问模式",
"IsOperableIdentifier": "是否可操作物模型标识符", "IdentifierType": "标识符类型",
"IsOperableIdentifier": "是否可操作标识符",
"StandardFieldValueType": "标准物模型值类型", "StandardFieldValueType": "标准物模型值类型",
"copyStandardThingModel": "复制标准模型", "copyStandardThingModel": "复制标准模型",
"copyAnotherThingModelModal": "复制已有模型" "copyAnotherThingModelModal": "复制已有模型",
"ioTPlatformProduct": "所属产品"
}, },
"IoTDBBase": { "IoTDBBase": {
"IoTDataType": "数据类型", "IoTDataType": "数据类型",

View File

@ -12,6 +12,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,
postIoTplatformThingModelInfoCopyAnotherThingModelAsync, postIoTplatformThingModelInfoCopyAnotherThingModelAsync,
postIoTplatformThingModelInfoCopyStandardThingModel, postIoTplatformThingModelInfoCopyStandardThingModel,
postIoTplatformThingModelInfoCreateAsync, postIoTplatformThingModelInfoCreateAsync,
@ -42,6 +43,41 @@ const productId = ref<string>((route.query.productId as string) || '');
const productName = ref<string>((route.query.productName as string) || ''); const productName = ref<string>((route.query.productName as string) || '');
const ioTPlatform = ref<string>((route.query.ioTPlatform as string) || '2'); const ioTPlatform = ref<string>((route.query.ioTPlatform as string) || '2');
//
const identifierTypeMap = ref<Record<number | string, string>>({});
//
const loadIdentifierTypeOptions = async () => {
try {
const res = await getCommonGetSelectList({
query: {
typeName: 'ThingModelIdentifierTypeEnum',
},
});
const items = Array.isArray(res.data)
? res.data
: Array.isArray(res.data?.items)
? res.data.items
: Array.isArray(res.data?.data)
? res.data.data
: [];
const map: Record<number | string, string> = {};
items.forEach((item: any) => {
if (item.key !== undefined && item.value) {
map[item.key] = item.value;
}
});
identifierTypeMap.value = map;
} catch (error) {
console.error('获取标识符类型选项失败:', error);
// 使
identifierTypeMap.value = {
1: '数据标识符',
2: '属性标识符',
};
}
};
const formOptions: VbenFormProps = { const formOptions: VbenFormProps = {
schema: querySchema.value, schema: querySchema.value,
initialValues: { initialValues: {
@ -148,6 +184,21 @@ const gridOptions: VxeGridProps<any> = {
queryParams.ioTPlatformProductId = String(currentProductId); queryParams.ioTPlatformProductId = String(currentProductId);
} }
// 访
if (finalFormValues?.accessMode) {
queryParams.accessMode = finalFormValues.accessMode;
}
//
if (
finalFormValues?.identifierType !== undefined &&
finalFormValues?.identifierType !== null
) {
queryParams.identifierType = Number.parseInt(
String(finalFormValues.identifierType),
) as 1 | 2;
}
const { data } = await postIoTplatformThingModelInfoPageAsync({ const { data } = await postIoTplatformThingModelInfoPageAsync({
body: queryParams, body: queryParams,
}); });
@ -237,6 +288,12 @@ const [ThingModelModal, thingModelModalApi] = useVbenModal({
...(isEdit ? editRow.value : {}), ...(isEdit ? editRow.value : {}),
_ioTPlatform: platformValue, _ioTPlatform: platformValue,
_ioTPlatformProductId: productIdValue, _ioTPlatformProductId: productIdValue,
// identifierType 便 key
...(isEdit &&
editRow.value.identifierType !== undefined &&
editRow.value.identifierType !== null && {
identifierType: String(editRow.value.identifierType),
}),
}); });
// //
@ -423,6 +480,9 @@ watch(
// //
onMounted(async () => { onMounted(async () => {
//
await loadIdentifierTypeOptions();
// //
if (route.query.productId) { if (route.query.productId) {
productId.value = route.query.productId as string; productId.value = route.query.productId as string;
@ -483,9 +543,7 @@ async function submit() {
? await gridApi.formApi.getValues() ? await gridApi.formApi.getValues()
: {}; : {};
finalProductId = finalProductId =
searchFormValues.ioTPlatformProductId || searchFormValues.ioTPlatformProductId || productId.value || undefined;
productId.value ||
undefined;
if (finalProductId) { if (finalProductId) {
finalProductId = String(finalProductId); finalProductId = String(finalProductId);
} }
@ -521,6 +579,13 @@ async function submit() {
// //
ioTPlatform: finalPlatform, ioTPlatform: finalPlatform,
ioTPlatformProductId: finalProductId, ioTPlatformProductId: finalProductId,
//
...(formValues.identifierType !== undefined &&
formValues.identifierType !== null && {
identifierType: Number.parseInt(
String(formValues.identifierType),
) as 1 | 2,
}),
// ID // ID
...(isEdit && { id: editRow.value.id }), ...(isEdit && { id: editRow.value.id }),
}; };
@ -562,6 +627,11 @@ async function onEdit(record: any) {
...record, ...record,
_ioTPlatform: platformValue, _ioTPlatform: platformValue,
_ioTPlatformProductId: productIdValue, _ioTPlatformProductId: productIdValue,
// identifierType 便 key
...(record.identifierType !== undefined &&
record.identifierType !== null && {
identifierType: String(record.identifierType),
}),
}); });
// //
@ -793,6 +863,35 @@ async function onDel(record: any) {
" /> " />
</template> </template>
<template #accessMode="{ row }">
<component :is="h(
Tag,
{
color:
row.accessMode === 'rw'
? 'green'
: row.accessMode === 'r'
? 'orange'
: row.accessMode === 'w'
? 'red'
: 'default',
},
() =>
row.accessMode === 'rw'
? '读写模式'
: row.accessMode === 'r'
? '只读模式'
: row.accessMode === 'w'
? '只写模式'
: '-',
)
" />
</template>
<template #identifierType="{ row }">
{{ identifierTypeMap[row.identifierType] || '-' }}
</template>
<template #action="{ row }"> <template #action="{ row }">
<TableAction :actions="[ <TableAction :actions="[
{ {

View File

@ -96,6 +96,70 @@ export const querySchema = computed(() => [
}; };
}, },
}, },
{
component: 'ApiSelect',
fieldName: 'accessMode',
label: $t('abp.thingModelInfos.AccessMode'),
componentProps: {
api: getCommonGetSelectList,
params: {
query: {
typeName: 'DevicePropertyAccessMode',
},
},
labelField: 'value',
valueField: 'key',
optionsPropName: 'options',
immediate: true,
allowClear: true,
placeholder: `${$t('common.pleaseSelect')}${$t('abp.thingModelInfos.AccessMode')}`,
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: 'ApiSelect',
fieldName: 'identifierType',
label: $t('abp.thingModelInfos.IdentifierType'),
componentProps: {
api: getCommonGetSelectList,
params: {
query: {
typeName: 'ThingModelIdentifierTypeEnum',
},
},
labelField: 'value',
valueField: 'key',
optionsPropName: 'options',
immediate: true,
allowClear: true,
placeholder: `${$t('common.pleaseSelect')}${$t('abp.thingModelInfos.IdentifierType')}`,
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: 'Input', component: 'Input',
fieldName: 'SearchKeyWords', fieldName: 'SearchKeyWords',
@ -104,6 +168,13 @@ export const querySchema = computed(() => [
]); ]);
export const tableSchema = computed(() => [ export const tableSchema = computed(() => [
{
field: 'ioTPlatformProductId',
title: $t('abp.thingModelInfos.ioTPlatformProduct'),
minWidth: 150,
showOverflow: 'tooltip',
fixed: 'left',
},
{ {
field: 'filedTypeName', field: 'filedTypeName',
title: $t('abp.thingModelInfos.FiledType'), title: $t('abp.thingModelInfos.FiledType'),
@ -167,13 +238,14 @@ export const tableSchema = computed(() => [
field: 'accessMode', field: 'accessMode',
title: $t('abp.thingModelInfos.AccessMode'), title: $t('abp.thingModelInfos.AccessMode'),
minWidth: 120, minWidth: 120,
formatter: ({ cellValue }: { cellValue: any }) => { slots: { default: 'accessMode' },
return cellValue === 'rw' },
? '读写模式' {
: cellValue === 'r' field: 'identifierType',
? '只读模式' title: $t('abp.thingModelInfos.IdentifierType'),
: '只写模式'; minWidth: 120,
}, showOverflow: 'tooltip',
slots: { default: 'identifierType' },
}, },
{ {
field: 'isOperableIdentifier', field: 'isOperableIdentifier',
@ -511,6 +583,39 @@ export const getAddThingModelFormSchema = (
style: { width: 'auto' }, style: { width: 'auto' },
}, },
}, },
{
component: 'ApiSelect',
fieldName: 'identifierType',
label: $t('abp.thingModelInfos.IdentifierType'),
componentProps: {
api: getCommonGetSelectList,
params: {
query: {
typeName: 'ThingModelIdentifierTypeEnum',
},
},
labelField: 'value',
valueField: 'key',
optionsPropName: 'options',
immediate: true,
allowClear: true,
placeholder:
$t('common.pleaseSelect') + $t('abp.thingModelInfos.IdentifierType'),
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: 'ApiSelect', component: 'ApiSelect',
fieldName: 'ioTPlatformRawFieldDataType', fieldName: 'ioTPlatformRawFieldDataType',
@ -872,6 +977,39 @@ export const getEditThingModelFormSchema = (
style: { width: 'auto' }, style: { width: 'auto' },
}, },
}, },
{
component: 'ApiSelect',
fieldName: 'identifierType',
label: $t('abp.thingModelInfos.IdentifierType'),
componentProps: {
api: getCommonGetSelectList,
params: {
query: {
typeName: 'ThingModelIdentifierTypeEnum',
},
},
labelField: 'value',
valueField: 'key',
optionsPropName: 'options',
immediate: true,
allowClear: true,
placeholder:
$t('common.pleaseSelect') + $t('abp.thingModelInfos.IdentifierType'),
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: 'ApiSelect', component: 'ApiSelect',
fieldName: 'ioTPlatformRawFieldDataType', fieldName: 'ioTPlatformRawFieldDataType',