Showing
11 changed files
with
71 additions
and
139 deletions
@@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
2 | *规则链 变换 中文配置文件 | 2 | *规则链 变换 中文配置文件 |
3 | 目前共有3个,分类按名称进行配置 | 3 | 目前共有3个,分类按名称进行配置 |
4 | */ | 4 | */ |
5 | + | ||
5 | export default { | 6 | export default { |
6 | title: '变换', | 7 | title: '变换', |
7 | description: '更改消息载体和元数据', | 8 | description: '更改消息载体和元数据', |
@@ -16,7 +17,7 @@ export default { | @@ -16,7 +17,7 @@ export default { | ||
16 | description: '使用JavaScript更改消息有效负载、元数据或消息类型。', | 17 | description: '使用JavaScript更改消息有效负载、元数据或消息类型。', |
17 | }, | 18 | }, |
18 | toEmail: { | 19 | toEmail: { |
19 | - name: '发送到电子邮件', | 20 | + name: '发送到Email', |
20 | details: `通过使用从元数据派生的值填充电子邮件字段,将消息转换为电子邮件内容并发送。设置SEND_EMAIL输出消息类型。`, | 21 | details: `通过使用从元数据派生的值填充电子邮件字段,将消息转换为电子邮件内容并发送。设置SEND_EMAIL输出消息类型。`, |
21 | description: '将消息转换为电子邮件内容并发送。', | 22 | description: '将消息转换为电子邮件内容并发送。', |
22 | }, | 23 | }, |
@@ -101,7 +101,7 @@ export default { | @@ -101,7 +101,7 @@ export default { | ||
101 | }, | 101 | }, |
102 | SaveTimeseriesFieldsNameEnum: { | 102 | SaveTimeseriesFieldsNameEnum: { |
103 | DEFAULT_TTL: '默认TTL(秒)', | 103 | DEFAULT_TTL: '默认TTL(秒)', |
104 | - SKIP_LATEST_PERSISTENCE: '滑雪最新坚持', | 104 | + SKIP_LATEST_PERSISTENCE: '跳过更新最新时序数据表(ts kv latest)', |
105 | USE_SERVER_TS: '使用服务器时间戳', | 105 | USE_SERVER_TS: '使用服务器时间戳', |
106 | }, | 106 | }, |
107 | SaveToCustomTableFieldsNameEnum: { | 107 | SaveToCustomTableFieldsNameEnum: { |
@@ -12,7 +12,7 @@ export default { | @@ -12,7 +12,7 @@ export default { | ||
12 | }, | 12 | }, |
13 | ToEmailFieldsNameEnum: { | 13 | ToEmailFieldsNameEnum: { |
14 | FROM_TEMPLATE: '来自模板', | 14 | FROM_TEMPLATE: '来自模板', |
15 | - TO_TEMPLATE: '发送到Email', | 15 | + TO_TEMPLATE: '到模板', |
16 | CC_TEMPLATE: '抄送模板', | 16 | CC_TEMPLATE: '抄送模板', |
17 | BCC_TEMPLATE: '密件抄送模板', | 17 | BCC_TEMPLATE: '密件抄送模板', |
18 | SUBJECT_TEMPLATE: '主题模板', | 18 | SUBJECT_TEMPLATE: '主题模板', |
@@ -62,7 +62,7 @@ export const columns: BasicColumn[] = [ | @@ -62,7 +62,7 @@ export const columns: BasicColumn[] = [ | ||
62 | export const searchFormSchema: FormSchema[] = [ | 62 | export const searchFormSchema: FormSchema[] = [ |
63 | { | 63 | { |
64 | field: 'name', | 64 | field: 'name', |
65 | - label: '模板名称', | 65 | + label: '模板', |
66 | component: 'Input', | 66 | component: 'Input', |
67 | colProps: { span: 8 }, | 67 | colProps: { span: 8 }, |
68 | componentProps: { | 68 | componentProps: { |
@@ -25,7 +25,7 @@ | @@ -25,7 +25,7 @@ | ||
25 | const [register, { reload }] = useCardList({ | 25 | const [register, { reload }] = useCardList({ |
26 | api: getPage, | 26 | api: getPage, |
27 | useSearchForm: true, | 27 | useSearchForm: true, |
28 | - title: '模版列表', | 28 | + title: '模版', |
29 | gutter: 4, | 29 | gutter: 4, |
30 | formConfig: { | 30 | formConfig: { |
31 | schemas: searchFormSchema, | 31 | schemas: searchFormSchema, |
1 | <script lang="ts" setup> | 1 | <script lang="ts" setup> |
2 | - import { ReloadOutlined } from '@ant-design/icons-vue'; | ||
3 | - import { Button, List, Tooltip } from 'ant-design-vue'; | ||
4 | import { TaskCard } from '/@/views/task/center/components/TaskCard'; | 2 | import { TaskCard } from '/@/views/task/center/components/TaskCard'; |
5 | - import { reactive, ref, unref } from 'vue'; | ||
6 | - import { PageWrapper } from '/@/components/Page'; | ||
7 | - import { BasicForm, useForm } from '/@/components/Form'; | ||
8 | import { formSchemas } from '/@/views/task/center/config'; | 3 | import { formSchemas } from '/@/views/task/center/config'; |
9 | import { getTaskCenterList } from '/@/api/task'; | 4 | import { getTaskCenterList } from '/@/api/task'; |
10 | - import { onMounted } from 'vue'; | ||
11 | - import { getBoundingClientRect } from '/@/utils/domUtils'; | ||
12 | import { TaskRecordType } from '/@/api/task/model'; | 5 | import { TaskRecordType } from '/@/api/task/model'; |
13 | import { RunTaskModal } from '/@/views/task/center/components/RunTaskModal'; | 6 | import { RunTaskModal } from '/@/views/task/center/components/RunTaskModal'; |
14 | import { useModal } from '/@/components/Modal'; | 7 | import { useModal } from '/@/components/Modal'; |
8 | + import { useCardList, BasicCardList } from '/@/components/CardList'; | ||
15 | 9 | ||
16 | const props = defineProps<{ | 10 | const props = defineProps<{ |
17 | tbDeviceId: string; | 11 | tbDeviceId: string; |
18 | }>(); | 12 | }>(); |
19 | 13 | ||
20 | - const listElRef = ref<Nullable<ComponentElRef>>(null); | ||
21 | - | ||
22 | const [registerRunTaskModal, { openModal }] = useModal(); | 14 | const [registerRunTaskModal, { openModal }] = useModal(); |
23 | 15 | ||
24 | - const [registerForm, { getFieldsValue }] = useForm({ | ||
25 | - schemas: formSchemas, | ||
26 | - baseColProps: { span: 8 }, | ||
27 | - compact: true, | ||
28 | - showAdvancedButton: true, | ||
29 | - labelWidth: 100, | ||
30 | - submitFunc: async () => { | ||
31 | - getDataSource(); | 16 | + const [registerCardList, { reload }] = useCardList({ |
17 | + title: '任务列表', | ||
18 | + api: getTaskCenterList, | ||
19 | + baseLayout: { col: 2, row: 2 }, | ||
20 | + useSearchForm: true, | ||
21 | + formConfig: { | ||
22 | + schemas: formSchemas, | ||
23 | + labelWidth: 100, | ||
24 | + baseColProps: { span: 8 }, | ||
32 | }, | 25 | }, |
33 | - resetFunc: async () => { | ||
34 | - getDataSource(true); | 26 | + offsetHeight: 16, |
27 | + beforeFetch: async (params: Recordable) => { | ||
28 | + return { ...params, tbDeviceId: props.tbDeviceId }; | ||
35 | }, | 29 | }, |
36 | }); | 30 | }); |
37 | 31 | ||
38 | - const paginationChange = (page: number, pageSize: number) => { | ||
39 | - pagination.current = page - 1 * pageSize > pagination.total ? 1 : page; | ||
40 | - pagination.pageSize = pageSize; | ||
41 | - getDataSource(); | ||
42 | - }; | ||
43 | - | ||
44 | - const pagination = reactive({ | ||
45 | - current: 1, | ||
46 | - pageSize: 10, | ||
47 | - total: 0, | ||
48 | - showQuickJumper: true, | ||
49 | - size: 'small', | ||
50 | - showTotal: (total: number) => `共 ${total} 条数据`, | ||
51 | - onChange: paginationChange, | ||
52 | - onShowSizeChange: paginationChange, | ||
53 | - }); | ||
54 | - | ||
55 | - const dataSource = ref<TaskRecordType[]>([]); | ||
56 | - const loading = ref(false); | ||
57 | - | ||
58 | - const getDataSource = async (reset = false) => { | ||
59 | - try { | ||
60 | - loading.value = true; | ||
61 | - const params = getFieldsValue() || {}; | ||
62 | - const { items, total } = await getTaskCenterList({ | ||
63 | - page: pagination.current, | ||
64 | - pageSize: pagination.pageSize, | ||
65 | - tbDeviceId: props.tbDeviceId, | ||
66 | - ...(reset ? {} : params), | ||
67 | - }); | ||
68 | - pagination.total = total; | ||
69 | - dataSource.value = items; | ||
70 | - } catch (error) { | ||
71 | - throw error; | ||
72 | - } finally { | ||
73 | - loading.value = false; | ||
74 | - } | ||
75 | - }; | ||
76 | - | ||
77 | - const reload = () => getDataSource(); | ||
78 | - | ||
79 | - const setListHeight = () => { | ||
80 | - const clientHeight = document.documentElement.clientHeight; | ||
81 | - const rect = getBoundingClientRect(unref(listElRef)!.$el!) as DOMRect; | ||
82 | - // margin-top 24 height 24 | ||
83 | - const paginationHeight = 24 + 24 + 8; | ||
84 | - // list pading top 8 maring-top 8 extra slot 56 | ||
85 | - const listContainerMarginBottom = 8 + 8 + 72; | ||
86 | - const listContainerHeight = | ||
87 | - clientHeight - rect.top - paginationHeight - listContainerMarginBottom; | ||
88 | - const listContainerEl = (unref(listElRef)!.$el as HTMLElement).querySelector( | ||
89 | - '.ant-spin-container' | ||
90 | - ) as HTMLElement; | ||
91 | - listContainerEl && | ||
92 | - (listContainerEl.style.height = listContainerHeight + 'px') && | ||
93 | - (listContainerEl.style.overflowY = 'auto') && | ||
94 | - (listContainerEl.style.overflowX = 'hidden'); | ||
95 | - }; | ||
96 | - | ||
97 | const handleRunTask = (record: TaskRecordType) => { | 32 | const handleRunTask = (record: TaskRecordType) => { |
98 | openModal(true, record); | 33 | openModal(true, record); |
99 | }; | 34 | }; |
100 | - | ||
101 | - onMounted(() => { | ||
102 | - setListHeight(); | ||
103 | - getDataSource(); | ||
104 | - }); | ||
105 | </script> | 35 | </script> |
106 | 36 | ||
107 | <template> | 37 | <template> |
108 | - <PageWrapper | 38 | + <!-- <PageWrapper |
109 | class="bg-neutral-100 dark:text-gray-300 dark:bg-dark-700 device-task-list-container" | 39 | class="bg-neutral-100 dark:text-gray-300 dark:bg-dark-700 device-task-list-container" |
110 | - > | ||
111 | - <section | ||
112 | - class="form-container bg-light-50 px-4 pt-4 mt-4 x dark:text-gray-300 dark:bg-dark-900" | ||
113 | - > | ||
114 | - <BasicForm @register="registerForm" /> | ||
115 | - </section> | ||
116 | - <section class="bg-light-50 my-4 p-4 x dark:text-gray-300 dark:bg-dark-900"> | ||
117 | - <List | ||
118 | - ref="listElRef" | ||
119 | - :dataSource="dataSource" | ||
120 | - :pagination="pagination" | ||
121 | - :grid="{ gutter: 16, xs: 1, sm: 1, md: 1, lg: 2, xl: 2, xxl: 3, column: 3 }" | ||
122 | - :loading="loading" | ||
123 | - > | ||
124 | - <template #header> | ||
125 | - <section class="flex justify-between gap-4 min-h-12 items-center"> | ||
126 | - <div class="text-lg font-semibold"> | ||
127 | - <span>任务列表</span> | ||
128 | - </div> | ||
129 | - <Tooltip title="刷新"> | ||
130 | - <Button type="primary" @click="getDataSource"> | ||
131 | - <ReloadOutlined :spin="loading" /> | ||
132 | - </Button> | ||
133 | - </Tooltip> | ||
134 | - </section> | ||
135 | - </template> | ||
136 | - <template #renderItem="{ item }"> | ||
137 | - <List.Item :key="item.id"> | ||
138 | - <TaskCard | ||
139 | - :record="item" | ||
140 | - :reload="reload" | ||
141 | - :tbDeviceId="tbDeviceId" | ||
142 | - :deviceTaskCardMode="true" | ||
143 | - @runTask="handleRunTask" | ||
144 | - /> | ||
145 | - </List.Item> | ||
146 | - </template> | ||
147 | - </List> | ||
148 | - <RunTaskModal :reload="reload" @register="registerRunTaskModal" /> | ||
149 | - </section> | ||
150 | - </PageWrapper> | 40 | + > --> |
41 | + <section class="bg-neutral-100 dark:text-gray-300 dark:bg-dark-700 device-task-list-container"> | ||
42 | + <BasicCardList class="flex-auto w-full" @register="registerCardList"> | ||
43 | + <template #renderItem="{ item }"> | ||
44 | + <TaskCard | ||
45 | + :record="item" | ||
46 | + :reload="reload" | ||
47 | + :tbDeviceId="tbDeviceId" | ||
48 | + :deviceTaskCardMode="true" | ||
49 | + @runTask="handleRunTask" | ||
50 | + /> | ||
51 | + </template> | ||
52 | + </BasicCardList> | ||
53 | + <RunTaskModal :reload="reload" @register="registerRunTaskModal" /> | ||
54 | + </section> | ||
55 | + <!-- </PageWrapper> --> | ||
151 | </template> | 56 | </template> |
152 | 57 | ||
153 | <style lang="less" scoped> | 58 | <style lang="less" scoped> |
@@ -156,8 +61,8 @@ | @@ -156,8 +61,8 @@ | ||
156 | border: none; | 61 | border: none; |
157 | } | 62 | } |
158 | 63 | ||
159 | - :deep(.ant-card-body) { | ||
160 | - padding: 16px 24px; | ||
161 | - } | 64 | + // :deep(.ant-card-body) { |
65 | + // padding: 16px 24px; | ||
66 | + // } | ||
162 | } | 67 | } |
163 | </style> | 68 | </style> |
@@ -18,9 +18,7 @@ | @@ -18,9 +18,7 @@ | ||
18 | 18 | ||
19 | const [register, { validate, resetFields, setFieldsValue, setProps }] = useForm({ | 19 | const [register, { validate, resetFields, setFieldsValue, setProps }] = useForm({ |
20 | labelWidth: 100, | 20 | labelWidth: 100, |
21 | - schemas: serviceSchemas( | ||
22 | - props.record.transportType === 'TCP' || props.record.ifShowClass === true | ||
23 | - ), | 21 | + schemas: serviceSchemas(props.record.transportType === 'TCP'), |
24 | actionColOptions: { | 22 | actionColOptions: { |
25 | span: 14, | 23 | span: 14, |
26 | }, | 24 | }, |
1 | import { CreateAlarmFieldsEnum, CreateAlarmFieldsNameEnum } from '../../../enum/formField/action'; | 1 | import { CreateAlarmFieldsEnum, CreateAlarmFieldsNameEnum } from '../../../enum/formField/action'; |
2 | import { JavascriptEditorWithTestModal } from '../../../src/components/JavaScriptFilterModal'; | 2 | import { JavascriptEditorWithTestModal } from '../../../src/components/JavaScriptFilterModal'; |
3 | +import { findDictItemByCode } from '/@/api/system/dict'; | ||
3 | import { FormSchema, useComponentRegister } from '/@/components/Form'; | 4 | import { FormSchema, useComponentRegister } from '/@/components/Form'; |
4 | import { useI18n } from '/@/hooks/web/useI18n'; | 5 | import { useI18n } from '/@/hooks/web/useI18n'; |
5 | 6 | ||
@@ -80,6 +81,22 @@ export const formSchemas: FormSchema[] = [ | @@ -80,6 +81,22 @@ export const formSchemas: FormSchema[] = [ | ||
80 | }, | 81 | }, |
81 | }, | 82 | }, |
82 | { | 83 | { |
84 | + field: CreateAlarmFieldsEnum.SEVERITY, | ||
85 | + component: 'ApiSelect', | ||
86 | + label: t(CreateAlarmFieldsNameEnum.SEVERITY), | ||
87 | + show: ({ model }) => !model[CreateAlarmFieldsEnum.USE_MESSAGE_ALARM_DATA], | ||
88 | + ifShow: ({ model }) => !model[CreateAlarmFieldsEnum.DYNAMIC_SEVERITY], | ||
89 | + componentProps: { | ||
90 | + api: findDictItemByCode, | ||
91 | + params: { | ||
92 | + dictCode: 'severity_type', | ||
93 | + }, | ||
94 | + labelField: 'itemText', | ||
95 | + valueField: 'itemValue', | ||
96 | + placeholder: `请输入${t(CreateAlarmFieldsNameEnum.SEVERITY)}`, | ||
97 | + }, | ||
98 | + }, | ||
99 | + { | ||
83 | field: CreateAlarmFieldsEnum.PROPAGATE, | 100 | field: CreateAlarmFieldsEnum.PROPAGATE, |
84 | component: 'Checkbox', | 101 | component: 'Checkbox', |
85 | label: '', | 102 | label: '', |
@@ -23,7 +23,7 @@ export const formSchemas: FormSchema[] = [ | @@ -23,7 +23,7 @@ export const formSchemas: FormSchema[] = [ | ||
23 | component: 'Checkbox', | 23 | component: 'Checkbox', |
24 | label: '', | 24 | label: '', |
25 | renderComponentContent: () => ({ | 25 | renderComponentContent: () => ({ |
26 | - default: () => t(SaveTimeseriesFieldsNameEnum.DEFAULT_TTL), | 26 | + default: () => t(SaveTimeseriesFieldsNameEnum.SKIP_LATEST_PERSISTENCE), |
27 | }), | 27 | }), |
28 | }, | 28 | }, |
29 | { | 29 | { |
@@ -60,6 +60,7 @@ export const formSchemas: FormSchema[] = [ | @@ -60,6 +60,7 @@ export const formSchemas: FormSchema[] = [ | ||
60 | field: OriginatorAttributesEnum.LATEST_TS_KEY_NAMES, | 60 | field: OriginatorAttributesEnum.LATEST_TS_KEY_NAMES, |
61 | component: 'Select', | 61 | component: 'Select', |
62 | label: t(OriginatorAttributesNameEnum.LATEST_TS_KEY_NAMES), | 62 | label: t(OriginatorAttributesNameEnum.LATEST_TS_KEY_NAMES), |
63 | + required: true, | ||
63 | helpMessage: [ | 64 | helpMessage: [ |
64 | `Hint: use \${metadataKey} for value from metadata, $[messageKey] for value from message body`, | 65 | `Hint: use \${metadataKey} for value from metadata, $[messageKey] for value from message body`, |
65 | ], | 66 | ], |
@@ -18,6 +18,10 @@ | @@ -18,6 +18,10 @@ | ||
18 | return nodeDefinition || {}; | 18 | return nodeDefinition || {}; |
19 | }); | 19 | }); |
20 | 20 | ||
21 | + const getHasInEnabledFlag = computed(() => unref(getNodeDefinition).inEnabled); | ||
22 | + | ||
23 | + const getHasOutEnabledFlag = computed(() => unref(getNodeDefinition).outEnabled); | ||
24 | + | ||
21 | const getIcon = computed(() => { | 25 | const getIcon = computed(() => { |
22 | const { icon } = unref(getNodeDefinition); | 26 | const { icon } = unref(getNodeDefinition); |
23 | const { icon: categoryIcon } = props.categoryConfig || {}; | 27 | const { icon: categoryIcon } = props.categoryConfig || {}; |
@@ -87,8 +91,14 @@ | @@ -87,8 +91,14 @@ | ||
87 | {{ config?.name }} | 91 | {{ config?.name }} |
88 | </span> | 92 | </span> |
89 | </div> | 93 | </div> |
90 | - <div class="w-4 h-4 bg-gray-300 rounded-md border absolute -left-3 border-gray-500"></div> | ||
91 | - <div class="w-4 h-4 bg-gray-300 rounded-md border absolute -right-3 border-gray-500"></div> | 94 | + <div |
95 | + v-if="getHasInEnabledFlag" | ||
96 | + class="w-4 h-4 bg-gray-300 rounded-md border absolute -left-3 border-gray-500" | ||
97 | + ></div> | ||
98 | + <div | ||
99 | + v-if="getHasOutEnabledFlag" | ||
100 | + class="w-4 h-4 bg-gray-300 rounded-md border absolute -right-3 border-gray-500" | ||
101 | + ></div> | ||
92 | </main> | 102 | </main> |
93 | </Tooltip> | 103 | </Tooltip> |
94 | </template> | 104 | </template> |