diff --git a/src/api/things/componentDescriptor.ts b/src/api/things/componentDescriptor.ts index 7a7d29a9b079cc07758e697e75599fd2b3d68018..001d620c50ff3d35ea5666fcf66459b36bcb88b3 100644 --- a/src/api/things/componentDescriptor.ts +++ b/src/api/things/componentDescriptor.ts @@ -8,6 +8,7 @@ export interface ComponentDescriptor extends BasicModel { type: ComponentDescriptorType; scope: 'SYSTEM' | 'TENANT'; clusteringMode: 'USER_PREFERENCE' | 'ENABLED' | 'SINGLETON'; + configurationVersion: number, configurationDescriptor: { nodeDefinition: { configDirective: string, diff --git a/src/enums/telemetryEnum.ts b/src/enums/telemetryEnum.ts index 6deb62994e935a99c69b12baa78b5675c50051b9..d81981933eafc434ea830cb82558bf38318147cb 100644 --- a/src/enums/telemetryEnum.ts +++ b/src/enums/telemetryEnum.ts @@ -3,3 +3,42 @@ export enum Scope { CLIENT_SCOPE = 'CLIENT_SCOPE', SHARED_SCOPE = 'SHARED_SCOPE', } + +export enum OrderBy { + ASCENDING = 'ASC', + DESCENDING = 'DESC', +} + +export enum Aggregation { + NONE = 'NONE', + MIN = 'MIN', + MAX = 'MAX', + AVG = 'AVG', + SUM = 'SUM', + COUNT = 'COUNT', +} + +export enum TimeUnit { + MILLISECONDS = 'MILLISECONDS', + SECONDS = 'SECONDS', + MINUTES = 'MINUTES', + HOURS = 'HOURS', + DAYS = 'DAYS', +} + +export const TIME_UNIT_OPTIONS = [ + { value: TimeUnit.MILLISECONDS, label: '毫秒' }, + { value: TimeUnit.SECONDS, label: '秒' }, + { value: TimeUnit.MINUTES, label: '分钟' }, + { value: TimeUnit.HOURS, label: '小时' }, + { value: TimeUnit.DAYS, label: '天' }, +] + +export const AGGREGATION_OPTIONS = [ + { value: Aggregation.NONE, label: '无' }, + { value: Aggregation.MIN, label: '最小值' }, + { value: Aggregation.MAX, label: '最大值' }, + { value: Aggregation.AVG, label: '平均值' }, + { value: Aggregation.SUM, label: '求和' }, + { value: Aggregation.COUNT, label: '计数' } +] \ No newline at end of file diff --git a/src/views/things/ruleChain/flow/index.vue b/src/views/things/ruleChain/flow/index.vue index b5e0bedb3f59a4111f33737c576ccf16a5e77340..b9c49419fa74e982cee45e82fbf9c7c413ea30f9 100644 --- a/src/views/things/ruleChain/flow/index.vue +++ b/src/views/things/ruleChain/flow/index.vue @@ -431,8 +431,8 @@ function onNodeAdded({ node, index, options }) { const [registerNodeModal, { openModal: openNodeModal }] = useModal(); // Node 节点数据编辑成功 更新节点数据 -function handleNodeSuccess(data: RuleNode) { - const node = graphRef.value?.getCellById(data.id.id) as Node; +function handleNodeSuccess({ nodeId, data }) { + const node = graphRef.value?.getCellById(nodeId) as Node; //TODO: 每个节点的弹框编辑数据 不一样,更新节点数据 if (node) { node.setData({ descriptor: node.data.descriptor, data: data }) @@ -643,7 +643,6 @@ async function handleSave() { const jsonData = graphRef.value?.toJSON(); if (jsonData) { const cells = jsonData.cells; - const nodes = cells .filter(cell => cell.shape == 'rule-chain-node' && cell.data.data) .map(cell => { diff --git a/src/views/things/ruleChain/flow/nodeForm.vue b/src/views/things/ruleChain/flow/nodeForm.vue index b180cb3450f56d794d61929367ed1dd247dbfbe6..d2f28de27edfc33c8c64a8c81e1d37b9b3fef3ca 100644 --- a/src/views/things/ruleChain/flow/nodeForm.vue +++ b/src/views/things/ruleChain/flow/nodeForm.vue @@ -39,6 +39,9 @@ + + + @@ -102,6 +105,7 @@ const formState = reactive({ singletonMode: false, type: descriptor.value?.clazz || '', configuration: descriptor.value?.configurationDescriptor.nodeDefinition.defaultConfiguration || {}, + configurationVersion: 0, additionalInfo: { description: '', layoutX: 0, layoutY: 0 }, }); @@ -117,14 +121,12 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data Object.keys(record.value as any).forEach(key => { formState[key] = record.value[key]; }) - if (isEmpty(formState.id.id)) { - formState.id.id = nodeId.value; + if (isEmpty(formState.id?.id)) { formState.type = descriptor.value?.clazz || ''; formState.configuration = descriptor.value?.configurationDescriptor.nodeDefinition.defaultConfiguration || {}; + formState.configurationVersion = descriptor.value?.configurationVersion || 0; } - - console.log(descriptor.value); - + console.log(descriptor.value) setModalProps({ loading: false }); }); @@ -149,7 +151,8 @@ async function handleSubmit() { // console.log('submit', params, data, record); setTimeout(closeModal); - emit('success', { ...data, configuration: configuration, id: formState.id, ruleChainId: formState.ruleChainId, }); + const ruleNode = { ...data, configuration: configuration, id: record.value?.id, ruleChainId: formState.ruleChainId }; + emit('success', { nodeId: nodeId.value, data: ruleNode }); } catch (error: any) { if (error && error.errorFields) { showMessage(t('common.validateError')); @@ -163,7 +166,7 @@ async function handleSubmit() { function handleCancel() { setTimeout(closeModal); if (record.value?.id?.id) { - emit('success', { ...record.value }); + emit('success', { nodeId: nodeId.value, data: { ...record.value } }); } else { emit('cancel', { nodeId: nodeId.value }); } diff --git a/src/views/things/ruleChain/flow/nodeTpl/ENRICHMENT/calculateDelta.vue b/src/views/things/ruleChain/flow/nodeTpl/ENRICHMENT/calculateDelta.vue new file mode 100644 index 0000000000000000000000000000000000000000..c0ad78eeb45016ed26e9c95baade47063dc96ba2 --- /dev/null +++ b/src/views/things/ruleChain/flow/nodeTpl/ENRICHMENT/calculateDelta.vue @@ -0,0 +1,115 @@ + + + diff --git a/src/views/things/ruleChain/flow/nodeTpl/ENRICHMENT/customerAttributes.vue b/src/views/things/ruleChain/flow/nodeTpl/ENRICHMENT/customerAttributes.vue new file mode 100644 index 0000000000000000000000000000000000000000..3718580b5c39276069e026ae58a10ee5c96c8d75 --- /dev/null +++ b/src/views/things/ruleChain/flow/nodeTpl/ENRICHMENT/customerAttributes.vue @@ -0,0 +1,177 @@ + + + + + diff --git a/src/views/things/ruleChain/flow/nodeTpl/ENRICHMENT/customerDetails.vue b/src/views/things/ruleChain/flow/nodeTpl/ENRICHMENT/customerDetails.vue new file mode 100644 index 0000000000000000000000000000000000000000..f42ff699bc5903ee786f859b2e34b7b11a32b50d --- /dev/null +++ b/src/views/things/ruleChain/flow/nodeTpl/ENRICHMENT/customerDetails.vue @@ -0,0 +1,94 @@ + + + diff --git a/src/views/things/ruleChain/flow/nodeTpl/ENRICHMENT/fetchDeviceCredentials.vue b/src/views/things/ruleChain/flow/nodeTpl/ENRICHMENT/fetchDeviceCredentials.vue new file mode 100644 index 0000000000000000000000000000000000000000..f00fd452e7297aef4750d0f8313eec95baefdb2f --- /dev/null +++ b/src/views/things/ruleChain/flow/nodeTpl/ENRICHMENT/fetchDeviceCredentials.vue @@ -0,0 +1,69 @@ + + + diff --git a/src/views/things/ruleChain/flow/nodeTpl/ENRICHMENT/originatorAttributes.vue b/src/views/things/ruleChain/flow/nodeTpl/ENRICHMENT/originatorAttributes.vue new file mode 100644 index 0000000000000000000000000000000000000000..ce48d24ceddac283118c4ec66c8a2db024ab01cb --- /dev/null +++ b/src/views/things/ruleChain/flow/nodeTpl/ENRICHMENT/originatorAttributes.vue @@ -0,0 +1,126 @@ + + + diff --git a/src/views/things/ruleChain/flow/nodeTpl/ENRICHMENT/originatorFields.vue b/src/views/things/ruleChain/flow/nodeTpl/ENRICHMENT/originatorFields.vue new file mode 100644 index 0000000000000000000000000000000000000000..472a782158be703dfe8196bae5e6ec15be2e22fc --- /dev/null +++ b/src/views/things/ruleChain/flow/nodeTpl/ENRICHMENT/originatorFields.vue @@ -0,0 +1,192 @@ + + + + + diff --git a/src/views/things/ruleChain/flow/nodeTpl/ENRICHMENT/originatorTelemetry.vue b/src/views/things/ruleChain/flow/nodeTpl/ENRICHMENT/originatorTelemetry.vue new file mode 100644 index 0000000000000000000000000000000000000000..9ab7d2ec286622395a0f0f95cf0229ac29797362 --- /dev/null +++ b/src/views/things/ruleChain/flow/nodeTpl/ENRICHMENT/originatorTelemetry.vue @@ -0,0 +1,203 @@ + + + diff --git a/src/views/things/ruleChain/flow/nodeTpl/FILTER/script.vue b/src/views/things/ruleChain/flow/nodeTpl/FILTER/script.vue index c1e656aeebb42b36b1856e8958eed66c36f6c1d1..f6d860bdc62d861bc76c449e01453d59edd84e35 100644 --- a/src/views/things/ruleChain/flow/nodeTpl/FILTER/script.vue +++ b/src/views/things/ruleChain/flow/nodeTpl/FILTER/script.vue @@ -1,12 +1,14 @@