平台端物模型管理新增模型刷功能
This commit is contained in:
parent
90a0a05147
commit
8f4cd47a4f
@ -1720,6 +1720,30 @@ export const CreateOrganizationUnitInputSchema = {
|
||||
additionalProperties: false
|
||||
} as const;
|
||||
|
||||
export const CreatePlatformThingModelCommandInputSchema = {
|
||||
required: ['issueCommand', 'operateType', 'thingModelDataId'],
|
||||
type: 'object',
|
||||
properties: {
|
||||
thingModelDataId: {
|
||||
type: 'string',
|
||||
description: '平台端物模型数据Id',
|
||||
format: 'uuid'
|
||||
},
|
||||
operateType: {
|
||||
type: 'integer',
|
||||
description: '待下发的操作指令类型,例如阀控操作时,是拉闸还是合闸,根据StandardFieldName进行分组',
|
||||
format: 'int32'
|
||||
},
|
||||
issueCommand: {
|
||||
minLength: 1,
|
||||
type: 'string',
|
||||
description: '完整透明转发指令'
|
||||
}
|
||||
},
|
||||
additionalProperties: false,
|
||||
description: '新增平台端物模型操作指令'
|
||||
} as const;
|
||||
|
||||
export const CreateTextTemplateInputSchema = {
|
||||
required: ['code', 'content', 'cultureName', 'name'],
|
||||
type: 'object',
|
||||
@ -2995,8 +3019,7 @@ export const DeviceThingModelCommandInfoDtoSchema = {
|
||||
operateCommandType: {
|
||||
type: 'integer',
|
||||
description: '待下发的操作指令类型,,例如阀控操作时,是拉闸还是合闸',
|
||||
format: 'int32',
|
||||
nullable: true
|
||||
format: 'int32'
|
||||
}
|
||||
},
|
||||
additionalProperties: false,
|
||||
@ -6272,7 +6295,10 @@ export const IoTPlatformThingModelCreateInputSchema = {
|
||||
description: '是否是特殊物模型标识符'
|
||||
},
|
||||
ioTPlatformRawFieldExtension: {
|
||||
'$ref': '#/components/schemas/JToken'
|
||||
type: 'object',
|
||||
additionalProperties: {},
|
||||
description: '物联网平台中对应产品物模型标识符扩展,用于扩展结构体类型',
|
||||
nullable: true
|
||||
},
|
||||
isOperableIdentifier: {
|
||||
type: 'boolean',
|
||||
@ -6287,7 +6313,10 @@ export const IoTPlatformThingModelCreateInputSchema = {
|
||||
'$ref': '#/components/schemas/ThingModelIdentifierTypeEnum'
|
||||
},
|
||||
standardFieldFieldExtension: {
|
||||
'$ref': '#/components/schemas/JToken'
|
||||
type: 'object',
|
||||
additionalProperties: {},
|
||||
description: '标准物模型字段标识符扩展,数组或者结构体时候的参数或者元素名称集合',
|
||||
nullable: true
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
@ -6709,7 +6738,10 @@ export const IoTPlatformThingModelUpdateInputSchema = {
|
||||
description: '是否是特殊物模型标识符'
|
||||
},
|
||||
ioTPlatformRawFieldExtension: {
|
||||
'$ref': '#/components/schemas/JToken'
|
||||
type: 'object',
|
||||
additionalProperties: {},
|
||||
description: '物联网平台中对应产品物模型标识符扩展,用于扩展结构体类型',
|
||||
nullable: true
|
||||
},
|
||||
isOperableIdentifier: {
|
||||
type: 'boolean',
|
||||
@ -6724,7 +6756,10 @@ export const IoTPlatformThingModelUpdateInputSchema = {
|
||||
'$ref': '#/components/schemas/ThingModelIdentifierTypeEnum'
|
||||
},
|
||||
standardFieldFieldExtension: {
|
||||
'$ref': '#/components/schemas/JToken'
|
||||
type: 'object',
|
||||
additionalProperties: {},
|
||||
description: '标准物模型字段标识符扩展,数组或者结构体时候的参数或者元素名称集合',
|
||||
nullable: true
|
||||
},
|
||||
id: {
|
||||
type: 'string',
|
||||
@ -6740,13 +6775,6 @@ export const IoTPlatformTypeEnumSchema = {
|
||||
description: '物联网平台类型枚举'
|
||||
} as const;
|
||||
|
||||
export const JTokenSchema = {
|
||||
type: 'array',
|
||||
items: {
|
||||
'$ref': '#/components/schemas/JToken'
|
||||
}
|
||||
} as const;
|
||||
|
||||
export const LanguageInfoSchema = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
@ -9389,6 +9417,14 @@ export const PagingDataDictionaryDetailOutputSchema = {
|
||||
description: '扩展属性',
|
||||
nullable: true
|
||||
},
|
||||
extendedAttributeValue: {
|
||||
type: 'object',
|
||||
additionalProperties: {
|
||||
nullable: true
|
||||
},
|
||||
description: '扩展属性值',
|
||||
nullable: true
|
||||
},
|
||||
isEnabled: {
|
||||
type: 'boolean',
|
||||
description: '启/停用(默认启用)'
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -552,6 +552,24 @@ export type CreateOrganizationUnitInput = {
|
||||
parentId?: (string) | null;
|
||||
};
|
||||
|
||||
/**
|
||||
* 新增平台端物模型操作指令
|
||||
*/
|
||||
export type CreatePlatformThingModelCommandInput = {
|
||||
/**
|
||||
* 平台端物模型数据Id
|
||||
*/
|
||||
thingModelDataId: string;
|
||||
/**
|
||||
* 待下发的操作指令类型,例如阀控操作时,是拉闸还是合闸,根据StandardFieldName进行分组
|
||||
*/
|
||||
operateType: number;
|
||||
/**
|
||||
* 完整透明转发指令
|
||||
*/
|
||||
issueCommand: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* 创建模板
|
||||
*/
|
||||
@ -1731,7 +1749,7 @@ export type DeviceThingModelCommandInfoDto = {
|
||||
/**
|
||||
* 待下发的操作指令类型,,例如阀控操作时,是拉闸还是合闸
|
||||
*/
|
||||
operateCommandType?: (number) | null;
|
||||
operateCommandType?: number;
|
||||
};
|
||||
|
||||
export type DeviceThingModelCommandInfoDtoPagedResultDto = {
|
||||
@ -3286,7 +3304,12 @@ export type IoTPlatformThingModelCreateInput = {
|
||||
* 是否是特殊物模型标识符
|
||||
*/
|
||||
isSpecialIdentifier?: boolean;
|
||||
ioTPlatformRawFieldExtension?: JToken;
|
||||
/**
|
||||
* 物联网平台中对应产品物模型标识符扩展,用于扩展结构体类型
|
||||
*/
|
||||
ioTPlatformRawFieldExtension?: {
|
||||
[key: string]: unknown;
|
||||
} | null;
|
||||
/**
|
||||
* 是否可操作物模型标识符
|
||||
*/
|
||||
@ -3296,7 +3319,12 @@ export type IoTPlatformThingModelCreateInput = {
|
||||
*/
|
||||
accessMode?: (string) | null;
|
||||
identifierType?: ThingModelIdentifierTypeEnum;
|
||||
standardFieldFieldExtension?: JToken;
|
||||
/**
|
||||
* 标准物模型字段标识符扩展,数组或者结构体时候的参数或者元素名称集合
|
||||
*/
|
||||
standardFieldFieldExtension?: {
|
||||
[key: string]: unknown;
|
||||
} | null;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -3565,7 +3593,12 @@ export type IoTPlatformThingModelUpdateInput = {
|
||||
* 是否是特殊物模型标识符
|
||||
*/
|
||||
isSpecialIdentifier?: boolean;
|
||||
ioTPlatformRawFieldExtension?: JToken;
|
||||
/**
|
||||
* 物联网平台中对应产品物模型标识符扩展,用于扩展结构体类型
|
||||
*/
|
||||
ioTPlatformRawFieldExtension?: {
|
||||
[key: string]: unknown;
|
||||
} | null;
|
||||
/**
|
||||
* 是否可操作物模型标识符
|
||||
*/
|
||||
@ -3575,7 +3608,12 @@ export type IoTPlatformThingModelUpdateInput = {
|
||||
*/
|
||||
accessMode?: (string) | null;
|
||||
identifierType?: ThingModelIdentifierTypeEnum;
|
||||
standardFieldFieldExtension?: JToken;
|
||||
/**
|
||||
* 标准物模型字段标识符扩展,数组或者结构体时候的参数或者元素名称集合
|
||||
*/
|
||||
standardFieldFieldExtension?: {
|
||||
[key: string]: unknown;
|
||||
} | null;
|
||||
id?: string;
|
||||
};
|
||||
|
||||
@ -3599,8 +3637,6 @@ export type IValueValidator = {
|
||||
} | null;
|
||||
};
|
||||
|
||||
export type JToken = Array<JToken>;
|
||||
|
||||
export type LanguageInfo = {
|
||||
cultureName?: (string) | null;
|
||||
uiCultureName?: (string) | null;
|
||||
@ -5219,6 +5255,12 @@ export type PagingDataDictionaryDetailOutput = {
|
||||
* 扩展属性
|
||||
*/
|
||||
extendedAttribute?: (string) | null;
|
||||
/**
|
||||
* 扩展属性值
|
||||
*/
|
||||
extendedAttributeValue?: {
|
||||
[key: string]: unknown;
|
||||
} | null;
|
||||
/**
|
||||
* 启/停用(默认启用)
|
||||
*/
|
||||
@ -7736,6 +7778,16 @@ export type PostIoTplatformThingModelInfoGetIoTplatformThingModelServiceResponse
|
||||
|
||||
export type PostIoTplatformThingModelInfoGetIoTplatformThingModelServiceError = unknown;
|
||||
|
||||
export type PostIoTplatformThingModelInfoCreateIoTplatformThingModelCommandData = {
|
||||
query?: {
|
||||
input?: CreatePlatformThingModelCommandInput;
|
||||
};
|
||||
};
|
||||
|
||||
export type PostIoTplatformThingModelInfoCreateIoTplatformThingModelCommandResponse = (IoTPlatformThingModelCommandDto);
|
||||
|
||||
export type PostIoTplatformThingModelInfoCreateIoTplatformThingModelCommandError = unknown;
|
||||
|
||||
export type PostLanguagesAllResponse = (Array<PageLanguageOutput>);
|
||||
|
||||
export type PostLanguagesAllError = (RemoteServiceErrorResponse);
|
||||
|
||||
@ -337,9 +337,9 @@ const commandTableColumns = computed(() => [
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '平台物模型属性标识符',
|
||||
dataIndex: 'ioTPlatformRawFieldName',
|
||||
key: 'ioTPlatformRawFieldName',
|
||||
title: '标准物模型属性标识符',
|
||||
dataIndex: 'standardFieldName',
|
||||
key: 'standardFieldName',
|
||||
width: 200,
|
||||
},
|
||||
{
|
||||
@ -473,6 +473,7 @@ const bindRows: Array<Record<string, any>> = ref([]);
|
||||
interface ThingModelProperty {
|
||||
id: string; // 物模型属性ID
|
||||
ioTPlatformRawFieldName: string; // 平台原始字段名
|
||||
standardFieldName: string; // 标准物模型字段名(标识符)
|
||||
standardFieldDisplayName: string; // 标准字段显示名
|
||||
commandValue: string; // 指令内容
|
||||
result: string; // 返回结果
|
||||
@ -487,6 +488,10 @@ const thingModelLoading = ref(false);
|
||||
// 筛选关键词
|
||||
const filterKeyword = ref('');
|
||||
|
||||
// 设备操作统一使用标准物模型标识符作为参数键
|
||||
const getPropertyIdentifier = (property: ThingModelProperty) =>
|
||||
(property.standardFieldName || '').trim();
|
||||
|
||||
// 判断是否为数字类型
|
||||
const isNumericType = (dataType: string | undefined): boolean => {
|
||||
if (!dataType) return false;
|
||||
@ -559,7 +564,7 @@ const filteredThingModelProperties = computed(() => {
|
||||
return thingModelProperties.value.filter((prop) => {
|
||||
return (
|
||||
prop.standardFieldDisplayName?.toLowerCase().includes(keyword) ||
|
||||
prop.ioTPlatformRawFieldName?.toLowerCase().includes(keyword)
|
||||
prop.standardFieldName?.toLowerCase().includes(keyword)
|
||||
);
|
||||
});
|
||||
});
|
||||
@ -593,6 +598,7 @@ const fetchThingModelProperties = async (row: Record<string, any>) => {
|
||||
thingModelProperties.value = items.map((item: any) => ({
|
||||
id: item.id || '',
|
||||
ioTPlatformRawFieldName: item.ioTPlatformRawFieldName || '',
|
||||
standardFieldName: item.standardFieldName || '',
|
||||
standardFieldDisplayName: item.standardFieldDisplayName || '',
|
||||
commandValue: '',
|
||||
result: '',
|
||||
@ -626,7 +632,7 @@ const submitBatchCommand = async () => {
|
||||
const selectedProperties = thingModelProperties.value.filter(
|
||||
(prop) =>
|
||||
prop.selected &&
|
||||
prop.ioTPlatformRawFieldName &&
|
||||
getPropertyIdentifier(prop) &&
|
||||
(prop.accessMode === 'rw' || prop.accessMode === 'w') && // 允许读写模式和只写模式
|
||||
prop.commandValue &&
|
||||
prop.commandValue.trim() !== '',
|
||||
@ -647,7 +653,10 @@ const submitBatchCommand = async () => {
|
||||
prop.commandValue.trim(),
|
||||
prop.ioTPlatformRawFieldDataType,
|
||||
);
|
||||
commandContent[prop.ioTPlatformRawFieldName] = convertedValue;
|
||||
const identifier = getPropertyIdentifier(prop);
|
||||
if (identifier) {
|
||||
commandContent[identifier] = convertedValue;
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
@ -2023,8 +2032,9 @@ const sendCommand = async (property: ThingModelProperty) => {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!property.ioTPlatformRawFieldName) {
|
||||
Message.warning('该属性缺少平台字段名,无法发送指令');
|
||||
const identifier = getPropertyIdentifier(property);
|
||||
if (!identifier) {
|
||||
Message.warning('该属性缺少标准物模型标识符,无法发送指令');
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2036,7 +2046,7 @@ const sendCommand = async (property: ThingModelProperty) => {
|
||||
property.commandValue.trim(),
|
||||
property.ioTPlatformRawFieldDataType,
|
||||
);
|
||||
commandContent[property.ioTPlatformRawFieldName] = convertedValue;
|
||||
commandContent[identifier] = convertedValue;
|
||||
|
||||
const result = await postAggregationDeviceDeviceCommandForApiAsync({
|
||||
body: {
|
||||
@ -2075,8 +2085,9 @@ const readData = async (property: ThingModelProperty) => {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!property.ioTPlatformRawFieldName) {
|
||||
Message.warning('该属性缺少平台字段名,无法抄读数据');
|
||||
const identifier = getPropertyIdentifier(property);
|
||||
if (!identifier) {
|
||||
Message.warning('该属性缺少标准物模型标识符,无法抄读数据');
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2091,16 +2102,14 @@ const readData = async (property: ThingModelProperty) => {
|
||||
{
|
||||
body: {
|
||||
id: String(commandRow.value.id),
|
||||
propertyList: [property.ioTPlatformRawFieldName],
|
||||
propertyList: { [identifier]: '' },
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
if (result.data !== undefined && result.data !== null) {
|
||||
// 返回结果是一个对象,需要根据属性名获取对应的值
|
||||
const propertyValue = (result.data as any)[
|
||||
property.ioTPlatformRawFieldName
|
||||
];
|
||||
const propertyValue = (result.data as any)[identifier];
|
||||
if (propertyValue !== undefined && propertyValue !== null) {
|
||||
property.result =
|
||||
typeof propertyValue === 'string'
|
||||
@ -2141,7 +2150,7 @@ const submitBatchRead = async () => {
|
||||
// 获取所有选中的行,排除只写模式(w)的属性
|
||||
const selectedProperties = thingModelProperties.value.filter(
|
||||
(prop) =>
|
||||
prop.selected && prop.ioTPlatformRawFieldName && prop.accessMode !== 'w', // 只写模式不能抄读
|
||||
prop.selected && getPropertyIdentifier(prop) && prop.accessMode !== 'w', // 只写模式不能抄读
|
||||
);
|
||||
|
||||
if (selectedProperties.length === 0) {
|
||||
@ -2155,8 +2164,15 @@ const submitBatchRead = async () => {
|
||||
}
|
||||
|
||||
// 获取所有选中属性的字段名列表
|
||||
const propertyList = selectedProperties.map(
|
||||
(prop) => prop.ioTPlatformRawFieldName,
|
||||
const propertyList = selectedProperties.reduce<Record<string, string>>(
|
||||
(acc, prop) => {
|
||||
const identifier = getPropertyIdentifier(prop);
|
||||
if (identifier) {
|
||||
acc[identifier] = '';
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
{},
|
||||
);
|
||||
|
||||
try {
|
||||
@ -2180,9 +2196,10 @@ const submitBatchRead = async () => {
|
||||
if (result.data !== undefined && result.data !== null) {
|
||||
// 更新所有选中行的返回结果
|
||||
selectedProperties.forEach((prop) => {
|
||||
const propertyValue = (result.data as any)[
|
||||
prop.ioTPlatformRawFieldName
|
||||
];
|
||||
const identifier = getPropertyIdentifier(prop);
|
||||
const propertyValue = identifier
|
||||
? (result.data as any)[identifier]
|
||||
: undefined;
|
||||
if (propertyValue !== undefined && propertyValue !== null) {
|
||||
prop.result =
|
||||
typeof propertyValue === 'string'
|
||||
|
||||
@ -13,6 +13,7 @@ import { useVbenForm } from '#/adapter/form';
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
getCommonGetSelectList,
|
||||
postAggregationIoTplatformUpdateIoTplatformProductThingModelInfoAsync,
|
||||
postIoTplatformThingModelInfoCopyAnotherThingModelAsync,
|
||||
postIoTplatformThingModelInfoCopyStandardThingModel,
|
||||
postIoTplatformThingModelInfoCreateAsync,
|
||||
@ -224,6 +225,8 @@ const editRow: Record<string, any> = ref({});
|
||||
|
||||
// 跟踪数据状态,用于控制按钮显示
|
||||
const hasData = ref(true);
|
||||
// 模型刷新按钮 loading 状态
|
||||
const thingModelRefreshLoading = ref(false);
|
||||
|
||||
const [ThingModelModal, thingModelModalApi] = useVbenModal({
|
||||
draggable: true,
|
||||
@ -522,6 +525,49 @@ onMounted(async () => {
|
||||
}, 300);
|
||||
});
|
||||
|
||||
function normalizeFieldExtensionValue(fieldValue: unknown) {
|
||||
if (typeof fieldValue !== 'string') {
|
||||
return fieldValue;
|
||||
}
|
||||
const trimmed = fieldValue.trim();
|
||||
if (!trimmed) {
|
||||
return '';
|
||||
}
|
||||
try {
|
||||
return JSON.parse(trimmed);
|
||||
} catch {
|
||||
return fieldValue;
|
||||
}
|
||||
}
|
||||
|
||||
function parseJsonFieldValue(
|
||||
fieldValue: unknown,
|
||||
fieldLabel: string,
|
||||
): { ok: boolean; value: unknown } {
|
||||
if (fieldValue == null || fieldValue === '') {
|
||||
return { ok: true, value: fieldValue };
|
||||
}
|
||||
|
||||
if (typeof fieldValue !== 'string') {
|
||||
return { ok: true, value: fieldValue };
|
||||
}
|
||||
|
||||
const trimmed = fieldValue.trim();
|
||||
if (!trimmed) {
|
||||
return { ok: true, value: '' };
|
||||
}
|
||||
|
||||
try {
|
||||
return {
|
||||
ok: true,
|
||||
value: JSON.parse(trimmed),
|
||||
};
|
||||
} catch {
|
||||
Message.error(`${fieldLabel}必须是合法JSON格式`);
|
||||
return { ok: false, value: fieldValue };
|
||||
}
|
||||
}
|
||||
|
||||
// 新增和编辑提交的逻辑
|
||||
async function submit() {
|
||||
const isEdit = !!editRow.value.id;
|
||||
@ -574,6 +620,14 @@ async function submit() {
|
||||
}
|
||||
|
||||
const formValues = await formApi.getValues();
|
||||
const ioTPlatformRawFieldExtensionParsed = parseJsonFieldValue(
|
||||
formValues.ioTPlatformRawFieldExtension,
|
||||
'平台物模型值类型扩展',
|
||||
);
|
||||
if (!ioTPlatformRawFieldExtensionParsed.ok) {
|
||||
return;
|
||||
}
|
||||
|
||||
const fetchParams: any = {
|
||||
...formValues,
|
||||
// 自动添加平台和产品信息
|
||||
@ -588,6 +642,12 @@ async function submit() {
|
||||
}),
|
||||
// 编辑时需要添加ID
|
||||
...(isEdit && { id: editRow.value.id }),
|
||||
// 标准物模型扩展参数支持在表单中以 JSON 文本编辑,提交时转回对象
|
||||
standardFieldFieldExtension: normalizeFieldExtensionValue(
|
||||
formValues.standardFieldFieldExtension,
|
||||
),
|
||||
// 平台物模型值类型扩展必须按 JSON 格式传入后台
|
||||
ioTPlatformRawFieldExtension: ioTPlatformRawFieldExtensionParsed.value,
|
||||
};
|
||||
|
||||
try {
|
||||
@ -695,6 +755,48 @@ const openAddModal = async () => {
|
||||
}, 100);
|
||||
};
|
||||
|
||||
// 模型刷新
|
||||
async function onThingModelRefresh() {
|
||||
const formValues = gridApi?.formApi ? await gridApi.formApi.getValues() : {};
|
||||
const platformValue = formValues.ioTPlatform || ioTPlatform.value;
|
||||
const productIdValue = formValues.ioTPlatformProductId || productId.value;
|
||||
|
||||
if (!productIdValue) {
|
||||
Message.error('请选择产品后再刷新模型');
|
||||
return;
|
||||
}
|
||||
|
||||
const ioTPlatformType = Number.parseInt(String(platformValue || ''), 10);
|
||||
if (Number.isNaN(ioTPlatformType)) {
|
||||
Message.error('平台类型无效,无法刷新模型');
|
||||
return;
|
||||
}
|
||||
|
||||
thingModelRefreshLoading.value = true;
|
||||
try {
|
||||
const resp =
|
||||
await postAggregationIoTplatformUpdateIoTplatformProductThingModelInfoAsync(
|
||||
{
|
||||
body: {
|
||||
ioTPlatformType,
|
||||
ioTPlatformProductId: String(productIdValue),
|
||||
},
|
||||
},
|
||||
);
|
||||
if (resp.data) {
|
||||
Message.success('模型刷新成功');
|
||||
await gridApi.reload();
|
||||
} else {
|
||||
Message.error('模型刷新失败');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('模型刷新失败:', error);
|
||||
Message.error('模型刷新失败');
|
||||
} finally {
|
||||
thingModelRefreshLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
// 打开复制已有模型模态框
|
||||
const openCopyAnotherThingModelModal = async () => {
|
||||
console.log('打开复制模态框,当前参数:', {
|
||||
@ -851,6 +953,15 @@ async function onDel(record: any) {
|
||||
ifShow: !hasData,
|
||||
disabled: !productId,
|
||||
},
|
||||
{
|
||||
label: '模型刷新',
|
||||
type: 'default',
|
||||
icon: 'ant-design:reload-outlined',
|
||||
onClick: onThingModelRefresh,
|
||||
auth: ['AbpIdentity.Users.Create'],
|
||||
disabled: !productId,
|
||||
loading: thingModelRefreshLoading,
|
||||
},
|
||||
]" />
|
||||
</template>
|
||||
|
||||
|
||||
@ -30,6 +30,21 @@ function formatFieldExtensionCell(cellValue: unknown): string {
|
||||
return String(cellValue);
|
||||
}
|
||||
|
||||
/** 表单中的扩展字段统一转换为可编辑文本 */
|
||||
function formatFieldExtensionFormValue(fieldValue: unknown): string {
|
||||
if (fieldValue == null || fieldValue === '') {
|
||||
return '';
|
||||
}
|
||||
if (typeof fieldValue === 'string') {
|
||||
return fieldValue;
|
||||
}
|
||||
try {
|
||||
return JSON.stringify(fieldValue, null, 2);
|
||||
} catch {
|
||||
return String(fieldValue);
|
||||
}
|
||||
}
|
||||
|
||||
export const querySchema = computed(() => [
|
||||
{
|
||||
component: 'ApiSelect',
|
||||
@ -405,6 +420,10 @@ export const getAddThingModelFormSchema = (
|
||||
formValues.standardFieldValueType = (item?.extendedAttribute ?? '')
|
||||
.toString()
|
||||
.toUpperCase();
|
||||
// 选择后自动回填标准物模型扩展参数:extendedAttributeValue
|
||||
formValues.standardFieldFieldExtension = formatFieldExtensionFormValue(
|
||||
item?.extendedAttributeValue,
|
||||
);
|
||||
},
|
||||
placeholder:
|
||||
$t('common.pleaseSelect') +
|
||||
@ -425,6 +444,15 @@ export const getAddThingModelFormSchema = (
|
||||
$t('abp.thingModelInfos.StandardFieldDisplayName'),
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'Textarea',
|
||||
fieldName: 'standardFieldFieldExtension',
|
||||
label: $t('abp.thingModelInfos.StandardFieldFieldExtension'),
|
||||
componentProps: {
|
||||
rows: 4,
|
||||
placeholder: '请选择标准物模型后自动回填扩展参数(JSON格式)',
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'ApiSelect',
|
||||
fieldName: 'ioTPlatformRawFieldName',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user