From b8b96601729ceb4b3c8309998ba6ded4b4cacd8c Mon Sep 17 00:00:00 2001
From: ChenYi <296215406@outlook.com>
Date: Wed, 11 Mar 2026 16:03:29 +0800
Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=8E=A8=E9=80=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
apps/web-antd/src/api-client/schemas.gen.ts | 27 ++++---
apps/web-antd/src/api-client/types.gen.ts | 21 +++---
.../onenetmanagement/privateProduct/index.vue | 72 +++++++++++++++----
3 files changed, 79 insertions(+), 41 deletions(-)
diff --git a/apps/web-antd/src/api-client/schemas.gen.ts b/apps/web-antd/src/api-client/schemas.gen.ts
index 1c2ce11..8d1921b 100644
--- a/apps/web-antd/src/api-client/schemas.gen.ts
+++ b/apps/web-antd/src/api-client/schemas.gen.ts
@@ -7165,9 +7165,14 @@ export const OneNETDataFlowConfigInputSchema = {
dataPushType: {
'$ref': '#/components/schemas/DataPushTypeEnum'
},
+ dataPushServer: {
+ type: 'string',
+ description: '数据推送服务地址信息,例如HTTP地址:http://192.168.1.1:8080,Redis订阅地址:192.168.1.1:6379',
+ nullable: true
+ },
dataPushInfo: {
type: 'string',
- description: '数据推送信息,HTTP推送就是推送地址,Reist推送主题或者key',
+ description: '数据推送信息,HTTP推送就是推送路径,Redis推送主题或者key',
nullable: true
}
},
@@ -7382,9 +7387,14 @@ export const OneNETProductInfoDtoSchema = {
dataPushType: {
'$ref': '#/components/schemas/DataPushTypeEnum'
},
+ dataPushServer: {
+ type: 'string',
+ description: '数据推送服务地址信息,例如HTTP地址:http://192.168.1.1:8080,Redis订阅地址:192.168.1.1:6379',
+ nullable: true
+ },
dataPushInfo: {
type: 'string',
- description: '数据推送信息,HTTP推送就是推送地址,Reist推送主题或者key',
+ description: '数据推送信息,HTTP推送就是推送路径,Redis推送主题或者key',
nullable: true
}
},
@@ -7650,19 +7660,6 @@ export const OneNetProductInfoModifyInputSchema = {
type: 'string',
description: '物模型文件名称',
nullable: true
- },
- isNeedPushData: {
- type: 'boolean',
- description: '是否需要推送数据',
- nullable: true
- },
- dataPushType: {
- '$ref': '#/components/schemas/DataPushTypeEnum'
- },
- dataPushInfo: {
- type: 'string',
- description: '数据推送信息,HTTP推送就是推送地址,Reist推送主题或者key',
- nullable: true
}
},
additionalProperties: false,
diff --git a/apps/web-antd/src/api-client/types.gen.ts b/apps/web-antd/src/api-client/types.gen.ts
index dd071d7..d46a90f 100644
--- a/apps/web-antd/src/api-client/types.gen.ts
+++ b/apps/web-antd/src/api-client/types.gen.ts
@@ -3882,7 +3882,11 @@ export type OneNETDataFlowConfigInput = {
isNeedPushData?: boolean;
dataPushType?: DataPushTypeEnum;
/**
- * 数据推送信息,HTTP推送就是推送地址,Reist推送主题或者key
+ * 数据推送服务地址信息,例如HTTP地址:http://192.168.1.1:8080,Redis订阅地址:192.168.1.1:6379
+ */
+ dataPushServer?: (string) | null;
+ /**
+ * 数据推送信息,HTTP推送就是推送路径,Redis推送主题或者key
*/
dataPushInfo?: (string) | null;
};
@@ -4026,7 +4030,11 @@ export type OneNETProductInfoDto = {
isNeedPushData?: boolean;
dataPushType?: DataPushTypeEnum;
/**
- * 数据推送信息,HTTP推送就是推送地址,Reist推送主题或者key
+ * 数据推送服务地址信息,例如HTTP地址:http://192.168.1.1:8080,Redis订阅地址:192.168.1.1:6379
+ */
+ dataPushServer?: (string) | null;
+ /**
+ * 数据推送信息,HTTP推送就是推送路径,Redis推送主题或者key
*/
dataPushInfo?: (string) | null;
};
@@ -4141,15 +4149,6 @@ export type OneNetProductInfoModifyInput = {
* 物模型文件名称
*/
thingModelFileName?: (string) | null;
- /**
- * 是否需要推送数据
- */
- isNeedPushData?: (boolean) | null;
- dataPushType?: DataPushTypeEnum;
- /**
- * 数据推送信息,HTTP推送就是推送地址,Reist推送主题或者key
- */
- dataPushInfo?: (string) | null;
};
/**
diff --git a/apps/web-antd/src/views/onenetmanagement/privateProduct/index.vue b/apps/web-antd/src/views/onenetmanagement/privateProduct/index.vue
index 268a6d0..7664a1a 100644
--- a/apps/web-antd/src/views/onenetmanagement/privateProduct/index.vue
+++ b/apps/web-antd/src/views/onenetmanagement/privateProduct/index.vue
@@ -12,6 +12,7 @@ import { message as Message, Tag } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import {
+ getCommonGetSelectList,
postAggregationIoTplatformUpdateIoTplatformProductThingModelInfoAsync,
postFilesDownload,
postFilesUpload,
@@ -19,8 +20,8 @@ import {
postOneNetProductInsertAsync,
postOneNetProductListAsync,
postOneNetProductModifyAsync,
- postOneNetProductProductStatusChangeAsync,
postOneNetProductOneNetDataFlowConfig,
+ postOneNetProductProductStatusChangeAsync,
} from '#/api-client';
import { TableAction } from '#/components/table-action';
import { $t } from '#/locales';
@@ -32,7 +33,6 @@ import {
setFileSelectedCallback,
tableSchema,
} from './schema';
-import { getCommonGetSelectList } from '#/api-client';
defineOptions({
name: 'OneNETProduct',
@@ -151,20 +151,31 @@ const [EditForm, editFormApi] = useVbenForm({
});
const [DataFlowForm, dataFlowFormApi] = useVbenForm({
+ // 默认展开
collapsed: false,
+ // 与产品新增表单保持一致的布局和宽度
+ commonConfig: {
+ labelWidth: 120,
+ componentProps: {
+ class: 'w-4/5',
+ },
+ },
layout: 'horizontal',
showCollapseButton: false,
showDefaultActions: false,
+ wrapperClass: 'grid-cols-2',
schema: [
{
component: 'Switch',
fieldName: 'isNeedPushData',
- label: '是否需要推送数据',
+ label: '是否推送数据',
componentProps: {
checkedValue: true,
unCheckedValue: false,
checkedChildren: '是',
unCheckedChildren: '否',
+ // 覆盖公共宽度样式,避免开关被拉长
+ class: 'ml-6',
},
},
{
@@ -183,7 +194,7 @@ const [DataFlowForm, dataFlowFormApi] = useVbenForm({
optionsPropName: 'options',
immediate: true,
allowClear: true,
- placeholder: '请选择数据推送类型',
+ placeholder: '请选择推送类型',
afterFetch: (res: any) => {
let items = [];
if (Array.isArray(res)) {
@@ -202,10 +213,19 @@ const [DataFlowForm, dataFlowFormApi] = useVbenForm({
},
{
component: 'Input',
- fieldName: 'dataPushInfo',
- label: '数据推送信息',
+ fieldName: 'dataPushServer',
+ label: '推送服务器地址',
componentProps: {
- placeholder: 'HTTP 为推送地址,Redis 为主题或 key',
+ placeholder:
+ 'HTTP:如 http://192.168.1.1:8080,Redis:如 192.168.1.1:6379',
+ },
+ },
+ {
+ component: 'Input',
+ fieldName: 'dataPushInfo',
+ label: '推送路径、KEY',
+ componentProps: {
+ placeholder: 'HTTP 为推送路径,Redis 为主题或 key',
},
},
],
@@ -391,7 +411,11 @@ async function onDataFlowConfig(record: any) {
editRow.value = record;
dataFlowFormApi.setValues({
isNeedPushData: record.isNeedPushData ?? false,
- dataPushType: record.dataPushType,
+ dataPushType:
+ record.dataPushType !== undefined && record.dataPushType !== null
+ ? String(record.dataPushType)
+ : undefined,
+ dataPushServer: record.dataPushServer,
dataPushInfo: record.dataPushInfo,
});
dataFlowModalApi.open();
@@ -403,13 +427,28 @@ async function submitDataFlowConfig() {
return;
}
- const { valid } = await dataFlowFormApi.validate();
- if (!valid) {
- return;
- }
-
const values = await dataFlowFormApi.getValues();
+ // 当需要推送数据时,校验其他字段必填
+ if (values.isNeedPushData) {
+ if (
+ values.dataPushType === undefined ||
+ values.dataPushType === null ||
+ values.dataPushType === ''
+ ) {
+ Message.error('请选择数据推送类型');
+ return;
+ }
+ if (!values.dataPushServer) {
+ Message.error('请输入推送服务器地址');
+ return;
+ }
+ if (!values.dataPushInfo) {
+ Message.error('请输入推送路径或 KEY');
+ return;
+ }
+ }
+
try {
const resp = await postOneNetProductOneNetDataFlowConfig({
body: {
@@ -419,6 +458,7 @@ async function submitDataFlowConfig() {
values.dataPushType !== undefined && values.dataPushType !== null
? Number(values.dataPushType)
: undefined,
+ dataPushServer: values.dataPushServer,
dataPushInfo: values.dataPushInfo,
},
});
@@ -489,7 +529,9 @@ function getRowActions(row: any) {
label: 'OneNET物模型更新',
type: 'link',
size: 'small',
- loading: productId ? (thingModelUpdateLoading.value[productId] || false) : false,
+ loading: productId
+ ? thingModelUpdateLoading.value[productId] || false
+ : false,
onClick: onThingModelUpdate.bind(null, row),
},
];
@@ -613,7 +655,7 @@ async function onThingModelUpdate(record: any) {
-
+