数据推送
This commit is contained in:
parent
3b73411d09
commit
b8b9660172
@ -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,
|
||||
|
||||
@ -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;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@ -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) {
|
||||
<component :is="editRow.id ? EditForm : AddForm" />
|
||||
</UserModal>
|
||||
|
||||
<DataFlowModal title="数据流转配置" class="w-[600px]">
|
||||
<DataFlowModal title="数据流转配置" class="w-[800px]">
|
||||
<DataFlowForm />
|
||||
</DataFlowModal>
|
||||
</Page>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user