Commit cc5f2eb36c720cc61f529147434c05430dd55a36

Authored by xp.Huang
2 parents b4a50ab3 84362631

Merge branch 'fix/rule-chain-field' into 'main_dev'

隐藏规则链相关的节点和修改节点字段名

See merge request yunteng/thingskit-front!1049
  1 +<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1701135308389" class="icon" viewBox="0 0 1079 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1473" xmlns:xlink="http://www.w3.org/1999/xlink" width="210.7421875" height="200"><path d="M602.973867 717.627733l342.024533-342.075733a48.759467 48.759467 0 0 0 14.344533-34.577067 48.896 48.896 0 0 0-83.456-34.5856l-307.5072 307.541334-307.464533-307.549867a48.913067 48.913067 0 0 0-69.128533 0 48.955733 48.955733 0 0 0 0 69.154133L533.845333 717.610667a48.930133 48.930133 0 0 0 69.128534 0.017066z" fill="#AAAAAA" p-id="1474"></path></svg>
\ No newline at end of file
... ...
... ... @@ -25,7 +25,7 @@ export default {
25 25 CLIENT_ATTRIBUTE_NAMES: '客户端属性',
26 26 SHARED_ATTRIBUTE_NAMES: '共享属性',
27 27 SERVER_ATTRIBUTE_NAMES: '服务器属性',
28   - LATEST_TS_KEY_NAMES: '最新时间序列',
  28 + LATEST_TS_KEY_NAMES: '最新时序数据-标识符',
29 29 GET_LATEST_VALUE_WITH_TS: '获取带有时间戳的最新遥测',
30 30 },
31 31 OriginatorFieldsNameEnum: {
... ...
... ... @@ -28,24 +28,24 @@ export enum RelationTypeNameEnum {
28 28 */
29 29 export enum EntityTypeEnum {
30 30 DEVICE = 'DEVICE',
31   - ASSET = 'ASSET',
32   - ENTITY_VIEW = 'ENTITY_VIEW',
  31 + // ASSET = 'ASSET',
  32 + // ENTITY_VIEW = 'ENTITY_VIEW',
33 33 TENANT = 'TENANT',
34 34 CUSTOMER = 'CUSTOMER',
35 35 USER = 'USER',
36   - DASHBOARD = 'DASHBOARD',
37   - EDGE = 'EDGE',
  36 + // DASHBOARD = 'DASHBOARD',
  37 + // EDGE = 'EDGE',
38 38 }
39 39
40 40 export enum EntityTypeNameEnum {
41 41 DEVICE = '设备',
42   - ASSET = '资产',
43   - ENTITY_VIEW = '实体视图',
  42 + // ASSET = '资产',
  43 + // ENTITY_VIEW = '实体视图',
44 44 TENANT = '租户',
45 45 CUSTOMER = '客户',
46 46 USER = '用户',
47   - DASHBOARD = '仪表板',
48   - EDGE = '边缘',
  47 + // DASHBOARD = '仪表板',
  48 + // EDGE = '边缘',
49 49 }
50 50
51 51 /**
... ...
... ... @@ -125,7 +125,7 @@ export function useAwaitPopupWindowBindData(
125 125 CheckExistenceFieldsNameEnum.METADATA_NAMES
126 126 )}最少选填一个`
127 127 );
128   - return false;
  128 + return true;
129 129 }
130 130 unref(resolveFn)?.({
131 131 flag: true,
... ...
1 1 <script setup lang="ts">
2   - import { Spin } from 'ant-design-vue';
  2 + import { Spin, Tooltip } from 'ant-design-vue';
3 3 import { Background, BackgroundVariant } from '@vue-flow/background';
4 4 import { Controls } from '@vue-flow/controls';
5 5 import { Panel, PanelPosition, VueFlow } from '@vue-flow/core';
... ... @@ -24,6 +24,11 @@
24 24 import { UpdateNodeDrawer } from './src/components/UpdateNodeDrawer';
25 25 import { UpdateEdgeDrawer } from './src/components/UpdateEdgeDrawer';
26 26 import { CreateRuleChainModal } from './src/components/CreateRuleChainModal';
  27 + import { useRouter } from 'vue-router';
  28 +
  29 + // import { getRuleChinsList } from '/@/api/ruleengine/ruleengineApi';
  30 + // import { ApiSelect } from '/@/components/Form';
  31 + // import DownImage from '/@/assets/svg/down-svg.svg';
27 32
28 33 const getId = Number(Math.random().toString().substring(2)).toString(16);
29 34
... ... @@ -96,6 +101,20 @@
96 101 useSaveAndRedoActionType.triggerChange?.();
97 102 };
98 103
  104 + const ROUTER = useRouter();
  105 + // const isShowSelect = ref<boolean>(false);
  106 + const handleBack = () => {
  107 + ROUTER.go(-1);
  108 + };
  109 +
  110 + // const handleDown = () => {
  111 + // isShowSelect.value = !unref(isShowSelect);
  112 + // };
  113 +
  114 + // const handleSelectChange = (e) => {
  115 + // ROUTER.replace(`${e}`);
  116 + // };
  117 +
99 118 onMounted(() => {
100 119 getCurrentPageMetaData(flowActionType);
101 120 getCurrentRuleChainDetail();
... ... @@ -131,9 +150,7 @@
131 150 <template #edge-custom="props">
132 151 <BasicEdge v-bind="props" />
133 152 </template>
134   -
135 153 <BasicConnectionArrow />
136   -
137 154 <Background :variant="BackgroundVariant.Lines" :gap="25" pattern-color="#cfcfcf" />
138 155
139 156 <Controls :position="PanelPosition.BottomLeft" />
... ... @@ -171,14 +188,56 @@
171 188 </section>
172 189 </Panel>
173 190
174   - <Panel position="top-right">
  191 + <Panel position="top-right" class="flex">
  192 + <Tooltip title="返回">
  193 + <button
  194 + class="w-10 h-10 bg-gray-300 flex justify-center items-center rounded-full dark:bg-dark-50"
  195 + @click="handleBack"
  196 + ><Icon icon="ant-design:rollback-outlined" class="cursor-pointer svg:text-xl" />
  197 + </button>
  198 + </Tooltip>
175 199 <button
176   - class="w-10 h-10 bg-gray-300 flex justify-center items-center rounded-full dark:bg-dark-50"
  200 + class="w-10 h-10 bg-gray-300 mx-1 flex justify-center items-center rounded-full dark:bg-dark-50"
177 201 @click="handleFullScreen"
178 202 >
179 203 <Icon class="!text-2xl dark:text-light-50" :icon="getFullScreenIcon" />
180 204 </button>
181 205 </Panel>
  206 + <!-- <Panel position="top-left">
  207 + <h1 class="ml-10">{{ ruleChainDetail?.name }}</h1>
  208 + </Panel> -->
  209 + <!-- <Panel position="top-center" class="flex flex-col items-center">
  210 + <button
  211 + class="w-10 h-10 bg-gray-300 mx-1 flex justify-center items-center rounded-full dark:bg-dark-50"
  212 + @click="handleDown"
  213 + >
  214 + <img :src="DownImage" alt="avatar" />
  215 + </button>
  216 + <div v-if="isShowSelect" class="mt-1">
  217 + <ApiSelect
  218 + class="!mx-2 flex-auto w-40"
  219 + :api="
  220 + async (params) => {
  221 + const options = await getRuleChinsList(params);
  222 + return options?.data
  223 + .map((item) => ({ label: item.name, value: item.id.id }))
  224 + .filter((item) => item.label !== ruleChainDetail?.name);
  225 + }
  226 + "
  227 + :showSearch="true"
  228 + :filterOption="(inputValue: string, option: Record<'label' | 'value', string>) =>
  229 + option.label.includes(inputValue)"
  230 + placeholder="请选择规则链"
  231 + :params="{
  232 + page: 0,
  233 + pageSize: 100,
  234 + sortProperty: 'createdTime',
  235 + sortOrder: 'DESC',
  236 + }"
  237 + @change="handleSelectChange"
  238 + />
  239 + </div>
  240 + </Panel> -->
182 241 </VueFlow>
183 242 </Spin>
184 243
... ... @@ -203,5 +262,9 @@
203 262 .ant-spin-container {
204 263 @apply w-full h-full;
205 264 }
  265 +
  266 + // :deep(.top .center) {
  267 + // margin: 0 !important;
  268 + // }
206 269 }
207 270 </style>
... ...
... ... @@ -8,54 +8,54 @@ import { useI18n } from '/@/hooks/web/useI18n';
8 8 const { t } = useI18n();
9 9
10 10 export const formSchemas: FormSchema[] = [
11   - {
12   - field: OriginatorAttributesEnum.TELL_FAILURE_IF_ABSENT,
13   - component: 'Checkbox',
14   - label: t(OriginatorAttributesNameEnum.TELL_FAILURE_IF_ABSENT),
15   - renderComponentContent: () => ({
16   - default: () =>
17   - 'If at least one selected key doesn\'t exist the outbound message will report "Failure".',
18   - }),
19   - },
20   - {
21   - field: OriginatorAttributesEnum.CLIENT_ATTRIBUTE_NAMES,
22   - component: 'Select',
23   - label: t(OriginatorAttributesNameEnum.CLIENT_ATTRIBUTE_NAMES),
24   - helpMessage: [
25   - `Hint: use \${metadataKey} for value from metadata, $[messageKey] for value from message body`,
26   - ],
27   - componentProps: {
28   - mode: 'tags',
29   - open: false,
30   - placeholder: `请输入${t(OriginatorAttributesNameEnum.CLIENT_ATTRIBUTE_NAMES)}`,
31   - },
32   - },
33   - {
34   - field: OriginatorAttributesEnum.SHARED_ATTRIBUTE_NAMES,
35   - component: 'Select',
36   - label: t(OriginatorAttributesNameEnum.SHARED_ATTRIBUTE_NAMES),
37   - helpMessage: [
38   - `Hint: use \${metadataKey} for value from metadata, $[messageKey] for value from message body`,
39   - ],
40   - componentProps: {
41   - mode: 'tags',
42   - open: false,
43   - placeholder: `请输入${t(OriginatorAttributesNameEnum.SHARED_ATTRIBUTE_NAMES)}`,
44   - },
45   - },
46   - {
47   - field: OriginatorAttributesEnum.SERVER_ATTRIBUTE_NAMES,
48   - component: 'Select',
49   - label: t(OriginatorAttributesNameEnum.SERVER_ATTRIBUTE_NAMES),
50   - helpMessage: [
51   - `Hint: use \${metadataKey} for value from metadata, $[messageKey] for value from message body`,
52   - ],
53   - componentProps: {
54   - mode: 'tags',
55   - open: false,
56   - placeholder: `请输入${t(OriginatorAttributesNameEnum.SERVER_ATTRIBUTE_NAMES)}`,
57   - },
58   - },
  11 + // {
  12 + // field: OriginatorAttributesEnum.TELL_FAILURE_IF_ABSENT,
  13 + // component: 'Checkbox',
  14 + // label: t(OriginatorAttributesNameEnum.TELL_FAILURE_IF_ABSENT),
  15 + // renderComponentContent: () => ({
  16 + // default: () =>
  17 + // 'If at least one selected key doesn\'t exist the outbound message will report "Failure".',
  18 + // }),
  19 + // },
  20 + // {
  21 + // field: OriginatorAttributesEnum.CLIENT_ATTRIBUTE_NAMES,
  22 + // component: 'Select',
  23 + // label: t(OriginatorAttributesNameEnum.CLIENT_ATTRIBUTE_NAMES),
  24 + // helpMessage: [
  25 + // `Hint: use \${metadataKey} for value from metadata, $[messageKey] for value from message body`,
  26 + // ],
  27 + // componentProps: {
  28 + // mode: 'tags',
  29 + // open: false,
  30 + // placeholder: `请输入${t(OriginatorAttributesNameEnum.CLIENT_ATTRIBUTE_NAMES)}`,
  31 + // },
  32 + // },
  33 + // {
  34 + // field: OriginatorAttributesEnum.SHARED_ATTRIBUTE_NAMES,
  35 + // component: 'Select',
  36 + // label: t(OriginatorAttributesNameEnum.SHARED_ATTRIBUTE_NAMES),
  37 + // helpMessage: [
  38 + // `Hint: use \${metadataKey} for value from metadata, $[messageKey] for value from message body`,
  39 + // ],
  40 + // componentProps: {
  41 + // mode: 'tags',
  42 + // open: false,
  43 + // placeholder: `请输入${t(OriginatorAttributesNameEnum.SHARED_ATTRIBUTE_NAMES)}`,
  44 + // },
  45 + // },
  46 + // {
  47 + // field: OriginatorAttributesEnum.SERVER_ATTRIBUTE_NAMES,
  48 + // component: 'Select',
  49 + // label: t(OriginatorAttributesNameEnum.SERVER_ATTRIBUTE_NAMES),
  50 + // helpMessage: [
  51 + // `Hint: use \${metadataKey} for value from metadata, $[messageKey] for value from message body`,
  52 + // ],
  53 + // componentProps: {
  54 + // mode: 'tags',
  55 + // open: false,
  56 + // placeholder: `请输入${t(OriginatorAttributesNameEnum.SERVER_ATTRIBUTE_NAMES)}`,
  57 + // },
  58 + // },
59 59 {
60 60 field: OriginatorAttributesEnum.LATEST_TS_KEY_NAMES,
61 61 component: 'Select',
... ... @@ -75,7 +75,7 @@ export const formSchemas: FormSchema[] = [
75 75 label: t(OriginatorAttributesNameEnum.GET_LATEST_VALUE_WITH_TS),
76 76 renderComponentContent: () => ({
77 77 default: () =>
78   - 'If selected, latest telemetry values will be added to the outbound message metadata with timestamp, e.g: "temp": "{"ts":1574329385897, "value":42}"',
  78 + '如果选中,最新的遥测值将添加到带有时间戳的出站消息元数据中, 例如: "temp": "{"ts":1574329385897, "value":42}"',
79 79 }),
80 80 },
81 81 ];
... ...
... ... @@ -13,6 +13,7 @@ export const formSchemas: FormSchema[] = [
13 13 component: 'AttributeConfiguration',
14 14 label: t(OriginatorFieldsNameEnum.FIELDS_MAPPING),
15 15 slot: OriginatorFieldsEnum.FIELDS_MAPPING,
  16 + helpMessage: '允许发起者类型: 租户、客户、用户、设备、告警、规则链',
16 17 valueField: 'value',
17 18 changeEvent: 'update:value',
18 19 },
... ...
... ... @@ -45,8 +45,8 @@
45 45 <AttributeConfiguration
46 46 v-model:value="model[field]"
47 47 ref="fieldControlElRef"
48   - keyLabel="Source Field"
49   - valueLabel="Target attribute"
  48 + keyLabel="实体的字段"
  49 + valueLabel="目标属性"
50 50 />
51 51 </template>
52 52 </BasicForm>
... ...
... ... @@ -139,7 +139,7 @@ export const formSchemas: FormSchema[] = [
139 139 {
140 140 field: RelatedDeviceAttributeFieldsEnum.LATEST_TS_KEY_NAMES,
141 141 component: 'Select',
142   - label: t(RelatedDeviceAttributeFieldsNameEnum.LATEST_TS_KEY_NAMES),
  142 + label: t(RelatedDeviceAttributeFieldsNameEnum.LATEST_TS_KEY_NAMES) + '123',
143 143 componentProps: {
144 144 open: false,
145 145 mode: 'tags',
... ...
1 1 import type { CategoryConfigType, NodeItemConfigType } from '../../types/node';
2 2 import { RuleNodeTypeEnum } from '../index.type';
3   -import { CustomerAttributesConfig } from './CustomerAttributes';
  3 +// import { CustomerAttributesConfig } from './CustomerAttributes';
4 4 import { OriginatorTelemetryConfig } from './OriginatorTelemetry';
5 5 import { OriginatorFieldsConfig } from './OriginatorFields';
6 6 import { CalculateDeltaConfig } from './CalculateDelta';
7   -import { TenantAttributesConfig } from './TenantAttributes';
8   -import { RelatedDeviceAttributesConfig } from './RelatedDeviceAttributes';
9   -import { RelatedAttributesConfig } from './RelatedAttributes';
10   -import { TenantDetailsConfig } from './TenantDetails';
  7 +// import { TenantAttributesConfig } from './TenantAttributes';
  8 +// import { RelatedDeviceAttributesConfig } from './RelatedDeviceAttributes';
  9 +// import { RelatedAttributesConfig } from './RelatedAttributes';
  10 +// import { TenantDetailsConfig } from './TenantDetails';
11 11 import { OriginatorAttributesConfig } from './OriginatorAttributes';
12   -import { CustomerDetailsConfig } from './CustomerDetails';
  12 +// import { CustomerDetailsConfig } from './CustomerDetails';
13 13 import { useI18n } from '/@/hooks/web/useI18n';
14 14
15 15 const { t } = useI18n(); // 加载国际化
... ... @@ -23,13 +23,13 @@ export const EnrichmentCategoryConfig: CategoryConfigType = {
23 23
24 24 export const EnrichmentComponents: NodeItemConfigType[] = [
25 25 CalculateDeltaConfig,
26   - CustomerAttributesConfig,
27   - CustomerDetailsConfig,
  26 + // CustomerAttributesConfig,
  27 + // CustomerDetailsConfig,
28 28 OriginatorAttributesConfig,
29 29 OriginatorFieldsConfig,
30 30 OriginatorTelemetryConfig,
31   - RelatedAttributesConfig,
32   - RelatedDeviceAttributesConfig,
33   - TenantAttributesConfig,
34   - TenantDetailsConfig,
  31 + // RelatedAttributesConfig,
  32 + // RelatedDeviceAttributesConfig,
  33 + // TenantAttributesConfig,
  34 + // TenantDetailsConfig,
35 35 ];
... ...
... ... @@ -56,7 +56,8 @@
56 56 const handleModalOk = async () => {
57 57 await validate();
58 58 const data = getFieldsValue();
59   - await handleSubmit(data);
  59 + const flag = await handleSubmit(data);
  60 + if (flag) return;
60 61 resetFieldsValue();
61 62 };
62 63
... ...
... ... @@ -9,6 +9,7 @@
9 9 import { useForm, BasicForm } from '/@/components/Form';
10 10 import { BottomFormSchemas, TopFormSchemas } from '../CreateNodeModal/config';
11 11 import { toRaw, unref } from 'vue';
  12 +
12 13 import { BasicEvents } from './BasicEvents';
13 14
14 15 const [topFormRegister, topFormActionType] = useForm({
... ... @@ -79,7 +80,7 @@
79 80 <template>
80 81 <BasicDrawer
81 82 v-model:visible="visible"
82   - :width="nodeData?.created ? '50%' : '40%'"
  83 + :width="!nodeData?.created ? '55%' : '40%'"
83 84 showFooter
84 85 showCancelBtn
85 86 showOkBtn
... ...