数据推送

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: {
'$ref': '#/components/schemas/DataPushTypeEnum'
},
dataPushServer: {
type: 'string',
description: '数据推送服务地址信息例如HTTP地址http://192.168.1.1:8080Redis订阅地址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:8080Redis订阅地址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,

View File

@ -3882,7 +3882,11 @@ export type OneNETDataFlowConfigInput = {
isNeedPushData?: boolean;
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;
};
@ -4026,7 +4030,11 @@ export type OneNETProductInfoDto = {
isNeedPushData?: boolean;
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;
};
@ -4141,15 +4149,6 @@ export type OneNetProductInfoModifyInput = {
*
*/
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 { 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: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;
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,12 +427,27 @@ async function submitDataFlowConfig() {
return;
}
const { valid } = await dataFlowFormApi.validate();
if (!valid) {
const values = await dataFlowFormApi.getValues();
//
if (values.isNeedPushData) {
if (
values.dataPushType === undefined ||
values.dataPushType === null ||
values.dataPushType === ''
) {
Message.error('请选择数据推送类型');
return;
}
const values = await dataFlowFormApi.getValues();
if (!values.dataPushServer) {
Message.error('请输入推送服务器地址');
return;
}
if (!values.dataPushInfo) {
Message.error('请输入推送路径或 KEY');
return;
}
}
try {
const resp = await postOneNetProductOneNetDataFlowConfig({
@ -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) {
<component :is="editRow.id ? EditForm : AddForm" />
</UserModal>
<DataFlowModal title="数据流转配置" class="w-[600px]">
<DataFlowModal title="数据流转配置" class="w-[800px]">
<DataFlowForm />
</DataFlowModal>
</Page>