Showing
21 changed files
with
595 additions
and
160 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="告警配置" /> |
@@ -79,6 +79,7 @@ | @@ -79,6 +79,7 @@ | ||
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({}); |
@@ -90,8 +91,10 @@ | @@ -90,8 +91,10 @@ | ||
90 | const postEditId = ref(''); | 91 | const postEditId = ref(''); |
91 | const current = ref(0); | 92 | const current = ref(0); |
92 | const isUpdate = ref(true); | 93 | const isUpdate = ref(true); |
93 | - | ||
94 | const getTitle = computed(() => (!unref(isUpdate) ? '新增设备配置' : '编辑设备配置')); | 94 | const getTitle = computed(() => (!unref(isUpdate) ? '新增设备配置' : '编辑设备配置')); |
95 | + const handleChange = (v) => { | ||
96 | + console.log(v); | ||
97 | + }; | ||
95 | const [register, { closeModal }] = useModalInner(async (data) => { | 98 | const [register, { closeModal }] = useModalInner(async (data) => { |
96 | isUpdate.value = !!data?.isUpdate; | 99 | isUpdate.value = !!data?.isUpdate; |
97 | if (!unref(isUpdate)) { | 100 | if (!unref(isUpdate)) { |
@@ -287,7 +290,8 @@ | @@ -287,7 +290,8 @@ | ||
287 | createMessage.success('新增设备配置成功'); | 290 | createMessage.success('新增设备配置成功'); |
288 | closeModal(); | 291 | closeModal(); |
289 | emit('success'); | 292 | emit('success'); |
290 | - } else { | 293 | + } |
294 | + if (unref(isUpdate)) { | ||
291 | postDeviceConfogData.value.id = postEditId.value; | 295 | postDeviceConfogData.value.id = postEditId.value; |
292 | isGetStepThreeData.value.profileData = getStepThreeData.value; | 296 | isGetStepThreeData.value.profileData = getStepThreeData.value; |
293 | alarmProfileData.value.alarmProfile = | 297 | alarmProfileData.value.alarmProfile = |
@@ -309,11 +313,13 @@ | @@ -309,11 +313,13 @@ | ||
309 | closeModal(); | 313 | closeModal(); |
310 | }; | 314 | }; |
311 | return { | 315 | return { |
316 | + handleChange, | ||
312 | DeviceProfileStep2Ref, | 317 | DeviceProfileStep2Ref, |
313 | DeviceProfileStep3Ref, | 318 | DeviceProfileStep3Ref, |
314 | DeviceProfileStep4Ref, | 319 | DeviceProfileStep4Ref, |
315 | DeviceProfileStep1Ref, | 320 | DeviceProfileStep1Ref, |
316 | editEchoData, | 321 | editEchoData, |
322 | + // getStepData, | ||
317 | handleStep3Next, | 323 | handleStep3Next, |
318 | handleSubmit, | 324 | handleSubmit, |
319 | handleCancel, | 325 | 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, |
@@ -207,7 +207,7 @@ | @@ -207,7 +207,7 @@ | ||
207 | 207 | ||
208 | <script lang="ts"> | 208 | <script lang="ts"> |
209 | import { defineComponent, ref, unref, getCurrentInstance, watch } from 'vue'; | 209 | import { defineComponent, ref, unref, getCurrentInstance, watch } from 'vue'; |
210 | - import type { IProfileData } from './index.t'; | 210 | + import type { IProfileData } from '../types/index'; |
211 | import { CollapseContainer } from '/@/components/Container/index'; | 211 | import { CollapseContainer } from '/@/components/Container/index'; |
212 | import { BasicForm, useForm } from '/@/components/Form'; | 212 | import { BasicForm, useForm } from '/@/components/Form'; |
213 | import { | 213 | import { |
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 |
@@ -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, |