数据推送

This commit is contained in:
ChenYi 2026-03-11 16:03:29 +08:00
parent 3b73411d09
commit b8b9660172
3 changed files with 79 additions and 41 deletions

View File

@ -7165,9 +7165,14 @@ export const OneNETDataFlowConfigInputSchema = {
dataPushType: { dataPushType: {
'$ref': '#/components/schemas/DataPushTypeEnum' '$ref': '#/components/schemas/DataPushTypeEnum'
}, },
dataPushServer: {
type: 'string',
description: '数据推送服务地址信息例如HTTP地址http://192.168.1.1:8080Redis订阅地址192.168.1.1:6379',
nullable: true
},
dataPushInfo: { dataPushInfo: {
type: 'string', type: 'string',
description: '数据推送信息,HTTP推送就是推送地址Reist推送主题或者key', description: '数据推送信息,HTTP推送就是推送路径Redis推送主题或者key',
nullable: true nullable: true
} }
}, },
@ -7382,9 +7387,14 @@ export const OneNETProductInfoDtoSchema = {
dataPushType: { dataPushType: {
'$ref': '#/components/schemas/DataPushTypeEnum' '$ref': '#/components/schemas/DataPushTypeEnum'
}, },
dataPushServer: {
type: 'string',
description: '数据推送服务地址信息例如HTTP地址http://192.168.1.1:8080Redis订阅地址192.168.1.1:6379',
nullable: true
},
dataPushInfo: { dataPushInfo: {
type: 'string', type: 'string',
description: '数据推送信息,HTTP推送就是推送地址Reist推送主题或者key', description: '数据推送信息,HTTP推送就是推送路径Redis推送主题或者key',
nullable: true nullable: true
} }
}, },
@ -7650,19 +7660,6 @@ export const OneNetProductInfoModifyInputSchema = {
type: 'string', type: 'string',
description: '物模型文件名称', description: '物模型文件名称',
nullable: true nullable: true
},
isNeedPushData: {
type: 'boolean',
description: '是否需要推送数据',
nullable: true
},
dataPushType: {
'$ref': '#/components/schemas/DataPushTypeEnum'
},
dataPushInfo: {
type: 'string',
description: '数据推送信息,HTTP推送就是推送地址Reist推送主题或者key',
nullable: true
} }
}, },
additionalProperties: false, additionalProperties: false,

View File

