1
|
<template>
|
1
|
<template>
|
2
|
- <div>
|
|
|
3
|
- <BasicDrawer
|
|
|
4
|
- v-bind="$attrs"
|
|
|
5
|
- @register="registerDrawer"
|
|
|
6
|
- showFooter
|
|
|
7
|
- :title="getTitle"
|
|
|
8
|
- width="1000px"
|
|
|
9
|
- @ok="handleSubmit"
|
|
|
10
|
- @close="handleCancel"
|
|
|
11
|
- >
|
2
|
+ <BasicDrawer
|
|
|
3
|
+ v-bind="$attrs"
|
|
|
4
|
+ @register="registerDrawer"
|
|
|
5
|
+ showFooter
|
|
|
6
|
+ :title="getTitle"
|
|
|
7
|
+ width="1000px"
|
|
|
8
|
+ @ok="handleSubmit"
|
|
|
9
|
+ >
|
|
|
10
|
+ <div>
|
|
|
11
|
+ <BasicForm @register="registerForm" />
|
|
|
12
|
+ <!-- 触发器 -->
|
12
|
<div>
|
13
|
<div>
|
13
|
- <BasicForm @register="registerForm" />
|
|
|
14
|
- <!-- 触发器 -->
|
|
|
15
|
- <div>
|
|
|
16
|
- <template
|
|
|
17
|
- v-for="(item, index) in isUpdate == false ? addTriggerPushData : editTriggerPushData"
|
|
|
18
|
- :key="index"
|
|
|
19
|
- >
|
|
|
20
|
- <span style="display: none">{{ item + index }}</span>
|
|
|
21
|
- <span style="position: relative; top: 3.2vh; left: 0.3vw">触发器 {{ index + 1 }}</span>
|
|
|
22
|
- <div style="display: block">
|
|
|
23
|
- <AddTriggerForm
|
|
|
24
|
- :editTriggerFather="isUpdate == false ? 1 : item"
|
|
|
25
|
- :newFilterMapFather="isUpdate == false ? 1 : newFilterMap"
|
|
|
26
|
- :deviceInfo="getDeviceInfo"
|
|
|
27
|
- ref="refTriggerChild"
|
|
|
28
|
- />
|
|
|
29
|
- </div>
|
|
|
30
|
- <div style="height: 3vh"></div>
|
|
|
31
|
- </template>
|
|
|
32
|
- <div
|
|
|
33
|
- style="
|
|
|
34
|
- display: flex;
|
|
|
35
|
- width: 11vw;
|
|
|
36
|
- height: 4vh;
|
|
|
37
|
- flex-direction: row;
|
|
|
38
|
- justify-content: space-between;
|
|
|
39
|
- "
|
|
|
40
|
- >
|
|
|
41
|
- <div style="display: flex; width: 4vw; height: 4vh">
|
|
|
42
|
- <Button type="primary" style="border-radius: 10px" class="mt-5" @click="addTrigger"
|
|
|
43
|
- >新增触发器</Button
|
|
|
44
|
- >
|
|
|
45
|
- </div>
|
|
|
46
|
- <div style="display: flex; width: 4vw; height: 4vh">
|
|
|
47
|
- <Button
|
|
|
48
|
- v-if="addTriggerPushData.length != 0 || editTriggerPushData.length != 0"
|
|
|
49
|
- type="default"
|
|
|
50
|
- style="border-radius: 10px; background-color: rgba(237, 111, 111, 1)"
|
|
|
51
|
- class="mt-5"
|
|
|
52
|
- @click="removeTrigger"
|
|
|
53
|
- >
|
|
|
54
|
- <span style="color: white">删除</span></Button
|
|
|
55
|
- >
|
|
|
56
|
- </div>
|
14
|
+ <template
|
|
|
15
|
+ v-for="(item, index) in isUpdate == false ? addTriggerPushData : editTriggerPushData"
|
|
|
16
|
+ :key="index"
|
|
|
17
|
+ >
|
|
|
18
|
+ <span style="display: none">{{ item + index }}</span>
|
|
|
19
|
+ <span style="position: relative; top: 3.2vh; left: 0.3vw">触发器 {{ index + 1 }}</span>
|
|
|
20
|
+ <div style="display: block">
|
|
|
21
|
+ <AddTriggerForm
|
|
|
22
|
+ :editTriggerFather="isUpdate == false ? 1 : item"
|
|
|
23
|
+ :newFilterMapFather="isUpdate == false ? 1 : newFilterMap"
|
|
|
24
|
+ :deviceInfo="getDeviceInfo"
|
|
|
25
|
+ ref="refTriggerChild"
|
|
|
26
|
+ />
|
57
|
</div>
|
27
|
</div>
|
58
|
- </div>
|
|
|
59
|
- <div style="height: 5vh"></div>
|
|
|
60
|
- <!-- 执行条件 -->
|
|
|
61
|
- <div>
|
|
|
62
|
- <template
|
|
|
63
|
- v-for="(item, index) in isUpdate == false
|
|
|
64
|
- ? addConditionPushData
|
|
|
65
|
- : editConditionPushData"
|
|
|
66
|
- :key="index"
|
|
|
67
|
- >
|
|
|
68
|
- <span style="display: none">{{ item + index }}</span>
|
|
|
69
|
- <span style="position: relative; top: 3.2vh; left: 0.3vw"
|
|
|
70
|
- >执行条件 {{ index + 1 }}</span
|
28
|
+ <div style="height: 3vh"></div>
|
|
|
29
|
+ </template>
|
|
|
30
|
+ <div
|
|
|
31
|
+ style="
|
|
|
32
|
+ display: flex;
|
|
|
33
|
+ width: 11vw;
|
|
|
34
|
+ height: 4vh;
|
|
|
35
|
+ flex-direction: row;
|
|
|
36
|
+ justify-content: space-between;
|
|
|
37
|
+ "
|
|
|
38
|
+ >
|
|
|
39
|
+ <div style="display: flex; width: 4vw; height: 4vh">
|
|
|
40
|
+ <Button type="primary" style="border-radius: 10px" class="mt-5" @click="addTrigger"
|
|
|
41
|
+ >新增触发器</Button
|
|
|
42
|
+ >
|
|
|
43
|
+ </div>
|
|
|
44
|
+ <div style="display: flex; width: 4vw; height: 4vh">
|
|
|
45
|
+ <Button
|
|
|
46
|
+ v-if="addTriggerPushData.length != 0 || editTriggerPushData.length != 0"
|
|
|
47
|
+ type="default"
|
|
|
48
|
+ style="border-radius: 10px; background-color: rgba(237, 111, 111, 1)"
|
|
|
49
|
+ class="mt-5"
|
|
|
50
|
+ @click="removeTrigger"
|
|
|
51
|
+ >
|
|
|
52
|
+ <span style="color: white">删除</span></Button
|
71
|
>
|
53
|
>
|
72
|
-
|
|
|
73
|
- <div>
|
|
|
74
|
- <AddConditiForm
|
|
|
75
|
- :editConditionFather="isUpdate == false ? 1 : item"
|
|
|
76
|
- :newConditionMapFather="isUpdate == false ? 1 : newConditionFilterMap"
|
|
|
77
|
- :deviceInfo1="getDeviceInfo1"
|
|
|
78
|
- ref="refConditionChild"
|
|
|
79
|
- />
|
|
|
80
|
- </div>
|
|
|
81
|
- <div style="height: 3vh"></div>
|
|
|
82
|
- </template>
|
|
|
83
|
- <div
|
|
|
84
|
- style="
|
|
|
85
|
- display: flex;
|
|
|
86
|
- width: 11vw;
|
|
|
87
|
- height: 4vh;
|
|
|
88
|
- flex-direction: row;
|
|
|
89
|
- justify-content: space-between;
|
|
|
90
|
- "
|
|
|
91
|
- >
|
|
|
92
|
- <div style="display: flex; width: 4vw; height: 4vh">
|
|
|
93
|
- <Button type="primary" style="border-radius: 10px" class="mt-5" @click="addCondition"
|
|
|
94
|
- >新增执行条件</Button
|
|
|
95
|
- >
|
|
|
96
|
- </div>
|
|
|
97
|
- <div style="display: flex; width: 4vw; height: 4vh">
|
|
|
98
|
- <Button
|
|
|
99
|
- v-if="addConditionPushData.length != 0 || editConditionPushData.length != 0"
|
|
|
100
|
- style="border-radius: 10px; background-color: rgba(237, 111, 111, 1)"
|
|
|
101
|
- type="default"
|
|
|
102
|
- class="mt-5"
|
|
|
103
|
- @click="removeCondition"
|
|
|
104
|
- >
|
|
|
105
|
- <span style="color: white">删除</span></Button
|
|
|
106
|
- >
|
|
|
107
|
- </div>
|
|
|
108
|
</div>
|
54
|
</div>
|
109
|
</div>
|
55
|
</div>
|
110
|
- <!-- 执行动作 -->
|
|
|
111
|
- <div style="height: 5vh"></div>
|
|
|
112
|
- <div>
|
|
|
113
|
- <template
|
|
|
114
|
- v-for="(item, index) in isUpdate == false ? addActionPushData : editActionPushData"
|
|
|
115
|
- :key="index"
|
|
|
116
|
- >
|
|
|
117
|
- <span style="display: none">{{ item + index }}</span>
|
|
|
118
|
- <span style="position: relative; top: 4.2vh; left: 0.65vw"
|
|
|
119
|
- >执行动作 {{ index + 1 }}</span
|
56
|
+ </div>
|
|
|
57
|
+ <div style="height: 5vh"></div>
|
|
|
58
|
+ <!-- 执行条件 -->
|
|
|
59
|
+ <div>
|
|
|
60
|
+ <template
|
|
|
61
|
+ v-for="(item, index) in isUpdate == false ? addConditionPushData : editConditionPushData"
|
|
|
62
|
+ :key="index"
|
|
|
63
|
+ >
|
|
|
64
|
+ <span style="display: none">{{ item + index }}</span>
|
|
|
65
|
+ <span style="position: relative; top: 3.2vh; left: 0.3vw">执行条件 {{ index + 1 }}</span>
|
|
|
66
|
+
|
|
|
67
|
+ <div>
|
|
|
68
|
+ <AddConditiForm
|
|
|
69
|
+ :editConditionFather="isUpdate == false ? 1 : item"
|
|
|
70
|
+ :newConditionMapFather="isUpdate == false ? 1 : newConditionFilterMap"
|
|
|
71
|
+ :deviceInfo1="getDeviceInfo1"
|
|
|
72
|
+ ref="refConditionChild"
|
|
|
73
|
+ />
|
|
|
74
|
+ </div>
|
|
|
75
|
+ <div style="height: 3vh"></div>
|
|
|
76
|
+ </template>
|
|
|
77
|
+ <div
|
|
|
78
|
+ style="
|
|
|
79
|
+ display: flex;
|
|
|
80
|
+ width: 11vw;
|
|
|
81
|
+ height: 4vh;
|
|
|
82
|
+ flex-direction: row;
|
|
|
83
|
+ justify-content: space-between;
|
|
|
84
|
+ "
|
|
|
85
|
+ >
|
|
|
86
|
+ <div style="display: flex; width: 4vw; height: 4vh">
|
|
|
87
|
+ <Button type="primary" style="border-radius: 10px" class="mt-5" @click="addCondition"
|
|
|
88
|
+ >新增执行条件</Button
|
|
|
89
|
+ >
|
|
|
90
|
+ </div>
|
|
|
91
|
+ <div style="display: flex; width: 4vw; height: 4vh">
|
|
|
92
|
+ <Button
|
|
|
93
|
+ v-if="addConditionPushData.length != 0 || addConditionPushData.length != 0"
|
|
|
94
|
+ style="border-radius: 10px; background-color: rgba(237, 111, 111, 1)"
|
|
|
95
|
+ type="default"
|
|
|
96
|
+ class="mt-5"
|
|
|
97
|
+ @click="removeCondition"
|
120
|
>
|
98
|
>
|
|
|
99
|
+ <span style="color: white">删除</span></Button
|
|
|
100
|
+ >
|
|
|
101
|
+ </div>
|
|
|
102
|
+ </div>
|
|
|
103
|
+ </div>
|
|
|
104
|
+ <!-- 执行动作 -->
|
|
|
105
|
+ <div style="height: 5vh"></div>
|
|
|
106
|
+ <div>
|
|
|
107
|
+ <template
|
|
|
108
|
+ v-for="(item, index) in isUpdate == false ? addActionPushData : editActionPushData"
|
|
|
109
|
+ :key="index"
|
|
|
110
|
+ >
|
|
|
111
|
+ <span style="display: none">{{ item + index }}</span>
|
|
|
112
|
+ <span style="position: relative; top: 4.2vh; left: 0.65vw">执行动作 {{ index + 1 }}</span>
|
121
|
|
113
|
|
122
|
- <div>
|
|
|
123
|
- <AddActionForm
|
|
|
124
|
- :editActionFather="isUpdate == false ? 1 : item"
|
|
|
125
|
- :newActionMapFather="isUpdate == false ? 1 : newActionFilterMap"
|
|
|
126
|
- :deviceInfo2="getDeviceInfo2"
|
|
|
127
|
- ref="refActionChild"
|
|
|
128
|
- />
|
|
|
129
|
- </div>
|
|
|
130
|
- <div style="height: 3vh"></div>
|
|
|
131
|
- </template>
|
|
|
132
|
- <div
|
|
|
133
|
- style="
|
|
|
134
|
- display: flex;
|
|
|
135
|
- width: 11vw;
|
|
|
136
|
- height: 4vh;
|
|
|
137
|
- flex-direction: row;
|
|
|
138
|
- justify-content: space-between;
|
|
|
139
|
- "
|
|
|
140
|
- >
|
|
|
141
|
- <div style="display: flex; width: 4vw; height: 4vh">
|
|
|
142
|
- <Button type="primary" style="border-radius: 10px" class="mt-5" @click="addAction"
|
|
|
143
|
- >新增执行动作</Button
|
|
|
144
|
- >
|
|
|
145
|
- </div>
|
|
|
146
|
- <div style="display: flex; width: 4vw; height: 4vh">
|
|
|
147
|
- <Button
|
|
|
148
|
- v-if="addActionPushData.length != 0 || editActionPushData.length != 0"
|
|
|
149
|
- style="border-radius: 10px; background-color: rgba(237, 111, 111, 1)"
|
|
|
150
|
- type="default"
|
|
|
151
|
- class="mt-5"
|
|
|
152
|
- @click="removeAction"
|
|
|
153
|
- >
|
|
|
154
|
- <span style="color: white">删除</span></Button
|
|
|
155
|
- >
|
|
|
156
|
- </div>
|
114
|
+ <div>
|
|
|
115
|
+ <AddActionForm
|
|
|
116
|
+ :editActionFather="isUpdate == false ? 1 : item"
|
|
|
117
|
+ :newActionMapFather="isUpdate == false ? 1 : newActionFilterMap"
|
|
|
118
|
+ :deviceInfo2="getDeviceInfo2"
|
|
|
119
|
+ ref="refActionChild"
|
|
|
120
|
+ />
|
|
|
121
|
+ </div>
|
|
|
122
|
+ <div style="height: 3vh"></div>
|
|
|
123
|
+ </template>
|
|
|
124
|
+ <div
|
|
|
125
|
+ style="
|
|
|
126
|
+ display: flex;
|
|
|
127
|
+ width: 11vw;
|
|
|
128
|
+ height: 4vh;
|
|
|
129
|
+ flex-direction: row;
|
|
|
130
|
+ justify-content: space-between;
|
|
|
131
|
+ "
|
|
|
132
|
+ >
|
|
|
133
|
+ <div style="display: flex; width: 4vw; height: 4vh">
|
|
|
134
|
+ <Button type="primary" style="border-radius: 10px" class="mt-5" @click="addAction"
|
|
|
135
|
+ >新增执行动作</Button
|
|
|
136
|
+ >
|
|
|
137
|
+ </div>
|
|
|
138
|
+ <div style="display: flex; width: 4vw; height: 4vh">
|
|
|
139
|
+ <Button
|
|
|
140
|
+ v-if="addActionPushData.length > 0 || addActionPushData.length > 0"
|
|
|
141
|
+ style="border-radius: 10px; background-color: rgba(237, 111, 111, 1)"
|
|
|
142
|
+ type="default"
|
|
|
143
|
+ class="mt-5"
|
|
|
144
|
+ @click="removeAction"
|
|
|
145
|
+ >
|
|
|
146
|
+ <span style="color: white">删除</span></Button
|
|
|
147
|
+ >
|
157
|
</div>
|
148
|
</div>
|
158
|
- <div style="height: 5vh"></div>
|
|
|
159
|
</div>
|
149
|
</div>
|
|
|
150
|
+ <div style="height: 5vh"></div>
|
160
|
</div>
|
151
|
</div>
|
161
|
- </BasicDrawer>
|
|
|
162
|
- </div>
|
152
|
+ </div>
|
|
|
153
|
+ </BasicDrawer>
|
163
|
</template>
|
154
|
</template>
|
164
|
<script lang="ts">
|
155
|
<script lang="ts">
|
165
|
import { defineComponent, ref, computed, unref, reactive, getCurrentInstance, watch } from 'vue';
|
156
|
import { defineComponent, ref, computed, unref, reactive, getCurrentInstance, watch } from 'vue';
|
166
|
import { BasicForm, useForm } from '/@/components/Form';
|
157
|
import { BasicForm, useForm } from '/@/components/Form';
|
167
|
- import { formSchema, getData, mockData } from './config';
|
158
|
+ import { formSchema, getData } from './config';
|
168
|
import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
|
159
|
import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
|
169
|
import {
|
160
|
import {
|
170
|
screenLinkPageAddApi,
|
161
|
screenLinkPageAddApi,
|
|
@@ -263,31 +254,56 @@ |
|
@@ -263,31 +254,56 @@ |
263
|
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
|
254
|
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
|
264
|
await resetFields();
|
255
|
await resetFields();
|
265
|
setDrawerProps({ confirmLoading: false });
|
256
|
setDrawerProps({ confirmLoading: false });
|
266
|
- isUpdate.value = data?.isUpdate;
|
|
|
267
|
- if (isUpdate.value) {
|
257
|
+ isUpdate.value = !!data?.isUpdate;
|
|
|
258
|
+ if (!unref(isUpdate)) {
|
|
|
259
|
+ editTriggerPushData.value = [];
|
|
|
260
|
+ editTriggerPushData.value.length = 0;
|
|
|
261
|
+ addTriggerPushData.value = [];
|
|
|
262
|
+ addTriggerPushData.value.length = 0;
|
|
|
263
|
+ addConditionPushData.value = [];
|
|
|
264
|
+ addConditionPushData.value.length = 0;
|
|
|
265
|
+ addActionPushData.value = [];
|
|
|
266
|
+ addActionPushData.value.length = 0;
|
268
|
try {
|
267
|
try {
|
269
|
- getId.value = mockData.id;
|
|
|
270
|
- getTenantId.value = mockData.tenantId;
|
|
|
271
|
- await setFieldsValue({
|
|
|
272
|
- ...data.record,
|
|
|
273
|
- });
|
|
|
274
|
- editTriggerPushData.value = mockData.triggers;
|
|
|
275
|
- editConditionPushData.value = mockData.doConditions;
|
|
|
276
|
- editActionPushData.value = mockData.doActions;
|
|
|
277
|
- // editTriggerPushData.value.forEach((f) => {
|
|
|
278
|
- // if (f?.id.length == 18) {
|
|
|
279
|
- // editTriggerPushData.value.pop();
|
|
|
280
|
- // if (editTriggerPushData.value.length) {
|
|
|
281
|
- // editTriggerPushData.value.length = editTriggerPushData.value.length;
|
|
|
282
|
- // }
|
|
|
283
|
- // }
|
|
|
284
|
- // });
|
|
|
285
|
-
|
|
|
286
|
- const options = await screenLinkPageByDeptIdGetDevice({
|
|
|
287
|
- organizationId: mockData.organizationId,
|
|
|
288
|
- });
|
|
|
289
|
-
|
|
|
290
|
- mockData.triggers.forEach((f1) => {
|
268
|
+ setTimeout(() => {
|
|
|
269
|
+ proxy.$refs.refTriggerChild.resetFieldsValueFunc();
|
|
|
270
|
+ proxy.$refs.refConditionChild.resetFieldsValueFunc();
|
|
|
271
|
+ proxy.$refs.refActionChild.resetFieldsValueFunc();
|
|
|
272
|
+ }, 50);
|
|
|
273
|
+ } catch (e) {
|
|
|
274
|
+ return e;
|
|
|
275
|
+ }
|
|
|
276
|
+ } else {
|
|
|
277
|
+ newFilterMap.value = [];
|
|
|
278
|
+ newConditionFilterMap.value = [];
|
|
|
279
|
+ newActionFilterMap.value = [];
|
|
|
280
|
+ clearAllArrayFunc();
|
|
|
281
|
+ editTriggerPushData.value = [];
|
|
|
282
|
+ editTriggerPushData.value.length = 0;
|
|
|
283
|
+ editConditionPushData.value = [];
|
|
|
284
|
+ editActionPushData.value = [];
|
|
|
285
|
+ lastEditRefTriggerChildDataArray.value = [];
|
|
|
286
|
+ getId.value = data.record.id;
|
|
|
287
|
+ getTenantId.value = data.record.tenantId;
|
|
|
288
|
+ await setFieldsValue({
|
|
|
289
|
+ ...data.record,
|
|
|
290
|
+ });
|
|
|
291
|
+ editTriggerPushData.value = data.record.triggers;
|
|
|
292
|
+ editTriggerPushData.value.forEach((f) => {
|
|
|
293
|
+ if (f?.id.length == 18) {
|
|
|
294
|
+ editTriggerPushData.value.pop();
|
|
|
295
|
+ if (editTriggerPushData.value.length) {
|
|
|
296
|
+ editTriggerPushData.value.length = editTriggerPushData.value.length;
|
|
|
297
|
+ }
|
|
|
298
|
+ }
|
|
|
299
|
+ });
|
|
|
300
|
+ editConditionPushData.value = data.record.doConditions;
|
|
|
301
|
+ editActionPushData.value = data.record.doActions;
|
|
|
302
|
+ const options = await screenLinkPageByDeptIdGetDevice({
|
|
|
303
|
+ organizationId: data.record.organizationId,
|
|
|
304
|
+ });
|
|
|
305
|
+ try {
|
|
|
306
|
+ data.record.triggers.forEach((f1) => {
|
291
|
options.items?.forEach((f2) => {
|
307
|
options.items?.forEach((f2) => {
|
292
|
if (f2.id == f1.deviceId) {
|
308
|
if (f2.id == f1.deviceId) {
|
293
|
newFilterMap.value.push({
|
309
|
newFilterMap.value.push({
|
|
@@ -298,7 +314,7 @@ |
|
@@ -298,7 +314,7 @@ |
298
|
});
|
314
|
});
|
299
|
});
|
315
|
});
|
300
|
|
316
|
|
301
|
- mockData.doConditions.forEach((f1) => {
|
317
|
+ data.record.doConditions.forEach((f1) => {
|
302
|
options.items?.forEach((f2) => {
|
318
|
options.items?.forEach((f2) => {
|
303
|
if (f2.id == f1.deviceId) {
|
319
|
if (f2.id == f1.deviceId) {
|
304
|
newConditionFilterMap.value.push({
|
320
|
newConditionFilterMap.value.push({
|
|
@@ -308,7 +324,7 @@ |
|
@@ -308,7 +324,7 @@ |
308
|
}
|
324
|
}
|
309
|
});
|
325
|
});
|
310
|
});
|
326
|
});
|
311
|
- mockData.doActions.forEach((f1) => {
|
327
|
+ data.record.doActions.forEach((f1) => {
|
312
|
options.items?.forEach((f2) => {
|
328
|
options.items?.forEach((f2) => {
|
313
|
if (f2.id == f1.deviceId) {
|
329
|
if (f2.id == f1.deviceId) {
|
314
|
newActionFilterMap.value.push({
|
330
|
newActionFilterMap.value.push({
|
|
@@ -318,41 +334,34 @@ |
|
@@ -318,41 +334,34 @@ |
318
|
}
|
334
|
}
|
319
|
});
|
335
|
});
|
320
|
});
|
336
|
});
|
321
|
- } catch (e) {
|
|
|
322
|
- return e;
|
|
|
323
|
- }
|
337
|
+ } catch (e) {}
|
324
|
}
|
338
|
}
|
325
|
});
|
339
|
});
|
326
|
- const getTitle = computed(() => (isUpdate.value == false ? '新增场景联动' : '编辑场景联动'));
|
340
|
+ const getTitle = computed(() => (!unref(isUpdate) ? '新增场景联动' : '编辑场景联动'));
|
327
|
|
341
|
|
328
|
- const clearPushArrayFunc = () => {
|
342
|
+ const clearAllArrayFunc = () => {
|
|
|
343
|
+ unref(addTriggerPushData).length = 0;
|
|
|
344
|
+ unref(addConditionPushData).length = 0;
|
|
|
345
|
+ unref(addActionPushData).length = 0;
|
|
|
346
|
+ lastRefTriggerChildDataArray.value.length = 0;
|
|
|
347
|
+ lastRefConditionChildDataArray.value.length = 0;
|
|
|
348
|
+ lastRefActionChildDataArray.value.length = 0;
|
|
|
349
|
+ lastEditRefTriggerChildDataArray.value.length = 0;
|
|
|
350
|
+ };
|
|
|
351
|
+ const resetActionsAllArrayFunc = () => {
|
329
|
try {
|
352
|
try {
|
330
|
- proxy.$refs.refConditionChild.resetFieldsValueFunc();
|
|
|
331
|
proxy.$refs.refActionChild.resetFieldsValueFunc();
|
353
|
proxy.$refs.refActionChild.resetFieldsValueFunc();
|
332
|
- proxy.$refs.refActionChild.resetFieldsValueFunc();
|
|
|
333
|
- proxy.$refs.refActionChild.clearSelectDevice();
|
|
|
334
|
- newFilterMap.value.length = 0;
|
|
|
335
|
- newConditionFilterMap.value.length = 0;
|
|
|
336
|
- newActionFilterMap.value.length = 0;
|
|
|
337
|
- editTriggerPushData.value.length = 0;
|
|
|
338
|
- editConditionPushData.value.length = 0;
|
|
|
339
|
- editActionPushData.value.length = 0;
|
|
|
340
|
- lastEditRefTriggerChildDataArray.value.length = 0;
|
|
|
341
|
- addTriggerPushData.value.length = 0;
|
|
|
342
|
- addConditionPushData.value.length = 0;
|
|
|
343
|
- addActionPushData.value.length = 0;
|
|
|
344
|
- lastRefTriggerChildDataArray.value.length = 0;
|
|
|
345
|
- lastRefConditionChildDataArray.value.length = 0;
|
|
|
346
|
- lastRefActionChildDataArray.value.length = 0;
|
|
|
347
|
- lastEditRefTriggerChildDataArray.value.length = 0;
|
|
|
348
|
} catch (e) {
|
354
|
} catch (e) {
|
349
|
return e;
|
355
|
return e;
|
350
|
}
|
356
|
}
|
351
|
};
|
357
|
};
|
352
|
- const handleCancel = () => {
|
|
|
353
|
- clearPushArrayFunc();
|
358
|
+ const clearActionsAllDevice = () => {
|
|
|
359
|
+ try {
|
|
|
360
|
+ proxy.$refs.refActionChild.clearSelectDevice();
|
|
|
361
|
+ } catch (e) {
|
|
|
362
|
+ return e;
|
|
|
363
|
+ }
|
354
|
};
|
364
|
};
|
355
|
-
|
|
|
356
|
watch(getData, (newV) => {
|
365
|
watch(getData, (newV) => {
|
357
|
getDeviceInfo.value = newV;
|
366
|
getDeviceInfo.value = newV;
|
358
|
getDeviceInfo1.value = newV;
|
367
|
getDeviceInfo1.value = newV;
|
|
@@ -385,7 +394,7 @@ |
|
@@ -385,7 +394,7 @@ |
385
|
};
|
394
|
};
|
386
|
|
395
|
|
387
|
const getDefaultValue = () => {
|
396
|
const getDefaultValue = () => {
|
388
|
- if (!isUpdate.value) {
|
397
|
+ if (!unref(isUpdate)) {
|
389
|
delete getAllFormData.id;
|
398
|
delete getAllFormData.id;
|
390
|
delete getAllFormData.getTenantId;
|
399
|
delete getAllFormData.getTenantId;
|
391
|
refTriggerChildDataFunc();
|
400
|
refTriggerChildDataFunc();
|
|
@@ -431,7 +440,7 @@ |
|
@@ -431,7 +440,7 @@ |
431
|
};
|
440
|
};
|
432
|
|
441
|
|
433
|
const handleSubmit = async () => {
|
442
|
const handleSubmit = async () => {
|
434
|
- if (!isUpdate.value) {
|
443
|
+ if (!unref(isUpdate)) {
|
435
|
getDefaultValue();
|
444
|
getDefaultValue();
|
436
|
getValuesFormData = await validateFields();
|
445
|
getValuesFormData = await validateFields();
|
437
|
if (!getValuesFormData) return;
|
446
|
if (!getValuesFormData) return;
|
|
@@ -439,7 +448,6 @@ |
|
@@ -439,7 +448,6 @@ |
439
|
await screenLinkPageAddApi(getAllFormData);
|
448
|
await screenLinkPageAddApi(getAllFormData);
|
440
|
createMessage.success('场景联动新增成功');
|
449
|
createMessage.success('场景联动新增成功');
|
441
|
closeDrawer();
|
450
|
closeDrawer();
|
442
|
- handleCancel();
|
|
|
443
|
emit('success');
|
451
|
emit('success');
|
444
|
} else {
|
452
|
} else {
|
445
|
getDefaultValue();
|
453
|
getDefaultValue();
|
|
@@ -455,12 +463,15 @@ |
|
@@ -455,12 +463,15 @@ |
455
|
};
|
463
|
};
|
456
|
const defaultAddTrigger = () => {
|
464
|
const defaultAddTrigger = () => {
|
457
|
if (unref(addTriggerPushData).length == 0) {
|
465
|
if (unref(addTriggerPushData).length == 0) {
|
458
|
- addTrigger();
|
466
|
+ setTimeout(() => {
|
|
|
467
|
+ addTrigger();
|
|
|
468
|
+ }, 10);
|
459
|
}
|
469
|
}
|
460
|
};
|
470
|
};
|
|
|
471
|
+
|
461
|
//新增触发器
|
472
|
//新增触发器
|
462
|
const addTrigger = () => {
|
473
|
const addTrigger = () => {
|
463
|
- if (isUpdate.value == false) {
|
474
|
+ if (!unref(isUpdate)) {
|
464
|
unref(addTriggerPushData).push(addTriggerData as never);
|
475
|
unref(addTriggerPushData).push(addTriggerData as never);
|
465
|
refTriggerChildDataFunc();
|
476
|
refTriggerChildDataFunc();
|
466
|
lastRefTriggerChildData.value = refTriggerChildData.value;
|
477
|
lastRefTriggerChildData.value = refTriggerChildData.value;
|
|
@@ -473,7 +484,7 @@ |
|
@@ -473,7 +484,7 @@ |
473
|
}
|
484
|
}
|
474
|
};
|
485
|
};
|
475
|
const removeTrigger = () => {
|
486
|
const removeTrigger = () => {
|
476
|
- if (!isUpdate.value) {
|
487
|
+ if (!unref(isUpdate)) {
|
477
|
try {
|
488
|
try {
|
478
|
unref(addTriggerPushData).splice(0, 1);
|
489
|
unref(addTriggerPushData).splice(0, 1);
|
479
|
lastRefTriggerChildDataArray.value.splice(0, 1);
|
490
|
lastRefTriggerChildDataArray.value.splice(0, 1);
|
|
@@ -489,29 +500,28 @@ |
|
@@ -489,29 +500,28 @@ |
489
|
}
|
500
|
}
|
490
|
}
|
501
|
}
|
491
|
};
|
502
|
};
|
492
|
- //默认新增执行动作
|
|
|
493
|
- const defaultAddAction = () => {
|
|
|
494
|
- if (unref(addActionPushData).length == 0) {
|
|
|
495
|
- addAction();
|
|
|
496
|
- }
|
|
|
497
|
- };
|
|
|
498
|
|
503
|
|
499
|
//新增执行条件
|
504
|
//新增执行条件
|
500
|
const addCondition = () => {
|
505
|
const addCondition = () => {
|
501
|
- if (!isUpdate.value) {
|
506
|
+ if (!unref(isUpdate)) {
|
502
|
unref(addConditionPushData).push(addConditionData as never);
|
507
|
unref(addConditionPushData).push(addConditionData as never);
|
503
|
refConditionChildDataFunc();
|
508
|
refConditionChildDataFunc();
|
504
|
lastRefConditionChildData.value = refConditionChildData.value;
|
509
|
lastRefConditionChildData.value = refConditionChildData.value;
|
505
|
lastRefConditionChildDataArray.value.push(lastRefConditionChildData.value as never);
|
510
|
lastRefConditionChildDataArray.value.push(lastRefConditionChildData.value as never);
|
506
|
} else {
|
511
|
} else {
|
507
|
unref(editConditionPushData).push(addConditionData as never);
|
512
|
unref(editConditionPushData).push(addConditionData as never);
|
|
|
513
|
+ console.log(unref(editConditionPushData));
|
508
|
refConditionChildDataFunc();
|
514
|
refConditionChildDataFunc();
|
509
|
lastRefConditionChildData.value = refConditionChildData.value;
|
515
|
lastRefConditionChildData.value = refConditionChildData.value;
|
510
|
lastEditRefConditionChildDataArray.value.push(lastRefConditionChildData.value as never);
|
516
|
lastEditRefConditionChildDataArray.value.push(lastRefConditionChildData.value as never);
|
511
|
}
|
517
|
}
|
|
|
518
|
+ // unref(addConditionPushData).push(addConditionData as never);
|
|
|
519
|
+ // refConditionChildDataFunc();
|
|
|
520
|
+ // lastRefConditionChildData.value = refConditionChildData.value;
|
|
|
521
|
+ // lastRefConditionChildDataArray.value.push(lastRefConditionChildData.value as never);
|
512
|
};
|
522
|
};
|
513
|
const removeCondition = () => {
|
523
|
const removeCondition = () => {
|
514
|
- if (!isUpdate.value) {
|
524
|
+ if (!unref(isUpdate)) {
|
515
|
try {
|
525
|
try {
|
516
|
unref(addConditionPushData).splice(0, 1);
|
526
|
unref(addConditionPushData).splice(0, 1);
|
517
|
lastRefConditionChildDataArray.value.splice(0, 1);
|
527
|
lastRefConditionChildDataArray.value.splice(0, 1);
|
|
@@ -528,13 +538,20 @@ |
|
@@ -528,13 +538,20 @@ |
528
|
}
|
538
|
}
|
529
|
};
|
539
|
};
|
530
|
|
540
|
|
|
|
541
|
+ //新增执行动作
|
|
|
542
|
+ const defaultAddAction = () => {
|
|
|
543
|
+ if (unref(addActionPushData).length == 0) {
|
|
|
544
|
+ addAction();
|
|
|
545
|
+ }
|
|
|
546
|
+ };
|
|
|
547
|
+
|
531
|
const defaultAddCondition = () => {
|
548
|
const defaultAddCondition = () => {
|
532
|
if (unref(addConditionPushData).length == 0) {
|
549
|
if (unref(addConditionPushData).length == 0) {
|
533
|
addCondition();
|
550
|
addCondition();
|
534
|
}
|
551
|
}
|
535
|
};
|
552
|
};
|
536
|
const addAction = () => {
|
553
|
const addAction = () => {
|
537
|
- if (!isUpdate.value) {
|
554
|
+ if (!unref(isUpdate)) {
|
538
|
unref(addActionPushData).push(addActionData as never);
|
555
|
unref(addActionPushData).push(addActionData as never);
|
539
|
refActionChildDataFunc();
|
556
|
refActionChildDataFunc();
|
540
|
lastRefActionChildData.value = refActionChildData.value;
|
557
|
lastRefActionChildData.value = refActionChildData.value;
|
|
@@ -545,9 +562,13 @@ |
|
@@ -545,9 +562,13 @@ |
545
|
lastRefActionChildData.value = refActionChildData.value;
|
562
|
lastRefActionChildData.value = refActionChildData.value;
|
546
|
lastEditRefActionChildDataArray.value.push(lastRefActionChildData.value as never);
|
563
|
lastEditRefActionChildDataArray.value.push(lastRefActionChildData.value as never);
|
547
|
}
|
564
|
}
|
|
|
565
|
+ // unref(addActionPushData).push(addActionData as never);
|
|
|
566
|
+ // refActionChildDataFunc();
|
|
|
567
|
+ // lastRefActionChildData.value = refActionChildData.value;
|
|
|
568
|
+ // lastRefActionChildDataArray.value.push(lastRefActionChildData.value as never);
|
548
|
};
|
569
|
};
|
549
|
const removeAction = () => {
|
570
|
const removeAction = () => {
|
550
|
- if (!isUpdate.value) {
|
571
|
+ if (!unref(isUpdate)) {
|
551
|
try {
|
572
|
try {
|
552
|
unref(addActionPushData).splice(0, 1);
|
573
|
unref(addActionPushData).splice(0, 1);
|
553
|
lastRefActionChildDataArray.value.splice(0, 1);
|
574
|
lastRefActionChildDataArray.value.splice(0, 1);
|
|
@@ -565,7 +586,6 @@ |
|
@@ -565,7 +586,6 @@ |
565
|
};
|
586
|
};
|
566
|
|
587
|
|
567
|
return {
|
588
|
return {
|
568
|
- handleCancel,
|
|
|
569
|
defaultAddTrigger,
|
589
|
defaultAddTrigger,
|
570
|
defaultAddCondition,
|
590
|
defaultAddCondition,
|
571
|
newFilterMap,
|
591
|
newFilterMap,
|
|
@@ -575,9 +595,11 @@ |
|
@@ -575,9 +595,11 @@ |
575
|
editConditionPushData,
|
595
|
editConditionPushData,
|
576
|
editActionPushData,
|
596
|
editActionPushData,
|
577
|
isUpdate,
|
597
|
isUpdate,
|
|
|
598
|
+ clearActionsAllDevice,
|
578
|
getDeviceInfo,
|
599
|
getDeviceInfo,
|
579
|
getDeviceInfo1,
|
600
|
getDeviceInfo1,
|
580
|
getDeviceInfo2,
|
601
|
getDeviceInfo2,
|
|
|
602
|
+ resetActionsAllArrayFunc,
|
581
|
addActionPushData,
|
603
|
addActionPushData,
|
582
|
defaultAddAction,
|
604
|
defaultAddAction,
|
583
|
refActionChild,
|
605
|
refActionChild,
|
|
@@ -587,6 +609,7 @@ |
|
@@ -587,6 +609,7 @@ |
587
|
refConditionChild,
|
609
|
refConditionChild,
|
588
|
addCondition,
|
610
|
addCondition,
|
589
|
removeCondition,
|
611
|
removeCondition,
|
|
|
612
|
+ clearAllArrayFunc,
|
590
|
removeTrigger,
|
613
|
removeTrigger,
|
591
|
addTriggerPushData,
|
614
|
addTriggerPushData,
|
592
|
addTriggerData,
|
615
|
addTriggerData,
|