Showing
8 changed files
with
69 additions
and
31 deletions
@@ -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" @change="handleChange"> | 11 | + <a-steps :current="current"> |
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,7 +79,6 @@ | @@ -79,7 +79,6 @@ | ||
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); | ||
83 | const { proxy } = getCurrentInstance(); | 82 | const { proxy } = getCurrentInstance(); |
84 | const postDeviceConfogData: any = ref({}); | 83 | const postDeviceConfogData: any = ref({}); |
85 | const getStepOneData: any = ref({}); | 84 | const getStepOneData: any = ref({}); |
@@ -91,10 +90,8 @@ | @@ -91,10 +90,8 @@ | ||
91 | const postEditId = ref(''); | 90 | const postEditId = ref(''); |
92 | const current = ref(0); | 91 | const current = ref(0); |
93 | const isUpdate = ref(true); | 92 | 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 | - }; | ||
98 | const [register, { closeModal }] = useModalInner(async (data) => { | 95 | const [register, { closeModal }] = useModalInner(async (data) => { |
99 | isUpdate.value = !!data?.isUpdate; | 96 | isUpdate.value = !!data?.isUpdate; |
100 | if (!unref(isUpdate)) { | 97 | if (!unref(isUpdate)) { |
@@ -277,6 +274,8 @@ | @@ -277,6 +274,8 @@ | ||
277 | isGetStepThreeData.value.profileData = getStepThreeData.value; | 274 | isGetStepThreeData.value.profileData = getStepThreeData.value; |
278 | alarmProfileData.value.alarmProfile = | 275 | alarmProfileData.value.alarmProfile = |
279 | await proxy.$refs.DeviceProfileStep4Ref.getAllFields(); | 276 | await proxy.$refs.DeviceProfileStep4Ref.getAllFields(); |
277 | + alarmProfileData.value.alarmProfile.alarmContactId.shift(); | ||
278 | + alarmProfileData.value.alarmProfile.messageMode.shift(); | ||
280 | Object.assign( | 279 | Object.assign( |
281 | postDeviceConfogData.value, | 280 | postDeviceConfogData.value, |
282 | getStepOneData.value, | 281 | getStepOneData.value, |
@@ -288,8 +287,7 @@ | @@ -288,8 +287,7 @@ | ||
288 | createMessage.success('新增设备配置成功'); | 287 | createMessage.success('新增设备配置成功'); |
289 | closeModal(); | 288 | closeModal(); |
290 | emit('success'); | 289 | emit('success'); |
291 | - } | ||
292 | - if (unref(isUpdate)) { | 290 | + } else { |
293 | postDeviceConfogData.value.id = postEditId.value; | 291 | postDeviceConfogData.value.id = postEditId.value; |
294 | isGetStepThreeData.value.profileData = getStepThreeData.value; | 292 | isGetStepThreeData.value.profileData = getStepThreeData.value; |
295 | alarmProfileData.value.alarmProfile = | 293 | alarmProfileData.value.alarmProfile = |
@@ -311,13 +309,11 @@ | @@ -311,13 +309,11 @@ | ||
311 | closeModal(); | 309 | closeModal(); |
312 | }; | 310 | }; |
313 | return { | 311 | return { |
314 | - handleChange, | ||
315 | DeviceProfileStep2Ref, | 312 | DeviceProfileStep2Ref, |
316 | DeviceProfileStep3Ref, | 313 | DeviceProfileStep3Ref, |
317 | DeviceProfileStep4Ref, | 314 | DeviceProfileStep4Ref, |
318 | DeviceProfileStep1Ref, | 315 | DeviceProfileStep1Ref, |
319 | editEchoData, | 316 | editEchoData, |
320 | - // getStepData, | ||
321 | handleStep3Next, | 317 | handleStep3Next, |
322 | handleSubmit, | 318 | handleSubmit, |
323 | handleCancel, | 319 | handleCancel, |
@@ -8,6 +8,8 @@ export const alertContactsSchemas: FormSchema[] = [ | @@ -8,6 +8,8 @@ export const alertContactsSchemas: FormSchema[] = [ | ||
8 | label: '告警通知联系人', | 8 | label: '告警通知联系人', |
9 | component: 'ApiSelect', | 9 | component: 'ApiSelect', |
10 | componentProps: { | 10 | componentProps: { |
11 | + mode: 'multiple', | ||
12 | + | ||
11 | api: alarmContactGetPage, | 13 | api: alarmContactGetPage, |
12 | labelField: 'username', | 14 | labelField: 'username', |
13 | valueField: 'id', | 15 | valueField: 'id', |
@@ -20,6 +22,7 @@ export const alertContactsSchemas: FormSchema[] = [ | @@ -20,6 +22,7 @@ export const alertContactsSchemas: FormSchema[] = [ | ||
20 | required: true, | 22 | required: true, |
21 | component: 'ApiSelect', | 23 | component: 'ApiSelect', |
22 | componentProps: { | 24 | componentProps: { |
25 | + mode: 'multiple', | ||
23 | api: findDictItemByCode, | 26 | api: findDictItemByCode, |
24 | params: { | 27 | params: { |
25 | dictCode: 'message_type', | 28 | dictCode: 'message_type', |
@@ -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 '../types/index'; | 210 | + import type { IProfileData } from './index.t'; |
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> --> | ||
5 | <BasicForm :showSubmitButton="false" @register="register" /> | 3 | <BasicForm :showSubmitButton="false" @register="register" /> |
6 | </div> | 4 | </div> |
7 | </template> | 5 | </template> |
8 | <script lang="ts"> | 6 | <script lang="ts"> |
9 | import { defineComponent, ref } from 'vue'; | 7 | import { defineComponent, ref } from 'vue'; |
10 | - // import { Tag } from 'ant-design-vue'; | ||
11 | import { BasicForm, useForm } from '/@/components/Form/index'; | 8 | import { BasicForm, useForm } from '/@/components/Form/index'; |
12 | import { alertContactsSchemas } from '../cpns/config'; | 9 | import { alertContactsSchemas } from '../cpns/config'; |
13 | 10 |
src/views/device/profile/step/index.t.ts
renamed from
src/views/device/profile/types/index.ts
@@ -23,7 +23,7 @@ | @@ -23,7 +23,7 @@ | ||
23 | 23 | ||
24 | export default defineComponent({ | 24 | export default defineComponent({ |
25 | components: { CollapseContainer, BasicForm, [Input.name]: Input }, | 25 | components: { CollapseContainer, BasicForm, [Input.name]: Input }, |
26 | - props: ['deviceInfo', 'editTriggerFather'], | 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({ | 29 | const [registerTrigger, { setFieldsValue, getFieldsValue, updateSchema }] = useForm({ |
@@ -50,6 +50,7 @@ | @@ -50,6 +50,7 @@ | ||
50 | }); | 50 | }); |
51 | } | 51 | } |
52 | ); | 52 | ); |
53 | + | ||
53 | //回显数据 | 54 | //回显数据 |
54 | const setFieldsFormValueFun = () => { | 55 | const setFieldsFormValueFun = () => { |
55 | setTimeout(() => { | 56 | setTimeout(() => { |
@@ -66,15 +67,37 @@ | @@ -66,15 +67,37 @@ | ||
66 | }, | 67 | }, |
67 | }); | 68 | }); |
68 | }; | 69 | }; |
69 | - const editSelectDevice = (v) => { | 70 | + const editSelectDevice = () => { |
71 | + setTimeout(() => { | ||
72 | + updateSchema({ | ||
73 | + field: 'deviceId', | ||
74 | + componentProps: { | ||
75 | + options: props.newFilterMapFather, | ||
76 | + }, | ||
77 | + }); | ||
78 | + }, 100); | ||
79 | + }; | ||
80 | + editSelectDevice(); | ||
81 | + //新增清空场景触发器选择 | ||
82 | + const clearSelectScene = () => { | ||
83 | + updateSchema({ | ||
84 | + field: 'sceneLinkageId', | ||
85 | + componentProps: { | ||
86 | + options: [], | ||
87 | + }, | ||
88 | + }); | ||
89 | + }; | ||
90 | + const editSelectScene = (v) => { | ||
70 | updateSchema({ | 91 | updateSchema({ |
71 | - field: 'deviceId', | 92 | + field: 'sceneLinkageId', |
72 | componentProps: { | 93 | componentProps: { |
73 | options: v, | 94 | options: v, |
74 | }, | 95 | }, |
75 | }); | 96 | }); |
76 | }; | 97 | }; |
77 | return { | 98 | return { |
99 | + clearSelectScene, | ||
100 | + editSelectScene, | ||
78 | clearSelectDevice, | 101 | clearSelectDevice, |
79 | editSelectDevice, | 102 | editSelectDevice, |
80 | getFieldsValueFunc, | 103 | getFieldsValueFunc, |
@@ -17,16 +17,14 @@ | @@ -17,16 +17,14 @@ | ||
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> | 19 | <span style="position: relative; top: 3.2vh; left: 0.3vw">触发器{{ index + 1 }}</span> |
20 | - <div v-if="isUpdate == true"> | 20 | + <div> |
21 | <AddTriggerForm | 21 | <AddTriggerForm |
22 | - :editTriggerFather="item" | 22 | + :editTriggerFather="isUpdate == false ? null : item" |
23 | + :newFilterMapFather="isUpdate == false ? null : newFilterMap" | ||
23 | :deviceInfo="getDeviceInfo" | 24 | :deviceInfo="getDeviceInfo" |
24 | ref="refTriggerChild" | 25 | ref="refTriggerChild" |
25 | /> | 26 | /> |
26 | </div> | 27 | </div> |
27 | - <div v-if="isUpdate == false"> | ||
28 | - <AddTriggerForm :deviceInfo="getDeviceInfo" ref="refTriggerChild" /> | ||
29 | - </div> | ||
30 | <div style="height: 3vh"></div> | 28 | <div style="height: 3vh"></div> |
31 | </template> | 29 | </template> |
32 | <div | 30 | <div |
@@ -45,6 +43,7 @@ | @@ -45,6 +43,7 @@ | ||
45 | </div> | 43 | </div> |
46 | <div style="display: flex; width: 4vw; height: 4vh"> | 44 | <div style="display: flex; width: 4vw; height: 4vh"> |
47 | <Button | 45 | <Button |
46 | + v-if="addTriggerPushData.length != 0 || editTriggerPushData.length != 0" | ||
48 | type="default" | 47 | type="default" |
49 | style="border-radius: 10px; background-color: rgba(237, 111, 111, 1)" | 48 | style="border-radius: 10px; background-color: rgba(237, 111, 111, 1)" |
50 | class="mt-5" | 49 | class="mt-5" |
@@ -83,6 +82,7 @@ | @@ -83,6 +82,7 @@ | ||
83 | </div> | 82 | </div> |
84 | <div style="display: flex; width: 4vw; height: 4vh"> | 83 | <div style="display: flex; width: 4vw; height: 4vh"> |
85 | <Button | 84 | <Button |
85 | + v-if="addConditionPushData.length != 0" | ||
86 | style="border-radius: 10px; background-color: rgba(237, 111, 111, 1)" | 86 | style="border-radius: 10px; background-color: rgba(237, 111, 111, 1)" |
87 | type="default" | 87 | type="default" |
88 | class="mt-5" | 88 | class="mt-5" |
@@ -121,6 +121,7 @@ | @@ -121,6 +121,7 @@ | ||
121 | </div> | 121 | </div> |
122 | <div style="display: flex; width: 4vw; height: 4vh"> | 122 | <div style="display: flex; width: 4vw; height: 4vh"> |
123 | <Button | 123 | <Button |
124 | + v-if="addActionPushData.length > 0" | ||
124 | style="border-radius: 10px; background-color: rgba(237, 111, 111, 1)" | 125 | style="border-radius: 10px; background-color: rgba(237, 111, 111, 1)" |
125 | type="default" | 126 | type="default" |
126 | class="mt-5" | 127 | class="mt-5" |
@@ -140,7 +141,11 @@ | @@ -140,7 +141,11 @@ | ||
140 | import { BasicForm, useForm } from '/@/components/Form'; | 141 | import { BasicForm, useForm } from '/@/components/Form'; |
141 | import { formSchema, getData } from './config'; | 142 | import { formSchema, getData } from './config'; |
142 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | 143 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; |
143 | - import { screenLinkPageAddApi, screenLinkPageUpdateApi } from '/@/api/ruleengine/ruleengineApi'; | 144 | + import { |
145 | + screenLinkPageAddApi, | ||
146 | + screenLinkPageUpdateApi, | ||
147 | + screenLinkPageByDeptIdGetDevice, | ||
148 | + } from '/@/api/ruleengine/ruleengineApi'; | ||
144 | import { useMessage } from '/@/hooks/web/useMessage'; | 149 | import { useMessage } from '/@/hooks/web/useMessage'; |
145 | import AddTriggerForm from './addForm/trigger.vue'; | 150 | import AddTriggerForm from './addForm/trigger.vue'; |
146 | import AddConditiForm from './addForm/condition.vue'; | 151 | import AddConditiForm from './addForm/condition.vue'; |
@@ -216,7 +221,7 @@ | @@ -216,7 +221,7 @@ | ||
216 | const getDeviceInfo = ref(null); | 221 | const getDeviceInfo = ref(null); |
217 | const getDeviceInfo1 = ref(null); | 222 | const getDeviceInfo1 = ref(null); |
218 | const getDeviceInfo2 = ref(null); | 223 | const getDeviceInfo2 = ref(null); |
219 | - const editReveiveData = ref<[]>([]); | 224 | + const newFilterMap = ref<[]>([]); |
220 | 225 | ||
221 | const [registerForm, { resetFields, setFieldsValue, validateFields }] = useForm({ | 226 | const [registerForm, { resetFields, setFieldsValue, validateFields }] = useForm({ |
222 | labelWidth: 120, | 227 | labelWidth: 120, |
@@ -228,26 +233,39 @@ | @@ -228,26 +233,39 @@ | ||
228 | await resetFields(); | 233 | await resetFields(); |
229 | setDrawerProps({ confirmLoading: false }); | 234 | setDrawerProps({ confirmLoading: false }); |
230 | isUpdate.value = !!data?.isUpdate; | 235 | isUpdate.value = !!data?.isUpdate; |
231 | - | ||
232 | if (!unref(isUpdate)) { | 236 | if (!unref(isUpdate)) { |
233 | try { | 237 | try { |
234 | proxy.$refs.refTriggerChild.clearSelectDevice(); | 238 | proxy.$refs.refTriggerChild.clearSelectDevice(); |
239 | + proxy.$refs.refTriggerChild.clearSelectScene(); | ||
235 | proxy.$refs.refConditionChild.clearSelectDevice(); | 240 | proxy.$refs.refConditionChild.clearSelectDevice(); |
236 | proxy.$refs.refActionChild.clearSelectDevice(); | 241 | proxy.$refs.refActionChild.clearSelectDevice(); |
237 | } catch (e) { | 242 | } catch (e) { |
238 | return e; | 243 | return e; |
239 | } | 244 | } |
240 | - } | ||
241 | - if (unref(isUpdate)) { | ||
242 | - //编辑 | 245 | + } else { |
246 | + newFilterMap.value = []; | ||
243 | clearAllArrayFunc(); | 247 | clearAllArrayFunc(); |
248 | + editTriggerPushData.value = []; | ||
249 | + lastEditRefTriggerChildDataArray.value = []; | ||
244 | getId.value = data.record.id; | 250 | getId.value = data.record.id; |
245 | getTenantId.value = data.record.tenantId; | 251 | getTenantId.value = data.record.tenantId; |
246 | await setFieldsValue({ | 252 | await setFieldsValue({ |
247 | ...data.record, | 253 | ...data.record, |
248 | }); | 254 | }); |
249 | - editReveiveData.value = data.record.triggers; | ||
250 | - editTriggerPushData.value = editReveiveData.value; | 255 | + editTriggerPushData.value = data.record.triggers; |
256 | + const options = await screenLinkPageByDeptIdGetDevice({ | ||
257 | + organizationId: data.record.organizationId, | ||
258 | + }); | ||
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 | + } | ||
267 | + }); | ||
268 | + }); | ||
251 | } | 269 | } |
252 | }); | 270 | }); |
253 | const getTitle = computed(() => (!unref(isUpdate) ? '新增场景联动' : '编辑场景联动')); | 271 | const getTitle = computed(() => (!unref(isUpdate) ? '新增场景联动' : '编辑场景联动')); |
@@ -259,7 +277,7 @@ | @@ -259,7 +277,7 @@ | ||
259 | lastRefTriggerChildDataArray.value.length = 0; | 277 | lastRefTriggerChildDataArray.value.length = 0; |
260 | lastRefConditionChildDataArray.value.length = 0; | 278 | lastRefConditionChildDataArray.value.length = 0; |
261 | lastRefActionChildDataArray.value.length = 0; | 279 | lastRefActionChildDataArray.value.length = 0; |
262 | - // lastEditRefTriggerChildDataArray.value.length = 0; | 280 | + lastEditRefTriggerChildDataArray.value.length = 0; |
263 | }; | 281 | }; |
264 | const resetActionsAllArrayFunc = () => { | 282 | const resetActionsAllArrayFunc = () => { |
265 | try { | 283 | try { |
@@ -444,6 +462,7 @@ | @@ -444,6 +462,7 @@ | ||
444 | }; | 462 | }; |
445 | 463 | ||
446 | return { | 464 | return { |
465 | + newFilterMap, | ||
447 | editTriggerPushData, | 466 | editTriggerPushData, |
448 | isUpdate, | 467 | isUpdate, |
449 | clearActionsAllDevice, | 468 | clearActionsAllDevice, |