Commit 3202c87d8f42f9a8ae643080d81643b577527c84
Merge branch 'ft-dev' into 'main'
fix:修改场景联动触发器新增触发器设备不显示问题,refractor:重构部分设备配置代码 See merge request huang/yun-teng-iot-front!109
Showing
27 changed files
with
1194 additions
and
722 deletions
@@ -3,17 +3,17 @@ import { FormSchema } from '/@/components/Form'; | @@ -3,17 +3,17 @@ import { FormSchema } from '/@/components/Form'; | ||
3 | import { BasicColumn } from '/@/components/Table'; | 3 | import { BasicColumn } from '/@/components/Table'; |
4 | import { DeviceTypeEnum } from '/@/api/device/model/deviceModel'; | 4 | import { DeviceTypeEnum } from '/@/api/device/model/deviceModel'; |
5 | import { getCustomerList } from '/@/api/device/deviceManager'; | 5 | import { getCustomerList } from '/@/api/device/deviceManager'; |
6 | -import moment from 'moment'; | 6 | +import dayjs from 'moment'; |
7 | export const columns: BasicColumn[] = [ | 7 | export const columns: BasicColumn[] = [ |
8 | { | 8 | { |
9 | title: '设备名称', | 9 | title: '设备名称', |
10 | dataIndex: 'name', | 10 | dataIndex: 'name', |
11 | - width: 160, | 11 | + width: 120, |
12 | }, | 12 | }, |
13 | { | 13 | { |
14 | title: '设备标签', | 14 | title: '设备标签', |
15 | dataIndex: 'label', | 15 | dataIndex: 'label', |
16 | - width: 160, | 16 | + width: 100, |
17 | }, | 17 | }, |
18 | { | 18 | { |
19 | title: '设备配置', | 19 | title: '设备配置', |
@@ -34,7 +34,7 @@ export const columns: BasicColumn[] = [ | @@ -34,7 +34,7 @@ export const columns: BasicColumn[] = [ | ||
34 | { | 34 | { |
35 | title: '描述', | 35 | title: '描述', |
36 | dataIndex: 'description', | 36 | dataIndex: 'description', |
37 | - width: 160, | 37 | + width: 180, |
38 | }, | 38 | }, |
39 | ]; | 39 | ]; |
40 | // 实时数据表格 | 40 | // 实时数据表格 |
@@ -100,7 +100,7 @@ export const alarmSearchSchemas: FormSchema[] = [ | @@ -100,7 +100,7 @@ export const alarmSearchSchemas: FormSchema[] = [ | ||
100 | component: 'DatePicker', | 100 | component: 'DatePicker', |
101 | componentProps: { | 101 | componentProps: { |
102 | valueFormat: 'x', | 102 | valueFormat: 'x', |
103 | - showTime: { defaultValue: moment('23:59:59', 'HH:mm:ss') }, | 103 | + showTime: { defaultValue: dayjs('23:59:59', 'HH:mm:ss') }, |
104 | }, | 104 | }, |
105 | colProps: { span: 6 }, | 105 | colProps: { span: 6 }, |
106 | }, | 106 | }, |
@@ -216,22 +216,16 @@ export const alarmSchemasForm: FormSchema[] = [ | @@ -216,22 +216,16 @@ export const alarmSchemasForm: FormSchema[] = [ | ||
216 | // 子设备 | 216 | // 子设备 |
217 | export const childDeviceSchemas: FormSchema[] = [ | 217 | export const childDeviceSchemas: FormSchema[] = [ |
218 | { | 218 | { |
219 | - field: 'deviceState', | ||
220 | - label: '设备状态', | ||
221 | - colProps: { span: 6 }, | 219 | + field: 'icon', |
220 | + label: '设备配置', | ||
222 | component: 'Select', | 221 | component: 'Select', |
222 | + colProps: { span: 6 }, | ||
223 | componentProps: { | 223 | componentProps: { |
224 | - size: 'small', | ||
225 | maxLength: 255, | 224 | maxLength: 255, |
226 | - options: [ | ||
227 | - { label: '待激活', value: 'INACTIVE' }, | ||
228 | - { label: '在线', value: 'ONLINE' }, | ||
229 | - { label: '离线', value: 'OFFLINE' }, | ||
230 | - ], | ||
231 | }, | 225 | }, |
232 | }, | 226 | }, |
233 | { | 227 | { |
234 | - field: 'name', | 228 | + field: 'icon', |
235 | label: '设备名称', | 229 | label: '设备名称', |
236 | component: 'Input', | 230 | component: 'Input', |
237 | colProps: { span: 6 }, | 231 | colProps: { span: 6 }, |
@@ -244,30 +238,32 @@ export const childDeviceSchemas: FormSchema[] = [ | @@ -244,30 +238,32 @@ export const childDeviceSchemas: FormSchema[] = [ | ||
244 | export const childDeviceColumns: BasicColumn[] = [ | 238 | export const childDeviceColumns: BasicColumn[] = [ |
245 | { | 239 | { |
246 | title: '名称', | 240 | title: '名称', |
247 | - dataIndex: 'tbDeviceName', | 241 | + dataIndex: 'name', |
248 | width: 120, | 242 | width: 120, |
249 | }, | 243 | }, |
250 | { | 244 | { |
251 | - title: '标签', | 245 | + title: '设备配置', |
252 | dataIndex: 'label', | 246 | dataIndex: 'label', |
247 | + width: 100, | ||
248 | + }, | ||
249 | + { | ||
250 | + title: '标签', | ||
251 | + dataIndex: 'aaa', | ||
253 | width: 160, | 252 | width: 160, |
254 | }, | 253 | }, |
255 | { | 254 | { |
256 | title: '状态', | 255 | title: '状态', |
257 | - dataIndex: 'deviceState', | ||
258 | - slots: { customRender: 'deviceState' }, | 256 | + dataIndex: 'bbb', |
259 | width: 160, | 257 | width: 160, |
260 | }, | 258 | }, |
261 | { | 259 | { |
262 | title: '最后连接时间', | 260 | title: '最后连接时间', |
263 | - dataIndex: 'lastOnlineTime', | ||
264 | - format: (text) => formatToDateTime(text, 'YYYY-MM-DD HH:mm:ss'), | 261 | + dataIndex: 'ccc', |
265 | width: 160, | 262 | width: 160, |
266 | }, | 263 | }, |
267 | { | 264 | { |
268 | - title: '更新时间', | ||
269 | - dataIndex: 'createdTime', | ||
270 | - format: (text) => formatToDateTime(text, 'YYYY-MM-DD HH:mm:ss'), | 265 | + title: '创建时间', |
266 | + dataIndex: 'ddd', | ||
271 | width: 160, | 267 | width: 160, |
272 | }, | 268 | }, |
273 | ]; | 269 | ]; |
@@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
7 | centered | 7 | centered |
8 | @ok="dispatchCustomer" | 8 | @ok="dispatchCustomer" |
9 | @cancel="resetFields" | 9 | @cancel="resetFields" |
10 | - :minHeight="100" | 10 | + :minHeight="150" |
11 | okText="分配" | 11 | okText="分配" |
12 | > | 12 | > |
13 | <BasicForm @register="registerForm" /> | 13 | <BasicForm @register="registerForm" /> |
@@ -17,8 +17,8 @@ | @@ -17,8 +17,8 @@ | ||
17 | /></TabPane> | 17 | /></TabPane> |
18 | <TabPane key="3" tab="告警"><Alarm :id="deviceDetail.id" /></TabPane> | 18 | <TabPane key="3" tab="告警"><Alarm :id="deviceDetail.id" /></TabPane> |
19 | <TabPane key="4" tab="子设备" v-if="deviceDetail?.deviceType === 'GATEWAY'" | 19 | <TabPane key="4" tab="子设备" v-if="deviceDetail?.deviceType === 'GATEWAY'" |
20 | - ><ChildDevice :fromId="deviceDetail?.tbDeviceId" /> | ||
21 | - </TabPane> | 20 | + ><ChildDevice |
21 | + /></TabPane> | ||
22 | </Tabs> | 22 | </Tabs> |
23 | </BasicDrawer> | 23 | </BasicDrawer> |
24 | </template> | 24 | </template> |
@@ -61,7 +61,6 @@ | @@ -61,7 +61,6 @@ | ||
61 | deviceDetailRef.value.initMap(longitude, latitude, address); | 61 | deviceDetailRef.value.initMap(longitude, latitude, address); |
62 | } | 62 | } |
63 | }); | 63 | }); |
64 | - | ||
65 | const closeDrawer = () => { | 64 | const closeDrawer = () => { |
66 | activeKey.value = '1'; | 65 | activeKey.value = '1'; |
67 | }; | 66 | }; |
@@ -10,9 +10,9 @@ | @@ -10,9 +10,9 @@ | ||
10 | centered | 10 | centered |
11 | > | 11 | > |
12 | <div class="step-form-form"> | 12 | <div class="step-form-form"> |
13 | - <Steps :current="current" v-if="!isUpdate"> | ||
14 | - <Step title="填写设备信息" /> | ||
15 | - <Step title="添加设备凭证" /> | 13 | + <Steps :current="current"> |
14 | + <Step title="填写设备信息" v-if="!isUpdate" /> | ||
15 | + <Step title="添加设备凭证" v-if="!isUpdate" /> | ||
16 | </Steps> | 16 | </Steps> |
17 | </div> | 17 | </div> |
18 | <div class="mt-5"> | 18 | <div class="mt-5"> |
1 | <template> | 1 | <template> |
2 | - <BasicTable @register="registerTable"> | ||
3 | - <template #deviceState="{ record }"> | ||
4 | - <Tag | ||
5 | - :color=" | ||
6 | - record.deviceState == DeviceState.INACTIVE | ||
7 | - ? 'warning' | ||
8 | - : record.deviceState == DeviceState.ONLINE | ||
9 | - ? 'success' | ||
10 | - : 'error' | ||
11 | - " | ||
12 | - class="ml-2" | ||
13 | - > | ||
14 | - {{ | ||
15 | - record.deviceState == DeviceState.INACTIVE | ||
16 | - ? '待激活' | ||
17 | - : record.deviceState == DeviceState.ONLINE | ||
18 | - ? '在线' | ||
19 | - : '离线' | ||
20 | - }} | ||
21 | - </Tag> | ||
22 | - </template> | ||
23 | - </BasicTable> | 2 | + <BasicTable @register="registerTable" /> |
24 | </template> | 3 | </template> |
25 | <script lang="ts"> | 4 | <script lang="ts"> |
26 | - import { defineComponent, onMounted } from 'vue'; | ||
27 | - import { Tag } from 'ant-design-vue'; | ||
28 | - import { DeviceState } from '/@/api/device/model/deviceModel'; | 5 | + import { defineComponent } from 'vue'; |
29 | import { BasicTable, useTable } from '/@/components/Table'; | 6 | import { BasicTable, useTable } from '/@/components/Table'; |
30 | import { childDeviceColumns, childDeviceSchemas } from '../../config/detail.config'; | 7 | import { childDeviceColumns, childDeviceSchemas } from '../../config/detail.config'; |
31 | - import { getChildDevicePage } from '/@/api/device/deviceManager.ts'; | 8 | + |
32 | export default defineComponent({ | 9 | export default defineComponent({ |
33 | name: 'DeviceManagement', | 10 | name: 'DeviceManagement', |
34 | components: { | 11 | components: { |
35 | BasicTable, | 12 | BasicTable, |
36 | - Tag, | ||
37 | - }, | ||
38 | - props: { | ||
39 | - fromId: { | ||
40 | - type: String, | ||
41 | - required: true, | ||
42 | - }, | ||
43 | }, | 13 | }, |
44 | - setup(props) { | ||
45 | - console.log(123); | ||
46 | - onMounted(() => { | ||
47 | - console.log(props.fromId); | ||
48 | - }); | 14 | + setup(_) { |
49 | const [registerTable] = useTable({ | 15 | const [registerTable] = useTable({ |
50 | - api: getChildDevicePage, | ||
51 | columns: childDeviceColumns, | 16 | columns: childDeviceColumns, |
52 | formConfig: { | 17 | formConfig: { |
53 | labelWidth: 120, | 18 | labelWidth: 120, |
54 | schemas: childDeviceSchemas, | 19 | schemas: childDeviceSchemas, |
55 | }, | 20 | }, |
56 | - beforeFetch: (data) => { | ||
57 | - console.log(props.fromId); | ||
58 | - Reflect.set(data, 'fromId', props.fromId); | ||
59 | - }, | ||
60 | useSearchForm: true, | 21 | useSearchForm: true, |
61 | showTableSetting: true, | 22 | showTableSetting: true, |
62 | bordered: true, | 23 | bordered: true, |
@@ -65,7 +26,6 @@ | @@ -65,7 +26,6 @@ | ||
65 | 26 | ||
66 | return { | 27 | return { |
67 | registerTable, | 28 | registerTable, |
68 | - DeviceState, | ||
69 | }; | 29 | }; |
70 | }, | 30 | }, |
71 | }); | 31 | }); |
@@ -23,7 +23,7 @@ | @@ -23,7 +23,7 @@ | ||
23 | </div> | 23 | </div> |
24 | <div v-if="deviceDetail?.deviceInfo?.address" class="mt-4"> | 24 | <div v-if="deviceDetail?.deviceInfo?.address" class="mt-4"> |
25 | <p>设备位置</p> | 25 | <p>设备位置</p> |
26 | - <div ref="wrapRef" style="height: 550px; width: 100%"></div> | 26 | + <div ref="wrapRef" style="height: 400px; width: 100%"></div> |
27 | </div> | 27 | </div> |
28 | </div> | 28 | </div> |
29 | </template> | 29 | </template> |
@@ -38,8 +38,6 @@ | @@ -38,8 +38,6 @@ | ||
38 | import { useModal } from '/@/components/Modal'; | 38 | import { useModal } from '/@/components/Modal'; |
39 | import ManageDeviceTokenModal from '../modal/ManageDeviceTokenModal.vue'; | 39 | import ManageDeviceTokenModal from '../modal/ManageDeviceTokenModal.vue'; |
40 | import { getDeviceToken } from '/@/api/device/deviceManager'; | 40 | import { getDeviceToken } from '/@/api/device/deviceManager'; |
41 | - import wz from '/@/assets/images/wz.png'; | ||
42 | - | ||
43 | export default defineComponent({ | 41 | export default defineComponent({ |
44 | components: { | 42 | components: { |
45 | Image, | 43 | Image, |
@@ -64,7 +62,7 @@ | @@ -64,7 +62,7 @@ | ||
64 | const BMap = (window as any).BMap; | 62 | const BMap = (window as any).BMap; |
65 | if (!wrapEl) return; | 63 | if (!wrapEl) return; |
66 | const map = new BMap.Map(wrapEl); | 64 | const map = new BMap.Map(wrapEl); |
67 | - let myIcon = new BMap.Icon(wz, new BMap.Size(20, 30)); | 65 | + let myIcon = new BMap.Icon('/src/assets/images/wz.png', new BMap.Size(20, 30)); |
68 | 66 | ||
69 | const point = new BMap.Point(Number(longitude), Number(latitude)); | 67 | const point = new BMap.Point(Number(longitude), Number(latitude)); |
70 | var content = `我在 ${address}`; | 68 | var content = `我在 ${address}`; |
@@ -207,7 +207,7 @@ | @@ -207,7 +207,7 @@ | ||
207 | } | 207 | } |
208 | 208 | ||
209 | function handleDelete(record: Recordable) { | 209 | function handleDelete(record: Recordable) { |
210 | - const ids = [record.id]; | 210 | + let ids = [record.id]; |
211 | deleteDevice(ids).then(() => { | 211 | deleteDevice(ids).then(() => { |
212 | createMessage.success('删除设备成功'); | 212 | createMessage.success('删除设备成功'); |
213 | handleSuccess(); | 213 | handleSuccess(); |
src/views/device/profile/1 copy.json
0 → 100644
1 | +{ | ||
2 | + "id": "", | ||
3 | + "name": "6", | ||
4 | + "transportType": "DEFAULT", | ||
5 | + "profileData": { | ||
6 | + "alarms": [ | ||
7 | + { | ||
8 | + "id": "05f99082-3941-467d-999a-7ab5eb7bac46", | ||
9 | + "alarmType": "6", | ||
10 | + "propagate": true, | ||
11 | + "propagateRelationTypes": ["6"], | ||
12 | + "createRules": { | ||
13 | + "MAJOR": { | ||
14 | + "alarmDetails": "CO2过高", | ||
15 | + "schedule": { | ||
16 | + "type": "ANY_TIME", | ||
17 | + "timezone": "Asia/Shanghai (UTC+08:00)" | ||
18 | + }, | ||
19 | + "condition": [ | ||
20 | + { | ||
21 | + "key": { | ||
22 | + "type": "TIME_SERIES", | ||
23 | + "key": "100" | ||
24 | + }, | ||
25 | + "valueType": "NUMERIC", | ||
26 | + "value": "100", | ||
27 | + "predicate": { | ||
28 | + "type": "NUMERIC", | ||
29 | + "operation": "NOT_EQUAL", | ||
30 | + "value": { | ||
31 | + "defaultValue": "100" | ||
32 | + } | ||
33 | + } | ||
34 | + } | ||
35 | + ] | ||
36 | + }, | ||
37 | + "MINOR": { | ||
38 | + "alarmDetails": "CO过高", | ||
39 | + "schedule": { | ||
40 | + "type": "ANY_TIME", | ||
41 | + "timezone": "Asia/Shanghai (UTC+08:00)" | ||
42 | + }, | ||
43 | + "condition": [ | ||
44 | + { | ||
45 | + "key": { | ||
46 | + "type": "TIME_SERIES", | ||
47 | + "key": "2000" | ||
48 | + }, | ||
49 | + "valueType": "NUMERIC", | ||
50 | + "value": "2000", | ||
51 | + "predicate": { | ||
52 | + "type": "NUMERIC", | ||
53 | + "operation": "EQUAL", | ||
54 | + "value": { | ||
55 | + "defaultValue": "2000" | ||
56 | + } | ||
57 | + } | ||
58 | + } | ||
59 | + ] | ||
60 | + } | ||
61 | + }, | ||
62 | + "clearRule": { | ||
63 | + "schedule": { | ||
64 | + "type": "ANY_TIME", | ||
65 | + "timezone": "Asia/Shanghai (UTC+08:00)" | ||
66 | + }, | ||
67 | + "condition": [ | ||
68 | + { | ||
69 | + "key": { | ||
70 | + "type": "TIME_SERIES", | ||
71 | + "key": "123" | ||
72 | + }, | ||
73 | + "valueType": "NUMERIC", | ||
74 | + "value": "123", | ||
75 | + "predicate": { | ||
76 | + "type": "NUMERIC", | ||
77 | + "operation": "GREATER_OR_EQUAL", | ||
78 | + "value": { | ||
79 | + "defaultValue": "123" | ||
80 | + } | ||
81 | + } | ||
82 | + }, | ||
83 | + { | ||
84 | + "key": { | ||
85 | + "type": "TIME_SERIES", | ||
86 | + "key": "456" | ||
87 | + }, | ||
88 | + "valueType": "NUMERIC", | ||
89 | + "value": "456", | ||
90 | + "predicate": { | ||
91 | + "type": "NUMERIC", | ||
92 | + "operation": "LESS", | ||
93 | + "value": { | ||
94 | + "defaultValue": "456" | ||
95 | + } | ||
96 | + } | ||
97 | + } | ||
98 | + ], | ||
99 | + "alarmDetails": "CO3过低" | ||
100 | + } | ||
101 | + } | ||
102 | + ] | ||
103 | + }, | ||
104 | + "alarmProfile": { | ||
105 | + "alarmContactId": "224a312c-4f52-41ef-9dce-2aac69ec2e85,8aff39c6-af9c-416a-b110-601183e39da0", | ||
106 | + "messageMode": "EMAIL_MESSAGE" | ||
107 | + } | ||
108 | +} |
src/views/device/profile/1.json
0 → 100644
1 | +{ | ||
2 | + "id": "5445f670-8946-11ec-ac19-e398562c8b61", | ||
3 | + "name": "一氧化碳检测", | ||
4 | + "enabled": false, | ||
5 | + "description": "针对一氧化碳有害气体检测", | ||
6 | + "tenantId": "de10f9e0-8892-11ec-ac19-e398562c8b61", | ||
7 | + "profileData": { | ||
8 | + "configuration": { | ||
9 | + "type": "DEFAULT" | ||
10 | + }, | ||
11 | + "transportConfiguration": { | ||
12 | + "type": "DEFAULT" | ||
13 | + }, | ||
14 | + "provisionConfiguration": { | ||
15 | + "type": "DISABLED", | ||
16 | + "provisionDeviceSecret": null | ||
17 | + }, | ||
18 | + "alarms": [ | ||
19 | + { | ||
20 | + "id": "5d11af7e-71ce-44ef-b34b-6b1a2425f25c", | ||
21 | + "alarmType": "气体浓度告警", | ||
22 | + "createRules": { | ||
23 | + "MAJOR": { | ||
24 | + "condition": { | ||
25 | + "condition": [ | ||
26 | + { | ||
27 | + "key": { | ||
28 | + "type": "TIME_SERIES", | ||
29 | + "key": "CO" | ||
30 | + }, | ||
31 | + "valueType": "NUMERIC", | ||
32 | + "value": null, | ||
33 | + "predicate": { | ||
34 | + "type": "NUMERIC", | ||
35 | + "operation": "GREATER", | ||
36 | + "value": { | ||
37 | + "defaultValue": 100, | ||
38 | + "userValue": null, | ||
39 | + "dynamicValue": null | ||
40 | + } | ||
41 | + } | ||
42 | + } | ||
43 | + ], | ||
44 | + "spec": { | ||
45 | + "type": "SIMPLE" | ||
46 | + } | ||
47 | + }, | ||
48 | + "schedule": { | ||
49 | + "type": "ANY_TIME" | ||
50 | + }, | ||
51 | + "alarmDetails": "告警", | ||
52 | + "dashboardId": null | ||
53 | + }, | ||
54 | + "MINOR": { | ||
55 | + "condition": { | ||
56 | + "condition": [ | ||
57 | + { | ||
58 | + "key": { | ||
59 | + "type": "TIME_SERIES", | ||
60 | + "key": "CO" | ||
61 | + }, | ||
62 | + "valueType": "NUMERIC", | ||
63 | + "value": null, | ||
64 | + "predicate": { | ||
65 | + "type": "NUMERIC", | ||
66 | + "operation": "GREATER", | ||
67 | + "value": { | ||
68 | + "defaultValue": 100, | ||
69 | + "userValue": null, | ||
70 | + "dynamicValue": null | ||
71 | + } | ||
72 | + } | ||
73 | + } | ||
74 | + ], | ||
75 | + "spec": { | ||
76 | + "type": "SIMPLE" | ||
77 | + } | ||
78 | + }, | ||
79 | + "schedule": { | ||
80 | + "type": "ANY_TIME" | ||
81 | + }, | ||
82 | + "alarmDetails": "告警", | ||
83 | + "dashboardId": null | ||
84 | + } | ||
85 | + }, | ||
86 | + "clearRule": { | ||
87 | + "condition": { | ||
88 | + "condition": [ | ||
89 | + { | ||
90 | + "key": { | ||
91 | + "type": "TIME_SERIES", | ||
92 | + "key": "CO" | ||
93 | + }, | ||
94 | + "valueType": "NUMERIC", | ||
95 | + "value": null, | ||
96 | + "predicate": { | ||
97 | + "type": "NUMERIC", | ||
98 | + "operation": "LESS_OR_EQUAL", | ||
99 | + "value": { | ||
100 | + "defaultValue": 100, | ||
101 | + "userValue": null, | ||
102 | + "dynamicValue": null | ||
103 | + } | ||
104 | + } | ||
105 | + } | ||
106 | + ], | ||
107 | + "spec": { | ||
108 | + "type": "SIMPLE" | ||
109 | + } | ||
110 | + }, | ||
111 | + "schedule": { | ||
112 | + "type": "ANY_TIME" | ||
113 | + }, | ||
114 | + "alarmDetails": "清除告警", | ||
115 | + "dashboardId": null | ||
116 | + }, | ||
117 | + "propagate": true, | ||
118 | + "propagateRelationTypes": ["CO"] | ||
119 | + } | ||
120 | + ] | ||
121 | + }, | ||
122 | + "defaultRuleChainId": "de8bf640-8892-11ec-ac19-e398562c8b61", | ||
123 | + "alarmProfile": { | ||
124 | + "id": "e822cccb-7f00-487e-9ece-790f4d145947", | ||
125 | + "creator": "b75f1c80-0f94-4a06-84ef-253962bbfe9e", | ||
126 | + "createTime": "2022-02-09 09:19:29", | ||
127 | + "enabled": false, | ||
128 | + "tenantId": "de10f9e0-8892-11ec-ac19-e398562c8b61", | ||
129 | + "alarmContactId": "8aff39c6-af9c-416a-b110-601183e39da0", | ||
130 | + "deviceProfileId": "5445f670-8946-11ec-ac19-e398562c8b61", | ||
131 | + "messageMode": "PHONE_MESSAGE" | ||
132 | + }, | ||
133 | + "defaultQueueName": "Main" | ||
134 | +} |
@@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
8 | @cancel="handleCancel" | 8 | @cancel="handleCancel" |
9 | > | 9 | > |
10 | <div class="step-form-form"> | 10 | <div class="step-form-form"> |
11 | - <a-steps :current="current"> | 11 | + <a-steps :current="current" @change="handleChange"> |
12 | <a-step title="设备配置" /> | 12 | <a-step title="设备配置" /> |
13 | <a-step title="传输配置" /> | 13 | <a-step title="传输配置" /> |
14 | <a-step title="告警配置" /> | 14 | <a-step title="告警配置" /> |
@@ -41,7 +41,7 @@ | @@ -41,7 +41,7 @@ | ||
41 | </BasicModal> | 41 | </BasicModal> |
42 | </template> | 42 | </template> |
43 | <script lang="ts"> | 43 | <script lang="ts"> |
44 | - import { defineComponent, ref, computed, unref, getCurrentInstance } from 'vue'; | 44 | + import { defineComponent, ref, computed, unref, getCurrentInstance, reactive } from 'vue'; |
45 | import { BasicModal, useModalInner } from '/@/components/Modal'; | 45 | import { BasicModal, useModalInner } from '/@/components/Modal'; |
46 | import DeviceProfileStep1 from '/@/views/device/profile/step/DeviceProfileStep1.vue'; | 46 | import DeviceProfileStep1 from '/@/views/device/profile/step/DeviceProfileStep1.vue'; |
47 | import DeviceProfileStep2 from '/@/views/device/profile/step/DeviceProfileStep2.vue'; | 47 | import DeviceProfileStep2 from '/@/views/device/profile/step/DeviceProfileStep2.vue'; |
@@ -79,19 +79,26 @@ | @@ -79,19 +79,26 @@ | ||
79 | const DeviceProfileStep3Ref = ref(null); | 79 | const DeviceProfileStep3Ref = ref(null); |
80 | const DeviceProfileStep4Ref = ref(null); | 80 | const DeviceProfileStep4Ref = ref(null); |
81 | const { createMessage } = useMessage(); | 81 | const { createMessage } = useMessage(); |
82 | + // const getStepData = ref(null); | ||
82 | const { proxy } = getCurrentInstance(); | 83 | const { proxy } = getCurrentInstance(); |
83 | const postDeviceConfogData: any = ref({}); | 84 | const postDeviceConfogData: any = ref({}); |
84 | const getStepOneData: any = ref({}); | 85 | const getStepOneData: any = ref({}); |
85 | const getStepTwoData: any = ref({}); | 86 | const getStepTwoData: any = ref({}); |
86 | - const getStepThreeData: any = ref({}); | 87 | + const getStepThreeData = ref([]); |
87 | const editEchoData: any = ref(null); | 88 | const editEchoData: any = ref(null); |
88 | const alarmProfileData: any = ref({}); | 89 | const alarmProfileData: any = ref({}); |
89 | - const isGetStepThreeData: any = ref({}); | 90 | + const isGetStepThreeData = reactive({ |
91 | + profileData: { | ||
92 | + alarms: [], | ||
93 | + }, | ||
94 | + }); | ||
90 | const postEditId = ref(''); | 95 | const postEditId = ref(''); |
91 | const current = ref(0); | 96 | const current = ref(0); |
92 | const isUpdate = ref(true); | 97 | const isUpdate = ref(true); |
93 | - | ||
94 | const getTitle = computed(() => (!unref(isUpdate) ? '新增设备配置' : '编辑设备配置')); | 98 | const getTitle = computed(() => (!unref(isUpdate) ? '新增设备配置' : '编辑设备配置')); |
99 | + const handleChange = (v) => { | ||
100 | + console.log(v); | ||
101 | + }; | ||
95 | const [register, { closeModal }] = useModalInner(async (data) => { | 102 | const [register, { closeModal }] = useModalInner(async (data) => { |
96 | isUpdate.value = !!data?.isUpdate; | 103 | isUpdate.value = !!data?.isUpdate; |
97 | if (!unref(isUpdate)) { | 104 | if (!unref(isUpdate)) { |
@@ -246,7 +253,7 @@ | @@ -246,7 +253,7 @@ | ||
246 | if (unref(isUpdate)) { | 253 | if (unref(isUpdate)) { |
247 | try { | 254 | try { |
248 | proxy.$refs.DeviceProfileStep4Ref.resetFieldsFunc({ | 255 | proxy.$refs.DeviceProfileStep4Ref.resetFieldsFunc({ |
249 | - alarmContactId: editEchoData.value.alarmProfile.alarmContactId, | 256 | + id: editEchoData.value.alarmProfile.id, |
250 | messageMode: editEchoData.value.alarmProfile.messageMode, | 257 | messageMode: editEchoData.value.alarmProfile.messageMode, |
251 | }); | 258 | }); |
252 | } catch (e) { | 259 | } catch (e) { |
@@ -255,7 +262,7 @@ | @@ -255,7 +262,7 @@ | ||
255 | } else { | 262 | } else { |
256 | try { | 263 | try { |
257 | proxy.$refs.DeviceProfileStep4Ref.resetFieldsFunc({ | 264 | proxy.$refs.DeviceProfileStep4Ref.resetFieldsFunc({ |
258 | - alarmContactId: '', | 265 | + id: '', |
259 | messageMode: '', | 266 | messageMode: '', |
260 | }); | 267 | }); |
261 | } catch (e) { | 268 | } catch (e) { |
@@ -271,7 +278,7 @@ | @@ -271,7 +278,7 @@ | ||
271 | } | 278 | } |
272 | const handleSubmit = async () => { | 279 | const handleSubmit = async () => { |
273 | if (!unref(isUpdate)) { | 280 | if (!unref(isUpdate)) { |
274 | - isGetStepThreeData.value.profileData = getStepThreeData.value; | 281 | + isGetStepThreeData.profileData.alarms = getStepThreeData.value; |
275 | alarmProfileData.value.alarmProfile = | 282 | alarmProfileData.value.alarmProfile = |
276 | await proxy.$refs.DeviceProfileStep4Ref.getAllFields(); | 283 | await proxy.$refs.DeviceProfileStep4Ref.getAllFields(); |
277 | alarmProfileData.value.alarmProfile.alarmContactId.shift(); | 284 | alarmProfileData.value.alarmProfile.alarmContactId.shift(); |
@@ -280,16 +287,18 @@ | @@ -280,16 +287,18 @@ | ||
280 | postDeviceConfogData.value, | 287 | postDeviceConfogData.value, |
281 | getStepOneData.value, | 288 | getStepOneData.value, |
282 | getStepTwoData.value, | 289 | getStepTwoData.value, |
283 | - isGetStepThreeData.value, | 290 | + isGetStepThreeData, |
284 | alarmProfileData.value | 291 | alarmProfileData.value |
285 | ); | 292 | ); |
286 | await deviceConfigAddOrEdit(postDeviceConfogData.value); | 293 | await deviceConfigAddOrEdit(postDeviceConfogData.value); |
287 | createMessage.success('新增设备配置成功'); | 294 | createMessage.success('新增设备配置成功'); |
288 | closeModal(); | 295 | closeModal(); |
289 | emit('success'); | 296 | emit('success'); |
290 | - } else { | 297 | + } |
298 | + if (unref(isUpdate)) { | ||
291 | postDeviceConfogData.value.id = postEditId.value; | 299 | postDeviceConfogData.value.id = postEditId.value; |
292 | - isGetStepThreeData.value.profileData = getStepThreeData.value; | 300 | + isGetStepThreeData.profileData.alarms = getStepThreeData.value; |
301 | + | ||
293 | alarmProfileData.value.alarmProfile = | 302 | alarmProfileData.value.alarmProfile = |
294 | await proxy.$refs.DeviceProfileStep4Ref.getAllFields(); | 303 | await proxy.$refs.DeviceProfileStep4Ref.getAllFields(); |
295 | Object.assign( | 304 | Object.assign( |
@@ -297,7 +306,7 @@ | @@ -297,7 +306,7 @@ | ||
297 | getStepOneData.value, | 306 | getStepOneData.value, |
298 | getStepTwoData.value, | 307 | getStepTwoData.value, |
299 | alarmProfileData.value, | 308 | alarmProfileData.value, |
300 | - isGetStepThreeData.value | 309 | + isGetStepThreeData |
301 | ); | 310 | ); |
302 | await deviceConfigAddOrEdit(postDeviceConfogData.value); | 311 | await deviceConfigAddOrEdit(postDeviceConfogData.value); |
303 | createMessage.success('编辑设备配置成功'); | 312 | createMessage.success('编辑设备配置成功'); |
@@ -309,11 +318,13 @@ | @@ -309,11 +318,13 @@ | ||
309 | closeModal(); | 318 | closeModal(); |
310 | }; | 319 | }; |
311 | return { | 320 | return { |
321 | + handleChange, | ||
312 | DeviceProfileStep2Ref, | 322 | DeviceProfileStep2Ref, |
313 | DeviceProfileStep3Ref, | 323 | DeviceProfileStep3Ref, |
314 | DeviceProfileStep4Ref, | 324 | DeviceProfileStep4Ref, |
315 | DeviceProfileStep1Ref, | 325 | DeviceProfileStep1Ref, |
316 | editEchoData, | 326 | editEchoData, |
327 | + // getStepData, | ||
317 | handleStep3Next, | 328 | handleStep3Next, |
318 | handleSubmit, | 329 | handleSubmit, |
319 | handleCancel, | 330 | handleCancel, |
@@ -223,7 +223,7 @@ | @@ -223,7 +223,7 @@ | ||
223 | function handleSuccess() { | 223 | function handleSuccess() { |
224 | reload(); | 224 | reload(); |
225 | } | 225 | } |
226 | - return { | 226 | + return { |
227 | deviceDetailRef, | 227 | deviceDetailRef, |
228 | setRowClassName, | 228 | setRowClassName, |
229 | registerModalDetail, | 229 | registerModalDetail, |
src/views/device/profile/step/1.json
0 → 100644
1 | +{ | ||
2 | + "name": "2", | ||
3 | + "icon": "", | ||
4 | + "transportType": "DEFAULT", | ||
5 | + "profileData": { | ||
6 | + "alarms": [ | ||
7 | + { | ||
8 | + "createRules": { | ||
9 | + "MAJOR": { | ||
10 | + "alarmDetails": "2", | ||
11 | + "schedule": { | ||
12 | + "type": "ANY_TIME", | ||
13 | + "timezone": "Asia/Shanghai (UTC+08:00)" | ||
14 | + }, | ||
15 | + "condition": { | ||
16 | + "type": "TIME_SERIES", | ||
17 | + "key1": "2", | ||
18 | + "type1": "NUMERIC", | ||
19 | + "id": 2 | ||
20 | + } | ||
21 | + }, | ||
22 | + "WARNING": { | ||
23 | + "alarmDetails": "3", | ||
24 | + "schedule": { | ||
25 | + "type": "ANY_TIME", | ||
26 | + "timezone": "Asia/Shanghai (UTC+08:00)" | ||
27 | + }, | ||
28 | + "condition": { | ||
29 | + "type": "TIME_SERIES", | ||
30 | + "key1": "3", | ||
31 | + "type1": "NUMERIC", | ||
32 | + "operation": "LESS", | ||
33 | + "value1": "3", | ||
34 | + "id": 2 | ||
35 | + } | ||
36 | + } | ||
37 | + }, | ||
38 | + "clearRule": { | ||
39 | + "schedule": { | ||
40 | + "type": "ANY_TIME", | ||
41 | + "timezone": "Asia/Shanghai (UTC+08:00)" | ||
42 | + }, | ||
43 | + "condition": { | ||
44 | + "type": "TIME_SERIES", | ||
45 | + "key1": "4", | ||
46 | + "type1": "NUMERIC", | ||
47 | + "operation": "GREATER_OR_EQUAL", | ||
48 | + "value1": "4", | ||
49 | + "id": 2 | ||
50 | + }, | ||
51 | + "alarmDetails": "4" | ||
52 | + }, | ||
53 | + "id": "d8dbd518-5c72-4a2e-ab27-56fca5f6fa8d", | ||
54 | + "alarmType": "2", | ||
55 | + "propagate": true, | ||
56 | + "propagateRelationTypes": [ | ||
57 | + "2" | ||
58 | + ] | ||
59 | + } | ||
60 | + ] | ||
61 | + }, | ||
62 | + "alarmProfile": { | ||
63 | + "alarmContactId": [], | ||
64 | + "messageMode": [ | ||
65 | + "PHONE_MESSAGE" | ||
66 | + ] | ||
67 | + } | ||
68 | +} |
1 | <template> | 1 | <template> |
2 | - <div class="step3" style="background-color: #f6f8f9"> | ||
3 | - <template v-for="(item, index) in profileData" :key="item.id"> | ||
4 | - <CollapseContainer class="border mb-1" :canExpan="false"> | ||
5 | - <template #action> | ||
6 | - <div class="cursor-pointer"> | ||
7 | - <img | ||
8 | - style="cursor: pointer" | ||
9 | - @click="deleteAlarmRule(index)" | ||
10 | - alt="移除" | ||
11 | - src="../../../../assets/images/delete.png" | ||
12 | - /> | ||
13 | - </div> | ||
14 | - </template> | ||
15 | - <div style="margin-top: -15px; margin-left: 10px"> | ||
16 | - <div class="alert-type" style="margin-left: -50px; margin-top: -10px"> | ||
17 | - <BasicForm @register="registerForm" | ||
18 | - /></div> | ||
19 | - <div style="margin-top: -15px"> | ||
20 | - <div style="margin-left: -8px; margin-top: -10px"> | ||
21 | - <BasicForm | ||
22 | - @register="registerFormHighSetting" | ||
23 | - style="margin-left: 12px; margin-top: -10px" | ||
24 | - > | ||
25 | - <template #checkBox="{ model, field }"> | ||
26 | - <Checkbox v-model:checked="model[field]">传递报警</Checkbox> | ||
27 | - </template> | ||
28 | - </BasicForm> | 2 | + <div> |
3 | + <div class="step3" style="background-color: #f6f8f9"> | ||
4 | + <template v-for="(item, index) in profileData" :key="item.id"> | ||
5 | + <CollapseContainer class="border mb-1" :canExpan="false"> | ||
6 | + <!-- 移除按钮 --> | ||
7 | + <template #action> | ||
8 | + <div class="cursor-pointer"> | ||
9 | + <img | ||
10 | + style="cursor: pointer" | ||
11 | + @click="deleteAlarmRule(index)" | ||
12 | + alt="移除" | ||
13 | + src="../../../../assets/images/delete.png" | ||
14 | + /> | ||
15 | + </div> | ||
16 | + </template> | ||
17 | + <!-- 移除按钮 --> | ||
18 | + <!-- 传递报警和报警类型 --> | ||
19 | + <div style="margin-top: -15px; margin-left: 10px"> | ||
20 | + <div class="alert-type" style="margin-left: -50px; margin-top: -10px"> | ||
21 | + <BasicForm @register="registerForm" | ||
22 | + /></div> | ||
23 | + <div style="margin-top: -15px"> | ||
24 | + <div style="margin-left: -8px; margin-top: -10px"> | ||
25 | + <BasicForm | ||
26 | + @register="registerFormHighSetting" | ||
27 | + style="margin-left: 12px; margin-top: -10px" | ||
28 | + > | ||
29 | + <template #checkBox="{ model, field }"> | ||
30 | + <Checkbox v-model:checked="model[field]">传递报警</Checkbox> | ||
31 | + </template> | ||
32 | + </BasicForm> | ||
33 | + </div> | ||
29 | </div> | 34 | </div> |
30 | </div> | 35 | </div> |
31 | - </div> | ||
32 | - <div style="margin-top: -57px"> | ||
33 | - <p style="margin-left: 10px">创建报警规则</p> | ||
34 | - <template v-for="(childItem, createIndex) in item.alarms" :key="childItem.id"> | ||
35 | - <div class="aic" style="border: 1px solid #bfbfbf"> | ||
36 | - <div class="w-3/4" style="margin-left: 40px"> | ||
37 | - <div style="margin-left: 10px; margin-top: 20px" | ||
38 | - ><BasicForm @register="registerFormCreateAlarm" /> | ||
39 | - </div> | ||
40 | - <div style="margin-left: 5px; margin-top: -50px"> | ||
41 | - <div style="color: #f5594e" class="ml-4" | ||
42 | - >报警规则条件: | ||
43 | - <Button | ||
44 | - style="margin-left: 4px" | ||
45 | - size="small" | ||
46 | - type="primary" | ||
47 | - @click="handleOpenAlaramRuleConditions" | ||
48 | - >添加</Button | ||
49 | - > | ||
50 | - <p>{{ ruleTemplateData }}</p> | 36 | + <!-- 传递报警和报警类型 --> |
37 | + <!-- 创建报警规则 --> | ||
38 | + <div style="margin-top: -57px"> | ||
39 | + <p style="margin-left: 10px; font-size: medium">创建报警规则</p> | ||
40 | + <template v-for="(childItem, createIndex) in item.alarms" :key="childItem.id"> | ||
41 | + <span style="display: none">{{ childItem }}</span> | ||
42 | + <!-- 报警添加条件 --> | ||
43 | + <div> | ||
44 | + <!-- 报警启用规则 --> | ||
45 | + <EnableRule | ||
46 | + v-if="isRuleAlarmRuleConditions === 2" | ||
47 | + ref="getChildData2" | ||
48 | + @getAllFieldsEnab="getAllFieldsEnabFunc" | ||
49 | + @register="registerModal2" | ||
50 | + /> | ||
51 | + <!-- 报警规则条件 --> | ||
52 | + <AlarmRuleConditions | ||
53 | + v-if="isRuleAlarmRuleConditions === 3" | ||
54 | + ref="getChildData3" | ||
55 | + @getAllFieldsRule="getAllFieldsRuleFunc" | ||
56 | + @register="registerModal3" | ||
57 | + /> | ||
58 | + </div> | ||
59 | + <!-- 添加条件按钮 --> | ||
60 | + <div class="aic" style="border: 1px solid #bfbfbf"> | ||
61 | + <div class="w-3/4" style="margin-left: 40px"> | ||
62 | + <!-- 报警严重程度 --> | ||
63 | + <div style="margin-left: 10px; margin-top: 20px" | ||
64 | + ><BasicForm @register="registerFormCreateAlarm" /> | ||
51 | </div> | 65 | </div> |
52 | - <div style="white-space: wrap; margin-top: 25px" class="mt-4 ml-4" | ||
53 | - >报警启用规则: | ||
54 | - <Button | ||
55 | - style="margin-left: 4px" | ||
56 | - size="small" | ||
57 | - type="primary" | ||
58 | - @click="handleOpenEnableRule" | ||
59 | - >添加</Button | ||
60 | - > | ||
61 | - <p>{{ enableTemplateData }}</p> | ||
62 | - <div | ||
63 | - class="mt-4 ml-4" | ||
64 | - style="margin-left: 0px; position: relative; margin-top: 25px" | ||
65 | - >报警详情模板: | ||
66 | - <div style="position: absolute; top: -5px; left: 106px; width: 581px"> | ||
67 | - <BasicForm @register="registerFormChangeDetail" /> | ||
68 | - </div> | ||
69 | - <!-- <Button size="small" type="primary" @click="handleOpenDetailTemplate" | 66 | + <!-- 报警严重程度 --> |
67 | + | ||
68 | + <div style="margin-left: 5px; margin-top: -50px"> | ||
69 | + <div style="color: #f5594e" class="ml-4" | ||
70 | + >报警规则条件: | ||
71 | + <Button | ||
72 | + style="margin-left: 4px" | ||
73 | + size="small" | ||
74 | + type="primary" | ||
75 | + @click="handleOpenAlaramRuleConditions" | ||
70 | >添加</Button | 76 | >添加</Button |
71 | - > --> | 77 | + > |
78 | + <!-- <p>{{ ruleTemplateData }}</p> --> | ||
72 | </div> | 79 | </div> |
73 | - <div style="margin-top: 25px; position: relative"> | ||
74 | - <div style="margin-left: -14px"> | ||
75 | - <BasicForm @register="dashboardForm" /> | 80 | + <div style="white-space: wrap; margin-top: 25px" class="mt-4 ml-4" |
81 | + >报警启用规则: | ||
82 | + <Button | ||
83 | + style="margin-left: 4px" | ||
84 | + size="small" | ||
85 | + type="primary" | ||
86 | + @click="handleOpenEnableRule" | ||
87 | + >添加</Button | ||
88 | + > | ||
89 | + <!-- <p>{{ enableTemplateData }}</p> --> | ||
90 | + <div | ||
91 | + class="mt-4 ml-4" | ||
92 | + style="margin-left: 0px; position: relative; margin-top: 25px" | ||
93 | + >报警详情模板: | ||
94 | + <div style="position: absolute; top: -5px; left: 106px; width: 581px"> | ||
95 | + <BasicForm @register="registerFormChangeDetail" /> | ||
96 | + </div> | ||
97 | + </div> | ||
98 | + <div style="margin-top: 25px; position: relative"> | ||
99 | + <div style="margin-left: -14px"> | ||
100 | + <BasicForm @register="dashboardForm" /> | ||
101 | + </div> | ||
76 | </div> | 102 | </div> |
77 | </div> | 103 | </div> |
78 | </div> | 104 | </div> |
79 | - </div> | ||
80 | - <div | ||
81 | - class="remove-type" | ||
82 | - style="display: inline-block; position: relative; top: -257px; left: 757px" | ||
83 | - > | ||
84 | - <img | ||
85 | - style="cursor: pointer" | ||
86 | - @click="deleteCondition(index, createIndex)" | ||
87 | - alt="移除" | ||
88 | - src="../../../../assets/images/close.png" | ||
89 | - /> | 105 | + <div |
106 | + class="remove-type" | ||
107 | + style="display: inline-block; position: relative; top: -257px; left: 757px" | ||
108 | + > | ||
109 | + <img | ||
110 | + style="cursor: pointer" | ||
111 | + @click="deleteCondition(index, createIndex)" | ||
112 | + alt="移除" | ||
113 | + src="../../../../assets/images/close.png" | ||
114 | + /> | ||
115 | + </div> | ||
90 | </div> | 116 | </div> |
91 | </div> | 117 | </div> |
118 | + </template> | ||
119 | + <div> | ||
120 | + <a-button style="border-radius: 10px" class="mt-5" @click="addCreateRole(index)" | ||
121 | + ><PlusCircleOutlined />添加创建条件</a-button | ||
122 | + > | ||
92 | </div> | 123 | </div> |
93 | - </template> | ||
94 | - <a-button style="border-radius: 10px" class="mt-5" @click="addCreateRole(index)" | ||
95 | - ><PlusCircleOutlined />添加创建条件</a-button | ||
96 | - > | ||
97 | - </div> | ||
98 | - <div style="height: 20px"></div> | ||
99 | - <div> | ||
100 | - <p style="margin-left: 10px">清除报警规则</p> | ||
101 | - <template | ||
102 | - v-for="(childClearItem, clearIndexItem) in item.clearRule" | ||
103 | - :key="childClearItem.id" | ||
104 | - > | ||
105 | - <div class="aic mb-1" style="border: 1px solid #bfbfbf"> | ||
106 | - <div class="w-3/4" style="margin-left: 40px"> | ||
107 | - <div style="margin-left: 5px"> | ||
108 | - <div style="color: #f5594e" class="mt-4 ml-4" | ||
109 | - >报警规则条件: | ||
110 | - <Button | ||
111 | - style="margin-left: 2px" | ||
112 | - size="small" | ||
113 | - type="primary" | ||
114 | - @click="handleOpenClearAlaramRuleConditions" | ||
115 | - >添加</Button | ||
116 | - > | ||
117 | - <p>{{ ruleClearTemplateData }}</p> | ||
118 | - </div> | ||
119 | - <div style="white-space: wrap; margin-top: 25px" class="mt-4 ml-4" | ||
120 | - >报警启用规则: | ||
121 | - <Button | ||
122 | - style="margin-left: 2px" | ||
123 | - size="small" | ||
124 | - type="primary" | ||
125 | - @click="handleOpenClearEnableRule" | ||
126 | - >添加</Button | ||
127 | - > | ||
128 | - <p>{{ enableClearTemplateData }}</p> | ||
129 | - <div | ||
130 | - class="mt-4 ml-4" | ||
131 | - style="margin-left: 0px; position: relative; margin-top: 25px" | ||
132 | - >报警详情模板: | ||
133 | - <div style="position: absolute; top: -5px; left: 106px; width: 581px"> | ||
134 | - <BasicForm @register="registerFormChangeClearDetail" /> | ||
135 | - </div> | ||
136 | - <!-- <Button size="small" type="primary" @click="handleOpenClearDetailTemplate" | 124 | + </div> |
125 | + <!-- 创建报警规则 --> | ||
126 | + <div style="height: 20px"></div> | ||
127 | + <!-- 清除报警规则 --> | ||
128 | + <div> | ||
129 | + <p style="margin-left: 10px; font-size: medium">清除报警规则</p> | ||
130 | + <template | ||
131 | + v-for="(childClearItem, clearIndexItem) in item.clearRule" | ||
132 | + :key="childClearItem.id" | ||
133 | + > | ||
134 | + <span style="display: none">{{ childClearItem }}</span> | ||
135 | + <span style="display: none">{{ clearIndexItem }}</span> | ||
136 | + <div> | ||
137 | + <!-- 报警启用规则 --> | ||
138 | + <EnableRule | ||
139 | + v-if="isRuleAlarmRuleConditions === 5" | ||
140 | + ref="getChildData5" | ||
141 | + @getAllFieldsEnab="getAllClearFieldsEnabFunc" | ||
142 | + @register="registerModal5" | ||
143 | + /> | ||
144 | + <!-- 报警规则条件 --> | ||
145 | + <AlarmRuleConditions | ||
146 | + v-if="isRuleAlarmRuleConditions === 6" | ||
147 | + ref="getChildData6" | ||
148 | + @getAllFieldsRule="getAllClearFieldsRuleFunc" | ||
149 | + @register="registerModal6" | ||
150 | + /> | ||
151 | + </div> | ||
152 | + <div class="aic mb-1" style="border: 1px solid #bfbfbf"> | ||
153 | + <div class="w-3/4" style="margin-left: 40px"> | ||
154 | + <div style="margin-left: 5px"> | ||
155 | + <div style="color: #f5594e" class="mt-4 ml-4" | ||
156 | + >报警规则条件: | ||
157 | + <Button | ||
158 | + style="margin-left: 2px" | ||
159 | + size="small" | ||
160 | + type="primary" | ||
161 | + @click="handleOpenClearAlaramRuleConditions" | ||
137 | >添加</Button | 162 | >添加</Button |
138 | > | 163 | > |
139 | - <p>{{ detailClearTemplateData }}</p> --> | 164 | + <!-- <p>{{ ruleClearTemplateData }}</p> --> |
140 | </div> | 165 | </div> |
141 | - <div style="margin-left: 0px; margin-top: 25px"> | ||
142 | - <div style="margin-left: -14px"> | ||
143 | - <BasicForm @register="dashboardForm" /> | 166 | + <div style="white-space: wrap; margin-top: 25px" class="mt-4 ml-4" |
167 | + >报警启用规则: | ||
168 | + <Button | ||
169 | + style="margin-left: 2px" | ||
170 | + size="small" | ||
171 | + type="primary" | ||
172 | + @click="handleOpenClearEnableRule" | ||
173 | + >添加</Button | ||
174 | + > | ||
175 | + <!-- <p>{{ enableClearTemplateData }}</p> --> | ||
176 | + <div | ||
177 | + class="mt-4 ml-4" | ||
178 | + style="margin-left: 0px; position: relative; margin-top: 25px" | ||
179 | + >报警详情模板: | ||
180 | + <div style="position: absolute; top: -5px; left: 106px; width: 581px"> | ||
181 | + <BasicForm @register="registerFormChangeClearDetail" /> | ||
182 | + </div> | ||
183 | + </div> | ||
184 | + <div style="margin-left: 0px; margin-top: 25px"> | ||
185 | + <div style="margin-left: -14px"> | ||
186 | + <BasicForm @register="dashboardForm" /> | ||
187 | + </div> | ||
144 | </div> | 188 | </div> |
145 | </div> | 189 | </div> |
146 | </div> | 190 | </div> |
147 | </div> | 191 | </div> |
148 | </div> | 192 | </div> |
149 | - </div> | ||
150 | - </template> | ||
151 | - </div> | ||
152 | - </CollapseContainer> | ||
153 | - </template> | ||
154 | - </div> | ||
155 | - <div class="flex justify-center" style="display: fixed; top: 100px"> | ||
156 | - <a-button class="mr-5" @click="prevStep">上一步</a-button> | ||
157 | - <a-button @click="handleFormStep3toStep4Next">下一步</a-button> | ||
158 | - <a-button style="margin-left: 20px" type="primary" @click="addAlarmRule">添加报警规则</a-button> | ||
159 | - </div> | ||
160 | - <div> | ||
161 | - <!-- 详情模板 --> | ||
162 | - <DetailTemplate | ||
163 | - v-if="isRuleAlarmRuleConditions == 1" | ||
164 | - @getAllFields="getAllFieldsFunc" | ||
165 | - @register="registerModal1" | ||
166 | - /> | ||
167 | - <!-- 启用规则 --> | ||
168 | - <EnableRule | ||
169 | - v-if="isRuleAlarmRuleConditions == 2" | ||
170 | - ref="getChildData2" | ||
171 | - @getAllFieldsEnab="getAllFieldsEnabFunc" | ||
172 | - @register="registerModal2" | ||
173 | - /> | ||
174 | - <!-- 报警规则条件 --> | ||
175 | - <AlarmRuleConditions | ||
176 | - v-if="isRuleAlarmRuleConditions == 3" | ||
177 | - ref="getChildData3" | ||
178 | - @getAllFieldsRule="getAllFieldsRuleFunc" | ||
179 | - @register="registerModal3" | ||
180 | - /> | ||
181 | - </div> | ||
182 | - | ||
183 | - <div> | ||
184 | - <!-- 清除条件 --> | ||
185 | - <!-- 详情模板 --> | ||
186 | - <DetailTemplate | ||
187 | - v-if="isRuleAlarmRuleConditions == 4" | ||
188 | - @getAllFields="getAllClearFieldsFunc" | ||
189 | - @register="registerModal4" | ||
190 | - /> | ||
191 | - <!-- 启用规则 --> | ||
192 | - <EnableRule | ||
193 | - v-if="isRuleAlarmRuleConditions == 5" | ||
194 | - ref="getChildData2" | ||
195 | - @getAllFieldsEnab="getAllClearFieldsEnabFunc" | ||
196 | - @register="registerModal5" | ||
197 | - /> | ||
198 | - <!-- 报警规则条件 --> | ||
199 | - <AlarmRuleConditions | ||
200 | - v-if="isRuleAlarmRuleConditions == 6" | ||
201 | - ref="getChildData3" | ||
202 | - @getAllFieldsRule="getAllClearFieldsRuleFunc" | ||
203 | - @register="registerModal6" | ||
204 | - /> | 193 | + </template> |
194 | + </div> | ||
195 | + <!-- 清除报警规则 --> | ||
196 | + </CollapseContainer> | ||
197 | + </template> | ||
198 | + </div> | ||
199 | + <div class="flex justify-center" style="display: fixed; bottom: 100px"> | ||
200 | + <a-button class="mr-5" @click="prevStep">上一步</a-button> | ||
201 | + <a-button @click="handleFormStep3toStep4Next">下一步</a-button> | ||
202 | + <a-button style="margin-left: 20px" type="primary" @click="addAlarmRule" | ||
203 | + >添加报警规则</a-button | ||
204 | + > | ||
205 | + </div> | ||
205 | </div> | 206 | </div> |
206 | </template> | 207 | </template> |
207 | 208 | ||
208 | <script lang="ts"> | 209 | <script lang="ts"> |
209 | - import { defineComponent, ref, unref, getCurrentInstance, watch } from 'vue'; | 210 | + import { defineComponent, ref, unref, getCurrentInstance, watch, reactive } from 'vue'; |
210 | import type { IProfileData } from './index.t'; | 211 | import type { IProfileData } from './index.t'; |
211 | import { CollapseContainer } from '/@/components/Container/index'; | 212 | import { CollapseContainer } from '/@/components/Container/index'; |
212 | import { BasicForm, useForm } from '/@/components/Form'; | 213 | import { BasicForm, useForm } from '/@/components/Form'; |
@@ -221,7 +222,6 @@ | @@ -221,7 +222,6 @@ | ||
221 | import { PlusCircleOutlined } from '@ant-design/icons-vue'; | 222 | import { PlusCircleOutlined } from '@ant-design/icons-vue'; |
222 | import { Checkbox } from 'ant-design-vue'; | 223 | import { Checkbox } from 'ant-design-vue'; |
223 | import { useModal } from '/@/components/Modal'; | 224 | import { useModal } from '/@/components/Modal'; |
224 | - import DetailTemplate from './cpns/detailtemplate/index.vue'; | ||
225 | import EnableRule from './cpns/enablerule/index.vue'; | 225 | import EnableRule from './cpns/enablerule/index.vue'; |
226 | import AlarmRuleConditions from './cpns/alarmruleconditions/index.vue'; | 226 | import AlarmRuleConditions from './cpns/alarmruleconditions/index.vue'; |
227 | import { Button } from '/@/components/Button'; | 227 | import { Button } from '/@/components/Button'; |
@@ -233,24 +233,21 @@ | @@ -233,24 +233,21 @@ | ||
233 | CollapseContainer, | 233 | CollapseContainer, |
234 | PlusCircleOutlined, | 234 | PlusCircleOutlined, |
235 | Checkbox, | 235 | Checkbox, |
236 | - DetailTemplate, | ||
237 | EnableRule, | 236 | EnableRule, |
238 | AlarmRuleConditions, | 237 | AlarmRuleConditions, |
239 | Button, | 238 | Button, |
240 | }, | 239 | }, |
241 | emits: ['prev', 'next', 'redo', 'handleFormStep3toStep4Next'], | 240 | emits: ['prev', 'next', 'redo', 'handleFormStep3toStep4Next'], |
242 | setup(_, { emit }) { | 241 | setup(_, { emit }) { |
243 | - const changeGetDetailValue: any = ref(null); | ||
244 | - const changeGetClearDetailValue: any = ref(null); | ||
245 | - const ruleNumber = ref(0); | ||
246 | const { proxy } = getCurrentInstance(); | 242 | const { proxy } = getCurrentInstance(); |
243 | + const changeGetDetailValue = ref({}); | ||
244 | + const changeGetClearDetailValue = ref({}); | ||
247 | const getChildData1 = ref(null); | 245 | const getChildData1 = ref(null); |
248 | const getChildData2 = ref(null); | 246 | const getChildData2 = ref(null); |
249 | const getChildData3 = ref(null); | 247 | const getChildData3 = ref(null); |
248 | + const getChildData5 = ref(null); | ||
249 | + const getChildData6 = ref(null); | ||
250 | const isRuleAlarmRuleConditions = ref(0); | 250 | const isRuleAlarmRuleConditions = ref(0); |
251 | - const getAllFormData: any = ref({}); | ||
252 | - const alarmss: any = ref([]); | ||
253 | - const emptyObj: any = ref({}); | ||
254 | const detailObj: any = ref({}); | 251 | const detailObj: any = ref({}); |
255 | const detailClearObj: any = ref({}); | 252 | const detailClearObj: any = ref({}); |
256 | const ruleObj: any = ref({}); | 253 | const ruleObj: any = ref({}); |
@@ -266,13 +263,94 @@ | @@ -266,13 +263,94 @@ | ||
266 | const ruleClearTemplateData: any = ref(null); | 263 | const ruleClearTemplateData: any = ref(null); |
267 | const enableClearTemplateData: any = ref(null); | 264 | const enableClearTemplateData: any = ref(null); |
268 | const detailClearTemplateData: any = ref(null); | 265 | const detailClearTemplateData: any = ref(null); |
269 | - const scheduleCustomValue: any = ref({}); | ||
270 | - const scheduleCustomClearValue: any = ref({}); | ||
271 | - const clearIndex = ref(-1); | ||
272 | - const getSchduleCustomValue: any = ref([]); | ||
273 | - const getSchduleClearCustomValue: any = ref([]); | ||
274 | - //告警列表 | 266 | + //重构 |
267 | + //告警列表接口 | ||
275 | let profileData = ref<IProfileData[]>([]); | 268 | let profileData = ref<IProfileData[]>([]); |
269 | + //初始化alarams数据 | ||
270 | + const initProfileData = reactive({ | ||
271 | + alarms: [ | ||
272 | + { | ||
273 | + id: Date.now() + Math.random() + '', | ||
274 | + alarmType: '', | ||
275 | + createRules: {}, | ||
276 | + propagate: false, | ||
277 | + propagateRelationTypes: [''], | ||
278 | + }, | ||
279 | + ], | ||
280 | + clearRule: [ | ||
281 | + { | ||
282 | + id: Date.now() + Math.random() + '', | ||
283 | + alarmDetails: '', | ||
284 | + dashboardId: { | ||
285 | + id: '', | ||
286 | + entityType: '', | ||
287 | + }, | ||
288 | + propagate: '', | ||
289 | + propagateRelationTypes: [''], | ||
290 | + schedule: { | ||
291 | + type: 'string', | ||
292 | + }, | ||
293 | + condition: {}, | ||
294 | + }, | ||
295 | + ], | ||
296 | + }); | ||
297 | + //初始化创建条件 | ||
298 | + const initCreateRules = reactive({ | ||
299 | + id: Date.now() + Math.random() + '', | ||
300 | + alarmType: '', | ||
301 | + createRules: {}, | ||
302 | + propagate: false, | ||
303 | + propagateRelationTypes: [''], | ||
304 | + }); | ||
305 | + //接收临时启用规则数据 | ||
306 | + const receiveOpenRuleTempArr = ref<[]>([]); | ||
307 | + //接收临时规则条件数据 | ||
308 | + const receiveRuleConditionTempArr = ref<[]>([]); | ||
309 | + //创建条件总对象 | ||
310 | + const createRulesObj = ref({}); | ||
311 | + const addCreateRulesObj = reactive({ | ||
312 | + createRules: {}, | ||
313 | + }); | ||
314 | + const addChangeSeverity = ref({}); | ||
315 | + let addNewOpenRule = reactive({ | ||
316 | + schedule: {}, | ||
317 | + }); | ||
318 | + let addNewRuleTem = reactive({ | ||
319 | + condition: {}, | ||
320 | + }); | ||
321 | + const refAlarmDetailTemplate = ref(null); | ||
322 | + const tempDetailTempArr = ref<[]>([]); | ||
323 | + const tempOpenRuleTempArr = ref<[]>([]); | ||
324 | + const tempRuleConditionTempArr = ref<[]>([]); | ||
325 | + let addClearRule = reactive({}); | ||
326 | + //总的alarms数据 | ||
327 | + let allAlarms = ref<[]>([]); | ||
328 | + const getClearObj = ref({}); | ||
329 | + const getAllObjTemp = ref({}); | ||
330 | + //报警类型数据 | ||
331 | + const alarmTypeGet = ref({}); | ||
332 | + const propagateAndpropagateRelationTypes = reactive({ | ||
333 | + propagate: '', | ||
334 | + propagateRelationTypes: [], | ||
335 | + }); | ||
336 | + let clearObj = reactive({ | ||
337 | + clearRule: {}, | ||
338 | + }); | ||
339 | + let kongClearOpenRuleObj = reactive({ | ||
340 | + schedule: {}, | ||
341 | + }); | ||
342 | + let kongClearRuleConditionObj = reactive({ | ||
343 | + condition: {}, | ||
344 | + }); | ||
345 | + // | ||
346 | + const kongDetail = ref({}); | ||
347 | + let kongOpenRuleObj = reactive({ | ||
348 | + schedule: {}, | ||
349 | + }); | ||
350 | + let kongRuleConditionObj = reactive({ | ||
351 | + condition: {}, | ||
352 | + }); | ||
353 | + | ||
276 | const log = (e) => { | 354 | const log = (e) => { |
277 | console.log(e); | 355 | console.log(e); |
278 | }; | 356 | }; |
@@ -282,7 +360,6 @@ | @@ -282,7 +360,6 @@ | ||
282 | }; | 360 | }; |
283 | //删除告警配置 | 361 | //删除告警配置 |
284 | const deleteAlarmRule = (index: number) => { | 362 | const deleteAlarmRule = (index: number) => { |
285 | - ruleNumber.value--; | ||
286 | unref(profileData).splice(index, 1); | 363 | unref(profileData).splice(index, 1); |
287 | }; | 364 | }; |
288 | // 上一步 | 365 | // 上一步 |
@@ -291,44 +368,7 @@ | @@ -291,44 +368,7 @@ | ||
291 | }; | 368 | }; |
292 | //添加报警规则 | 369 | //添加报警规则 |
293 | const addAlarmRule = () => { | 370 | const addAlarmRule = () => { |
294 | - ruleNumber.value++; | ||
295 | - clearIndex.value++; | ||
296 | - unref(profileData).push({ | ||
297 | - configuration: { | ||
298 | - type: '', | ||
299 | - }, | ||
300 | - transportConfiguration: { | ||
301 | - type: '', | ||
302 | - }, | ||
303 | - provisionConfiguration: { | ||
304 | - provisionDeviceSecret: '', | ||
305 | - }, | ||
306 | - alarms: [ | ||
307 | - { | ||
308 | - id: Date.now() + Math.random() + '', | ||
309 | - alarmType: '', | ||
310 | - createRules: {}, | ||
311 | - propagate: false, | ||
312 | - propagateRelationTypes: [''], | ||
313 | - }, | ||
314 | - ], | ||
315 | - clearRule: [ | ||
316 | - { | ||
317 | - id: Date.now() + Math.random() + '', | ||
318 | - alarmDetails: '', | ||
319 | - dashboardId: { | ||
320 | - id: '', | ||
321 | - entityType: '', | ||
322 | - }, | ||
323 | - propagate: '', | ||
324 | - propagateRelationTypes: [''], | ||
325 | - schedule: { | ||
326 | - type: 'string', | ||
327 | - }, | ||
328 | - condition: {}, | ||
329 | - }, | ||
330 | - ], | ||
331 | - }); | 371 | + unref(profileData).push(initProfileData); |
332 | }; | 372 | }; |
333 | //TODO Mobile dashboard: | 373 | //TODO Mobile dashboard: |
334 | const [dashboardForm] = useForm({ | 374 | const [dashboardForm] = useForm({ |
@@ -343,7 +383,7 @@ | @@ -343,7 +383,7 @@ | ||
343 | { | 383 | { |
344 | setFieldsValue: setRegisterForm, | 384 | setFieldsValue: setRegisterForm, |
345 | resetFields: resetRegisterForm, | 385 | resetFields: resetRegisterForm, |
346 | - validate: validateRegisterForm, | 386 | + getFieldsValue: validateRegisterForm, |
347 | }, | 387 | }, |
348 | ] = useForm({ | 388 | ] = useForm({ |
349 | labelWidth: 120, | 389 | labelWidth: 120, |
@@ -357,7 +397,7 @@ | @@ -357,7 +397,7 @@ | ||
357 | { | 397 | { |
358 | setFieldsValue: setRegisterFormHighSetting, | 398 | setFieldsValue: setRegisterFormHighSetting, |
359 | resetFields: resetRegisterFormHighSetting, | 399 | resetFields: resetRegisterFormHighSetting, |
360 | - validate: validateRegisterFormHighSetting, | 400 | + getFieldsValue: validateRegisterFormHighSetting, |
361 | }, | 401 | }, |
362 | ] = useForm({ | 402 | ] = useForm({ |
363 | labelWidth: 120, | 403 | labelWidth: 120, |
@@ -409,7 +449,6 @@ | @@ -409,7 +449,6 @@ | ||
409 | setFieldsValue: setRegisterFormCreateAlarm, | 449 | setFieldsValue: setRegisterFormCreateAlarm, |
410 | resetFields: resetRegisterFormCreateAlarm, | 450 | resetFields: resetRegisterFormCreateAlarm, |
411 | validate: validateRegisterFormCreateAlarm, | 451 | validate: validateRegisterFormCreateAlarm, |
412 | - updateSchema, | ||
413 | }, | 452 | }, |
414 | ] = useForm({ | 453 | ] = useForm({ |
415 | labelWidth: 120, | 454 | labelWidth: 120, |
@@ -494,77 +533,92 @@ | @@ -494,77 +533,92 @@ | ||
494 | setRegisterFormClearChangeDetail(v); | 533 | setRegisterFormClearChangeDetail(v); |
495 | }; | 534 | }; |
496 | 535 | ||
497 | - const tempValue1: string = ref<string>(''); | ||
498 | - // 添加‘创建条件’ | ||
499 | - const addCreateRole = (index: number) => { | ||
500 | - updateSchema({ | ||
501 | - field: 'default', | ||
502 | - componentProps: ({ formModel }) => { | ||
503 | - if (formModel.default == 'CRITICAL') { | ||
504 | - tempValue1.value = formModel.default; | ||
505 | - } else if (formModel.default == 'MAJOR') { | ||
506 | - tempValue1.value = formModel.default; | ||
507 | - } else if (formModel.default == 'MINOR') { | ||
508 | - tempValue1.value = formModel.default; | ||
509 | - } else if (formModel.default == 'WARNING') { | ||
510 | - tempValue1.value = formModel.default; | ||
511 | - } else if (formModel.default == 'INDETERMINATE') { | ||
512 | - tempValue1.value = formModel.default; | ||
513 | - } | ||
514 | - return { | ||
515 | - options: [ | ||
516 | - { | ||
517 | - value: 'CRITICAL', | ||
518 | - label: '危险', | ||
519 | - disabled: tempValue1.value == 'CRITICAL', | ||
520 | - }, | ||
521 | - { | ||
522 | - value: 'MAJOR', | ||
523 | - label: '重要', | ||
524 | - disabled: tempValue1.value == 'MAJOR', | ||
525 | - }, | ||
526 | - { | ||
527 | - value: 'MINOR', | ||
528 | - label: '次要', | ||
529 | - disabled: tempValue1.value == 'MINOR', | ||
530 | - }, | ||
531 | - { | ||
532 | - value: 'WARNING', | ||
533 | - label: '警告', | ||
534 | - disabled: tempValue1.value == 'WARNING', | ||
535 | - }, | ||
536 | - { | ||
537 | - value: 'INDETERMINATE', | ||
538 | - label: '不确定', | ||
539 | - disabled: tempValue1.value == 'INDETERMINATE', | ||
540 | - }, | ||
541 | - ], | ||
542 | - }; | ||
543 | - }, | 536 | + const getRegisterFormChangeDetailFunc = () => { |
537 | + changeGetDetailValue.value = getRegisterFormChangeDetail(); | ||
538 | + }; | ||
539 | + const getRegisterClearFormChangeDetailFunc = () => { | ||
540 | + changeGetClearDetailValue.value = getRegisterFormClearChangeDetail(); | ||
541 | + }; | ||
542 | + | ||
543 | + const emptyCreateRoleFunc = () => { | ||
544 | + receiveOpenRuleTempArr.value = []; | ||
545 | + receiveRuleConditionTempArr.value = []; | ||
546 | + addNewOpenRule.schedule = {}; | ||
547 | + addNewRuleTem.condition = {}; | ||
548 | + }; | ||
549 | + | ||
550 | + const getOpenRuleAndRuleCondition = () => { | ||
551 | + addNewOpenRule.schedule = enableObj.value as never; | ||
552 | + addNewRuleTem.condition = ruleObj.value as never; | ||
553 | + tempOpenRuleTempArr.value.push(addNewOpenRule.schedule as never); | ||
554 | + tempRuleConditionTempArr.value.push(addNewRuleTem.condition as never); | ||
555 | + }; | ||
556 | + const getClearOpenRuleAndRuleCondition = () => { | ||
557 | + kongClearOpenRuleObj.schedule = enableClearObj.value as never; | ||
558 | + kongClearRuleConditionObj.condition = ruleLastObj.value as never; | ||
559 | + }; | ||
560 | + | ||
561 | + //传递报警数据 | ||
562 | + const validateRegisterFormHighSettingFunc = () => { | ||
563 | + const val = validateRegisterFormHighSetting(); | ||
564 | + propagateAndpropagateRelationTypes.propagate = val.propagate; | ||
565 | + propagateAndpropagateRelationTypes.propagateRelationTypes.push( | ||
566 | + val.propagateRelationTypes as never | ||
567 | + ); | ||
568 | + }; | ||
569 | + //报警类型数据 | ||
570 | + const validateRegisterFormFunc = () => { | ||
571 | + const val1 = validateRegisterForm(); | ||
572 | + alarmTypeGet.value = val1; | ||
573 | + }; | ||
574 | + | ||
575 | + // 添加创建条件方法 | ||
576 | + const addCreateRuleFunc = async () => { | ||
577 | + getRegisterFormChangeDetailFunc(); | ||
578 | + tempDetailTempArr.value.push(changeGetDetailValue.value as never); | ||
579 | + console.log(tempDetailTempArr.value); | ||
580 | + tempDetailTempArr.value.forEach((f1) => { | ||
581 | + kongDetail.value = f1; | ||
544 | }); | 582 | }); |
545 | - unref(profileData)[index].alarms.push({ | ||
546 | - id: Date.now() + Math.random() + '', | ||
547 | - alarmType: '', | ||
548 | - createRules: {}, | ||
549 | - // clearRule: [ | ||
550 | - // { | ||
551 | - // id: Date.now() + Math.random() + '', | ||
552 | - // alarmDetails: '', | ||
553 | - // dashboardId: { | ||
554 | - // id: '', | ||
555 | - // entityType: '', | ||
556 | - // }, | ||
557 | - // propagate: '', | ||
558 | - // propagateRelationTypes: [''], | ||
559 | - // schedule: { | ||
560 | - // type: 'string', | ||
561 | - // }, | ||
562 | - // condition: {}, | ||
563 | - // }, | ||
564 | - // ], | ||
565 | - propagate: false, | ||
566 | - propagateRelationTypes: [''], | 583 | + addChangeSeverity.value = await validateRegisterFormCreateAlarm(); |
584 | + emptyCreateRoleFunc(); | ||
585 | + getOpenRuleAndRuleCondition(); | ||
586 | + | ||
587 | + tempOpenRuleTempArr.value.forEach((f2) => { | ||
588 | + kongOpenRuleObj.schedule = f2; | ||
567 | }); | 589 | }); |
590 | + | ||
591 | + tempRuleConditionTempArr.value.forEach((f3) => { | ||
592 | + kongRuleConditionObj.condition = f3; | ||
593 | + }); | ||
594 | + | ||
595 | + createRulesObj.value[addChangeSeverity.value.default] = { | ||
596 | + ...kongDetail.value, | ||
597 | + ...addNewOpenRule, | ||
598 | + ...addNewRuleTem, | ||
599 | + ...kongOpenRuleObj, | ||
600 | + ...kongRuleConditionObj, | ||
601 | + }; | ||
602 | + addCreateRulesObj.createRules = createRulesObj.value; | ||
603 | + }; | ||
604 | + | ||
605 | + //清除报警规则 | ||
606 | + const addClearAlaramRule = () => { | ||
607 | + getClearOpenRuleAndRuleCondition(); | ||
608 | + getRegisterClearFormChangeDetailFunc(); | ||
609 | + addClearRule = { | ||
610 | + ...kongClearOpenRuleObj, | ||
611 | + ...kongClearRuleConditionObj, | ||
612 | + ...changeGetClearDetailValue.value, | ||
613 | + }; | ||
614 | + clearObj.clearRule = { ...addClearRule }; | ||
615 | + getClearObj.value = clearObj; | ||
616 | + }; | ||
617 | + | ||
618 | + // 添加创建条件 | ||
619 | + const addCreateRole = async (index: number) => { | ||
620 | + unref(profileData)[index]?.alarms.push(initCreateRules); | ||
621 | + addCreateRuleFunc(); | ||
568 | }; | 622 | }; |
569 | // 删除‘创建条件’ | 623 | // 删除‘创建条件’ |
570 | const deleteCondition = (index: number, createIndex: number) => { | 624 | const deleteCondition = (index: number, createIndex: number) => { |
@@ -583,8 +637,8 @@ | @@ -583,8 +637,8 @@ | ||
583 | const getAllFieldsFunc = (v) => { | 637 | const getAllFieldsFunc = (v) => { |
584 | detailObj.value = v; | 638 | detailObj.value = v; |
585 | detailTemplateData.value = ` | 639 | detailTemplateData.value = ` |
586 | - 报警详细信息:${v.alarmDetails} | ||
587 | - `; | 640 | + 报警详细信息:${v.alarmDetails} |
641 | + `; | ||
588 | }; | 642 | }; |
589 | //启用规则 | 643 | //启用规则 |
590 | const getAllFieldsEnabFunc = (v) => { | 644 | const getAllFieldsEnabFunc = (v) => { |
@@ -625,7 +679,7 @@ | @@ -625,7 +679,7 @@ | ||
625 | return f.label; | 679 | return f.label; |
626 | } | 680 | } |
627 | } catch (e) { | 681 | } catch (e) { |
628 | - console.log(e); | 682 | + return e; |
629 | } | 683 | } |
630 | }); | 684 | }); |
631 | const findDayCustomByValue = findDay.map((f, i) => { | 685 | const findDayCustomByValue = findDay.map((f, i) => { |
@@ -634,7 +688,7 @@ | @@ -634,7 +688,7 @@ | ||
634 | return f.label; | 688 | return f.label; |
635 | } | 689 | } |
636 | } catch (e) { | 690 | } catch (e) { |
637 | - console.log(e); | 691 | + return e; |
638 | } | 692 | } |
639 | }); | 693 | }); |
640 | enableTemplateData.value = | 694 | enableTemplateData.value = |
@@ -642,13 +696,14 @@ | @@ -642,13 +696,14 @@ | ||
642 | ? `始终启用` | 696 | ? `始终启用` |
643 | : v.schedule == 'SPECIFIC_TIME' | 697 | : v.schedule == 'SPECIFIC_TIME' |
644 | ? ` | 698 | ? ` |
645 | - 开始时间:${v.startsOn},结束时间:${v.endsOn},天数:${findDayByValue} | ||
646 | - ` | 699 | + 开始时间:${v.startsOn},结束时间:${v.endsOn},天数:${findDayByValue} |
700 | + ` | ||
647 | : `天数:${findDayCustomByValue},开始时间: ${v.startsOn1},结束时间:${v.endsOn1}`; | 701 | : `天数:${findDayCustomByValue},开始时间: ${v.startsOn1},结束时间:${v.endsOn1}`; |
648 | }; | 702 | }; |
649 | //规则条件 | 703 | //规则条件 |
650 | - const getAllFieldsRuleFunc = (v, v1) => { | 704 | + const getAllFieldsRuleFunc = (v) => { |
651 | ruleObj.value = v; | 705 | ruleObj.value = v; |
706 | + console.log(v); | ||
652 | const findDay = [ | 707 | const findDay = [ |
653 | { label: '等于', value: 'EQUAL' }, | 708 | { label: '等于', value: 'EQUAL' }, |
654 | { label: '不等于', value: 'NOT_EQUAL' }, | 709 | { label: '不等于', value: 'NOT_EQUAL' }, |
@@ -669,10 +724,10 @@ | @@ -669,10 +724,10 @@ | ||
669 | } | 724 | } |
670 | }); | 725 | }); |
671 | ruleTemplateData.value = ` | 726 | ruleTemplateData.value = ` |
672 | - 键名:${v.key1} 操作:${findRuleByValue?.label} 值:${v.value1} | ||
673 | - `; | 727 | + 键名:${v.key1} 操作:${findRuleByValue?.label} 值:${v.value1} |
728 | + `; | ||
674 | 729 | ||
675 | - ruleLastObj.value = v1; | 730 | + // ruleLastObj.value = v1; |
676 | const predicate = { | 731 | const predicate = { |
677 | operation: ruleObj.value.operation, | 732 | operation: ruleObj.value.operation, |
678 | value: { | 733 | value: { |
@@ -715,8 +770,8 @@ | @@ -715,8 +770,8 @@ | ||
715 | const getAllClearFieldsFunc = (v) => { | 770 | const getAllClearFieldsFunc = (v) => { |
716 | detailClearObj.value = v; | 771 | detailClearObj.value = v; |
717 | detailClearTemplateData.value = ` | 772 | detailClearTemplateData.value = ` |
718 | - 报警详细信息:${v.alarmDetails} | ||
719 | - `; | 773 | + 报警详细信息:${v.alarmDetails} |
774 | + `; | ||
720 | }; | 775 | }; |
721 | //启用规则 | 776 | //启用规则 |
722 | const getAllClearFieldsEnabFunc = (v) => { | 777 | const getAllClearFieldsEnabFunc = (v) => { |
@@ -757,7 +812,7 @@ | @@ -757,7 +812,7 @@ | ||
757 | return f.label; | 812 | return f.label; |
758 | } | 813 | } |
759 | } catch (e) { | 814 | } catch (e) { |
760 | - console.log(e); | 815 | + return e; |
761 | } | 816 | } |
762 | }); | 817 | }); |
763 | const findDayCustomByValue = findDay.map((f, i) => { | 818 | const findDayCustomByValue = findDay.map((f, i) => { |
@@ -766,7 +821,7 @@ | @@ -766,7 +821,7 @@ | ||
766 | return f.label; | 821 | return f.label; |
767 | } | 822 | } |
768 | } catch (e) { | 823 | } catch (e) { |
769 | - console.log(e); | 824 | + return e; |
770 | } | 825 | } |
771 | }); | 826 | }); |
772 | enableClearTemplateData.value = | 827 | enableClearTemplateData.value = |
@@ -774,13 +829,15 @@ | @@ -774,13 +829,15 @@ | ||
774 | ? `始终启用` | 829 | ? `始终启用` |
775 | : v.schedule == 'SPECIFIC_TIME' | 830 | : v.schedule == 'SPECIFIC_TIME' |
776 | ? ` | 831 | ? ` |
777 | - 开始时间:${v.startsOn},结束时间:${v.endsOn},天数:${findDayByValue} | ||
778 | - ` | 832 | + 开始时间:${v.startsOn},结束时间:${v.endsOn},天数:${findDayByValue} |
833 | + ` | ||
779 | : `天数:${findDayCustomByValue},开始时间: ${v.startsOn1},结束时间:${v.endsOn1}`; | 834 | : `天数:${findDayCustomByValue},开始时间: ${v.startsOn1},结束时间:${v.endsOn1}`; |
780 | }; | 835 | }; |
781 | //规则条件 | 836 | //规则条件 |
782 | - const getAllClearFieldsRuleFunc = (v, v1) => { | ||
783 | - ruleObj.value = v; | 837 | + const getAllClearFieldsRuleFunc = (v) => { |
838 | + ruleLastObj.value = v; | ||
839 | + console.log(v); | ||
840 | + | ||
784 | const findDay = [ | 841 | const findDay = [ |
785 | { label: '等于', value: 'EQUAL' }, | 842 | { label: '等于', value: 'EQUAL' }, |
786 | { label: '不等于', value: 'NOT_EQUAL' }, | 843 | { label: '不等于', value: 'NOT_EQUAL' }, |
@@ -801,10 +858,10 @@ | @@ -801,10 +858,10 @@ | ||
801 | } | 858 | } |
802 | }); | 859 | }); |
803 | ruleClearTemplateData.value = ` | 860 | ruleClearTemplateData.value = ` |
804 | - 键名:${v.key1} 操作:${findRuleByValue?.label} 值:${v.value1} | ||
805 | - `; | 861 | + 键名:${v.key1} 操作:${findRuleByValue?.label} 值:${v.value1} |
862 | + `; | ||
806 | 863 | ||
807 | - ruleLastObj.value = v1; | 864 | + // ruleLastObj.value = v1; |
808 | const predicate = { | 865 | const predicate = { |
809 | operation: ruleObj.value.operation, | 866 | operation: ruleObj.value.operation, |
810 | value: { | 867 | value: { |
@@ -842,6 +899,7 @@ | @@ -842,6 +899,7 @@ | ||
842 | }; | 899 | }; |
843 | Object.assign(addClearitionalObj.value, getValueConditon); | 900 | Object.assign(addClearitionalObj.value, getValueConditon); |
844 | }; | 901 | }; |
902 | + | ||
845 | //生成uuid | 903 | //生成uuid |
846 | function generateUUID() { | 904 | function generateUUID() { |
847 | let d = new Date().getTime(); | 905 | let d = new Date().getTime(); |
@@ -857,166 +915,29 @@ | @@ -857,166 +915,29 @@ | ||
857 | } | 915 | } |
858 | const handleFormStep3toStep4Next = async () => { | 916 | const handleFormStep3toStep4Next = async () => { |
859 | try { | 917 | try { |
860 | - changeGetDetailValue.value = getRegisterFormChangeDetail(); | ||
861 | - changeGetClearDetailValue.value = getRegisterFormClearChangeDetail(); | ||
862 | - if (enableObj.value.schedule == 'CUSTOM') { | ||
863 | - // for (let i in enableObj.value) { | ||
864 | - // console.log(i); | ||
865 | - // // let o = {}; | ||
866 | - // // if(enableObj.value[i]=='1') | ||
867 | - // // o[i] = enableObj.value[i]; | ||
868 | - // // getSchduleCustomValue.value.push(o); | ||
869 | - // // getSchduleCustomValue.value.push(enableObj.value[i]); | ||
870 | - // } | ||
871 | - // switch (enableObj.value.daysOfWeek1[0]) { | ||
872 | - // case '1': | ||
873 | - // getSchduleCustomValue.value.push({ | ||
874 | - // enabled: true, | ||
875 | - // dayOfWeek: enableObj.value.daysOfWeek1[0], | ||
876 | - // startsOn: enableObj.value.startsOn1, | ||
877 | - // endsOn: enableObj.value.endsOn1, | ||
878 | - // }); | ||
879 | - // break; | ||
880 | - // case '2': | ||
881 | - // getSchduleCustomValue.value.push({ | ||
882 | - // enabled: true, | ||
883 | - // dayOfWeek: enableObj.value.daysOfWeek2[0], | ||
884 | - // startsOn: enableObj.value.startsOn2, | ||
885 | - // endsOn: enableObj.value.endsOn2, | ||
886 | - // }); | ||
887 | - // break; | ||
888 | - // case '3': | ||
889 | - // getSchduleCustomValue.value.push({ | ||
890 | - // enabled: true, | ||
891 | - // dayOfWeek: enableObj.value.daysOfWeek3[0], | ||
892 | - // startsOn: enableObj.value.startsOn3, | ||
893 | - // endsOn: enableObj.value.endsOn3, | ||
894 | - // }); | ||
895 | - // break; | ||
896 | - // } | ||
897 | - scheduleCustomValue.value = { | ||
898 | - type: enableObj.value.schedule, | ||
899 | - timezone: enableObj.value.timezone, | ||
900 | - items: getSchduleCustomValue.value, | ||
901 | - }; | ||
902 | - } | ||
903 | - //清除报警规则---报警日程表 | ||
904 | - if (enableClearObj.value.schedule == 'CUSTOM') { | ||
905 | - switch (enableClearObj.value.daysOfWeek1[0]) { | ||
906 | - case '1': | ||
907 | - getSchduleClearCustomValue.value.push({ | ||
908 | - enabled: true, | ||
909 | - dayOfWeek: enableClearObj.value.daysOfWeek1[0], | ||
910 | - startsOn: enableClearObj.value.startsOn1, | ||
911 | - endsOn: enableClearObj.value.endsOn1, | ||
912 | - }); | ||
913 | - break; | ||
914 | - case '2': | ||
915 | - getSchduleClearCustomValue.value.push({ | ||
916 | - enabled: true, | ||
917 | - dayOfWeek: enableClearObj.value.daysOfWeek2[0], | ||
918 | - startsOn: enableClearObj.value.startsOn2, | ||
919 | - endsOn: enableClearObj.value.endsOn2, | ||
920 | - }); | ||
921 | - break; | ||
922 | - case '3': | ||
923 | - getSchduleClearCustomValue.value.push({ | ||
924 | - enabled: true, | ||
925 | - dayOfWeek: enableClearObj.value.daysOfWeek3[0], | ||
926 | - startsOn: enableClearObj.value.startsOn3, | ||
927 | - endsOn: enableClearObj.value.endsOn3, | ||
928 | - }); | ||
929 | - break; | ||
930 | - } | ||
931 | - scheduleCustomClearValue.value = { | ||
932 | - type: enableClearObj.value.schedule, | ||
933 | - timezone: enableClearObj.value.timezone, | ||
934 | - items: getSchduleClearCustomValue.value, | ||
935 | - }; | ||
936 | - } | ||
937 | - const scheduleClearValue = { | ||
938 | - type: enableClearObj.value.schedule, | ||
939 | - daysOfWeek: enableClearObj.value.daysOfWeek, | ||
940 | - endsOn: enableClearObj.value.endsOn, | ||
941 | - startsOn: enableClearObj.value.startOn, | ||
942 | - timezone: enableClearObj.value.timezone, | ||
943 | - }; | ||
944 | - const getClearSchedule = { | ||
945 | - schedule: | ||
946 | - enableClearObj.value.schedule == 'CUSTOM' | ||
947 | - ? scheduleCustomClearValue.value | ||
948 | - : scheduleClearValue, | ||
949 | - }; | ||
950 | - const getClearAdditionalProp = Object.assign( | ||
951 | - {}, | ||
952 | - changeGetClearDetailValue.value, | ||
953 | - getClearSchedule | ||
954 | - ); | ||
955 | - const scheduleValue = { | ||
956 | - type: enableObj.value.schedule, | ||
957 | - daysOfWeek: enableObj.value.daysOfWeek, | ||
958 | - endsOn: enableObj.value.endsOn, | ||
959 | - startsOn: enableObj.value.startOn, | ||
960 | - timezone: enableObj.value.timezone, | ||
961 | - }; | ||
962 | - const getSchedule = { | ||
963 | - schedule: | ||
964 | - enableObj.value.schedule == 'CUSTOM' ? scheduleCustomValue.value : scheduleValue, | ||
965 | - }; | ||
966 | - | ||
967 | - const getAdditionalProp = Object.assign({}, changeGetDetailValue.value, getSchedule); | ||
968 | - const getScheduleAndAlarmDetails = Object.assign( | ||
969 | - {}, | ||
970 | - getAdditionalProp, | ||
971 | - additionalObj.value | ||
972 | - ); | ||
973 | - const getScheduleAndClearAlarmDetails = Object.assign( | ||
974 | - {}, | ||
975 | - getClearAdditionalProp, | ||
976 | - addClearitionalObj.value | ||
977 | - ); | ||
978 | - const getIsWhereTypeValue: any = isWhereTypeValue.value; | ||
979 | - const getAdditionalPropObj = { | ||
980 | - [getIsWhereTypeValue]: getScheduleAndAlarmDetails, | ||
981 | - }; | ||
982 | - const getCreateRulesAllObj = { | ||
983 | - createRules: getAdditionalPropObj, | ||
984 | - }; | ||
985 | - const getClearRulesAllObj = { | ||
986 | - clearRule: getScheduleAndClearAlarmDetails, | ||
987 | - }; | ||
988 | - const valueRegisterForm = await validateRegisterForm(); | ||
989 | - const valueRegisterFormAndId = { | ||
990 | - alarmType: Object.values(valueRegisterForm)[0], | ||
991 | - }; | 918 | + validateRegisterFormFunc(); |
919 | + validateRegisterFormHighSettingFunc(); | ||
992 | const objectId = { | 920 | const objectId = { |
993 | id: generateUUID(), | 921 | id: generateUUID(), |
994 | }; | 922 | }; |
995 | - const valueRegisterFormHighSetting = await validateRegisterFormHighSetting(); | ||
996 | - const valueRegisterFormCreateAlarm = await validateRegisterFormCreateAlarm(); | ||
997 | - console.log(valueRegisterFormCreateAlarm); | ||
998 | - const getValueRegisterFormHighSetting = { | ||
999 | - propagate: valueRegisterFormHighSetting?.propagate, | ||
1000 | - propagateRelationTypes: [valueRegisterFormHighSetting?.propagateRelationTypes].flat(1), | ||
1001 | - }; | ||
1002 | - Object.assign( | ||
1003 | - emptyObj.value, | ||
1004 | - valueRegisterFormAndId, | ||
1005 | - getValueRegisterFormHighSetting, | ||
1006 | - getCreateRulesAllObj, | ||
1007 | - getClearRulesAllObj, | ||
1008 | - objectId | ||
1009 | - ); | ||
1010 | - if (alarmss.value.length == 0) { | ||
1011 | - alarmss.value.push(emptyObj.value); | ||
1012 | - } | ||
1013 | - const getAlarms = { | ||
1014 | - alarms: alarmss.value, | 923 | + getRegisterFormChangeDetailFunc(); |
924 | + addCreateRuleFunc(); | ||
925 | + addClearAlaramRule(); | ||
926 | + console.log(addCreateRulesObj); | ||
927 | + console.log(getClearObj.value); | ||
928 | + | ||
929 | + getAllObjTemp.value = { | ||
930 | + ...addCreateRulesObj, | ||
931 | + ...getClearObj.value, | ||
932 | + ...objectId, | ||
933 | + ...alarmTypeGet.value, | ||
934 | + ...propagateAndpropagateRelationTypes, | ||
1015 | }; | 935 | }; |
1016 | - Object.assign(getAllFormData.value, getAlarms); | ||
1017 | - emit('next', getAllFormData.value); | 936 | + allAlarms.value.push(getAllObjTemp.value as never); |
937 | + emit('next', allAlarms.value); | ||
1018 | } catch (error) {} | 938 | } catch (error) {} |
1019 | }; | 939 | }; |
940 | + | ||
1020 | const [registerModal1, { openModal: openModal1 }] = useModal(); | 941 | const [registerModal1, { openModal: openModal1 }] = useModal(); |
1021 | const [registerModal2, { openModal: openModal2 }] = useModal(); | 942 | const [registerModal2, { openModal: openModal2 }] = useModal(); |
1022 | const [registerModal3, { openModal: openModal3 }] = useModal(); | 943 | const [registerModal3, { openModal: openModal3 }] = useModal(); |
@@ -1087,13 +1008,15 @@ | @@ -1087,13 +1008,15 @@ | ||
1087 | }; | 1008 | }; |
1088 | 1009 | ||
1089 | return { | 1010 | return { |
1011 | + getChildData5, | ||
1012 | + getChildData6, | ||
1013 | + refAlarmDetailTemplate, | ||
1090 | resetRegisterFormChangeDetailFunc, | 1014 | resetRegisterFormChangeDetailFunc, |
1091 | resetRegisterFormClearChangeDetailFunc, | 1015 | resetRegisterFormClearChangeDetailFunc, |
1092 | setRegisterFormClearChangeDetailFunc, | 1016 | setRegisterFormClearChangeDetailFunc, |
1093 | setRegisterFormChangeDetailFunc, | 1017 | setRegisterFormChangeDetailFunc, |
1094 | registerFormChangeClearDetail, | 1018 | registerFormChangeClearDetail, |
1095 | registerFormChangeDetail, | 1019 | registerFormChangeDetail, |
1096 | - ruleNumber, | ||
1097 | resetEnableClearFormDataFunc, | 1020 | resetEnableClearFormDataFunc, |
1098 | resetTemplateClearFormDataFunc, | 1021 | resetTemplateClearFormDataFunc, |
1099 | resetRulesClearFormDataFunc, | 1022 | resetRulesClearFormDataFunc, |
@@ -1107,7 +1030,6 @@ | @@ -1107,7 +1030,6 @@ | ||
1107 | retryTemplateFormDataFunc, | 1030 | retryTemplateFormDataFunc, |
1108 | retryRulesFormDataFunc, | 1031 | retryRulesFormDataFunc, |
1109 | clearProfileDataFunc, | 1032 | clearProfileDataFunc, |
1110 | - clearIndex, | ||
1111 | retryRegisterFormFunc, | 1033 | retryRegisterFormFunc, |
1112 | retryRegisterFormHighSettingmFunc, | 1034 | retryRegisterFormHighSettingmFunc, |
1113 | retryRegisterFormCreateAlarmFunc, | 1035 | retryRegisterFormCreateAlarmFunc, |
1 | <template> | 1 | <template> |
2 | <div class="step-4"> | 2 | <div class="step-4"> |
3 | + <!-- <span>请选择告警通知联系人:</span> --> | ||
4 | + <!-- <Tag v-for="(item, index) in 15" closable :key="index"> 冯涛+{{ item }}</Tag> --> | ||
3 | <BasicForm :showSubmitButton="false" @register="register" /> | 5 | <BasicForm :showSubmitButton="false" @register="register" /> |
4 | </div> | 6 | </div> |
5 | </template> | 7 | </template> |
6 | <script lang="ts"> | 8 | <script lang="ts"> |
7 | import { defineComponent, ref } from 'vue'; | 9 | import { defineComponent, ref } from 'vue'; |
10 | + // import { Tag } from 'ant-design-vue'; | ||
8 | import { BasicForm, useForm } from '/@/components/Form/index'; | 11 | import { BasicForm, useForm } from '/@/components/Form/index'; |
9 | import { alertContactsSchemas } from '../cpns/config'; | 12 | import { alertContactsSchemas } from '../cpns/config'; |
10 | 13 |
1 | +{ | ||
2 | + "name": "1", | ||
3 | + "defaultRuleChainId": "de8bf640-8892-11ec-ac19-e398562c8b61", | ||
4 | + "defaultQueueName": "HighPriority", | ||
5 | + "description": "1", | ||
6 | + "icon": "", | ||
7 | + "transportType": "DEFAULT", | ||
8 | + "profileData": { | ||
9 | + "alarms": [ | ||
10 | + { | ||
11 | + "createRules": { | ||
12 | + "MAJOR": { | ||
13 | + "alarmDetails": "1", | ||
14 | + "schedule": { | ||
15 | + "type": "ANY_TIME", | ||
16 | + "timezone": "Asia/Shanghai (UTC+08:00)" | ||
17 | + }, | ||
18 | + "condition": { | ||
19 | + "type": "TIME_SERIES", | ||
20 | + "key1": "1", | ||
21 | + "type1": "NUMERIC", | ||
22 | + "operation": "GREATER_OR_EQUAL", | ||
23 | + "value1": "1", | ||
24 | + "id": 3 | ||
25 | + } | ||
26 | + }, | ||
27 | + "MINOR": { | ||
28 | + "alarmDetails": "2", | ||
29 | + "schedule": { | ||
30 | + "type": "ANY_TIME", | ||
31 | + "timezone": "Asia/Shanghai (UTC+08:00)" | ||
32 | + }, | ||
33 | + "condition": { | ||
34 | + "type": "TIME_SERIES", | ||
35 | + "key1": "2", | ||
36 | + "type1": "NUMERIC", | ||
37 | + "operation": "GREATER", | ||
38 | + "value1": "2", | ||
39 | + "id": 2 | ||
40 | + } | ||
41 | + } | ||
42 | + }, | ||
43 | + "clearRule": { | ||
44 | + "schedule": { | ||
45 | + "type": "ANY_TIME", | ||
46 | + "timezone": "Asia/Shanghai (UTC+08:00)" | ||
47 | + }, | ||
48 | + "condition": { | ||
49 | + "type": "TIME_SERIES", | ||
50 | + "key1": "3", | ||
51 | + "type1": "NUMERIC", | ||
52 | + "operation": "LESS_OR_EQUAL", | ||
53 | + "value1": "3", | ||
54 | + "id": 2 | ||
55 | + }, | ||
56 | + "alarmDetails": "3" | ||
57 | + }, | ||
58 | + "id": "a5043fdc-2ad0-4d7c-8a29-fa7e8e18fe8d", | ||
59 | + "alarmType": "0", | ||
60 | + "propagate": true, | ||
61 | + "propagateRelationTypes": ["0"] | ||
62 | + } | ||
63 | + ] | ||
64 | + }, | ||
65 | + "alarmProfile": { | ||
66 | + "alarmContactId": ["224a312c-4f52-41ef-9dce-2aac69ec2e85"], | ||
67 | + "messageMode": ["PHONE_MESSAGE", "EMAIL_MESSAGE"] | ||
68 | + } | ||
69 | +} |
@@ -3,9 +3,8 @@ import { FormSchema } from '/@/components/Table'; | @@ -3,9 +3,8 @@ import { FormSchema } from '/@/components/Table'; | ||
3 | export const formSchema: FormSchema[] = [ | 3 | export const formSchema: FormSchema[] = [ |
4 | { | 4 | { |
5 | field: 'alarmDetails', | 5 | field: 'alarmDetails', |
6 | - label: '报警详细信息', | 6 | + label: '', |
7 | colProps: { span: 17 }, | 7 | colProps: { span: 17 }, |
8 | - required: true, | ||
9 | component: 'Input', | 8 | component: 'Input', |
10 | componentProps: { | 9 | componentProps: { |
11 | maxLength: 255, | 10 | maxLength: 255, |
1 | <template> | 1 | <template> |
2 | - <BasicModal | ||
3 | - v-bind="$attrs" | ||
4 | - width="55rem" | ||
5 | - @register="register" | ||
6 | - :title="getTitle" | ||
7 | - @ok="handleSubmit" | ||
8 | - > | 2 | + <div> |
9 | <BasicForm :showResetButton="false" :showSubmitButton="false" @register="registerForm" /> | 3 | <BasicForm :showResetButton="false" :showSubmitButton="false" @register="registerForm" /> |
10 | - </BasicModal> | 4 | + </div> |
11 | </template> | 5 | </template> |
12 | <script lang="ts"> | 6 | <script lang="ts"> |
13 | - import { defineComponent, ref, computed, unref } from 'vue'; | ||
14 | - import { BasicModal, useModalInner } from '/@/components/Modal'; | 7 | + import { defineComponent, ref } from 'vue'; |
15 | import { BasicForm, useForm } from '/@/components/Form'; | 8 | import { BasicForm, useForm } from '/@/components/Form'; |
16 | import { formSchema } from './config'; | 9 | import { formSchema } from './config'; |
17 | 10 | ||
18 | export default defineComponent({ | 11 | export default defineComponent({ |
19 | name: 'DetailTemplate', | 12 | name: 'DetailTemplate', |
20 | components: { | 13 | components: { |
21 | - BasicModal, | ||
22 | BasicForm, | 14 | BasicForm, |
23 | }, | 15 | }, |
24 | emits: ['success', 'register', 'getAllFields'], | 16 | emits: ['success', 'register', 'getAllFields'], |
25 | - setup(_, { emit }) { | ||
26 | - // const getValueData: any = ref({}); | ||
27 | - const isUpdate = ref(true); | ||
28 | - const [registerForm, { getFieldsValue, resetFields }] = useForm({ | 17 | + setup() { |
18 | + const fieldValue: any = ref({}); | ||
19 | + const [registerForm, { getFieldsValue }] = useForm({ | ||
29 | labelWidth: 120, | 20 | labelWidth: 120, |
30 | schemas: formSchema, | 21 | schemas: formSchema, |
31 | }); | 22 | }); |
32 | - const getTitle = computed(() => (!unref(isUpdate) ? '新增详情模板' : '编辑详情模板')); | ||
33 | - const [register, { closeModal }] = useModalInner((data) => { | ||
34 | - isUpdate.value = !!data?.isUpdate; | ||
35 | - }); | ||
36 | - const resetDataFunc = () => { | ||
37 | - resetFields(); | ||
38 | - }; | ||
39 | - const handleSubmit = () => { | ||
40 | - const values = getFieldsValue(); | ||
41 | - emit('getAllFields', values); | ||
42 | - // let getV = {}; | ||
43 | - // getAllFields(getV); | ||
44 | - closeModal(); | 23 | + |
24 | + const getFieldsValueFunc = () => { | ||
25 | + fieldValue.value = getFieldsValue(); | ||
26 | + return fieldValue.value; | ||
45 | }; | 27 | }; |
46 | - // function getAllFields(getV) { | ||
47 | - // const values = getFieldsValue(); | ||
48 | - // getValueData.value = values; | ||
49 | - // getV = getValueData.value; | ||
50 | - // return getV; | ||
51 | - // } | 28 | + |
52 | return { | 29 | return { |
53 | - resetDataFunc, | ||
54 | - // getAllFields, | 30 | + getFieldsValueFunc, |
55 | registerForm, | 31 | registerForm, |
56 | - handleSubmit, | ||
57 | - register, | ||
58 | - getTitle, | ||
59 | }; | 32 | }; |
60 | }, | 33 | }, |
61 | }); | 34 | }); |
@@ -23,7 +23,7 @@ export const isTimeAll = (type: string) => { | @@ -23,7 +23,7 @@ export const isTimeAll = (type: string) => { | ||
23 | 23 | ||
24 | export const formSchema: FormSchema[] = [ | 24 | export const formSchema: FormSchema[] = [ |
25 | { | 25 | { |
26 | - field: 'schedule', | 26 | + field: 'type', |
27 | label: '报警日程表', | 27 | label: '报警日程表', |
28 | colProps: { span: 12 }, | 28 | colProps: { span: 12 }, |
29 | required: true, | 29 | required: true, |
@@ -55,7 +55,7 @@ export const formSchema: FormSchema[] = [ | @@ -55,7 +55,7 @@ export const formSchema: FormSchema[] = [ | ||
55 | ], | 55 | ], |
56 | }, | 56 | }, |
57 | ifShow: ({ values }) => | 57 | ifShow: ({ values }) => |
58 | - isWenDu(Reflect.get(values, 'schedule')) || isTimeAll(Reflect.get(values, 'schedule')), | 58 | + isWenDu(Reflect.get(values, 'type')) || isTimeAll(Reflect.get(values, 'type')), |
59 | }, | 59 | }, |
60 | 60 | ||
61 | { | 61 | { |
@@ -73,7 +73,7 @@ export const formSchema: FormSchema[] = [ | @@ -73,7 +73,7 @@ export const formSchema: FormSchema[] = [ | ||
73 | }, | 73 | }, |
74 | ], | 74 | ], |
75 | }, | 75 | }, |
76 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 76 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')), |
77 | }, | 77 | }, |
78 | { | 78 | { |
79 | field: 'startsOn1', | 79 | field: 'startsOn1', |
@@ -85,7 +85,7 @@ export const formSchema: FormSchema[] = [ | @@ -85,7 +85,7 @@ export const formSchema: FormSchema[] = [ | ||
85 | colProps: { | 85 | colProps: { |
86 | span: 8, | 86 | span: 8, |
87 | }, | 87 | }, |
88 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 88 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')), |
89 | }, | 89 | }, |
90 | { | 90 | { |
91 | field: 'endsOn1', | 91 | field: 'endsOn1', |
@@ -97,7 +97,7 @@ export const formSchema: FormSchema[] = [ | @@ -97,7 +97,7 @@ export const formSchema: FormSchema[] = [ | ||
97 | colProps: { | 97 | colProps: { |
98 | span: 8, | 98 | span: 8, |
99 | }, | 99 | }, |
100 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 100 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')), |
101 | }, | 101 | }, |
102 | 102 | ||
103 | { | 103 | { |
@@ -115,7 +115,7 @@ export const formSchema: FormSchema[] = [ | @@ -115,7 +115,7 @@ export const formSchema: FormSchema[] = [ | ||
115 | }, | 115 | }, |
116 | ], | 116 | ], |
117 | }, | 117 | }, |
118 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 118 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')), |
119 | }, | 119 | }, |
120 | { | 120 | { |
121 | field: 'startsOn2', | 121 | field: 'startsOn2', |
@@ -127,7 +127,7 @@ export const formSchema: FormSchema[] = [ | @@ -127,7 +127,7 @@ export const formSchema: FormSchema[] = [ | ||
127 | colProps: { | 127 | colProps: { |
128 | span: 8, | 128 | span: 8, |
129 | }, | 129 | }, |
130 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 130 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')), |
131 | }, | 131 | }, |
132 | { | 132 | { |
133 | field: 'endsOn2', | 133 | field: 'endsOn2', |
@@ -139,7 +139,7 @@ export const formSchema: FormSchema[] = [ | @@ -139,7 +139,7 @@ export const formSchema: FormSchema[] = [ | ||
139 | colProps: { | 139 | colProps: { |
140 | span: 8, | 140 | span: 8, |
141 | }, | 141 | }, |
142 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 142 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')), |
143 | }, | 143 | }, |
144 | { | 144 | { |
145 | field: 'daysOfWeek3', | 145 | field: 'daysOfWeek3', |
@@ -156,7 +156,7 @@ export const formSchema: FormSchema[] = [ | @@ -156,7 +156,7 @@ export const formSchema: FormSchema[] = [ | ||
156 | }, | 156 | }, |
157 | ], | 157 | ], |
158 | }, | 158 | }, |
159 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 159 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')), |
160 | }, | 160 | }, |
161 | { | 161 | { |
162 | field: 'startsOn3', | 162 | field: 'startsOn3', |
@@ -168,7 +168,7 @@ export const formSchema: FormSchema[] = [ | @@ -168,7 +168,7 @@ export const formSchema: FormSchema[] = [ | ||
168 | colProps: { | 168 | colProps: { |
169 | span: 8, | 169 | span: 8, |
170 | }, | 170 | }, |
171 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 171 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')), |
172 | }, | 172 | }, |
173 | { | 173 | { |
174 | field: 'endsOn3', | 174 | field: 'endsOn3', |
@@ -180,7 +180,7 @@ export const formSchema: FormSchema[] = [ | @@ -180,7 +180,7 @@ export const formSchema: FormSchema[] = [ | ||
180 | colProps: { | 180 | colProps: { |
181 | span: 8, | 181 | span: 8, |
182 | }, | 182 | }, |
183 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 183 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')), |
184 | }, | 184 | }, |
185 | { | 185 | { |
186 | field: 'daysOfWeek4', | 186 | field: 'daysOfWeek4', |
@@ -197,7 +197,7 @@ export const formSchema: FormSchema[] = [ | @@ -197,7 +197,7 @@ export const formSchema: FormSchema[] = [ | ||
197 | }, | 197 | }, |
198 | ], | 198 | ], |
199 | }, | 199 | }, |
200 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 200 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')), |
201 | }, | 201 | }, |
202 | { | 202 | { |
203 | field: 'startsOn4', | 203 | field: 'startsOn4', |
@@ -209,7 +209,7 @@ export const formSchema: FormSchema[] = [ | @@ -209,7 +209,7 @@ export const formSchema: FormSchema[] = [ | ||
209 | colProps: { | 209 | colProps: { |
210 | span: 8, | 210 | span: 8, |
211 | }, | 211 | }, |
212 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 212 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')), |
213 | }, | 213 | }, |
214 | { | 214 | { |
215 | field: 'endsOn4', | 215 | field: 'endsOn4', |
@@ -221,7 +221,7 @@ export const formSchema: FormSchema[] = [ | @@ -221,7 +221,7 @@ export const formSchema: FormSchema[] = [ | ||
221 | colProps: { | 221 | colProps: { |
222 | span: 8, | 222 | span: 8, |
223 | }, | 223 | }, |
224 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 224 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')), |
225 | }, | 225 | }, |
226 | { | 226 | { |
227 | field: 'daysOfWeek5', | 227 | field: 'daysOfWeek5', |
@@ -238,7 +238,7 @@ export const formSchema: FormSchema[] = [ | @@ -238,7 +238,7 @@ export const formSchema: FormSchema[] = [ | ||
238 | }, | 238 | }, |
239 | ], | 239 | ], |
240 | }, | 240 | }, |
241 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 241 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')), |
242 | }, | 242 | }, |
243 | { | 243 | { |
244 | field: 'startsOn5', | 244 | field: 'startsOn5', |
@@ -250,7 +250,7 @@ export const formSchema: FormSchema[] = [ | @@ -250,7 +250,7 @@ export const formSchema: FormSchema[] = [ | ||
250 | colProps: { | 250 | colProps: { |
251 | span: 8, | 251 | span: 8, |
252 | }, | 252 | }, |
253 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 253 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')), |
254 | }, | 254 | }, |
255 | { | 255 | { |
256 | field: 'endsOn5', | 256 | field: 'endsOn5', |
@@ -262,7 +262,7 @@ export const formSchema: FormSchema[] = [ | @@ -262,7 +262,7 @@ export const formSchema: FormSchema[] = [ | ||
262 | colProps: { | 262 | colProps: { |
263 | span: 8, | 263 | span: 8, |
264 | }, | 264 | }, |
265 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 265 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')), |
266 | }, | 266 | }, |
267 | { | 267 | { |
268 | field: 'daysOfWeek6', | 268 | field: 'daysOfWeek6', |
@@ -279,7 +279,7 @@ export const formSchema: FormSchema[] = [ | @@ -279,7 +279,7 @@ export const formSchema: FormSchema[] = [ | ||
279 | }, | 279 | }, |
280 | ], | 280 | ], |
281 | }, | 281 | }, |
282 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 282 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')), |
283 | }, | 283 | }, |
284 | { | 284 | { |
285 | field: 'startsOn6', | 285 | field: 'startsOn6', |
@@ -291,7 +291,7 @@ export const formSchema: FormSchema[] = [ | @@ -291,7 +291,7 @@ export const formSchema: FormSchema[] = [ | ||
291 | colProps: { | 291 | colProps: { |
292 | span: 8, | 292 | span: 8, |
293 | }, | 293 | }, |
294 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 294 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')), |
295 | }, | 295 | }, |
296 | { | 296 | { |
297 | field: 'endsOn6', | 297 | field: 'endsOn6', |
@@ -303,7 +303,7 @@ export const formSchema: FormSchema[] = [ | @@ -303,7 +303,7 @@ export const formSchema: FormSchema[] = [ | ||
303 | colProps: { | 303 | colProps: { |
304 | span: 8, | 304 | span: 8, |
305 | }, | 305 | }, |
306 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 306 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')), |
307 | }, | 307 | }, |
308 | { | 308 | { |
309 | field: 'daysOfWeek7', | 309 | field: 'daysOfWeek7', |
@@ -320,7 +320,7 @@ export const formSchema: FormSchema[] = [ | @@ -320,7 +320,7 @@ export const formSchema: FormSchema[] = [ | ||
320 | }, | 320 | }, |
321 | ], | 321 | ], |
322 | }, | 322 | }, |
323 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 323 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')), |
324 | }, | 324 | }, |
325 | { | 325 | { |
326 | field: 'startsOn7', | 326 | field: 'startsOn7', |
@@ -332,7 +332,7 @@ export const formSchema: FormSchema[] = [ | @@ -332,7 +332,7 @@ export const formSchema: FormSchema[] = [ | ||
332 | colProps: { | 332 | colProps: { |
333 | span: 8, | 333 | span: 8, |
334 | }, | 334 | }, |
335 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 335 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')), |
336 | }, | 336 | }, |
337 | { | 337 | { |
338 | field: 'endsOn7', | 338 | field: 'endsOn7', |
@@ -344,7 +344,7 @@ export const formSchema: FormSchema[] = [ | @@ -344,7 +344,7 @@ export const formSchema: FormSchema[] = [ | ||
344 | colProps: { | 344 | colProps: { |
345 | span: 8, | 345 | span: 8, |
346 | }, | 346 | }, |
347 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 347 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')), |
348 | }, | 348 | }, |
349 | 349 | ||
350 | { | 350 | { |
@@ -392,7 +392,7 @@ export const formSchema: FormSchema[] = [ | @@ -392,7 +392,7 @@ export const formSchema: FormSchema[] = [ | ||
392 | }, | 392 | }, |
393 | ], | 393 | ], |
394 | }, | 394 | }, |
395 | - ifShow: ({ values }) => isWenDu(Reflect.get(values, 'schedule')), | 395 | + ifShow: ({ values }) => isWenDu(Reflect.get(values, 'type')), |
396 | }, | 396 | }, |
397 | { | 397 | { |
398 | field: 'startsOn', | 398 | field: 'startsOn', |
@@ -404,7 +404,7 @@ export const formSchema: FormSchema[] = [ | @@ -404,7 +404,7 @@ export const formSchema: FormSchema[] = [ | ||
404 | componentProps: { | 404 | componentProps: { |
405 | valueFormat: 'HH:mm:ss', | 405 | valueFormat: 'HH:mm:ss', |
406 | }, | 406 | }, |
407 | - ifShow: ({ values }) => isWenDu(Reflect.get(values, 'schedule')), | 407 | + ifShow: ({ values }) => isWenDu(Reflect.get(values, 'type')), |
408 | }, | 408 | }, |
409 | { | 409 | { |
410 | field: 'endsOn', | 410 | field: 'endsOn', |
@@ -416,6 +416,6 @@ export const formSchema: FormSchema[] = [ | @@ -416,6 +416,6 @@ export const formSchema: FormSchema[] = [ | ||
416 | componentProps: { | 416 | componentProps: { |
417 | valueFormat: 'HH:mm:ss', | 417 | valueFormat: 'HH:mm:ss', |
418 | }, | 418 | }, |
419 | - ifShow: ({ values }) => isWenDu(Reflect.get(values, 'schedule')), | 419 | + ifShow: ({ values }) => isWenDu(Reflect.get(values, 'type')), |
420 | }, | 420 | }, |
421 | ]; | 421 | ]; |
@@ -158,6 +158,7 @@ export const step3CreateAlarm: FormSchema[] = [ | @@ -158,6 +158,7 @@ export const step3CreateAlarm: FormSchema[] = [ | ||
158 | { | 158 | { |
159 | field: 'default', | 159 | field: 'default', |
160 | component: 'Select', | 160 | component: 'Select', |
161 | + required: true, | ||
161 | label: '报警严重程度:', | 162 | label: '报警严重程度:', |
162 | colProps: { | 163 | colProps: { |
163 | span: 17, | 164 | span: 17, |
@@ -26,7 +26,6 @@ interface IAlarms { | @@ -26,7 +26,6 @@ interface IAlarms { | ||
26 | id: string; | 26 | id: string; |
27 | alarmType: string; | 27 | alarmType: string; |
28 | createRules: ICreateRule; | 28 | createRules: ICreateRule; |
29 | - // clearRule?: IClearRule[]; | ||
30 | propagate: boolean; | 29 | propagate: boolean; |
31 | propagateRelationTypes: string[]; | 30 | propagateRelationTypes: string[]; |
32 | } | 31 | } |
@@ -38,3 +37,12 @@ export interface IProfileData { | @@ -38,3 +37,12 @@ export interface IProfileData { | ||
38 | alarms?: IAlarms[]; | 37 | alarms?: IAlarms[]; |
39 | clearRule?: IClearRule[]; | 38 | clearRule?: IClearRule[]; |
40 | } | 39 | } |
40 | + | ||
41 | +export interface IAddAlarms { | ||
42 | + id: string; | ||
43 | + alarmType: string; | ||
44 | + createRules: []; | ||
45 | + clearRule: {}; | ||
46 | + propagate: boolean; | ||
47 | + propagateRelationTypes: string[]; | ||
48 | +} |
src/views/device/profile/types/index.ts
0 → 100644
1 | +interface IConfiguration { | ||
2 | + type?: string; | ||
3 | +} | ||
4 | +interface ITansportConfiguration { | ||
5 | + type?: string; | ||
6 | +} | ||
7 | +interface provisionConfigurationD { | ||
8 | + provisionDeviceSecret?: string; | ||
9 | +} | ||
10 | +type ICreateRule = {}; | ||
11 | +type IClearRule = { | ||
12 | + id: string; | ||
13 | + alarmDetails: string; | ||
14 | + dashboardId: { | ||
15 | + id: string; | ||
16 | + entityType: string; | ||
17 | + }; | ||
18 | + propagate: string; | ||
19 | + propagateRelationTypes: string[]; | ||
20 | + schedule: { | ||
21 | + type: string; | ||
22 | + }; | ||
23 | + condition: object; | ||
24 | +}; | ||
25 | +interface IAlarms { | ||
26 | + id: string; | ||
27 | + alarmType: string; | ||
28 | + createRules: ICreateRule; | ||
29 | + // clearRule?: IClearRule[]; | ||
30 | + propagate: boolean; | ||
31 | + propagateRelationTypes: string[]; | ||
32 | +} | ||
33 | + | ||
34 | +export interface IProfileData { | ||
35 | + configuration?: IConfiguration; | ||
36 | + transportConfiguration?: ITansportConfiguration; | ||
37 | + provisionConfiguration?: provisionConfigurationD; | ||
38 | + alarms?: IAlarms[]; | ||
39 | + clearRule?: IClearRule[]; | ||
40 | +} |
@@ -21,19 +21,23 @@ | @@ -21,19 +21,23 @@ | ||
21 | 21 | ||
22 | export default defineComponent({ | 22 | export default defineComponent({ |
23 | components: { CollapseContainer, BasicForm, [Input.name]: Input }, | 23 | components: { CollapseContainer, BasicForm, [Input.name]: Input }, |
24 | - props: ['deviceInfo1'], | 24 | + props: ['deviceInfo1', 'editconditionFather', 'newConditionMapFather'], |
25 | 25 | ||
26 | setup(props) { | 26 | setup(props) { |
27 | const fieldValue: any = ref({}); | 27 | const fieldValue: any = ref({}); |
28 | - const [registerCondition, { getFieldsValue, updateSchema }] = useForm({ | ||
29 | - labelWidth: 100, | ||
30 | - schemas: useConditionDrawerSchema, | ||
31 | - actionColOptions: { span: 24 }, | ||
32 | - }); | 28 | + const [registerCondition, { setFieldsValue, getFieldsValue, updateSchema, resetFields }] = |
29 | + useForm({ | ||
30 | + labelWidth: 100, | ||
31 | + schemas: useConditionDrawerSchema, | ||
32 | + actionColOptions: { span: 24 }, | ||
33 | + }); | ||
33 | const getFieldsValueFunc = () => { | 34 | const getFieldsValueFunc = () => { |
34 | fieldValue.value = getFieldsValue(); | 35 | fieldValue.value = getFieldsValue(); |
35 | return fieldValue.value; | 36 | return fieldValue.value; |
36 | }; | 37 | }; |
38 | + const resetFieldsValueFunc = () => { | ||
39 | + resetFields(); | ||
40 | + }; | ||
37 | watch( | 41 | watch( |
38 | () => props.deviceInfo1, | 42 | () => props.deviceInfo1, |
39 | async (newV) => { | 43 | async (newV) => { |
@@ -49,6 +53,29 @@ | @@ -49,6 +53,29 @@ | ||
49 | }); | 53 | }); |
50 | } | 54 | } |
51 | ); | 55 | ); |
56 | + | ||
57 | + //回显数据 | ||
58 | + const setFieldsFormValueFun = () => { | ||
59 | + if (props.editconditionFather !== 1) { | ||
60 | + setTimeout(() => { | ||
61 | + setFieldsValue(props.editconditionFather); | ||
62 | + }, 100); | ||
63 | + } | ||
64 | + }; | ||
65 | + setFieldsFormValueFun(); | ||
66 | + const editSelectDevice = () => { | ||
67 | + if (props.newConditionMapFather !== 1) { | ||
68 | + setTimeout(() => { | ||
69 | + updateSchema({ | ||
70 | + field: 'deviceId', | ||
71 | + componentProps: { | ||
72 | + options: props.newConditionMapFather, | ||
73 | + }, | ||
74 | + }); | ||
75 | + }, 100); | ||
76 | + } | ||
77 | + }; | ||
78 | + editSelectDevice(); | ||
52 | //新增清空设备选择 | 79 | //新增清空设备选择 |
53 | const clearSelectDevice = () => { | 80 | const clearSelectDevice = () => { |
54 | updateSchema({ | 81 | updateSchema({ |
@@ -58,15 +85,16 @@ | @@ -58,15 +85,16 @@ | ||
58 | }, | 85 | }, |
59 | }); | 86 | }); |
60 | }; | 87 | }; |
61 | - const editSelectDevice = (v) => { | ||
62 | - updateSchema({ | ||
63 | - field: 'deviceId', | ||
64 | - componentProps: { | ||
65 | - options: v, | ||
66 | - }, | ||
67 | - }); | ||
68 | - }; | 88 | + // const editSelectDevice = (v) => { |
89 | + // updateSchema({ | ||
90 | + // field: 'deviceId', | ||
91 | + // componentProps: { | ||
92 | + // options: v, | ||
93 | + // }, | ||
94 | + // }); | ||
95 | + // }; | ||
69 | return { | 96 | return { |
97 | + resetFieldsValueFunc, | ||
70 | clearSelectDevice, | 98 | clearSelectDevice, |
71 | editSelectDevice, | 99 | editSelectDevice, |
72 | getFieldsValueFunc, | 100 | getFieldsValueFunc, |
@@ -21,15 +21,16 @@ | @@ -21,15 +21,16 @@ | ||
21 | 21 | ||
22 | export default defineComponent({ | 22 | export default defineComponent({ |
23 | components: { CollapseContainer, BasicForm, [Input.name]: Input }, | 23 | components: { CollapseContainer, BasicForm, [Input.name]: Input }, |
24 | - props: ['deviceInfo2'], | 24 | + props: ['deviceInfo2', 'editActionFather', 'newActionMapFather'], |
25 | 25 | ||
26 | setup(props) { | 26 | setup(props) { |
27 | const fieldValue: any = ref({}); | 27 | const fieldValue: any = ref({}); |
28 | - const [registerAction, { getFieldsValue, resetFields, updateSchema }] = useForm({ | ||
29 | - labelWidth: 100, | ||
30 | - schemas: useActionDrawerSchema, | ||
31 | - actionColOptions: { span: 24 }, | ||
32 | - }); | 28 | + const [registerAction, { setFieldsValue, getFieldsValue, resetFields, updateSchema }] = |
29 | + useForm({ | ||
30 | + labelWidth: 100, | ||
31 | + schemas: useActionDrawerSchema, | ||
32 | + actionColOptions: { span: 24 }, | ||
33 | + }); | ||
33 | const getFieldsValueFunc = () => { | 34 | const getFieldsValueFunc = () => { |
34 | fieldValue.value = getFieldsValue(); | 35 | fieldValue.value = getFieldsValue(); |
35 | return fieldValue.value; | 36 | return fieldValue.value; |
@@ -52,6 +53,29 @@ | @@ -52,6 +53,29 @@ | ||
52 | }); | 53 | }); |
53 | } | 54 | } |
54 | ); | 55 | ); |
56 | + | ||
57 | + //回显数据 | ||
58 | + const setFieldsFormValueFun = () => { | ||
59 | + if (props.editActionFather !== 1) { | ||
60 | + setTimeout(() => { | ||
61 | + setFieldsValue(props.editActionFather); | ||
62 | + }, 100); | ||
63 | + } | ||
64 | + }; | ||
65 | + setFieldsFormValueFun(); | ||
66 | + const editSelectDevice = () => { | ||
67 | + if (props.newActionMapFather !== 1) { | ||
68 | + setTimeout(() => { | ||
69 | + updateSchema({ | ||
70 | + field: 'deviceId', | ||
71 | + componentProps: { | ||
72 | + options: props.newActionMapFather, | ||
73 | + }, | ||
74 | + }); | ||
75 | + }, 100); | ||
76 | + } | ||
77 | + }; | ||
78 | + editSelectDevice(); | ||
55 | //新增清空设备选择 | 79 | //新增清空设备选择 |
56 | const clearSelectDevice = () => { | 80 | const clearSelectDevice = () => { |
57 | updateSchema({ | 81 | updateSchema({ |
@@ -61,14 +85,14 @@ | @@ -61,14 +85,14 @@ | ||
61 | }, | 85 | }, |
62 | }); | 86 | }); |
63 | }; | 87 | }; |
64 | - const editSelectDevice = (v) => { | ||
65 | - updateSchema({ | ||
66 | - field: 'deviceId', | ||
67 | - componentProps: { | ||
68 | - options: v, | ||
69 | - }, | ||
70 | - }); | ||
71 | - }; | 88 | + // const editSelectDevice = (v) => { |
89 | + // updateSchema({ | ||
90 | + // field: 'deviceId', | ||
91 | + // componentProps: { | ||
92 | + // options: v, | ||
93 | + // }, | ||
94 | + // }); | ||
95 | + // }; | ||
72 | return { | 96 | return { |
73 | clearSelectDevice, | 97 | clearSelectDevice, |
74 | editSelectDevice, | 98 | editSelectDevice, |
@@ -26,11 +26,12 @@ | @@ -26,11 +26,12 @@ | ||
26 | props: ['deviceInfo', 'editTriggerFather', 'newFilterMapFather'], | 26 | props: ['deviceInfo', 'editTriggerFather', 'newFilterMapFather'], |
27 | setup(props) { | 27 | setup(props) { |
28 | const fieldValue: any = ref({}); | 28 | const fieldValue: any = ref({}); |
29 | - const [registerTrigger, { setFieldsValue, getFieldsValue, updateSchema }] = useForm({ | ||
30 | - labelWidth: 100, | ||
31 | - schemas: useTriggerDrawerSchema, | ||
32 | - actionColOptions: { span: 24 }, | ||
33 | - }); | 29 | + const [registerTrigger, { resetFields, setFieldsValue, getFieldsValue, updateSchema }] = |
30 | + useForm({ | ||
31 | + labelWidth: 100, | ||
32 | + schemas: useTriggerDrawerSchema, | ||
33 | + actionColOptions: { span: 24 }, | ||
34 | + }); | ||
34 | const getFieldsValueFunc = () => { | 35 | const getFieldsValueFunc = () => { |
35 | fieldValue.value = getFieldsValue(); | 36 | fieldValue.value = getFieldsValue(); |
36 | return fieldValue.value; | 37 | return fieldValue.value; |
@@ -42,21 +43,34 @@ | @@ -42,21 +43,34 @@ | ||
42 | options.items.forEach((v) => { | 43 | options.items.forEach((v) => { |
43 | return (v.value = v.id), (v.label = v.name); | 44 | return (v.value = v.id), (v.label = v.name); |
44 | }); | 45 | }); |
46 | + updateFieldDeviceId(options.items); | ||
47 | + } | ||
48 | + ); | ||
49 | + const updateFieldDeviceId = (v) => { | ||
50 | + setTimeout(() => { | ||
45 | updateSchema({ | 51 | updateSchema({ |
46 | field: 'deviceId', | 52 | field: 'deviceId', |
47 | componentProps: { | 53 | componentProps: { |
48 | - options: options.items, | 54 | + options: v, |
49 | }, | 55 | }, |
50 | }); | 56 | }); |
51 | - } | ||
52 | - ); | 57 | + }, 10); |
58 | + }; | ||
59 | + const resetFieldsValueFunc = () => { | ||
60 | + setTimeout(() => { | ||
61 | + resetFields(); | ||
62 | + }, 100); | ||
63 | + }; | ||
53 | 64 | ||
54 | //回显数据 | 65 | //回显数据 |
55 | const setFieldsFormValueFun = () => { | 66 | const setFieldsFormValueFun = () => { |
56 | - setTimeout(() => { | ||
57 | - setFieldsValue(props.editTriggerFather); | ||
58 | - }, 100); | 67 | + if (props.editTriggerFather != 1) { |
68 | + setTimeout(() => { | ||
69 | + setFieldsValue(props.editTriggerFather); | ||
70 | + }, 100); | ||
71 | + } | ||
59 | }; | 72 | }; |
73 | + | ||
60 | setFieldsFormValueFun(); | 74 | setFieldsFormValueFun(); |
61 | //新增清空设备选择 | 75 | //新增清空设备选择 |
62 | const clearSelectDevice = () => { | 76 | const clearSelectDevice = () => { |
@@ -68,14 +82,16 @@ | @@ -68,14 +82,16 @@ | ||
68 | }); | 82 | }); |
69 | }; | 83 | }; |
70 | const editSelectDevice = () => { | 84 | const editSelectDevice = () => { |
71 | - setTimeout(() => { | ||
72 | - updateSchema({ | ||
73 | - field: 'deviceId', | ||
74 | - componentProps: { | ||
75 | - options: props.newFilterMapFather, | ||
76 | - }, | ||
77 | - }); | ||
78 | - }, 100); | 85 | + if (props.newFilterMapFather != 1) { |
86 | + setTimeout(() => { | ||
87 | + updateSchema({ | ||
88 | + field: 'deviceId', | ||
89 | + componentProps: { | ||
90 | + options: props.newFilterMapFather, | ||
91 | + }, | ||
92 | + }); | ||
93 | + }, 100); | ||
94 | + } | ||
79 | }; | 95 | }; |
80 | editSelectDevice(); | 96 | editSelectDevice(); |
81 | //新增清空场景触发器选择 | 97 | //新增清空场景触发器选择 |
@@ -96,6 +112,8 @@ | @@ -96,6 +112,8 @@ | ||
96 | }); | 112 | }); |
97 | }; | 113 | }; |
98 | return { | 114 | return { |
115 | + updateFieldDeviceId, | ||
116 | + resetFieldsValueFunc, | ||
99 | clearSelectScene, | 117 | clearSelectScene, |
100 | editSelectScene, | 118 | editSelectScene, |
101 | clearSelectDevice, | 119 | clearSelectDevice, |
@@ -90,6 +90,10 @@ | @@ -90,6 +90,10 @@ | ||
90 | function handleAdd() { | 90 | function handleAdd() { |
91 | try { | 91 | try { |
92 | proxy.$refs.sceneLinkAgeDrawerRef.clearAllArrayFunc(); | 92 | proxy.$refs.sceneLinkAgeDrawerRef.clearAllArrayFunc(); |
93 | + setTimeout(() => { | ||
94 | + proxy.$refs.sceneLinkAgeDrawerRef.defaultAddTrigger(); | ||
95 | + }, 10); | ||
96 | + proxy.$refs.sceneLinkAgeDrawerRef.defaultAddCondition(); | ||
93 | proxy.$refs.sceneLinkAgeDrawerRef.defaultAddAction(); | 97 | proxy.$refs.sceneLinkAgeDrawerRef.defaultAddAction(); |
94 | proxy.$refs.sceneLinkAgeDrawerRef.resetActionsAllArrayFunc(); | 98 | proxy.$refs.sceneLinkAgeDrawerRef.resetActionsAllArrayFunc(); |
95 | proxy.$refs.sceneLinkAgeDrawerRef.clearActionsAllDevice(); | 99 | proxy.$refs.sceneLinkAgeDrawerRef.clearActionsAllDevice(); |
@@ -16,11 +16,11 @@ | @@ -16,11 +16,11 @@ | ||
16 | :key="index" | 16 | :key="index" |
17 | > | 17 | > |
18 | <span style="display: none">{{ item + index }}</span> | 18 | <span style="display: none">{{ item + index }}</span> |
19 | - <span style="position: relative; top: 3.2vh; left: 0.3vw">触发器{{ index + 1 }}</span> | ||
20 | - <div> | 19 | + <span style="position: relative; top: 3.2vh; left: 0.3vw">触发器 {{ index + 1 }}</span> |
20 | + <div style="display: block"> | ||
21 | <AddTriggerForm | 21 | <AddTriggerForm |
22 | - :editTriggerFather="isUpdate == false ? null : item" | ||
23 | - :newFilterMapFather="isUpdate == false ? null : newFilterMap" | 22 | + :editTriggerFather="isUpdate == false ? 1 : item" |
23 | + :newFilterMapFather="isUpdate == false ? 1 : newFilterMap" | ||
24 | :deviceInfo="getDeviceInfo" | 24 | :deviceInfo="getDeviceInfo" |
25 | ref="refTriggerChild" | 25 | ref="refTriggerChild" |
26 | /> | 26 | /> |
@@ -57,12 +57,20 @@ | @@ -57,12 +57,20 @@ | ||
57 | <div style="height: 5vh"></div> | 57 | <div style="height: 5vh"></div> |
58 | <!-- 执行条件 --> | 58 | <!-- 执行条件 --> |
59 | <div> | 59 | <div> |
60 | - <template v-for="(item, index) in addConditionPushData" :key="index"> | 60 | + <template |
61 | + v-for="(item, index) in isUpdate == false ? addConditionPushData : editConditionPushData" | ||
62 | + :key="index" | ||
63 | + > | ||
61 | <span style="display: none">{{ item + index }}</span> | 64 | <span style="display: none">{{ item + index }}</span> |
62 | - <span style="position: relative; top: 3.2vh; left: 0.3vw">执行条件{{ index + 1 }}</span> | 65 | + <span style="position: relative; top: 3.2vh; left: 0.3vw">执行条件 {{ index + 1 }}</span> |
63 | 66 | ||
64 | <div> | 67 | <div> |
65 | - <AddConditiForm :deviceInfo1="getDeviceInfo1" ref="refConditionChild" /> | 68 | + <AddConditiForm |
69 | + :editConditionFather="isUpdate == false ? 1 : item" | ||
70 | + :newConditionMapFather="isUpdate == false ? 1 : newConditionFilterMap" | ||
71 | + :deviceInfo1="getDeviceInfo1" | ||
72 | + ref="refConditionChild" | ||
73 | + /> | ||
66 | </div> | 74 | </div> |
67 | <div style="height: 3vh"></div> | 75 | <div style="height: 3vh"></div> |
68 | </template> | 76 | </template> |
@@ -82,7 +90,7 @@ | @@ -82,7 +90,7 @@ | ||
82 | </div> | 90 | </div> |
83 | <div style="display: flex; width: 4vw; height: 4vh"> | 91 | <div style="display: flex; width: 4vw; height: 4vh"> |
84 | <Button | 92 | <Button |
85 | - v-if="addConditionPushData.length != 0" | 93 | + v-if="addConditionPushData.length != 0 || addConditionPushData.length != 0" |
86 | style="border-radius: 10px; background-color: rgba(237, 111, 111, 1)" | 94 | style="border-radius: 10px; background-color: rgba(237, 111, 111, 1)" |
87 | type="default" | 95 | type="default" |
88 | class="mt-5" | 96 | class="mt-5" |
@@ -96,12 +104,20 @@ | @@ -96,12 +104,20 @@ | ||
96 | <!-- 执行动作 --> | 104 | <!-- 执行动作 --> |
97 | <div style="height: 5vh"></div> | 105 | <div style="height: 5vh"></div> |
98 | <div> | 106 | <div> |
99 | - <template v-for="(item, index) in addActionPushData" :key="index"> | 107 | + <template |
108 | + v-for="(item, index) in isUpdate == false ? addActionPushData : editActionPushData" | ||
109 | + :key="index" | ||
110 | + > | ||
100 | <span style="display: none">{{ item + index }}</span> | 111 | <span style="display: none">{{ item + index }}</span> |
101 | - <span style="position: relative; top: 4.2vh; left: 0.65vw">执行动作{{ index + 1 }}</span> | 112 | + <span style="position: relative; top: 4.2vh; left: 0.65vw">执行动作 {{ index + 1 }}</span> |
102 | 113 | ||
103 | <div> | 114 | <div> |
104 | - <AddActionForm :deviceInfo2="getDeviceInfo2" ref="refActionChild" /> | 115 | + <AddActionForm |
116 | + :editActionFather="isUpdate == false ? 1 : item" | ||
117 | + :newActionMapFather="isUpdate == false ? 1 : newActionFilterMap" | ||
118 | + :deviceInfo2="getDeviceInfo2" | ||
119 | + ref="refActionChild" | ||
120 | + /> | ||
105 | </div> | 121 | </div> |
106 | <div style="height: 3vh"></div> | 122 | <div style="height: 3vh"></div> |
107 | </template> | 123 | </template> |
@@ -121,7 +137,7 @@ | @@ -121,7 +137,7 @@ | ||
121 | </div> | 137 | </div> |
122 | <div style="display: flex; width: 4vw; height: 4vh"> | 138 | <div style="display: flex; width: 4vw; height: 4vh"> |
123 | <Button | 139 | <Button |
124 | - v-if="addActionPushData.length > 0" | 140 | + v-if="addActionPushData.length > 0 || addActionPushData.length > 0" |
125 | style="border-radius: 10px; background-color: rgba(237, 111, 111, 1)" | 141 | style="border-radius: 10px; background-color: rgba(237, 111, 111, 1)" |
126 | type="default" | 142 | type="default" |
127 | class="mt-5" | 143 | class="mt-5" |
@@ -168,6 +184,8 @@ | @@ -168,6 +184,8 @@ | ||
168 | const { proxy } = getCurrentInstance(); | 184 | const { proxy } = getCurrentInstance(); |
169 | const lastRefTriggerChildDataArray = ref<[]>([]); | 185 | const lastRefTriggerChildDataArray = ref<[]>([]); |
170 | const lastEditRefTriggerChildDataArray = ref<[]>([]); | 186 | const lastEditRefTriggerChildDataArray = ref<[]>([]); |
187 | + const lastEditRefConditionChildDataArray = ref<[]>([]); | ||
188 | + const lastEditRefActionChildDataArray = ref<[]>([]); | ||
171 | const lastRefConditionChildDataArray = ref<[]>([]); | 189 | const lastRefConditionChildDataArray = ref<[]>([]); |
172 | const lastRefActionChildDataArray = ref<[]>([]); | 190 | const lastRefActionChildDataArray = ref<[]>([]); |
173 | const lastRefTriggerChildData: any = ref({}); | 191 | const lastRefTriggerChildData: any = ref({}); |
@@ -207,6 +225,8 @@ | @@ -207,6 +225,8 @@ | ||
207 | const addActionPushData = ref<[]>([]); | 225 | const addActionPushData = ref<[]>([]); |
208 | //edit data | 226 | //edit data |
209 | const editTriggerPushData = ref<[]>([]); | 227 | const editTriggerPushData = ref<[]>([]); |
228 | + const editConditionPushData = ref<[]>([]); | ||
229 | + const editActionPushData = ref<[]>([]); | ||
210 | const getChildData = ref(null); | 230 | const getChildData = ref(null); |
211 | const refTriggerChild = ref(null); | 231 | const refTriggerChild = ref(null); |
212 | const refConditionChild = ref(null); | 232 | const refConditionChild = ref(null); |
@@ -222,6 +242,8 @@ | @@ -222,6 +242,8 @@ | ||
222 | const getDeviceInfo1 = ref(null); | 242 | const getDeviceInfo1 = ref(null); |
223 | const getDeviceInfo2 = ref(null); | 243 | const getDeviceInfo2 = ref(null); |
224 | const newFilterMap = ref<[]>([]); | 244 | const newFilterMap = ref<[]>([]); |
245 | + const newConditionFilterMap = ref<[]>([]); | ||
246 | + const newActionFilterMap = ref<[]>([]); | ||
225 | 247 | ||
226 | const [registerForm, { resetFields, setFieldsValue, validateFields }] = useForm({ | 248 | const [registerForm, { resetFields, setFieldsValue, validateFields }] = useForm({ |
227 | labelWidth: 120, | 249 | labelWidth: 120, |
@@ -234,18 +256,26 @@ | @@ -234,18 +256,26 @@ | ||
234 | setDrawerProps({ confirmLoading: false }); | 256 | setDrawerProps({ confirmLoading: false }); |
235 | isUpdate.value = !!data?.isUpdate; | 257 | isUpdate.value = !!data?.isUpdate; |
236 | if (!unref(isUpdate)) { | 258 | if (!unref(isUpdate)) { |
259 | + editTriggerPushData.value = []; | ||
260 | + editTriggerPushData.value.length = 0; | ||
237 | try { | 261 | try { |
238 | - proxy.$refs.refTriggerChild.clearSelectDevice(); | ||
239 | - proxy.$refs.refTriggerChild.clearSelectScene(); | ||
240 | - proxy.$refs.refConditionChild.clearSelectDevice(); | ||
241 | - proxy.$refs.refActionChild.clearSelectDevice(); | 262 | + setTimeout(() => { |
263 | + // proxy.$refs.refTriggerChild.resetFieldsValueFunc(); | ||
264 | + proxy.$refs.refConditionChild.resetFieldsValueFunc(); | ||
265 | + proxy.$refs.refActionChild.resetFieldsValueFunc(); | ||
266 | + }, 50); | ||
242 | } catch (e) { | 267 | } catch (e) { |
243 | return e; | 268 | return e; |
244 | } | 269 | } |
245 | } else { | 270 | } else { |
246 | newFilterMap.value = []; | 271 | newFilterMap.value = []; |
272 | + newConditionFilterMap.value = []; | ||
273 | + newActionFilterMap.value = []; | ||
247 | clearAllArrayFunc(); | 274 | clearAllArrayFunc(); |
248 | editTriggerPushData.value = []; | 275 | editTriggerPushData.value = []; |
276 | + editTriggerPushData.value.length = 0; | ||
277 | + editConditionPushData.value = []; | ||
278 | + editActionPushData.value = []; | ||
249 | lastEditRefTriggerChildDataArray.value = []; | 279 | lastEditRefTriggerChildDataArray.value = []; |
250 | getId.value = data.record.id; | 280 | getId.value = data.record.id; |
251 | getTenantId.value = data.record.tenantId; | 281 | getTenantId.value = data.record.tenantId; |
@@ -253,19 +283,52 @@ | @@ -253,19 +283,52 @@ | ||
253 | ...data.record, | 283 | ...data.record, |
254 | }); | 284 | }); |
255 | editTriggerPushData.value = data.record.triggers; | 285 | editTriggerPushData.value = data.record.triggers; |
286 | + editTriggerPushData.value.forEach((f) => { | ||
287 | + if (f?.id.length == 18) { | ||
288 | + editTriggerPushData.value.pop(); | ||
289 | + if (editTriggerPushData.value.length) { | ||
290 | + editTriggerPushData.value.length = editTriggerPushData.value.length; | ||
291 | + } | ||
292 | + } | ||
293 | + }); | ||
294 | + editConditionPushData.value = data.record.doConditions; | ||
295 | + editActionPushData.value = data.record.doActions; | ||
256 | const options = await screenLinkPageByDeptIdGetDevice({ | 296 | const options = await screenLinkPageByDeptIdGetDevice({ |
257 | organizationId: data.record.organizationId, | 297 | organizationId: data.record.organizationId, |
258 | }); | 298 | }); |
259 | - data.record.triggers.forEach((f1) => { | ||
260 | - options.items.forEach((f2) => { | ||
261 | - if (f2.id == f1.deviceId) { | ||
262 | - newFilterMap.value.push({ | ||
263 | - value: f2.id, | ||
264 | - label: f2.name, | ||
265 | - }); | ||
266 | - } | 299 | + try { |
300 | + data.record.triggers.forEach((f1) => { | ||
301 | + options.items?.forEach((f2) => { | ||
302 | + if (f2.id == f1.deviceId) { | ||
303 | + newFilterMap.value.push({ | ||
304 | + value: f2.id, | ||
305 | + label: f2.name, | ||
306 | + }); | ||
307 | + } | ||
308 | + }); | ||
267 | }); | 309 | }); |
268 | - }); | 310 | + |
311 | + data.record.doConditions.forEach((f1) => { | ||
312 | + options.items?.forEach((f2) => { | ||
313 | + if (f2.id == f1.deviceId) { | ||
314 | + newConditionFilterMap.value.push({ | ||
315 | + value: f2.id, | ||
316 | + label: f2.name, | ||
317 | + }); | ||
318 | + } | ||
319 | + }); | ||
320 | + }); | ||
321 | + data.record.doActions.forEach((f1) => { | ||
322 | + options.items?.forEach((f2) => { | ||
323 | + if (f2.id == f1.deviceId) { | ||
324 | + newActionFilterMap.value.push({ | ||
325 | + value: f2.id, | ||
326 | + label: f2.name, | ||
327 | + }); | ||
328 | + } | ||
329 | + }); | ||
330 | + }); | ||
331 | + } catch (e) {} | ||
269 | } | 332 | } |
270 | }); | 333 | }); |
271 | const getTitle = computed(() => (!unref(isUpdate) ? '新增场景联动' : '编辑场景联动')); | 334 | const getTitle = computed(() => (!unref(isUpdate) ? '新增场景联动' : '编辑场景联动')); |
@@ -353,6 +416,8 @@ | @@ -353,6 +416,8 @@ | ||
353 | refConditionChildDataFunc(); | 416 | refConditionChildDataFunc(); |
354 | refActionChildDataFunc(); | 417 | refActionChildDataFunc(); |
355 | lastEditRefTriggerChildDataArray.value.push(refTriggerChildData.value as never); | 418 | lastEditRefTriggerChildDataArray.value.push(refTriggerChildData.value as never); |
419 | + lastEditRefConditionChildDataArray.value.push(refConditionChildData.value as never); | ||
420 | + lastEditRefActionChildDataArray.value.push(refActionChildData.value as never); | ||
356 | lastRefConditionChildDataArray.value.push(refConditionChildData.value as never); | 421 | lastRefConditionChildDataArray.value.push(refConditionChildData.value as never); |
357 | lastRefActionChildDataArray.value.push(refActionChildData.value as never); | 422 | lastRefActionChildDataArray.value.push(refActionChildData.value as never); |
358 | const triggersObj = { | 423 | const triggersObj = { |
@@ -365,6 +430,7 @@ | @@ -365,6 +430,7 @@ | ||
365 | doActions: lastRefActionChildDataArray.value, | 430 | doActions: lastRefActionChildDataArray.value, |
366 | }; | 431 | }; |
367 | Object.assign(getAllFormData, triggersObj, conditionsObj, actionsObj); | 432 | Object.assign(getAllFormData, triggersObj, conditionsObj, actionsObj); |
433 | + console.log(getAllFormData); | ||
368 | } | 434 | } |
369 | }; | 435 | }; |
370 | 436 | ||
@@ -381,7 +447,6 @@ | @@ -381,7 +447,6 @@ | ||
381 | } else { | 447 | } else { |
382 | getDefaultValue(); | 448 | getDefaultValue(); |
383 | getValuesFormData = await validateFields(); | 449 | getValuesFormData = await validateFields(); |
384 | - if (!getValuesFormData) return; | ||
385 | Object.assign(getAllFormData, getValuesFormData); | 450 | Object.assign(getAllFormData, getValuesFormData); |
386 | getAllFormData.id = getId.value; | 451 | getAllFormData.id = getId.value; |
387 | getAllFormData.tenantId = getTenantId.value; | 452 | getAllFormData.tenantId = getTenantId.value; |
@@ -391,6 +456,13 @@ | @@ -391,6 +456,13 @@ | ||
391 | emit('success'); | 456 | emit('success'); |
392 | } | 457 | } |
393 | }; | 458 | }; |
459 | + const defaultAddTrigger = () => { | ||
460 | + if (unref(addTriggerPushData).length == 0) { | ||
461 | + setTimeout(() => { | ||
462 | + addTrigger(); | ||
463 | + }, 10); | ||
464 | + } | ||
465 | + }; | ||
394 | 466 | ||
395 | //新增触发器 | 467 | //新增触发器 |
396 | const addTrigger = () => { | 468 | const addTrigger = () => { |
@@ -426,6 +498,21 @@ | @@ -426,6 +498,21 @@ | ||
426 | 498 | ||
427 | //新增执行条件 | 499 | //新增执行条件 |
428 | const addCondition = () => { | 500 | const addCondition = () => { |
501 | + // if (!unref(isUpdate)) { | ||
502 | + // console.log('add'); | ||
503 | + // unref(addConditionPushData).push(addConditionData as never); | ||
504 | + // refConditionChildDataFunc(); | ||
505 | + // lastRefConditionChildData.value = refConditionChildData.value; | ||
506 | + // lastRefConditionChildDataArray.value.push(lastRefConditionChildData.value as never); | ||
507 | + // } else { | ||
508 | + // console.log('edit'); | ||
509 | + | ||
510 | + // unref(editConditionPushData).push(addConditionData as never); | ||
511 | + // console.log(unref(editConditionPushData)); | ||
512 | + // refConditionChildDataFunc(); | ||
513 | + // lastRefConditionChildData.value = refConditionChildData.value; | ||
514 | + // lastEditRefConditionChildDataArray.value.push(lastRefConditionChildData.value as never); | ||
515 | + // } | ||
429 | unref(addConditionPushData).push(addConditionData as never); | 516 | unref(addConditionPushData).push(addConditionData as never); |
430 | refConditionChildDataFunc(); | 517 | refConditionChildDataFunc(); |
431 | lastRefConditionChildData.value = refConditionChildData.value; | 518 | lastRefConditionChildData.value = refConditionChildData.value; |
@@ -446,7 +533,24 @@ | @@ -446,7 +533,24 @@ | ||
446 | addAction(); | 533 | addAction(); |
447 | } | 534 | } |
448 | }; | 535 | }; |
536 | + | ||
537 | + const defaultAddCondition = () => { | ||
538 | + if (unref(addConditionPushData).length == 0) { | ||
539 | + addCondition(); | ||
540 | + } | ||
541 | + }; | ||
449 | const addAction = () => { | 542 | const addAction = () => { |
543 | + // if (!unref(isUpdate)) { | ||
544 | + // unref(addActionPushData).push(addActionData as never); | ||
545 | + // refActionChildDataFunc(); | ||
546 | + // lastRefActionChildData.value = refActionChildData.value; | ||
547 | + // lastRefActionChildDataArray.value.push(lastRefActionChildData.value as never); | ||
548 | + // } else { | ||
549 | + // unref(editActionPushData).push(addActionData as never); | ||
550 | + // refActionChildDataFunc(); | ||
551 | + // lastRefActionChildData.value = refActionChildData.value; | ||
552 | + // lastEditRefActionChildDataArray.value.push(lastRefActionChildData.value as never); | ||
553 | + // } | ||
450 | unref(addActionPushData).push(addActionData as never); | 554 | unref(addActionPushData).push(addActionData as never); |
451 | refActionChildDataFunc(); | 555 | refActionChildDataFunc(); |
452 | lastRefActionChildData.value = refActionChildData.value; | 556 | lastRefActionChildData.value = refActionChildData.value; |
@@ -462,8 +566,14 @@ | @@ -462,8 +566,14 @@ | ||
462 | }; | 566 | }; |
463 | 567 | ||
464 | return { | 568 | return { |
569 | + defaultAddTrigger, | ||
570 | + defaultAddCondition, | ||
465 | newFilterMap, | 571 | newFilterMap, |
572 | + newConditionFilterMap, | ||
573 | + newActionFilterMap, | ||
466 | editTriggerPushData, | 574 | editTriggerPushData, |
575 | + editConditionPushData, | ||
576 | + editActionPushData, | ||
467 | isUpdate, | 577 | isUpdate, |
468 | clearActionsAllDevice, | 578 | clearActionsAllDevice, |
469 | getDeviceInfo, | 579 | getDeviceInfo, |