From 9ef2ebd13a65a8cd11d0105160a85ad3def96043 Mon Sep 17 00:00:00 2001 From: ChenYi <296215406@outlook.com> Date: Thu, 18 Dec 2025 22:05:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DeviceThingModelCommandModal.vue | 88 +++++++++++++++++ .../DeviceThingModelPropertyModal.vue | 94 +++++++++++++++++++ .../deviceThingModelManagement/index.vue | 69 +++++++++++++- 3 files changed, 247 insertions(+), 4 deletions(-) create mode 100644 apps/web-antd/src/views/thingmodelinfo/deviceThingModelManagement/DeviceThingModelCommandModal.vue create mode 100644 apps/web-antd/src/views/thingmodelinfo/deviceThingModelManagement/DeviceThingModelPropertyModal.vue diff --git a/apps/web-antd/src/views/thingmodelinfo/deviceThingModelManagement/DeviceThingModelCommandModal.vue b/apps/web-antd/src/views/thingmodelinfo/deviceThingModelManagement/DeviceThingModelCommandModal.vue new file mode 100644 index 0000000..7eeaa79 --- /dev/null +++ b/apps/web-antd/src/views/thingmodelinfo/deviceThingModelManagement/DeviceThingModelCommandModal.vue @@ -0,0 +1,88 @@ + + + + + diff --git a/apps/web-antd/src/views/thingmodelinfo/deviceThingModelManagement/DeviceThingModelPropertyModal.vue b/apps/web-antd/src/views/thingmodelinfo/deviceThingModelManagement/DeviceThingModelPropertyModal.vue new file mode 100644 index 0000000..2bf0fc5 --- /dev/null +++ b/apps/web-antd/src/views/thingmodelinfo/deviceThingModelManagement/DeviceThingModelPropertyModal.vue @@ -0,0 +1,94 @@ + + + + + diff --git a/apps/web-antd/src/views/thingmodelinfo/deviceThingModelManagement/index.vue b/apps/web-antd/src/views/thingmodelinfo/deviceThingModelManagement/index.vue index 1cd6617..51ad5ce 100644 --- a/apps/web-antd/src/views/thingmodelinfo/deviceThingModelManagement/index.vue +++ b/apps/web-antd/src/views/thingmodelinfo/deviceThingModelManagement/index.vue @@ -27,6 +27,9 @@ import { tableSchema, } from './schema'; +import DeviceThingModelPropertyModal from './DeviceThingModelPropertyModal.vue'; +import DeviceThingModelCommandModal from './DeviceThingModelCommandModal.vue'; + defineOptions({ name: 'DeviceThingModelManagement', }); @@ -113,10 +116,18 @@ const gridOptions: VxeGridProps = { proxyConfig: { ajax: { query: async ({ page }, formValues) => { + // 始终以最新的表单值为准,确保搜索关键字等字段不会丢失 + const latestFormValues = + formValues || + (gridApi && gridApi.formApi + ? await gridApi.formApi.getValues() + : {}); + // 优先使用表单值,如果没有则使用响应式变量 - const currentPlatform = formValues?.ioTPlatform || ioTPlatform.value; + const currentPlatform = + latestFormValues?.ioTPlatform || ioTPlatform.value; const currentProductId = - formValues?.ioTPlatformProductId || productId.value; + latestFormValues?.ioTPlatformProductId || productId.value; try { const { data } = await postDeviceThingModelManagementPageAsync({ @@ -133,8 +144,8 @@ const gridOptions: VxeGridProps = { ...(currentProductId && { ioTPlatformProductId: String(currentProductId), }), - ...(formValues?.SearchKeyWords && { - searchKeyWords: formValues.SearchKeyWords, + ...(latestFormValues?.SearchKeyWords && { + searchKeyWords: latestFormValues.SearchKeyWords, }), }, }); @@ -156,6 +167,16 @@ const [Grid, gridApi] = useVbenVxeGrid({ formOptions, gridOptions }); const editRow: Record = ref({}); +// 属性管理弹窗(使用独立组件) +const [PropertyModal, propertyModalApi] = useVbenModal({ + connectedComponent: DeviceThingModelPropertyModal, +}); + +// 指令管理弹窗(使用独立组件) +const [CommandModal, commandModalApi] = useVbenModal({ + connectedComponent: DeviceThingModelCommandModal, +}); + const [ThingModelModal, thingModelModalApi] = useVbenModal({ draggable: true, footer: true, @@ -263,6 +284,26 @@ async function onEdit(record: any) { thingModelModalApi.open(); } +// 打开属性管理 +async function openPropertyModal(record: any) { + editRow.value = record; + propertyModalApi.setData({ + deviceThingModelId: record.id, + deviceModelName: record.deviceModelName, + }); + propertyModalApi.open(); +} + +// 打开指令管理 +async function openCommandModal(record: any) { + editRow.value = record; + commandModalApi.setData({ + deviceThingModelId: record.id, + deviceModelName: record.deviceModelName, + }); + commandModalApi.open(); +} + const openAddModal = async () => { editRow.value = {}; thingModelModalApi.open(); @@ -361,6 +402,20 @@ onMounted(async () => { auth: ['AbpIdentity.Users.Update'], onClick: onEdit.bind(null, row), }, + { + label: '属性管理', + type: 'link', + size: 'small', + auth: ['AbpIdentity.Users.Update'], + onClick: openPropertyModal.bind(null, row), + }, + { + label: '指令管理', + type: 'link', + size: 'small', + auth: ['AbpIdentity.Users.Update'], + onClick: openCommandModal.bind(null, row), + }, { label: $t('common.delete'), icon: 'ant-design:delete-outlined', @@ -377,6 +432,12 @@ onMounted(async () => { + + + + + +