修改产品物模型管理按钮,更新nswag接口信息

This commit is contained in:
ChenYi 2025-12-17 11:19:31 +08:00
parent 28479396f9
commit fdc07134a8
6 changed files with 2294 additions and 206 deletions

12
.vscode/settings.json vendored
View File

@ -237,5 +237,15 @@
"nolebase", "nolebase",
"rollup", "rollup",
"vitest" "vitest"
] ],
"editor.gotoLocation.alternativeDeclarationCommand": "editor.action.revealDefinition",
"editor.gotoLocation.alternativeDefinitionCommand": "editor.action.revealDefinition",
"editor.gotoLocation.alternativeTypeDefinitionCommand": "editor.action.revealDefinition",
"editor.selectionHighlight": false,
"files.autoSave": "onFocusChange",
"editor.quickSuggestions": {
"other": "on",
"comments": "off",
"strings": "on"
}
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -172,6 +172,38 @@ export type BatchCreateDeviceAggregationInput = {
deviceSourceTypeEnum?: DeviceSourceTypeEnum; deviceSourceTypeEnum?: DeviceSourceTypeEnum;
}; };
/**
*
*/
export type BuildAnalysisScriptInput = {
/**
* Id
*/
id?: string;
/**
*
*/
scriptName?: (string) | null;
/**
*
*/
functionScript?: (string) | null;
};
/**
*
*/
export type BuildAnalysisScriptOutput = {
/**
*
*/
functionName?: (string) | null;
/**
*
*/
functionCode?: (string) | null;
};
export type ChangePasswordInput = { export type ChangePasswordInput = {
currentPassword?: (string) | null; currentPassword?: (string) | null;
newPassword: string; newPassword: string;
@ -200,6 +232,21 @@ export type ControllerInterfaceApiDescriptionModel = {
methods?: Array<InterfaceMethodApiDescriptionModel> | null; methods?: Array<InterfaceMethodApiDescriptionModel> | null;
}; };
/**
*
*/
export type CopyAnotherDeviceInput = {
ioTPlatform?: IoTPlatformTypeEnum;
/**
* Id
*/
deviceThingModelId?: string;
/**
* ID
*/
sourceProductId?: string;
};
/** /**
* *
*/ */
@ -983,13 +1030,13 @@ export type DeleteTextTemplateInput = {
* *
*/ */
export type DeviceCommandForApiInput = { export type DeviceCommandForApiInput = {
id?: string; id: string;
/** /**
* JSON格式 *
*/ */
commandContent: string; commandContent: {
deviceType?: DeviceTypeEnum; [key: string]: unknown;
telemetryType?: DeviceTelemetryCommandTypeEnum; };
}; };
export type DeviceManagementInfoDto = { export type DeviceManagementInfoDto = {
@ -1095,10 +1142,14 @@ export type DeviceManagementInfoDto = {
* *
*/ */
readonly deviceTypeName?: (string) | null; readonly deviceTypeName?: (string) | null;
/**
* false
*/
isNeedConfigDevicMdoel?: boolean;
/** /**
* Id * Id
*/ */
deviceThingModelDataId?: string; deviceThingModelDataId?: (string) | null;
}; };
export type DeviceManagementInfoDtoPagedResultDto = { export type DeviceManagementInfoDtoPagedResultDto = {
@ -1208,9 +1259,545 @@ export type DeviceTableModelDataInfoPageOutputPagedResultDto = {
}; };
/** /**
* *
*/ */
export type DeviceTelemetryCommandTypeEnum = 1 | 2; export type DeviceThingModelCommandInfoCreateInput = {
/**
* Id
*/
deviceThingModelId: string;
/**
*
*/
commandName: string;
/**
*
*/
issueCommand: string;
/**
* ,JSON格式字符串数组
*/
propertyArray: Array<(string)>;
};
/**
*
*/
export type DeviceThingModelCommandInfoDto = {
id?: string;
creationTime?: string;
creatorId?: (string) | null;
lastModificationTime?: (string) | null;
lastModifierId?: (string) | null;
isDeleted?: boolean;
deleterId?: (string) | null;
deletionTime?: (string) | null;
/**
* Id
*/
tenantId?: (string) | null;
/**
*
*/
remark?: (string) | null;
/**
* Id
*/
osaCreatorId?: (number) | null;
/**
* Id
*/
osaLastModifierId?: (number) | null;
/**
* Id
*/
osaDeleterId?: (number) | null;
/**
* ,,JSON格式
*/
extraProperties?: {
[key: string]: unknown;
} | null;
/**
* Id
*/
deviceThingModelId?: string;
ioTPlatform?: IoTPlatformTypeEnum;
/**
* Id
*/
ioTPlatformProductId?: (string) | null;
/**
*
*/
commandName?: (string) | null;
/**
*
*/
issueCommand?: (string) | null;
/**
* ,JSON格式字符串数组
*/
propertyArray?: Array<(string)> | null;
};
export type DeviceThingModelCommandInfoDtoPagedResultDto = {
items?: Array<DeviceThingModelCommandInfoDto> | null;
totalCount?: number;
};
/**
*
*/
export type DeviceThingModelCommandInfoPageInput = {
/**
* .1
*/
pageIndex?: number;
/**
* .
*/
pageSize?: number;
/**
*
*/
readonly skipCount?: number;
/**
*
* <example>
* name desc
* </example>
*/
sorting?: (string) | null;
/**
* Id
*/
deviceThingModelId: string;
ioTPlatform?: IoTPlatformTypeEnum;
/**
*
*/
searchKeyWords?: (string) | null;
/**
* Id
*/
ioTPlatformProductId?: (string) | null;
/**
* JiShe.ServicePro.Core.DataDictionaryTypeConst
*/
filedType?: (string) | null;
/**
*
*/
isPage?: boolean;
};
/**
*
*/
export type DeviceThingModelCommandInfoUpdateInput = {
/**
* Id
*/
deviceThingModelId: string;
/**
*
*/
commandName: string;
/**
*
*/
issueCommand: string;
/**
* ,JSON格式字符串数组
*/
propertyArray: Array<(string)>;
id: string;
};
export type DeviceThingModelCreateInput = {
/**
*
*/
deviceModelName?: (string) | null;
ioTPlatform?: IoTPlatformTypeEnum;
/**
* Id
*/
ioTPlatformProductId?: (string) | null;
/**
*
*/
scriptName?: (string) | null;
/**
*
*/
functionScript?: (string) | null;
};
/**
*
*/
export type DeviceThingModelManagementDto = {
id?: string;
creationTime?: string;
creatorId?: (string) | null;
lastModificationTime?: (string) | null;
lastModifierId?: (string) | null;
isDeleted?: boolean;
deleterId?: (string) | null;
deletionTime?: (string) | null;
/**
* Id
*/
tenantId?: (string) | null;
/**
*
*/
remark?: (string) | null;
/**
* Id
*/
osaCreatorId?: (number) | null;
/**
* Id
*/
osaLastModifierId?: (number) | null;
/**
* Id
*/
osaDeleterId?: (number) | null;
/**
* ,,JSON格式
*/
extraProperties?: {
[key: string]: unknown;
} | null;
/**
*
*/
deviceModelName?: (string) | null;
ioTPlatform?: IoTPlatformTypeEnum;
/**
* Id
*/
ioTPlatformProductId?: (string) | null;
/**
*
*/
scriptName?: (string) | null;
/**
*
*/
functionScript?: (string) | null;
parsingSequence?: ParsingSequenceTypeEnum;
/**
* false
*/
functionAnalysisFlag?: boolean;
/**
*
*/
propertyInfos?: Array<DeviceThingModelPropertyInfoDto> | null;
/**
*
*/
commandInfos?: Array<DeviceThingModelCommandInfoDto> | null;
};
export type DeviceThingModelManagementDtoPagedResultDto = {
items?: Array<DeviceThingModelManagementDto> | null;
totalCount?: number;
};
export type DeviceThingModelPageInput = {
/**
* .1
*/
pageIndex?: number;
/**
* .
*/
pageSize?: number;
/**
*
*/
readonly skipCount?: number;
/**
*
* <example>
* name desc
* </example>
*/
sorting?: (string) | null;
ioTPlatform?: IoTPlatformTypeEnum;
/**
*
*/
searchKeyWords?: (string) | null;
/**
* Id
*/
ioTPlatformProductId?: (string) | null;
/**
* JiShe.ServicePro.Core.DataDictionaryTypeConst
*/
filedType?: (string) | null;
/**
*
*/
isPage?: boolean;
};
/**
*
*/
export type DeviceThingModelPropertyCreateInput = {
/**
* Id
*/
deviceThingModelId: string;
/**
* JiShe.ServicePro.Core.DataDictionaryTypeConst
*/
filedType?: (string) | null;
/**
*
*/
ioTPlatformRawFieldName: string;
/**
* JiShe.ServicePro.Core.OneNETAllThingModel
*/
ioTPlatformRawFieldDataType: string;
/**
*
*/
standardFieldName: string;
/**
*
*/
standardFieldValueType: string;
/**
*
*/
standardFieldDisplayName: string;
/**
*
*/
isValueNeedConvert?: boolean;
/**
*
*/
skipNumber?: number;
/**
*
*/
takeNumber?: number;
};
/**
*
*/
export type DeviceThingModelPropertyInfoDto = {
id?: string;
creationTime?: string;
creatorId?: (string) | null;
lastModificationTime?: (string) | null;
lastModifierId?: (string) | null;
isDeleted?: boolean;
deleterId?: (string) | null;
deletionTime?: (string) | null;
/**
* Id
*/
tenantId?: (string) | null;
/**
*
*/
remark?: (string) | null;
/**
* Id
*/
osaCreatorId?: (number) | null;
/**
* Id
*/
osaLastModifierId?: (number) | null;
/**
* Id
*/
osaDeleterId?: (number) | null;
/**
* ,,JSON格式
*/
extraProperties?: {
[key: string]: unknown;
} | null;
/**
* Id
*/
deviceThingModelId?: string;
ioTPlatform?: IoTPlatformTypeEnum;
/**
* Id
*/
ioTPlatformProductId?: (string) | null;
/**
* JiShe.ServicePro.Core.DataDictionaryTypeConst
*/
filedType?: (string) | null;
/**
*
*/
ioTPlatformRawFieldName?: (string) | null;
/**
* JiShe.ServicePro.Core.OneNETAllThingModel
*/
ioTPlatformRawFieldDataType?: (string) | null;
/**
*
*/
standardFieldName?: (string) | null;
/**
*
*/
standardFieldValueType?: (string) | null;
/**
*
*/
standardFieldDisplayName?: (string) | null;
/**
*
*/
isValueNeedConvert?: boolean;
/**
*
*/
skipNumber?: number;
/**
*
*/
takeNumber?: number;
};
export type DeviceThingModelPropertyInfoDtoPagedResultDto = {
items?: Array<DeviceThingModelPropertyInfoDto> | null;
totalCount?: number;
};
/**
*
*/
export type DeviceThingModelPropertyPageInput = {
/**
* .1
*/
pageIndex?: number;
/**
* .
*/
pageSize?: number;
/**
*
*/
readonly skipCount?: number;
/**
*
* <example>
* name desc
* </example>
*/
sorting?: (string) | null;
/**
* Id
*/
deviceThingModelId: string;
ioTPlatform?: IoTPlatformTypeEnum;
/**
*
*/
searchKeyWords?: (string) | null;
/**
* Id
*/
ioTPlatformProductId?: (string) | null;
/**
* JiShe.ServicePro.Core.DataDictionaryTypeConst
*/
filedType?: (string) | null;
/**
*
*/
isPage?: boolean;
};
/**
*
*/
export type DeviceThingModelPropertyUpdateInput = {
/**
* Id
*/
deviceThingModelId: string;
/**
* JiShe.ServicePro.Core.DataDictionaryTypeConst
*/
filedType?: (string) | null;
/**
*
*/
ioTPlatformRawFieldName: string;
/**
* JiShe.ServicePro.Core.OneNETAllThingModel
*/
ioTPlatformRawFieldDataType: string;
/**
*
*/
standardFieldName: string;
/**
*
*/
standardFieldValueType: string;
/**
*
*/
standardFieldDisplayName: string;
/**
*
*/
isValueNeedConvert?: boolean;
/**
*
*/
skipNumber?: number;
/**
*
*/
takeNumber?: number;
id: string;
};
export type DeviceThingModelUpdateInput = {
/**
*
*/
deviceModelName?: (string) | null;
ioTPlatform?: IoTPlatformTypeEnum;
/**
* Id
*/
ioTPlatformProductId?: (string) | null;
/**
*
*/
scriptName?: (string) | null;
/**
*
*/
functionScript?: (string) | null;
id?: string;
};
/** /**
* *
@ -1958,7 +2545,7 @@ export type IdentityUserUpdateDto = {
}; };
export type IdInput = { export type IdInput = {
id?: string; id: string;
}; };
export type InterfaceMethodApiDescriptionModel = { export type InterfaceMethodApiDescriptionModel = {
@ -2077,6 +2664,10 @@ export type IoTPlatformThingModelInfoDto = {
* *
*/ */
isSpecialIdentifier?: boolean; isSpecialIdentifier?: boolean;
/**
*
*/
ioTPlatformRawFieldExtension?: (string) | null;
}; };
export type IoTPlatformThingModelInfoDtoPagedResultDto = { export type IoTPlatformThingModelInfoDtoPagedResultDto = {
@ -2251,6 +2842,26 @@ export type LoginResultType = 1 | 2 | 3 | 4 | 5;
*/ */
export type MenuType = 10 | 20; export type MenuType = 10 | 20;
/**
*
*/
export type MessageAnalysisTestInput = {
/**
*
*/
functionName?: (string) | null;
/**
*
*/
functionCode?: (string) | null;
/**
*
*/
parameters?: {
[key: string]: unknown;
} | null;
};
/** /**
* *
*/ */
@ -2772,7 +3383,7 @@ export type OneNETProductInfoDto = {
*/ */
communicationAddressTLS?: (string) | null; communicationAddressTLS?: (string) | null;
/** /**
* *
*/ */
thingModelInfos?: (string) | null; thingModelInfos?: (string) | null;
}; };
@ -3436,6 +4047,9 @@ export type PagingAuditLogInput = {
readonly skipCount?: number; readonly skipCount?: number;
/** /**
* *
* <example>
* name desc
* </example>
*/ */
sorting?: (string) | null; sorting?: (string) | null;
/** /**
@ -4015,6 +4629,11 @@ export type ParameterApiDescriptionModel = {
descriptorName?: (string) | null; descriptorName?: (string) | null;
}; };
/**
*
*/
export type ParsingSequenceTypeEnum = 1 | 2;
export type PermissionOutput = { export type PermissionOutput = {
grants?: Array<(string)> | null; grants?: Array<(string)> | null;
allGrants?: Array<(string)> | null; allGrants?: Array<(string)> | null;
@ -4571,7 +5190,7 @@ export type SettingOutput = {
}; };
export type StringIdInput = { export type StringIdInput = {
id?: (string) | null; id: string;
}; };
export type StringStringFromSelector = { export type StringStringFromSelector = {
@ -5254,6 +5873,242 @@ export type PostDeviceInfoCacheDeviceDataToRedisResponse = (boolean);
export type PostDeviceInfoCacheDeviceDataToRedisError = unknown; export type PostDeviceInfoCacheDeviceDataToRedisError = unknown;
export type PostDeviceThingModelManagementCreateAsyncData = {
query?: {
input?: DeviceThingModelCreateInput;
};
};
export type PostDeviceThingModelManagementCreateAsyncResponse = (DeviceThingModelManagementDto);
export type PostDeviceThingModelManagementCreateAsyncError = unknown;
export type PostDeviceThingModelManagementUpdateAsyncData = {
query?: {
input?: DeviceThingModelUpdateInput;
};
};
export type PostDeviceThingModelManagementUpdateAsyncResponse = (DeviceThingModelManagementDto);
export type PostDeviceThingModelManagementUpdateAsyncError = unknown;
export type PostDeviceThingModelManagementDeleteAsyncData = {
query?: {
input?: IdInput;
};
};
export type PostDeviceThingModelManagementDeleteAsyncResponse = (boolean);
export type PostDeviceThingModelManagementDeleteAsyncError = unknown;
export type PostDeviceThingModelManagementFindByIdAsyncData = {
query?: {
input?: IdInput;
};
};
export type PostDeviceThingModelManagementFindByIdAsyncResponse = (DeviceThingModelManagementDto);
export type PostDeviceThingModelManagementFindByIdAsyncError = unknown;
export type PostDeviceThingModelManagementGetDeviceThingModelAllInfoByIdAsyncData = {
query?: {
input?: IdInput;
};
};
export type PostDeviceThingModelManagementGetDeviceThingModelAllInfoByIdAsyncResponse = (DeviceThingModelManagementDto);
export type PostDeviceThingModelManagementGetDeviceThingModelAllInfoByIdAsyncError = unknown;
export type PostDeviceThingModelManagementBuildAnalysisScriptByIdAsyncData = {
query?: {
input?: IdInput;
};
};
export type PostDeviceThingModelManagementBuildAnalysisScriptByIdAsyncResponse = (BuildAnalysisScriptOutput);
export type PostDeviceThingModelManagementBuildAnalysisScriptByIdAsyncError = unknown;
export type PostDeviceThingModelManagementBuildAnalysisScriptAsyncData = {
query?: {
input?: BuildAnalysisScriptInput;
};
};
export type PostDeviceThingModelManagementBuildAnalysisScriptAsyncResponse = (boolean);
export type PostDeviceThingModelManagementBuildAnalysisScriptAsyncError = unknown;
export type PostDeviceThingModelManagementUpdateAnalysisScriptByIdAsyncData = {
query?: {
input?: IdInput;
};
};
export type PostDeviceThingModelManagementUpdateAnalysisScriptByIdAsyncResponse = (boolean);
export type PostDeviceThingModelManagementUpdateAnalysisScriptByIdAsyncError = unknown;
export type PostDeviceThingModelManagementMessageAnalysisTestAsyncData = {
query?: {
input?: MessageAnalysisTestInput;
};
};
export type PostDeviceThingModelManagementMessageAnalysisTestAsyncResponse = ({
[key: string]: unknown;
});
export type PostDeviceThingModelManagementMessageAnalysisTestAsyncError = unknown;
export type PostDeviceThingModelManagementFindByPlatformProductIdAsyncData = {
query?: {
input?: StringIdInput;
};
};
export type PostDeviceThingModelManagementFindByPlatformProductIdAsyncResponse = (Array<DeviceThingModelManagementDto>);
export type PostDeviceThingModelManagementFindByPlatformProductIdAsyncError = unknown;
export type PostDeviceThingModelManagementCopyAnotherThingModelAsyncData = {
query?: {
input?: CopyAnotherDeviceInput;
};
};
export type PostDeviceThingModelManagementCopyAnotherThingModelAsyncResponse = (boolean);
export type PostDeviceThingModelManagementCopyAnotherThingModelAsyncError = unknown;
export type PostDeviceThingModelManagementPageAsyncData = {
query?: {
input?: DeviceThingModelPageInput;
};
};
export type PostDeviceThingModelManagementPageAsyncResponse = (DeviceThingModelManagementDtoPagedResultDto);
export type PostDeviceThingModelManagementPageAsyncError = unknown;
export type PostDeviceThingModelManagementPropertyCreateAsyncData = {
query?: {
input?: DeviceThingModelPropertyCreateInput;
};
};
export type PostDeviceThingModelManagementPropertyCreateAsyncResponse = (DeviceThingModelPropertyInfoDto);
export type PostDeviceThingModelManagementPropertyCreateAsyncError = unknown;
export type PostDeviceThingModelManagementPropertyUpdateAsyncData = {
query?: {
input?: DeviceThingModelPropertyUpdateInput;
};
};
export type PostDeviceThingModelManagementPropertyUpdateAsyncResponse = (DeviceThingModelPropertyInfoDto);
export type PostDeviceThingModelManagementPropertyUpdateAsyncError = unknown;
export type PostDeviceThingModelManagementPropertyDeleteAsyncData = {
query?: {
input?: IdInput;
};
};
export type PostDeviceThingModelManagementPropertyDeleteAsyncResponse = (boolean);
export type PostDeviceThingModelManagementPropertyDeleteAsyncError = unknown;
export type PostDeviceThingModelManagementPropertyFindByIdAsyncData = {
query?: {
input?: IdInput;
};
};
export type PostDeviceThingModelManagementPropertyFindByIdAsyncResponse = (DeviceThingModelPropertyInfoDto);
export type PostDeviceThingModelManagementPropertyFindByIdAsyncError = unknown;
export type PostDeviceThingModelManagementPropertyPageAsyncData = {
query?: {
input?: DeviceThingModelPropertyPageInput;
};
};
export type PostDeviceThingModelManagementPropertyPageAsyncResponse = (DeviceThingModelPropertyInfoDtoPagedResultDto);
export type PostDeviceThingModelManagementPropertyPageAsyncError = unknown;
export type PostDeviceThingModelManagementCommandCreateAsyncData = {
query?: {
input?: DeviceThingModelCommandInfoCreateInput;
};
};
export type PostDeviceThingModelManagementCommandCreateAsyncResponse = (DeviceThingModelCommandInfoDto);
export type PostDeviceThingModelManagementCommandCreateAsyncError = unknown;
export type PostDeviceThingModelManagementCommandUpdateAsyncData = {
query?: {
input?: DeviceThingModelCommandInfoUpdateInput;
};
};
export type PostDeviceThingModelManagementCommandUpdateAsyncResponse = (DeviceThingModelCommandInfoDto);
export type PostDeviceThingModelManagementCommandUpdateAsyncError = unknown;
export type PostDeviceThingModelManagementCommandDeleteAsyncData = {
query?: {
input?: IdInput;
};
};
export type PostDeviceThingModelManagementCommandDeleteAsyncResponse = (boolean);
export type PostDeviceThingModelManagementCommandDeleteAsyncError = unknown;
export type PostDeviceThingModelManagementCommandFindByIdAsyncData = {
query?: {
input?: IdInput;
};
};
export type PostDeviceThingModelManagementCommandFindByIdAsyncResponse = (DeviceThingModelCommandInfoDto);
export type PostDeviceThingModelManagementCommandFindByIdAsyncError = unknown;
export type PostDeviceThingModelManagementCommandPageAsyncData = {
query?: {
input?: DeviceThingModelCommandInfoPageInput;
};
};
export type PostDeviceThingModelManagementCommandPageAsyncResponse = (DeviceThingModelCommandInfoDtoPagedResultDto);
export type PostDeviceThingModelManagementCommandPageAsyncError = unknown;
export type PostDeviceThingModelManagementCacheDeviceThingModelToRedisAsyncData = {
query?: {
input?: IdInput;
};
};
export type PostDeviceThingModelManagementCacheDeviceThingModelToRedisAsyncResponse = (boolean);
export type PostDeviceThingModelManagementCacheDeviceThingModelToRedisAsyncError = unknown;
export type PostDeviceThingModelManagementCacheAllDeviceThingModelToRedisAsyncResponse = (boolean);
export type PostDeviceThingModelManagementCacheAllDeviceThingModelToRedisAsyncError = unknown;
export type PostFeaturesListData = { export type PostFeaturesListData = {
body?: GetFeatureListResultInput; body?: GetFeatureListResultInput;
}; };
@ -5694,6 +6549,16 @@ export type PostOneNetProductProductStatusChangeAsyncResponse = (OneNETProductIn
export type PostOneNetProductProductStatusChangeAsyncError = unknown; export type PostOneNetProductProductStatusChangeAsyncError = unknown;
export type PostOneNetProductUpdateThingModelAsyncData = {
query?: {
input?: IdInput;
};
};
export type PostOneNetProductUpdateThingModelAsyncResponse = (OneNETProductInfoDto);
export type PostOneNetProductUpdateThingModelAsyncError = unknown;
export type PostOneNetProductListAsyncData = { export type PostOneNetProductListAsyncData = {
query?: { query?: {
input?: OneNetProductInfoListInput; input?: OneNetProductInfoListInput;

View File

@ -23,8 +23,6 @@ import {
import { TableAction } from '#/components/table-action'; import { TableAction } from '#/components/table-action';
import { $t } from '#/locales'; import { $t } from '#/locales';
import ThingModelInfoModal from '#/views/thingmodelinfo/ioTPlatformThingModelInfo/index.vue';
import { import {
addProductFormSchema, addProductFormSchema,
editProductFormSchemaEdit, editProductFormSchemaEdit,
@ -78,10 +76,6 @@ const editRow: Record<string, any> = ref({});
// //
let selectedFile: File | null = null; let selectedFile: File | null = null;
//
const thingModelModalVisible = ref(false);
const currentProductInfo = ref<any>({});
// //
setFileSelectedCallback((file) => { setFileSelectedCallback((file) => {
selectedFile = file; selectedFile = file;
@ -330,22 +324,15 @@ function onDeviceManagement(record: any) {
// //
function onThingModelManagement(record: any) { function onThingModelManagement(record: any) {
console.log('物模型管理按钮被点击', record); console.log('物模型管理按钮被点击', record);
// // ID
currentProductInfo.value = { router.push({
productId: record.ioTPlatformProductId, path: '/thingmodelinfo/ioTPlatformThingModelInfo',
query: {
productId: record.ioTPlatformProductId, // ID
productName: record.productName, productName: record.productName,
ioTPlatform: '2', // OneNET2 ioTPlatform: '2', // OneNET2
}; },
console.log('设置产品信息:', currentProductInfo.value); });
//
thingModelModalVisible.value = true;
console.log('模态框状态设置为:', thingModelModalVisible.value);
}
//
function closeThingModelModal() {
thingModelModalVisible.value = false;
currentProductInfo.value = {};
} }
</script> </script>
@ -428,14 +415,5 @@ function closeThingModelModal() {
<UserModal :title="editRow.id ? $t('common.edit') : $t('common.add')" class="w-[800px]"> <UserModal :title="editRow.id ? $t('common.edit') : $t('common.add')" class="w-[800px]">
<component :is="editRow.id ? EditForm : AddForm" /> <component :is="editRow.id ? EditForm : AddForm" />
</UserModal> </UserModal>
<!-- 物模型信息模态框 -->
<ThingModelInfoModal
v-model:visible="thingModelModalVisible"
:product-id="currentProductInfo.productId"
:product-name="currentProductInfo.productName"
:io-t-platform="currentProductInfo.ioTPlatform"
@close="closeThingModelModal"
/>
</Page> </Page>
</template> </template>

View File

@ -2,11 +2,12 @@
import type { VbenFormProps } from '#/adapter/form'; import type { VbenFormProps } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table'; import type { VxeGridProps } from '#/adapter/vxe-table';
import { h, nextTick, ref, watch } from 'vue'; import { h, nextTick, onMounted, ref, watch } from 'vue';
import { useRoute } from 'vue-router';
import { useVbenModal } from '@vben/common-ui'; import { Page, useVbenModal } from '@vben/common-ui';
import { message as Message, Modal, Tag } from 'ant-design-vue'; 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';
@ -30,29 +31,15 @@ import {
} from './schema'; } from './schema';
defineOptions({ defineOptions({
name: 'ThingModelInfoModal', name: 'IoTPlatformThingModelInfo',
}); });
const props = withDefaults(defineProps<Props>(), { const route = useRoute();
visible: false,
productId: '',
productName: '',
ioTPlatform: '2',
});
// emits //
const emit = defineEmits<{ const productId = ref<string>((route.query.productId as string) || '');
close: []; const productName = ref<string>((route.query.productName as string) || '');
'update:visible': [value: boolean]; const ioTPlatform = ref<string>((route.query.ioTPlatform as string) || '2');
}>();
// props
interface Props {
visible?: boolean;
productId?: string;
productName?: string;
ioTPlatform?: string;
}
const formOptions: VbenFormProps = { const formOptions: VbenFormProps = {
schema: querySchema.value, schema: querySchema.value,
@ -76,20 +63,38 @@ const gridOptions: VxeGridProps<any> = {
proxyConfig: { proxyConfig: {
ajax: { ajax: {
query: async ({ page }, formValues) => { query: async ({ page }, formValues) => {
// ID
if (!productId.value) {
hasData.value = false;
return {
items: [],
totalCount: 0,
};
}
try {
const { data } = await postIoTplatformThingModelInfoPageAsync({ const { data } = await postIoTplatformThingModelInfoPageAsync({
query: { query: {
input: { input: {
pageIndex: page.currentPage, pageIndex: page.currentPage,
pageSize: page.pageSize, pageSize: page.pageSize,
ioTPlatform: Number.parseInt(props.ioTPlatform) as 1 | 2, ioTPlatform: Number.parseInt(ioTPlatform.value) as 1 | 2,
ioTPlatformProductId: props.productId, ioTPlatformProductId: productId.value,
...(formValues?.SearchKeyWords && { searchKeyWords: formValues.SearchKeyWords }), ...(formValues?.SearchKeyWords && { searchKeyWords: formValues.SearchKeyWords }),
}, },
}, },
}); });
// //
hasData.value = data?.items && data.items.length > 0; hasData.value = data?.items && data.items.length > 0;
return data; return data || { items: [], totalCount: 0 };
} catch (error) {
console.error('查询物模型信息失败:', error);
hasData.value = false;
return {
items: [],
totalCount: 0,
};
}
}, },
}, },
}, },
@ -183,41 +188,69 @@ const [CopyForm, copyFormApi] = useVbenForm({
wrapperClass: 'grid-cols-2', wrapperClass: 'grid-cols-2',
}); });
// props //
watch( watch(
() => [props.visible, props.productId, props.ioTPlatform], () => [route.query.productId, route.query.ioTPlatform],
async ([visible, productId, ioTPlatform]) => { async ([newProductId, newIoTPlatform]) => {
console.log('物模型模态框props变化:', { visible, productId, ioTPlatform }); if (newProductId) {
console.log('所有props:', props); productId.value = newProductId as string;
if (visible && productId) { }
if (newIoTPlatform) {
ioTPlatform.value = newIoTPlatform as string;
}
if (route.query.productName) {
productName.value = route.query.productName as string;
}
// //
if (gridApi) {
setTimeout(async () => { setTimeout(async () => {
try { try {
//
const filterValues: any = {};
// ioTPlatformProductId API props.productId
// SearchKeyWords
console.log('设置筛选条件:', filterValues);
//
if (Object.keys(filterValues).length > 0) {
await gridApi.formApi.setValues(filterValues);
}
// 使 productId
await gridApi.reload(); await gridApi.reload();
} catch (error) { } catch (error) {
console.error('设置筛选条件时出错:', error); console.error('加载数据时出错:', error);
} }
}, 100); }, 100);
} }
}, },
{ immediate: true }, { immediate: false },
); );
//
onMounted(async () => {
//
if (route.query.productId) {
productId.value = route.query.productId as string;
}
if (route.query.productName) {
productName.value = route.query.productName as string;
}
if (route.query.ioTPlatform) {
ioTPlatform.value = route.query.ioTPlatform as string;
}
//
// 使 productId
await nextTick();
setTimeout(async () => {
if (gridApi && gridApi.reload) {
try {
await gridApi.reload();
} catch (error) {
console.error('初始化加载数据时出错:', error);
}
}
}, 300);
});
// //
async function submit() { async function submit() {
// ID
if (!productId.value) {
Message.error('产品ID不存在无法保存物模型信息');
return;
}
const isEdit = !!editRow.value.id; const isEdit = !!editRow.value.id;
const formApi = isEdit ? editFormApi : addFormApi; const formApi = isEdit ? editFormApi : addFormApi;
const api = isEdit const api = isEdit
@ -230,8 +263,8 @@ async function submit() {
const fetchParams: any = { const fetchParams: any = {
...formValues, ...formValues,
// //
ioTPlatform: Number.parseInt(props.ioTPlatform) as 1 | 2, ioTPlatform: Number.parseInt(ioTPlatform.value) as 1 | 2,
ioTPlatformProductId: props.productId, ioTPlatformProductId: productId.value,
// ID // ID
...(isEdit && { id: editRow.value.id }), ...(isEdit && { id: editRow.value.id }),
}; };
@ -270,16 +303,22 @@ const openAddModal = async () => {
// //
const openCopyAnotherThingModelModal = async () => { const openCopyAnotherThingModelModal = async () => {
console.log('打开复制模态框,当前props:', { console.log('打开复制模态框,当前参数:', {
productId: props.productId, productId: productId.value,
productName: props.productName, productName: productName.value,
ioTPlatform: props.ioTPlatform, ioTPlatform: ioTPlatform.value,
}); });
copyModalApi.open(); copyModalApi.open();
}; };
// //
async function submitCopy() { async function submitCopy() {
// ID
if (!productId.value) {
Message.error('产品ID不存在无法复制物模型信息');
return;
}
const { valid } = await copyFormApi.validate(); const { valid } = await copyFormApi.validate();
if (!valid) return; if (!valid) return;
@ -287,10 +326,10 @@ async function submitCopy() {
console.log('复制提交参数:', { console.log('复制提交参数:', {
formValues, formValues,
props: { params: {
productId: props.productId, productId: productId.value,
productName: props.productName, productName: productName.value,
ioTPlatform: props.ioTPlatform, ioTPlatform: ioTPlatform.value,
}, },
}); });
@ -298,8 +337,8 @@ async function submitCopy() {
const resp = await postIoTplatformThingModelInfoCopyAnotherThingModelAsync({ const resp = await postIoTplatformThingModelInfoCopyAnotherThingModelAsync({
query: { query: {
input: { input: {
ioTPlatform: Number.parseInt(props.ioTPlatform) as 1 | 2, ioTPlatform: Number.parseInt(ioTPlatform.value) as 1 | 2,
ioTPlatformProductId: props.productId, ioTPlatformProductId: productId.value,
sourceProductId: formValues.ioTPlatformProductId, sourceProductId: formValues.ioTPlatformProductId,
}, },
}, },
@ -340,12 +379,18 @@ async function onDel(record: any) {
// //
async function copyStandardThingModel() { async function copyStandardThingModel() {
// ID
if (!productId.value) {
Message.error('产品ID不存在无法复制标准模型');
return;
}
try { try {
const resp = await postIoTplatformThingModelInfoCopyStandardThingModel({ const resp = await postIoTplatformThingModelInfoCopyStandardThingModel({
query: { query: {
input: { input: {
ioTPlatform: Number.parseInt(props.ioTPlatform) as 1 | 2, ioTPlatform: Number.parseInt(ioTPlatform.value) as 1 | 2,
ioTPlatformProductId: props.productId, ioTPlatformProductId: productId.value,
}, },
}, },
}); });
@ -360,20 +405,11 @@ async function copyStandardThingModel() {
Message.error('复制标准模型失败'); Message.error('复制标准模型失败');
} }
} }
//
function closeModal() {
emit('update:visible', false);
emit('close');
}
</script> </script>
<template> <template>
<Modal :open="visible" :title="`${props.ioTPlatform === 1 ? 'CTWing' : 'OneNET'}物模型管理 - ${productName || '产品'}`" <Page auto-content-height>
width="90%" :footer="null" @cancel="closeModal" @ok="closeModal" <Grid>
:body-style="{ height: '70vh', overflow: 'hidden' }">
<div style="display: flex; flex-direction: column; height: 100%">
<Grid style="flex: 1; overflow: hidden">
<template #toolbar-actions> <template #toolbar-actions>
<TableAction :actions="[ <TableAction :actions="[
{ {
@ -382,6 +418,7 @@ function closeModal() {
icon: 'ant-design:plus-outlined', icon: 'ant-design:plus-outlined',
onClick: openAddModal.bind(null), onClick: openAddModal.bind(null),
auth: ['AbpIdentity.Users.Create'], auth: ['AbpIdentity.Users.Create'],
disabled: !productId,
}, },
{ {
label: $t('abp.thingModelInfos.copyStandardThingModel'), label: $t('abp.thingModelInfos.copyStandardThingModel'),
@ -389,6 +426,7 @@ function closeModal() {
icon: 'ant-design:copy-outlined', icon: 'ant-design:copy-outlined',
onClick: copyStandardThingModel, onClick: copyStandardThingModel,
auth: ['AbpIdentity.Users.Create'], auth: ['AbpIdentity.Users.Create'],
disabled: !productId,
}, },
{ {
label: $t('abp.thingModelInfos.copyAnotherThingModelModal'), label: $t('abp.thingModelInfos.copyAnotherThingModelModal'),
@ -397,6 +435,7 @@ function closeModal() {
onClick: openCopyAnotherThingModelModal, onClick: openCopyAnotherThingModelModal,
auth: ['AbpIdentity.Users.Create'], auth: ['AbpIdentity.Users.Create'],
ifShow: !hasData, ifShow: !hasData,
disabled: !productId,
}, },
]" /> ]" />
</template> </template>
@ -433,7 +472,6 @@ function closeModal() {
]" /> ]" />
</template> </template>
</Grid> </Grid>
</div>
<ThingModelModal :title="editRow.id ? $t('common.edit') : $t('common.add')" class="w-[800px]"> <ThingModelModal :title="editRow.id ? $t('common.edit') : $t('common.add')" class="w-[800px]">
<component :is="editRow.id ? EditForm : AddForm" /> <component :is="editRow.id ? EditForm : AddForm" />
</ThingModelModal> </ThingModelModal>
@ -442,5 +480,5 @@ function closeModal() {
<CopyModal title="复制已有模型" class="w-[600px]"> <CopyModal title="复制已有模型" class="w-[600px]">
<CopyForm /> <CopyForm />
</CopyModal> </CopyModal>
</Modal> </Page>
</template> </template>