Showing
7 changed files
with
61 additions
and
23 deletions
src/api/device/eventManage.ts
0 → 100644
1 | +import { EventManageRequest } from './model/eventManageModel'; | ||
2 | +import { defHttp } from '/@/utils/http/axios'; | ||
3 | +enum EventManage { | ||
4 | + LIST = '/event', | ||
5 | +} | ||
6 | + | ||
7 | +/** | ||
8 | + * @description 获取事件管理列表 | ||
9 | + * @param params | ||
10 | + * @returns | ||
11 | + */ | ||
12 | +export const getEventManageListRecord = (params: EventManageRequest) => { | ||
13 | + return defHttp.get({ | ||
14 | + url: EventManage.LIST, | ||
15 | + params, | ||
16 | + }); | ||
17 | +}; |
@@ -177,6 +177,8 @@ export interface DeviceRecord { | @@ -177,6 +177,8 @@ export interface DeviceRecord { | ||
177 | default: boolean; | 177 | default: boolean; |
178 | defaultRuleChainId: string; | 178 | defaultRuleChainId: string; |
179 | profileId: string; | 179 | profileId: string; |
180 | + alias?: string; | ||
181 | + brand?: string; | ||
180 | } | 182 | } |
181 | 183 | ||
182 | export interface DeviceModelOfMatterAttrs { | 184 | export interface DeviceModelOfMatterAttrs { |
src/api/device/model/eventManageModel.ts
0 → 100644
@@ -49,7 +49,7 @@ | @@ -49,7 +49,7 @@ | ||
49 | <!-- 网关设备并且是TBox --> | 49 | <!-- 网关设备并且是TBox --> |
50 | 50 | ||
51 | <TabPane key="eventManage" tab="事件管理"> | 51 | <TabPane key="eventManage" tab="事件管理"> |
52 | - <EventManage /> | 52 | + <EventManage :tbDeviceId="deviceDetail.tbDeviceId" /> |
53 | </TabPane> | 53 | </TabPane> |
54 | </Tabs> | 54 | </Tabs> |
55 | </BasicDrawer> | 55 | </BasicDrawer> |
@@ -70,6 +70,7 @@ | @@ -70,6 +70,7 @@ | ||
70 | // import HistoryData from '../tabs/HistoryData.vue'; | 70 | // import HistoryData from '../tabs/HistoryData.vue'; |
71 | import ModelOfMatter from '../tabs/ModelOfMatter.vue'; | 71 | import ModelOfMatter from '../tabs/ModelOfMatter.vue'; |
72 | import EventManage from '../tabs/EventManage/index.vue'; | 72 | import EventManage from '../tabs/EventManage/index.vue'; |
73 | + import { DeviceRecord } from '/@/api/device/model/deviceModel'; | ||
73 | 74 | ||
74 | export default defineComponent({ | 75 | export default defineComponent({ |
75 | name: 'DeviceModal', | 76 | name: 'DeviceModal', |
@@ -93,7 +94,7 @@ | @@ -93,7 +94,7 @@ | ||
93 | const activeKey = ref('1'); | 94 | const activeKey = ref('1'); |
94 | const size = ref('small'); | 95 | const size = ref('small'); |
95 | const deviceDetailRef = ref(); | 96 | const deviceDetailRef = ref(); |
96 | - const deviceDetail = ref<any>({}); | 97 | + const deviceDetail = ref<DeviceRecord>({} as unknown as DeviceRecord); |
97 | const tbDeviceId = ref(''); | 98 | const tbDeviceId = ref(''); |
98 | // 详情回显 | 99 | // 详情回显 |
99 | const [register] = useDrawerInner(async (data) => { | 100 | const [register] = useDrawerInner(async (data) => { |
@@ -8,7 +8,7 @@ export const columnSchema: BasicColumn[] = [ | @@ -8,7 +8,7 @@ export const columnSchema: BasicColumn[] = [ | ||
8 | }, | 8 | }, |
9 | { | 9 | { |
10 | title: '标识符', | 10 | title: '标识符', |
11 | - dataIndex: 'identifier', | 11 | + dataIndex: 'eventIdentifier', |
12 | helpMessage: ['标识符格式为模块标识符: 功能定义标识符'], | 12 | helpMessage: ['标识符格式为模块标识符: 功能定义标识符'], |
13 | }, | 13 | }, |
14 | { | 14 | { |
@@ -28,15 +28,17 @@ export const columnSchema: BasicColumn[] = [ | @@ -28,15 +28,17 @@ export const columnSchema: BasicColumn[] = [ | ||
28 | 28 | ||
29 | export const formSchemas: FormSchema[] = [ | 29 | export const formSchemas: FormSchema[] = [ |
30 | { | 30 | { |
31 | - field: 'identifier', | 31 | + field: 'eventIdentifier', |
32 | label: '标识符', | 32 | label: '标识符', |
33 | component: 'Input', | 33 | component: 'Input', |
34 | + componentProps: { | ||
35 | + placeholder: '请输入标识符', | ||
36 | + }, | ||
34 | }, | 37 | }, |
35 | { | 38 | { |
36 | - field: 'alarmType', | 39 | + field: 'eventType', |
37 | label: '告警类型', | 40 | label: '告警类型', |
38 | component: 'ApiSelect', | 41 | component: 'ApiSelect', |
39 | - defaultValue: 'INFO', | ||
40 | componentProps: { | 42 | componentProps: { |
41 | placeholder: '请选择事件类型', | 43 | placeholder: '请选择事件类型', |
42 | api: findDictItemByCode, | 44 | api: findDictItemByCode, |
@@ -52,5 +54,8 @@ export const formSchemas: FormSchema[] = [ | @@ -52,5 +54,8 @@ export const formSchemas: FormSchema[] = [ | ||
52 | label: '时间范围', | 54 | label: '时间范围', |
53 | component: 'RangePicker', | 55 | component: 'RangePicker', |
54 | colProps: { span: 10 }, | 56 | colProps: { span: 10 }, |
57 | + componentProps: { | ||
58 | + showTime: true, | ||
59 | + }, | ||
55 | }, | 60 | }, |
56 | ]; | 61 | ]; |
@@ -2,13 +2,16 @@ | @@ -2,13 +2,16 @@ | ||
2 | import { BasicTable, useTable } from '/@/components/Table'; | 2 | import { BasicTable, useTable } from '/@/components/Table'; |
3 | import { formSchemas, columnSchema } from './config'; | 3 | import { formSchemas, columnSchema } from './config'; |
4 | import { BasicModal, useModal } from '/@/components/Modal'; | 4 | import { BasicModal, useModal } from '/@/components/Modal'; |
5 | - import { Textarea } from 'ant-design-vue'; | 5 | + import { Input } from 'ant-design-vue'; |
6 | import { ref } from 'vue'; | 6 | import { ref } from 'vue'; |
7 | - import { formatToDateTime } from '/@/utils/dateUtil'; | ||
8 | import { EyeOutlined } from '@ant-design/icons-vue'; | 7 | import { EyeOutlined } from '@ant-design/icons-vue'; |
8 | + import { getEventManageListRecord } from '/@/api/device/eventManage'; | ||
9 | + import { EventManageRequest } from '/@/api/device/model/eventManageModel'; | ||
9 | 10 | ||
10 | const outputData = ref<string>(); | 11 | const outputData = ref<string>(); |
11 | 12 | ||
13 | + const props = defineProps<{ tbDeviceId: string }>(); | ||
14 | + | ||
12 | const [register] = useTable({ | 15 | const [register] = useTable({ |
13 | columns: columnSchema, | 16 | columns: columnSchema, |
14 | size: 'small', | 17 | size: 'small', |
@@ -16,24 +19,25 @@ | @@ -16,24 +19,25 @@ | ||
16 | useSearchForm: true, | 19 | useSearchForm: true, |
17 | showTableSetting: true, | 20 | showTableSetting: true, |
18 | bordered: true, | 21 | bordered: true, |
19 | - dataSource: [ | ||
20 | - { | ||
21 | - time: formatToDateTime(new Date()), | ||
22 | - identifier: '标识符', | ||
23 | - eventName: '事件名', | ||
24 | - eventType: '告警', | ||
25 | - outputParams: { test: 1 }, | ||
26 | - }, | ||
27 | - ], | 22 | + api: getEventManageListRecord, |
23 | + fetchSetting: { | ||
24 | + totalField: 'totalElements', | ||
25 | + listField: 'data', | ||
26 | + }, | ||
28 | formConfig: { | 27 | formConfig: { |
29 | layout: 'inline', | 28 | layout: 'inline', |
30 | baseColProps: { span: 6 }, | 29 | baseColProps: { span: 6 }, |
31 | labelWidth: 80, | 30 | labelWidth: 80, |
32 | schemas: formSchemas, | 31 | schemas: formSchemas, |
32 | + fieldMapToTime: [['dateRange', ['startTime', 'endTime']]], | ||
33 | }, | 33 | }, |
34 | - handleSearchInfoFn: (params: Recordable) => { | ||
35 | - // console.log(params); | ||
36 | - return params; | 34 | + beforeFetch: (params: EventManageRequest) => { |
35 | + return { | ||
36 | + ...params, | ||
37 | + startTime: params.startTime ? new Date(params.startTime).getTime() : params.startTime, | ||
38 | + endTime: params.endTime ? new Date(params.endTime).getTime() : params.endTime, | ||
39 | + tbDeviceId: props.tbDeviceId, | ||
40 | + }; | ||
37 | }, | 41 | }, |
38 | }); | 42 | }); |
39 | 43 | ||
@@ -61,7 +65,7 @@ | @@ -61,7 +65,7 @@ | ||
61 | </template> | 65 | </template> |
62 | </BasicTable> | 66 | </BasicTable> |
63 | <BasicModal title="输出参数" @register="registerModal"> | 67 | <BasicModal title="输出参数" @register="registerModal"> |
64 | - <Textarea v-model:value="outputData" :autosize="true" /> | 68 | + <Input.TextArea v-model:value="outputData" :autosize="true" /> |
65 | </BasicModal> | 69 | </BasicModal> |
66 | </template> | 70 | </template> |
67 | 71 |
@@ -13,7 +13,7 @@ | @@ -13,7 +13,7 @@ | ||
13 | import HistoryData from './HistoryData.vue'; | 13 | import HistoryData from './HistoryData.vue'; |
14 | import { BasicModal, useModal } from '/@/components/Modal'; | 14 | import { BasicModal, useModal } from '/@/components/Modal'; |
15 | import { getDeviceAttrs } from '/@/api/device/deviceManager'; | 15 | import { getDeviceAttrs } from '/@/api/device/deviceManager'; |
16 | - import { DeviceModelOfMatterAttrs } from '/@/api/device/model/deviceModel'; | 16 | + import { DeviceModelOfMatterAttrs, DeviceRecord } from '/@/api/device/model/deviceModel'; |
17 | import { computed } from '@vue/reactivity'; | 17 | import { computed } from '@vue/reactivity'; |
18 | import { Specs, StructJSON } from '/@/api/device/model/modelOfMatterModel'; | 18 | import { Specs, StructJSON } from '/@/api/device/model/modelOfMatterModel'; |
19 | import { isArray, isObject } from '/@/utils/is'; | 19 | import { isArray, isObject } from '/@/utils/is'; |
@@ -34,7 +34,7 @@ | @@ -34,7 +34,7 @@ | ||
34 | } | 34 | } |
35 | 35 | ||
36 | const props = defineProps<{ | 36 | const props = defineProps<{ |
37 | - deviceDetail: Record<'tbDeviceId' | 'profileId' | 'id' | 'deviceProfileId', string>; | 37 | + deviceDetail: DeviceRecord; |
38 | }>(); | 38 | }>(); |
39 | 39 | ||
40 | const grid = { | 40 | const grid = { |