@ -3882,7 +3882,11 @@ export type OneNETDataFlowConfigInput = {
isNeedPushData?: boolean; isNeedPushData?: boolean;
dataPushType?: DataPushTypeEnum; dataPushType?: DataPushTypeEnum;
/** /**
* ,HTTP推送就是推送地址Reist推送主题或者key * HTTP地址http://192.168.1.1:8080Redis订阅地址192.168.1.1:6379
*/
dataPushServer?: (string) | null;
/**
* ,HTTP推送就是推送路径Redis推送主题或者key
*/ */
dataPushInfo?: (string) | null; dataPushInfo?: (string) | null;
}; };
@ -4026,7 +4030,11 @@ export type OneNETProductInfoDto = {
isNeedPushData?: boolean; isNeedPushData?: boolean;
dataPushType?: DataPushTypeEnum; dataPushType?: DataPushTypeEnum;
/** /**
* ,HTTP推送就是推送地址Reist推送主题或者key * HTTP地址http://192.168.1.1:8080Redis订阅地址192.168.1.1:6379
*/
dataPushServer?: (string) | null;
/**
* ,HTTP推送就是推送路径Redis推送主题或者key
*/ */
dataPushInfo?: (string) | null; dataPushInfo?: (string) | null;
}; };
@ -4141,15 +4149,6 @@ export type OneNetProductInfoModifyInput = {
* *
*/ */
thingModelFileName?: (string) | null; thingModelFileName?: (string) | null;
/**
*
*/
isNeedPushData?: (boolean) | null;
dataPushType?: DataPushTypeEnum;
/**
* ,HTTP推送就是推送地址Reist推送主题或者key
*/
dataPushInfo?: (string) | null;
}; };
/** /**

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,
postAggregationIoTplatformUpdateIoTplatformProductThingModelInfoAsync, postAggregationIoTplatformUpdateIoTplatformProductThingModelInfoAsync,
postFilesDownload, postFilesDownload,
postFilesUpload, postFilesUpload,
@ -19,8 +20,8 @@ import {
postOneNetProductInsertAsync, postOneNetProductInsertAsync,
postOneNetProductListAsync, postOneNetProductListAsync,
postOneNetProductModifyAsync, postOneNetProductModifyAsync,
postOneNetProductProductStatusChangeAsync,
postOneNetProductOneNetDataFlowConfig, postOneNetProductOneNetDataFlowConfig,
postOneNetProductProductStatusChangeAsync,
} from '#/api-client'; } from '#/api-client';
import { TableAction } from '#/components/table-action'; import { TableAction } from '#/components/table-action';
import { $t } from '#/locales'; import { $t } from '#/locales';
@ -32,7 +33,6 @@ import {
setFileSelectedCallback, setFileSelectedCallback,
tableSchema, tableSchema,
} from './schema'; } from './schema';
import { getCommonGetSelectList } from '#/api-client';
defineOptions({ defineOptions({
name: 'OneNETProduct', name: 'OneNETProduct',
@ -151,20 +151,31 @@ const [EditForm, editFormApi] = useVbenForm({
}); });
const [DataFlowForm, dataFlowFormApi] = useVbenForm({ const [DataFlowForm, dataFlowFormApi] = useVbenForm({
//
collapsed: false, collapsed: false,
//
commonConfig: {
labelWidth: 120,
componentProps: {
class: 'w-4/5',
},
},
layout: 'horizontal', layout: 'horizontal',
showCollapseButton: false, showCollapseButton: false,
showDefaultActions: false, showDefaultActions: false,
wrapperClass: 'grid-cols-2',
schema: [ schema: [
{ {
component: 'Switch', component: 'Switch',
fieldName: 'isNeedPushData', fieldName: 'isNeedPushData',
label: '是否需要推送数据', label: '是否推送数据',
componentProps: { componentProps: {
checkedValue: true, checkedValue: true,
unCheckedValue: false, unCheckedValue: false,
checkedChildren: '是', checkedChildren: '是',
unCheckedChildren: '否', unCheckedChildren: '否',
//
class: 'ml-6',
}, },
}, },
{ {
@ -183,7 +194,7 @@ const [DataFlowForm, dataFlowFormApi] = useVbenForm({
optionsPropName: 'options', optionsPropName: 'options',
immediate: true, immediate: true,
allowClear: true, allowClear: true,
placeholder: '请选择数据推送类型', placeholder: '请选择推送类型',
afterFetch: (res: any) => { afterFetch: (res: any) => {
let items = []; let items = [];
if (Array.isArray(res)) { if (Array.isArray(res)) {
@ -202,10 +213,19 @@ const [DataFlowForm, dataFlowFormApi] = useVbenForm({
}, },
{ {
component: 'Input', component: 'Input',
fieldName: 'dataPushInfo', fieldName: 'dataPushServer',
label: '数据推送信息', label: '推送服务器地址',
componentProps: { componentProps: {
placeholder: 'HTTP 为推送地址Redis 为主题或 key', placeholder:
'HTTP如 http://192.168.1.1:8080Redis如 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; editRow.value = record;
dataFlowFormApi.setValues({ dataFlowFormApi.setValues({
isNeedPushData: record.isNeedPushData ?? false, isNeedPushData: record.isNeedPushData ?? false,
dataPushType: record.dataPushType, dataPushType:
record.dataPushType !== undefined && record.dataPushType !== null
? String(record.dataPushType)
: undefined,
dataPushServer: record.dataPushServer,
dataPushInfo: record.dataPushInfo, dataPushInfo: record.dataPushInfo,
}); });
dataFlowModalApi.open(); dataFlowModalApi.open();
@ -403,13 +427,28 @@ async function submitDataFlowConfig() {
return; return;
} }
const { valid } = await dataFlowFormApi.validate();
if (!valid) {
return;
}
const values = await dataFlowFormApi.getValues(); 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 { try {
const resp = await postOneNetProductOneNetDataFlowConfig({ const resp = await postOneNetProductOneNetDataFlowConfig({
body: { body: {
@ -419,6 +458,7 @@ async function submitDataFlowConfig() {
values.dataPushType !== undefined && values.dataPushType !== null values.dataPushType !== undefined && values.dataPushType !== null
? Number(values.dataPushType) ? Number(values.dataPushType)
: undefined, : undefined,
dataPushServer: values.dataPushServer,
dataPushInfo: values.dataPushInfo, dataPushInfo: values.dataPushInfo,
}, },
}); });
@ -489,7 +529,9 @@ function getRowActions(row: any) {
label: 'OneNET物模型更新', label: 'OneNET物模型更新',
type: 'link', type: 'link',
size: 'small', size: 'small',
loading: productId ? (thingModelUpdateLoading.value[productId] || false) : false, loading: productId
? thingModelUpdateLoading.value[productId] || false
: false,
onClick: onThingModelUpdate.bind(null, row), onClick: onThingModelUpdate.bind(null, row),
}, },
]; ];
@ -613,7 +655,7 @@ async function onThingModelUpdate(record: any) {
<component :is="editRow.id ? EditForm : AddForm" /> <component :is="editRow.id ? EditForm : AddForm" />
</UserModal> </UserModal>
<DataFlowModal title="数据流转配置" class="w-[600px]"> <DataFlowModal title="数据流转配置" class="w-[800px]">
<DataFlowForm /> <DataFlowForm />
</DataFlowModal> </DataFlowModal>
</Page> </Page>