Commit 38549d76e2747730d335a2251ad010cc742a2e08

Authored by xp.Huang
2 parents f26042d6 c03c09d2

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

fix: 规则链文字修改

See merge request yunteng/thingskit-front!1044
... ... @@ -3,7 +3,7 @@
3 3 目前共有10个,分类按名称进行配置
4 4 */
5 5 export default {
6   - title: '属性',
  6 + title: '属性',
7 7 description: '向消息元数据中添加附加信息',
8 8 calculateDelta: {
9 9 name: '计算增量',
... ... @@ -11,9 +11,9 @@ export default {
11 11 description: `根据传入值和上一个值计算增量值并将其添加到消息中。`,
12 12 },
13 13 customerAttributes: {
14   - name: '客户属性',
  14 + name: '客户属性',
15 15 details: `如果已配置属性,则会将服务器范围属性添加到消息元数据中。如果配置了'最新遥测',则将最新遥测添加到元数据中。要访问其他节点中的这些属性,可以使用metadata.temperature访问。`,
16   - description: `将发起者客户属性或最新遥测添加到消息元数据中。`,
  16 + description: `将发起者客户属性或最新遥测添加到消息元数据中。`,
17 17 },
18 18 customerDetails: {
19 19 name: '客户详情',
... ... @@ -51,8 +51,8 @@ export default {
51 51 description: '将发起者租户属性或最新遥测添加到消息元数据中。',
52 52 },
53 53 tenantDetails: {
54   - name: '租户详细信息',
  54 + name: '租户详',
55 55 details: `如果选中:【将选定的详细信息添加到消息元数据】,则现有字段将添加到消息元数据而不是消息数据;注意:只允许设备、资产和实体视图类型;如果原始的消息发件人未分配给Tenant或者不支持原始发件人类型,消息将转发到失败链,否则将使用成功链路。`,
56   - description: '将租户详细信息中的字段添加到消息正文或元数据中。',
  56 + description: '将租户详中的字段添加到消息正文或元数据中。',
57 57 },
58 58 };
... ...
... ... @@ -3,7 +3,7 @@
3 3 目前共有11个,分类按名称进行配置
4 4 */
5 5 export default {
6   - title: '外部',
  6 + title: '外部',
7 7 description: '与外部系统交互',
8 8 alarmNotice: {
9 9 name: '告警通知',
... ...
... ... @@ -3,15 +3,15 @@
3 3 目前共有11个,分类按名称进行配置
4 4 */
5 5 export default {
6   - title: '筛选器',
  6 + title: '过滤',
7 7 description: '使用配置条件筛选传入消息',
8 8 checkAlarmStatus: {
9   - name: '检测报警状态',
  9 + name: '检查告警状态',
10 10 details: '如果警报状态与指定的状态匹配,则消息成功;如果不匹配,则消息失败。',
11   - description: '检测报警状态',
  11 + description: '检查告警状态',
12 12 },
13 13 checkExistenceFields: {
14   - name: '检字段是否存在',
  14 + name: '检字段是否存在',
15 15 details: `如果选中【检查所有选择的键是否存在】 ,就必选满足Message data中配置的字段和Message metadata中配置的字段,都必须存在才会返回true发送消息,否则返回false。
16 16 如果未选中,Message data中配置的字段或者Message metadata中配置的字段至少有一个键存在返回true,否则返回false。`,
17 17 description: '检查消息中的字段数据和消息元数据中所选择的键是否都存在。',
... ... @@ -22,27 +22,27 @@ export default {
22 22 description: `检查关系是按类型和方向将所选实体发送给消息的发起者;如果“检查单个实体”设置为true,否则规则节点将按类型和方向检查是否存在与消息发起者的任何关系。`,
23 23 },
24 24 gpsGeofencingFilter: {
25   - name: 'GPS地理围栏过滤',
  25 + name: 'GPS地理围栏过滤',
26 26 details: `从传入消息中提取纬度和经度参数,如果它们位于配置的周界内,则返回'True',否则返回'False'。`,
27 27 description: '通过基于GPS的地理围栏过滤传入消息。',
28 28 },
29 29 messageType: {
30   - name: '消息类型',
  30 + name: '消息类型过滤',
31 31 details: `如果需要传入消息类型通过,则'True'链发送消息,否则使用'False'链路。`,
32   - description: '按消息类型筛选传入消息。',
  32 + description: '按消息类型传入消息。',
33 33 },
34 34 messageTypeSwitch: {
35   - name: '消息类型换',
  35 + name: '消息类型换',
36 36 details: `通过相应链发送消息类型为'属性上报','遥测上报','RPC请求'等的消息,否则使用其他链。`,
37 37 description: '按消息类型路由传入消息。',
38 38 },
39 39 originatorType: {
40   - name: '发起者类型',
  40 + name: '实体类型过滤',
41 41 details: `如果预期传入消息的发起者类型,通过则True链发送消息,否则使用False链路。`,
42 42 description: '按消息发起者类型过滤传入消息。',
43 43 },
44 44 originatorTypeSwitch: {
45   - name: '发起者类型转换',
  45 + name: '实体类型转换',
46 46 details: `根据发起方类型(设备、资产等)将消息路由到链。`,
47 47 description: '按消息发起者类型路由传入消息。',
48 48 },
... ... @@ -52,9 +52,9 @@ export default {
52 52 description: '基于业务场景,实现设备的交互控制。',
53 53 },
54 54 script: {
55   - name: 'JS脚本',
  55 + name: '脚本',
56 56 details: `使用配置的JS匹配条件传入消息。如果为True,则通过True链发送消息,否则使用False链。可以通过msg属性访问消息负载。 例如 msg.temperature < 10 ;可以通过metadata属性访问消息元数据。例如metadata.customerName === 'John';可以通过msgType属性访问消息类型。`,
57   - description: '使用JS脚本过滤传入消息。',
  57 + description: '使用脚本过滤传入消息。',
58 58 },
59 59 switch: {
60 60 name: '转换器',
... ...
... ... @@ -3,7 +3,7 @@
3 3 目前共有4个,分类按名称进行配置
4 4 */
5 5 export default {
6   - title: '流',
  6 + title: '流',
7 7 description: '组织消息流',
8 8 acknowledge: {
9 9 name: '确认消息',
... ...
... ... @@ -8,8 +8,8 @@ export default {
8 8 OUTPUT_VALUE_KEY: '输出值键',
9 9 ROUND: '小数',
10 10 USE_CACHE: '使用缓存获取最新值',
11   - TELL_FAILURE_IF_DELTA_IS_NEGATIVE: '如果delta为负数,则告知Failure',
12   - ADD_PERIOD_BETWEEN_MSGS: '在消息之间添加句点',
  11 + TELL_FAILURE_IF_DELTA_IS_NEGATIVE: '如果delta为负数,则告知Failure【失败】',
  12 + ADD_PERIOD_BETWEEN_MSGS: '在消息之间添加时间差值{单位:毫秒}',
13 13 PERIOD_VALUE_KEY: '期间值键',
14 14 },
15 15 CustomerAttributesFieldsNameEnum: {
... ...
... ... @@ -18,15 +18,15 @@ export default {
18 18 RELEATION_TYPE: '关联类型',
19 19 },
20 20 GpsGeofencingFilterFieldsNameEnum: {
21   - LATITUDE_KEY_NAME: '纬度键名称',
22   - LONGITUDE_KEY_NAME: '经度键名称',
23   - PERIMETER_TYPE: '周长类型',
24   - FETCH_PERIMETER_INFO_FROM_MESSAGE_METADATA: '从消息元数据中获取周边信息',
  21 + LATITUDE_KEY_NAME: '纬度标识符',
  22 + LONGITUDE_KEY_NAME: '经度标识符',
  23 + PERIMETER_TYPE: '周界类型',
  24 + FETCH_PERIMETER_INFO_FROM_MESSAGE_METADATA: '从消息元数据中获取周界信息',
25 25 CENTER_LATITUDE: '中心纬度',
26 26 CENTER_LONGITUDE: '中心经度',
27   - RANGE: '范围',
  27 + RANGE: '圆半径范围',
28 28 RANGE_UNIT: '范围的单位',
29   - PERIMETER_KEY_NAME: '周界密钥名称',
  29 + PERIMETER_KEY_NAME: '周界标识符名称',
30 30 POLYGONS_DEFINITION: '多边形定义',
31 31 },
32 32 MessageTypeFieldsNameEnum: {
... ...
... ... @@ -297,7 +297,6 @@ export const formSchema: FormSchema[] = [
297 297 ifShow: ({ values }) => isDingtalk(Reflect.get(values, 'messageType')),
298 298 required: true,
299 299 componentProps: {
300   - maxLength: 36,
301 300 placeholder: '请输入clientSecret',
302 301 },
303 302 },
... ...
... ... @@ -4,6 +4,12 @@ import { CreateModalDefineExposeType, AwaitPopupWindowReturnDataType } from '../
4 4 import { EdgeData, NodeData } from '../types/node';
5 5 import { DataActionModeEnum } from '/@/enums/toolEnum';
6 6 import { ElementsTypeEnum } from '../enum';
  7 +import { FilterCategoryComponentEnum } from '../enum/category';
  8 +import { useMessage } from '/@/hooks/web/useMessage';
  9 +import { CheckExistenceFieldsNameEnum } from '../enum/formField/filter';
  10 +import { useI18n } from '/@/hooks/web/useI18n';
  11 +
  12 +const { t } = useI18n();
7 13
8 14 interface OptionsType {
9 15 mode: DataActionModeEnum;
... ... @@ -102,10 +108,25 @@ export function useAwaitPopupWindowBindData(
102 108 );
103 109 };
104 110
  111 + const { createMessage } = useMessage();
  112 +
105 113 const handleSubmit = async (extraData: Recordable = {}) => {
106 114 const { flag } = await validate();
107 115 if (!flag) return;
108 116 const value = await unref(createComponentEl)?.getFieldsValue?.();
  117 + const { config } = nodeData.value || {};
  118 + if (
  119 + config?.key === FilterCategoryComponentEnum.CHECK_EXISTENCE_FIELDS &&
  120 + !value?.messageNames &&
  121 + !value?.messageNames
  122 + ) {
  123 + createMessage.warning(
  124 + `${t(CheckExistenceFieldsNameEnum.MESSAGE_NAMES)}和${t(
  125 + CheckExistenceFieldsNameEnum.METADATA_NAMES
  126 + )}最少选填一个`
  127 + );
  128 + return false;
  129 + }
109 130 unref(resolveFn)?.({
110 131 flag: true,
111 132 data: handleSubmitData(extraData, value),
... ...
... ... @@ -229,7 +229,6 @@ export function useBasicDataTransform() {
229 229
230 230 if (resultNode.additionalInfo.layoutX < offsetX) offsetX = resultNode.additionalInfo.layoutX;
231 231 if (resultNode.additionalInfo.layoutY < offsetY) offsetY = resultNode.additionalInfo.layoutY;
232   -
233 232 nodes.push(resultNode);
234 233 }
235 234
... ...
... ... @@ -317,7 +317,6 @@ export function useContextMenuAction() {
317 317 const selectedEdges = unref(flowActionType?.getSelectedEdges);
318 318 const { firstNodeIndex, connections, nodes, outputEdgesId, inputEdgesId } =
319 319 transformToRuleChain(selectedNodes, selectedEdges);
320   -
321 320 await saveRuleChainData({
322 321 firstNodeIndex,
323 322 connections: connections.filter(
... ...
... ... @@ -84,7 +84,6 @@ export function useSaveAndRedo() {
84 84 ruleChainDetail.value = detail;
85 85 ruleChainId = detail.id.id;
86 86 }
87   -
88 87 const data = await saveRuleChainData({
89 88 connections,
90 89 nodes,
... ...
... ... @@ -46,26 +46,24 @@
46 46 <AttributeConfiguration
47 47 v-model:value="model[field]"
48 48 ref="attributeControlElRef"
49   - :keyLabel="`Source ${
50   - model[CustomerAttributesFieldsEnum.TELEMETRY] ? 'telemetry' : 'attribute'
51   - }`"
52   - valueLabel="Target attribute"
  49 + :keyLabel="`原始${model[CustomerAttributesFieldsEnum.TELEMETRY] ? '遥测' : '属性'}`"
  50 + valueLabel="目标属性"
53 51 >
54 52 <template #afterForm>
55 53 <div class="text-xs text-gray-500">
56   - Hint: use
  54 + ” 备注: 使用
57 55 <code>
58 56 <span class="text-dark-500">${</span>
59 57 metadataKey
60 58 <span class="text-dark-500">}</span>
61 59 </code>
62   - for value from metadata,
  60 + 表示元数据中的值,
63 61 <code>
64 62 <span class="text-dark-500"> $[</span>
65 63 messageKey
66 64 <span class="text-dark-500">] </span>
67 65 </code>
68   - for value from message body to substitute "Source" and "Target" key names
  66 + 表示消息正文中的值。用“Source”和“Target'键名代替。“
69 67 </div>
70 68 </template>
71 69 </AttributeConfiguration>
... ...
... ... @@ -45,26 +45,24 @@
45 45 <AttributeConfiguration
46 46 v-model:value="model[field]"
47 47 ref="attributeControlElRef"
48   - :keyLabel="`Source ${
49   - model[CustomerAttributesFieldsEnum.TELEMETRY] ? 'telemetry' : 'attribute'
50   - }`"
51   - valueLabel="Target attribute"
  48 + :keyLabel="`原始${model[CustomerAttributesFieldsEnum.TELEMETRY] ? '遥测' : '属性'}`"
  49 + valueLabel="目标属性"
52 50 >
53 51 <template #afterForm>
54 52 <div class="text-xs text-gray-500">
55   - Hint: use
  53 + ” 备注: 使用
56 54 <code>
57 55 <span class="text-dark-500">${</span>
58 56 metadataKey
59 57 <span class="text-dark-500">}</span>
60 58 </code>
61   - for value from metadata,
  59 + 表示元数据中的值,
62 60 <code>
63 61 <span class="text-dark-500"> $[</span>
64 62 messageKey
65 63 <span class="text-dark-500">] </span>
66 64 </code>
67   - for value from message body to substitute "Source" and "Target" key names
  65 + 表示消息正文中的值。用“Source”和“Target'键名代替。“
68 66 </div>
69 67 </template>
70 68 </AttributeConfiguration>
... ...
... ... @@ -12,13 +12,9 @@ export const formSchemas: FormSchema[] = [
12 12 field: CheckExistenceFieldsEnum.MESSAGE_NAMES,
13 13 component: 'Select',
14 14 label: t(CheckExistenceFieldsNameEnum.MESSAGE_NAMES),
15   - rules: [
16   - {
17   - required: true,
18   - type: 'array',
19   - message: `请选择${t(CheckExistenceFieldsNameEnum.MESSAGE_NAMES)}`,
20   - },
21   - ],
  15 + helpMessage: `${t(CheckExistenceFieldsNameEnum.MESSAGE_NAMES)}和${t(
  16 + CheckExistenceFieldsNameEnum.METADATA_NAMES
  17 + )}最少选填一个`,
22 18 componentProps: {
23 19 mode: 'tags',
24 20 open: false,
... ... @@ -30,13 +26,9 @@ export const formSchemas: FormSchema[] = [
30 26 field: CheckExistenceFieldsEnum.METADATA_NAMES,
31 27 component: 'Select',
32 28 label: t(CheckExistenceFieldsNameEnum.METADATA_NAMES),
33   - rules: [
34   - {
35   - required: true,
36   - type: 'array',
37   - message: `请选择${t(CheckExistenceFieldsNameEnum.METADATA_NAMES)}`,
38   - },
39   - ],
  29 + helpMessage: `${t(CheckExistenceFieldsNameEnum.MESSAGE_NAMES)}和${t(
  30 + CheckExistenceFieldsNameEnum.METADATA_NAMES
  31 + )}最少选填一个`,
40 32 componentProps: {
41 33 mode: 'tags',
42 34 open: false,
... ...
... ... @@ -118,7 +118,7 @@ export const formSchemas: FormSchema[] = [
118 118 },
119 119 {
120 120 field: CheckRelationFieldsEnum.RELEATION_TYPE,
121   - component: 'Select',
  121 + component: 'AutoComplete',
122 122 label: t(CheckRelationFieldsNameEnum.RELEATION_TYPE),
123 123 defaultValue: RelationTypeEnum.CONTAINS,
124 124 componentProps: {
... ...
... ... @@ -16,11 +16,23 @@ export const formSchemas: FormSchema[] = [
16 16 componentProps: {
17 17 placeholder: `请输入${t(GpsGeofencingFilterFieldsNameEnum.LATITUDE_KEY_NAME)}`,
18 18 },
  19 + rules: [
  20 + {
  21 + required: true,
  22 + message: `请输入${t(GpsGeofencingFilterFieldsNameEnum.LATITUDE_KEY_NAME)}`,
  23 + },
  24 + ],
19 25 },
20 26 {
21 27 field: GpsGeofencingFilterFieldsEnum.LONGITUDE_KEY_NAME,
22 28 component: 'Input',
23 29 label: t(GpsGeofencingFilterFieldsNameEnum.LONGITUDE_KEY_NAME),
  30 + rules: [
  31 + {
  32 + required: true,
  33 + message: `请输入${t(GpsGeofencingFilterFieldsNameEnum.LONGITUDE_KEY_NAME)}`,
  34 + },
  35 + ],
24 36 componentProps: {
25 37 placeholder: `请输入${t(GpsGeofencingFilterFieldsNameEnum.LONGITUDE_KEY_NAME)}`,
26 38 },
... ... @@ -47,6 +59,7 @@ export const formSchemas: FormSchema[] = [
47 59 field: GpsGeofencingFilterFieldsEnum.PERIMETER_KEY_NAME,
48 60 component: 'Input',
49 61 label: t(GpsGeofencingFilterFieldsNameEnum.PERIMETER_KEY_NAME),
  62 + helpMessage: '根据周界类型',
50 63 show: ({ model }) =>
51 64 model[GpsGeofencingFilterFieldsEnum.FETCH_PERIMETER_INFO_FROM_MESSAGE_METADATA],
52 65 componentProps: {
... ...
... ... @@ -15,7 +15,7 @@ export const formSchemas: FormSchema[] = [
15 15 label: MessageTypesNameEnum[value],
16 16 value,
17 17 })),
18   - mode: 'multiple',
  18 + mode: 'tags',
19 19 placeholder: `请选择${t(MessageTypeFieldsNameEnum.MESSAGE_TYPES)}`,
20 20 getPopupContainer: () => document.body,
21 21 },
... ...
... ... @@ -15,7 +15,7 @@ export const formSchemas: FormSchema[] = [
15 15 changeEvent: 'update:value',
16 16 valueField: 'value',
17 17 componentProps: {
18   - buttonName: 'Test Switch Function',
  18 + buttonName: '测试过滤函数',
19 19 javaScriptEditorProps: {
20 20 height: 230,
21 21 functionName: 'Switch',
... ...
... ... @@ -14,7 +14,7 @@
14 14 scriptType?: string;
15 15 }>(),
16 16 {
17   - buttonName: 'Test Filter Function',
  17 + buttonName: '测试过滤函数',
18 18 javaScriptEditorProps: () => ({
19 19 functionName: 'Filter',
20 20 scriptType: 'filter',
... ...
... ... @@ -79,7 +79,7 @@
79 79 <template>
80 80 <BasicDrawer
81 81 v-model:visible="visible"
82   - width="40%"
  82 + :width="nodeData?.created ? '50%' : '40%'"
83 83 showFooter
84 84 showCancelBtn
85 85 showOkBtn
... ...