Commit a66b73727410e245257c602fbfe51177bb2bf5da
Merge branch 'ft-dev' of http://git.yuntengiot.com/huang/yun-teng-iot-front into ft-dev
Showing
10 changed files
with
195 additions
and
244 deletions
@@ -105,6 +105,11 @@ export interface ScreenAddModel { | @@ -105,6 +105,11 @@ export interface ScreenAddModel { | ||
105 | updateTime?: string; | 105 | updateTime?: string; |
106 | updater?: string; | 106 | updater?: string; |
107 | } | 107 | } |
108 | + | ||
109 | +export interface IChangeStatus { | ||
110 | + status?: number; | ||
111 | + id?: string; | ||
112 | +} | ||
108 | export interface ScreenUpdateModel { | 113 | export interface ScreenUpdateModel { |
109 | createTime?: string; | 114 | createTime?: string; |
110 | creator?: string; | 115 | creator?: string; |
@@ -5,6 +5,7 @@ import { | @@ -5,6 +5,7 @@ import { | ||
5 | ScreenUpdateModel, | 5 | ScreenUpdateModel, |
6 | ScreenLinkPageQueryParam, | 6 | ScreenLinkPageQueryParam, |
7 | ScreenByDeptIdParams, | 7 | ScreenByDeptIdParams, |
8 | + IChangeStatus, | ||
8 | } from '/@/api/ruleengine/model/ruleengineModel'; | 9 | } from '/@/api/ruleengine/model/ruleengineModel'; |
9 | 10 | ||
10 | enum ScreenManagerApi { | 11 | enum ScreenManagerApi { |
@@ -16,7 +17,7 @@ enum ScreenManagerApi { | @@ -16,7 +17,7 @@ enum ScreenManagerApi { | ||
16 | SCREEN_DELETE_URL = '/sceneLinkage', | 17 | SCREEN_DELETE_URL = '/sceneLinkage', |
17 | SCREEN_UPDATE_URL = '/sceneLinkage/update', | 18 | SCREEN_UPDATE_URL = '/sceneLinkage/update', |
18 | SCREEN_ORGANIZATION_URL = '/organization/me/list', | 19 | SCREEN_ORGANIZATION_URL = '/organization/me/list', |
19 | - SCREEN_CHANGE_STATUS = '/sceneLinkage/updateSceneStatus', | 20 | + SCREEN_CHANGE_STATUS = '/convert/update/scene', |
20 | SCREEN_GET_BY_DEPTID = '/sceneLinkage/device/', | 21 | SCREEN_GET_BY_DEPTID = '/sceneLinkage/device/', |
21 | } | 22 | } |
22 | 23 | ||
@@ -78,10 +79,13 @@ export const screenLinkPageDeleteApi = (ids: string[]) => { | @@ -78,10 +79,13 @@ export const screenLinkPageDeleteApi = (ids: string[]) => { | ||
78 | 79 | ||
79 | /** | 80 | /** |
80 | * 改变场景联动状态 | 81 | * 改变场景联动状态 |
81 | - * @param params sceneLinkageId status | 82 | + * @param params id status |
82 | */ | 83 | */ |
83 | -export const screenLinkPagePutApi = (sceneLinkageId: string, status: number) => | ||
84 | - defHttp.put({ url: ScreenManagerApi.SCREEN_CHANGE_STATUS + '/' + sceneLinkageId + '/' + status }); | 84 | +export const screenLinkPagePutApi = (params: IChangeStatus) => |
85 | + defHttp.post({ | ||
86 | + url: ScreenManagerApi.SCREEN_CHANGE_STATUS, | ||
87 | + data: params, | ||
88 | + }); | ||
85 | 89 | ||
86 | /** | 90 | /** |
87 | * 根据部门id获取设备列表 | 91 | * 根据部门id获取设备列表 |
src/views.zip
0 → 100644
No preview for this file type
@@ -135,6 +135,9 @@ | @@ -135,6 +135,9 @@ | ||
135 | stepThreeData: {}, | 135 | stepThreeData: {}, |
136 | }); | 136 | }); |
137 | } else if (isUpdate.value == 2) { | 137 | } else if (isUpdate.value == 2) { |
138 | + postEditId.value = data.record.id; | ||
139 | + getBackendData = await deviceConfigGetDetail(postEditId.value); | ||
140 | + editData.value = getBackendData; | ||
138 | proxy.$refs.DeviceProfileStep3Ref.isAddRuleStatusFunc(true); | 141 | proxy.$refs.DeviceProfileStep3Ref.isAddRuleStatusFunc(true); |
139 | isShowRule.value = true; | 142 | isShowRule.value = true; |
140 | isShowOkBtnFalse.value = true; | 143 | isShowOkBtnFalse.value = true; |
@@ -144,17 +147,17 @@ | @@ -144,17 +147,17 @@ | ||
144 | proxy.$refs.DeviceProfileStep1Ref.customResetStepOneFunc(); | 147 | proxy.$refs.DeviceProfileStep1Ref.customResetStepOneFunc(); |
145 | //回显第一步数据 | 148 | //回显第一步数据 |
146 | proxy.$refs.DeviceProfileStep1Ref.setStepOneFieldsValueFunc({ | 149 | proxy.$refs.DeviceProfileStep1Ref.setStepOneFieldsValueFunc({ |
147 | - name: data.record.name, | ||
148 | - defaultRuleChainId: data.record.defaultRuleChainId, | ||
149 | - defaultQueueName: data.record.defaultQueueName, | ||
150 | - description: data.record.description, | 150 | + name: editData.value.name, |
151 | + defaultRuleChainId: editData.value.defaultRuleChainId, | ||
152 | + defaultQueueName: editData.value.defaultQueueName, | ||
153 | + description: editData.value.description, | ||
151 | }); | 154 | }); |
152 | proxy.$refs.DeviceProfileStep3Ref.clearProfileDataFunc(); | 155 | proxy.$refs.DeviceProfileStep3Ref.clearProfileDataFunc(); |
153 | proxy.$refs.DeviceProfileStep3Ref.addAlarmRule(); | 156 | proxy.$refs.DeviceProfileStep3Ref.addAlarmRule(); |
157 | + } else if (isUpdate.value == 3) { | ||
154 | postEditId.value = data.record.id; | 158 | postEditId.value = data.record.id; |
155 | getBackendData = await deviceConfigGetDetail(postEditId.value); | 159 | getBackendData = await deviceConfigGetDetail(postEditId.value); |
156 | editData.value = getBackendData; | 160 | editData.value = getBackendData; |
157 | - } else if (isUpdate.value == 3) { | ||
158 | proxy.$refs.DeviceProfileStep3Ref.isAddRuleStatusFunc(false); | 161 | proxy.$refs.DeviceProfileStep3Ref.isAddRuleStatusFunc(false); |
159 | isShowRule.value = false; | 162 | isShowRule.value = false; |
160 | isShowOkBtnFalse.value = false; | 163 | isShowOkBtnFalse.value = false; |
@@ -164,16 +167,13 @@ | @@ -164,16 +167,13 @@ | ||
164 | proxy.$refs.DeviceProfileStep1Ref.customResetStepOneFunc(); | 167 | proxy.$refs.DeviceProfileStep1Ref.customResetStepOneFunc(); |
165 | //回显第一步数据 | 168 | //回显第一步数据 |
166 | proxy.$refs.DeviceProfileStep1Ref.setStepOneFieldsValueFunc({ | 169 | proxy.$refs.DeviceProfileStep1Ref.setStepOneFieldsValueFunc({ |
167 | - name: data.record.name, | ||
168 | - defaultRuleChainId: data.record.defaultRuleChainId, | ||
169 | - defaultQueueName: data.record.defaultQueueName, | ||
170 | - description: data.record.description, | 170 | + name: editData.value.name, |
171 | + defaultRuleChainId: editData.value.defaultRuleChainId, | ||
172 | + defaultQueueName: editData.value.defaultQueueName, | ||
173 | + description: editData.value.description, | ||
171 | }); | 174 | }); |
172 | proxy.$refs.DeviceProfileStep3Ref.clearProfileDataFunc(); | 175 | proxy.$refs.DeviceProfileStep3Ref.clearProfileDataFunc(); |
173 | proxy.$refs.DeviceProfileStep3Ref.addAlarmRule(); | 176 | proxy.$refs.DeviceProfileStep3Ref.addAlarmRule(); |
174 | - postEditId.value = data.record.id; | ||
175 | - getBackendData = await deviceConfigGetDetail(postEditId.value); | ||
176 | - editData.value = getBackendData; | ||
177 | } | 177 | } |
178 | }); | 178 | }); |
179 | function handleStepPrev() { | 179 | function handleStepPrev() { |
@@ -9,7 +9,6 @@ export const alertContactsSchemas: FormSchema[] = [ | @@ -9,7 +9,6 @@ export const alertContactsSchemas: FormSchema[] = [ | ||
9 | component: 'ApiSelect', | 9 | component: 'ApiSelect', |
10 | componentProps: { | 10 | componentProps: { |
11 | mode: 'multiple', | 11 | mode: 'multiple', |
12 | - | ||
13 | api: alarmContactGetPage, | 12 | api: alarmContactGetPage, |
14 | labelField: 'username', | 13 | labelField: 'username', |
15 | valueField: 'id', | 14 | valueField: 'id', |
@@ -26,7 +26,7 @@ export const step1Schemas: FormSchema[] = [ | @@ -26,7 +26,7 @@ export const step1Schemas: FormSchema[] = [ | ||
26 | //规则链(string) | 26 | //规则链(string) |
27 | { | 27 | { |
28 | field: 'defaultRuleChainId', | 28 | field: 'defaultRuleChainId', |
29 | - label: '请选择规则链', | 29 | + label: '规则链', |
30 | component: 'ApiSelect', | 30 | component: 'ApiSelect', |
31 | componentProps: { | 31 | componentProps: { |
32 | api: async () => { | 32 | api: async () => { |
@@ -48,6 +48,21 @@ export const step1Schemas: FormSchema[] = [ | @@ -48,6 +48,21 @@ export const step1Schemas: FormSchema[] = [ | ||
48 | field: 'defaultQueueName', | 48 | field: 'defaultQueueName', |
49 | label: '处理队列', | 49 | label: '处理队列', |
50 | component: 'ApiSelect', | 50 | component: 'ApiSelect', |
51 | + // componentProps: { | ||
52 | + // api: async () => { | ||
53 | + // const data = await findDictItemByCode({ dictCode: 'queen_execute_sequence' }); | ||
54 | + // const returnData = data.map((m) => { | ||
55 | + // return { | ||
56 | + // getLabelField: m.itemText, | ||
57 | + // getValueField: m.itemValue, | ||
58 | + // }; | ||
59 | + // }); | ||
60 | + // return returnData; | ||
61 | + // }, | ||
62 | + // labelField: 'getLabelField', | ||
63 | + // valueField: 'getValueField', | ||
64 | + // immediate: true, | ||
65 | + // }, | ||
51 | componentProps: { | 66 | componentProps: { |
52 | api: findDictItemByCode, | 67 | api: findDictItemByCode, |
53 | params: { | 68 | params: { |
@@ -55,8 +70,10 @@ export const step1Schemas: FormSchema[] = [ | @@ -55,8 +70,10 @@ export const step1Schemas: FormSchema[] = [ | ||
55 | }, | 70 | }, |
56 | labelField: 'itemText', | 71 | labelField: 'itemText', |
57 | valueField: 'itemValue', | 72 | valueField: 'itemValue', |
73 | + resultField: 'items', | ||
58 | }, | 74 | }, |
59 | }, | 75 | }, |
76 | + | ||
60 | { | 77 | { |
61 | label: '描述', | 78 | label: '描述', |
62 | field: 'description', | 79 | field: 'description', |
@@ -65,19 +82,6 @@ export const step1Schemas: FormSchema[] = [ | @@ -65,19 +82,6 @@ export const step1Schemas: FormSchema[] = [ | ||
65 | maxLength: 255, | 82 | maxLength: 255, |
66 | placeholder: '请输入描述', | 83 | placeholder: '请输入描述', |
67 | }, | 84 | }, |
68 | - dynamicRules: () => { | ||
69 | - return [ | ||
70 | - { | ||
71 | - required: false, | ||
72 | - validator: (_, value) => { | ||
73 | - if (String(value).length > 255) { | ||
74 | - return Promise.reject('字数不超过255个字'); | ||
75 | - } | ||
76 | - return Promise.resolve(); | ||
77 | - }, | ||
78 | - }, | ||
79 | - ]; | ||
80 | - }, | ||
81 | }, | 85 | }, |
82 | ]; | 86 | ]; |
83 | 87 |
@@ -59,7 +59,7 @@ | @@ -59,7 +59,7 @@ | ||
59 | const updateFieldDeviceId = (v) => { | 59 | const updateFieldDeviceId = (v) => { |
60 | setTimeout(() => { | 60 | setTimeout(() => { |
61 | updateSchema({ | 61 | updateSchema({ |
62 | - field: 'entityId', | 62 | + field: 'deviceId', |
63 | componentProps: { | 63 | componentProps: { |
64 | options: v, | 64 | options: v, |
65 | }, | 65 | }, |
@@ -80,7 +80,7 @@ | @@ -80,7 +80,7 @@ | ||
80 | if (props.newActionMapFather !== 1) { | 80 | if (props.newActionMapFather !== 1) { |
81 | setTimeout(() => { | 81 | setTimeout(() => { |
82 | updateSchema({ | 82 | updateSchema({ |
83 | - field: 'entityId', | 83 | + field: 'deviceId', |
84 | componentProps: { | 84 | componentProps: { |
85 | options: props.newActionMapFather, | 85 | options: props.newActionMapFather, |
86 | }, | 86 | }, |
@@ -92,7 +92,7 @@ | @@ -92,7 +92,7 @@ | ||
92 | //新增清空设备选择 | 92 | //新增清空设备选择 |
93 | const clearSelectDevice = () => { | 93 | const clearSelectDevice = () => { |
94 | updateSchema({ | 94 | updateSchema({ |
95 | - field: 'entityId', | 95 | + field: 'deviceId', |
96 | componentProps: { | 96 | componentProps: { |
97 | options: [], | 97 | options: [], |
98 | }, | 98 | }, |
@@ -30,9 +30,17 @@ export enum AttributeActionEnum { | @@ -30,9 +30,17 @@ export enum AttributeActionEnum { | ||
30 | 30 | ||
31 | export enum AttrAndWenDuEnum { | 31 | export enum AttrAndWenDuEnum { |
32 | IS_ALL_ATTR = 'ALL_ATTR', | 32 | IS_ALL_ATTR = 'ALL_ATTR', |
33 | - IS_WENDU_ACT = 'temp', | ||
34 | - IS_SHIDU = 'temp', | 33 | + IS_WENDU_ACT = 'NUMERIC', |
34 | + IS_SHIDU = 'NUMERIC', | ||
35 | + IS_CONDITION_WENDU = 'NUMERIC2', | ||
36 | + IS_CONDITION_SHIDU = 'NUMERIC1', | ||
35 | } | 37 | } |
38 | +export const isConditionShiDu = (type: string) => { | ||
39 | + return type === AttrAndWenDuEnum.IS_CONDITION_SHIDU; | ||
40 | +}; | ||
41 | +export const isConditionWenDu = (type: string) => { | ||
42 | + return type === AttrAndWenDuEnum.IS_CONDITION_WENDU; | ||
43 | +}; | ||
36 | 44 | ||
37 | export const isShiDu = (type: string) => { | 45 | export const isShiDu = (type: string) => { |
38 | return type === AttrAndWenDuEnum.IS_SHIDU; | 46 | return type === AttrAndWenDuEnum.IS_SHIDU; |
@@ -43,7 +51,7 @@ export const isWenDu = (type: string) => { | @@ -43,7 +51,7 @@ export const isWenDu = (type: string) => { | ||
43 | }; | 51 | }; |
44 | 52 | ||
45 | export const isTimeAll = (type: string) => { | 53 | export const isTimeAll = (type: string) => { |
46 | - return type === TriggerEnum.IS_TIME_ALL; | 54 | + return type === TriggerEnum.IS_TIME_ACT; |
47 | }; | 55 | }; |
48 | 56 | ||
49 | export const isMsg = (type: string) => { | 57 | export const isMsg = (type: string) => { |
@@ -107,7 +115,7 @@ export const columns: BasicColumn[] = [ | @@ -107,7 +115,7 @@ export const columns: BasicColumn[] = [ | ||
107 | record.pendingStatus = true; | 115 | record.pendingStatus = true; |
108 | const newStatus = checked ? 1 : 0; | 116 | const newStatus = checked ? 1 : 0; |
109 | const { createMessage } = useMessage(); | 117 | const { createMessage } = useMessage(); |
110 | - screenLinkPagePutApi(record.id, newStatus) | 118 | + screenLinkPagePutApi({ id: record.id, status: newStatus }) |
111 | .then(() => { | 119 | .then(() => { |
112 | record.status = newStatus; | 120 | record.status = newStatus; |
113 | if (record.status == 1) { | 121 | if (record.status == 1) { |
@@ -265,7 +273,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | @@ -265,7 +273,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | ||
265 | }, | 273 | }, |
266 | }, | 274 | }, |
267 | { | 275 | { |
268 | - field: 'entityIdCorn', | 276 | + field: 'entityId1', |
269 | component: 'Input', | 277 | component: 'Input', |
270 | label: '', | 278 | label: '', |
271 | componentProps: { | 279 | componentProps: { |
@@ -275,7 +283,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | @@ -275,7 +283,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | ||
275 | colProps: { | 283 | colProps: { |
276 | span: 12, | 284 | span: 12, |
277 | }, | 285 | }, |
278 | - ifShow: ({ values }) => isTime(Reflect.get(values, 'triggerType')), | 286 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'triggerType')), |
279 | }, | 287 | }, |
280 | { | 288 | { |
281 | field: 'type1', | 289 | field: 'type1', |
@@ -320,8 +328,8 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | @@ -320,8 +328,8 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | ||
320 | componentProps: { | 328 | componentProps: { |
321 | placeholder: '全部属性', | 329 | placeholder: '全部属性', |
322 | options: [ | 330 | options: [ |
323 | - { label: '全部属性', value: 'All_ATTR' }, | ||
324 | - { label: 'wendu', value: 'temp' }, | 331 | + { label: '全部属性', value: 'STRING' }, |
332 | + { label: 'wendu', value: 'NUMERIC' }, | ||
325 | ], | 333 | ], |
326 | }, | 334 | }, |
327 | ifShow: ({ values }) => | 335 | ifShow: ({ values }) => |
@@ -364,7 +372,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | @@ -364,7 +372,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | ||
364 | 372 | ||
365 | ifShow: ({ values }) => | 373 | ifShow: ({ values }) => |
366 | isWenDu(Reflect.get(values, 'type2')) && | 374 | isWenDu(Reflect.get(values, 'type2')) && |
367 | - !isUpAndDown(Reflect.get(values, 'type')) && | 375 | + !isUpAndDown(Reflect.get(values, 'type1')) && |
368 | !isTime(Reflect.get(values, 'triggerType')) && | 376 | !isTime(Reflect.get(values, 'triggerType')) && |
369 | !isScene(Reflect.get(values, 'triggerType')) && | 377 | !isScene(Reflect.get(values, 'triggerType')) && |
370 | !isHand(Reflect.get(values, 'triggerType')), | 378 | !isHand(Reflect.get(values, 'triggerType')), |
@@ -374,7 +382,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | @@ -374,7 +382,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | ||
374 | }, | 382 | }, |
375 | 383 | ||
376 | { | 384 | { |
377 | - field: 'entityIdScene', | 385 | + field: 'entityId2', |
378 | label: '', | 386 | label: '', |
379 | component: 'Select', | 387 | component: 'Select', |
380 | colProps: { | 388 | colProps: { |
@@ -456,21 +464,21 @@ export const useConditionDrawerSchema: FormSchema[] = [ | @@ -456,21 +464,21 @@ export const useConditionDrawerSchema: FormSchema[] = [ | ||
456 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'triggerType')), | 464 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'triggerType')), |
457 | }, | 465 | }, |
458 | { | 466 | { |
459 | - field: 'key', | 467 | + field: 'type', |
460 | label: '', | 468 | label: '', |
461 | component: 'Select', | 469 | component: 'Select', |
462 | componentProps: { | 470 | componentProps: { |
463 | placeholder: '请选择或者输入属性', | 471 | placeholder: '请选择或者输入属性', |
464 | options: [ | 472 | options: [ |
465 | - { label: 'shidu', value: 'temp' }, | ||
466 | - { label: 'wendu', value: 'temp' }, | 473 | + { label: 'shidu', value: 'NUMERIC1' }, |
474 | + { label: 'wendu', value: 'NUMERIC2' }, | ||
467 | ], | 475 | ], |
468 | }, | 476 | }, |
469 | ifShow: ({ values }) => !isTimeAll(Reflect.get(values, 'triggerType')), | 477 | ifShow: ({ values }) => !isTimeAll(Reflect.get(values, 'triggerType')), |
470 | colProps: { span: 12 }, | 478 | colProps: { span: 12 }, |
471 | }, | 479 | }, |
472 | { | 480 | { |
473 | - field: 'operation', | 481 | + field: 'operation1', |
474 | label: '', | 482 | label: '', |
475 | component: 'Select', | 483 | component: 'Select', |
476 | componentProps: { | 484 | componentProps: { |
@@ -484,11 +492,12 @@ export const useConditionDrawerSchema: FormSchema[] = [ | @@ -484,11 +492,12 @@ export const useConditionDrawerSchema: FormSchema[] = [ | ||
484 | ], | 492 | ], |
485 | }, | 493 | }, |
486 | ifShow: ({ values }) => | 494 | ifShow: ({ values }) => |
487 | - isShiDu(Reflect.get(values, 'key')) && !isTimeAll(Reflect.get(values, 'triggerType')), | 495 | + isConditionShiDu(Reflect.get(values, 'type')) && |
496 | + !isTimeAll(Reflect.get(values, 'triggerType')), | ||
488 | colProps: { span: 12 }, | 497 | colProps: { span: 12 }, |
489 | }, | 498 | }, |
490 | { | 499 | { |
491 | - field: 'value', | 500 | + field: 'value1', |
492 | component: 'Input', | 501 | component: 'Input', |
493 | label: '', | 502 | label: '', |
494 | componentProps: { | 503 | componentProps: { |
@@ -497,14 +506,15 @@ export const useConditionDrawerSchema: FormSchema[] = [ | @@ -497,14 +506,15 @@ export const useConditionDrawerSchema: FormSchema[] = [ | ||
497 | }, | 506 | }, |
498 | 507 | ||
499 | ifShow: ({ values }) => | 508 | ifShow: ({ values }) => |
500 | - isShiDu(Reflect.get(values, 'key')) && !isTimeAll(Reflect.get(values, 'triggerType')), | 509 | + isConditionShiDu(Reflect.get(values, 'type')) && |
510 | + !isTimeAll(Reflect.get(values, 'triggerType')), | ||
501 | colProps: { | 511 | colProps: { |
502 | span: 12, | 512 | span: 12, |
503 | }, | 513 | }, |
504 | }, | 514 | }, |
505 | 515 | ||
506 | { | 516 | { |
507 | - field: 'operation', | 517 | + field: 'operation2', |
508 | label: '', | 518 | label: '', |
509 | component: 'Select', | 519 | component: 'Select', |
510 | componentProps: { | 520 | componentProps: { |
@@ -518,11 +528,12 @@ export const useConditionDrawerSchema: FormSchema[] = [ | @@ -518,11 +528,12 @@ export const useConditionDrawerSchema: FormSchema[] = [ | ||
518 | ], | 528 | ], |
519 | }, | 529 | }, |
520 | ifShow: ({ values }) => | 530 | ifShow: ({ values }) => |
521 | - isWenDu(Reflect.get(values, 'key')) && !isTimeAll(Reflect.get(values, 'triggerType')), | 531 | + isConditionWenDu(Reflect.get(values, 'type')) && |
532 | + !isTimeAll(Reflect.get(values, 'triggerType')), | ||
522 | colProps: { span: 12 }, | 533 | colProps: { span: 12 }, |
523 | }, | 534 | }, |
524 | { | 535 | { |
525 | - field: 'value', | 536 | + field: 'value2', |
526 | component: 'Input', | 537 | component: 'Input', |
527 | label: '', | 538 | label: '', |
528 | componentProps: { | 539 | componentProps: { |
@@ -530,7 +541,8 @@ export const useConditionDrawerSchema: FormSchema[] = [ | @@ -530,7 +541,8 @@ export const useConditionDrawerSchema: FormSchema[] = [ | ||
530 | placeholder: '请输入比较值', | 541 | placeholder: '请输入比较值', |
531 | }, | 542 | }, |
532 | ifShow: ({ values }) => | 543 | ifShow: ({ values }) => |
533 | - isWenDu(Reflect.get(values, 'key')) && !isTimeAll(Reflect.get(values, 'triggerType')), | 544 | + isConditionWenDu(Reflect.get(values, 'type')) && |
545 | + !isTimeAll(Reflect.get(values, 'triggerType')), | ||
534 | colProps: { | 546 | colProps: { |
535 | span: 12, | 547 | span: 12, |
536 | }, | 548 | }, |
@@ -554,7 +566,7 @@ export const useActionDrawerSchema: FormSchema[] = [ | @@ -554,7 +566,7 @@ export const useActionDrawerSchema: FormSchema[] = [ | ||
554 | colProps: { span: 12 }, | 566 | colProps: { span: 12 }, |
555 | }, | 567 | }, |
556 | { | 568 | { |
557 | - field: 'entityId', | 569 | + field: 'deviceId', |
558 | label: '', | 570 | label: '', |
559 | component: 'Select', | 571 | component: 'Select', |
560 | componentProps: { | 572 | componentProps: { |
@@ -606,7 +618,7 @@ export const useActionDrawerSchema: FormSchema[] = [ | @@ -606,7 +618,7 @@ export const useActionDrawerSchema: FormSchema[] = [ | ||
606 | ifShow: ({ values }) => isMsg(Reflect.get(values, 'outTarget')), | 618 | ifShow: ({ values }) => isMsg(Reflect.get(values, 'outTarget')), |
607 | }, | 619 | }, |
608 | { | 620 | { |
609 | - field: 'sceneLinkageId', | 621 | + field: 'entityId', |
610 | label: '', | 622 | label: '', |
611 | component: 'Select', | 623 | component: 'Select', |
612 | colProps: { | 624 | colProps: { |
1 | export interface IAddTrigger { | 1 | export interface IAddTrigger { |
2 | triggerType: string; | 2 | triggerType: string; |
3 | - deviceId: string; | 3 | + entityId: string; |
4 | touchWay: string; | 4 | touchWay: string; |
5 | attributeChoose: string; | 5 | attributeChoose: string; |
6 | compare: string; | 6 | compare: string; |
@@ -9,7 +9,7 @@ export interface IAddTrigger { | @@ -9,7 +9,7 @@ export interface IAddTrigger { | ||
9 | 9 | ||
10 | export interface IAddCondition { | 10 | export interface IAddCondition { |
11 | triggerType: string; | 11 | triggerType: string; |
12 | - deviceId: string; | 12 | + entityId: string; |
13 | createTime: string; | 13 | createTime: string; |
14 | updateTime: string; | 14 | updateTime: string; |
15 | compare: string; | 15 | compare: string; |
@@ -200,7 +200,7 @@ | @@ -200,7 +200,7 @@ | ||
200 | compare: '', | 200 | compare: '', |
201 | value: '', | 201 | value: '', |
202 | }); | 202 | }); |
203 | - const editTriggerData = reactive<IAddTrigger>({ | 203 | + let editTriggerData = reactive<IAddTrigger>({ |
204 | triggerType: '', | 204 | triggerType: '', |
205 | entityId: '请选择设备', | 205 | entityId: '请选择设备', |
206 | touchWay: '请选择触发方式', | 206 | touchWay: '请选择触发方式', |
@@ -208,19 +208,25 @@ | @@ -208,19 +208,25 @@ | ||
208 | compare: '', | 208 | compare: '', |
209 | value: '', | 209 | value: '', |
210 | }); | 210 | }); |
211 | - const addConditionData = reactive<IAddCondition>({ | ||
212 | - triggerType: '', | ||
213 | - entityId: '', | 211 | + const editConditionData = reactive<IAddCondition>({ |
212 | + entityId: '请选择设备', | ||
214 | createTime: '', | 213 | createTime: '', |
215 | updateTime: '', | 214 | updateTime: '', |
215 | + triggerType: '', | ||
216 | compare: '', | 216 | compare: '', |
217 | value: '', | 217 | value: '', |
218 | }); | 218 | }); |
219 | - const editConditionData = reactive<IAddCondition>({ | 219 | + const editActionData = reactive<IAddAction>({ |
220 | + outTarget: '', | ||
220 | entityId: '请选择设备', | 221 | entityId: '请选择设备', |
222 | + command: '请输入执行命令', | ||
223 | + sceneLinkageId: '', | ||
224 | + }); | ||
225 | + const addConditionData = reactive<IAddCondition>({ | ||
226 | + triggerType: '', | ||
227 | + entityId: '', | ||
221 | createTime: '', | 228 | createTime: '', |
222 | updateTime: '', | 229 | updateTime: '', |
223 | - triggerType: '', | ||
224 | compare: '', | 230 | compare: '', |
225 | value: '', | 231 | value: '', |
226 | }); | 232 | }); |
@@ -230,12 +236,6 @@ | @@ -230,12 +236,6 @@ | ||
230 | command: '', | 236 | command: '', |
231 | sceneLinkageId: '', | 237 | sceneLinkageId: '', |
232 | }); | 238 | }); |
233 | - const editActionData = reactive<IAddAction>({ | ||
234 | - outTarget: '', | ||
235 | - entityId: '请选择设备', | ||
236 | - command: '请输入执行命令', | ||
237 | - sceneLinkageId: '', | ||
238 | - }); | ||
239 | const addTriggerPushData = ref<[]>([]); | 239 | const addTriggerPushData = ref<[]>([]); |
240 | const addConditionPushData = ref<[]>([]); | 240 | const addConditionPushData = ref<[]>([]); |
241 | const addActionPushData = ref<[]>([]); | 241 | const addActionPushData = ref<[]>([]); |
@@ -261,8 +261,7 @@ | @@ -261,8 +261,7 @@ | ||
261 | const newConditionFilterMap = ref<[]>([]); | 261 | const newConditionFilterMap = ref<[]>([]); |
262 | const newActionFilterMap = ref<[]>([]); | 262 | const newActionFilterMap = ref<[]>([]); |
263 | let filterNewConditionArr = []; | 263 | let filterNewConditionArr = []; |
264 | - let filterNewActionArr = []; | ||
265 | - const pushEditArray = []; | 264 | + const pushEditArray = ref<any>([{}]); |
266 | const pushEditConditionArray = []; | 265 | const pushEditConditionArray = []; |
267 | const pushEditActionArray = []; | 266 | const pushEditActionArray = []; |
268 | let filterArrayTrigger = []; | 267 | let filterArrayTrigger = []; |
@@ -291,8 +290,6 @@ | @@ -291,8 +290,6 @@ | ||
291 | isUpdate.value = !!data?.isUpdate; | 290 | isUpdate.value = !!data?.isUpdate; |
292 | if (!unref(isUpdate)) { | 291 | if (!unref(isUpdate)) { |
293 | try { | 292 | try { |
294 | - filterNewActionArr = []; | ||
295 | - filterNewActionArr.length = 0; | ||
296 | refTriggerChildData = {}; | 293 | refTriggerChildData = {}; |
297 | refConditionChildData = {}; | 294 | refConditionChildData = {}; |
298 | refActionChildData = {}; | 295 | refActionChildData = {}; |
@@ -337,45 +334,44 @@ | @@ -337,45 +334,44 @@ | ||
337 | return e; | 334 | return e; |
338 | } | 335 | } |
339 | } else { | 336 | } else { |
340 | - newFilterMap.value = []; | ||
341 | - newConditionFilterMap.value = []; | ||
342 | - newActionFilterMap.value = []; | ||
343 | - clearAllArrayFunc(); | ||
344 | - editTriggerPushData.value = []; | ||
345 | - editTriggerPushData.value.length = 0; | ||
346 | - editConditionPushData.value = []; | ||
347 | - editConditionPushData.value.length = 0; | ||
348 | - editActionPushData.value = []; | ||
349 | - editActionPushData.value.length = 0; | ||
350 | - lastEditRefTriggerChildDataArray.value = []; | ||
351 | - getId.value = data.record.id; | ||
352 | - getTenantId.value = data.record.tenantId; | ||
353 | - await setFieldsValue({ | ||
354 | - ...data.record, | ||
355 | - }); | ||
356 | - editTriggerPushData.value = data.record.triggers; | ||
357 | - editConditionPushData.value = data.record.doConditions; | ||
358 | - editActionPushData.value = data.record.doActions; | ||
359 | - const options = await screenLinkPageByDeptIdGetDevice({ | ||
360 | - organizationId: data.record.organizationId, | ||
361 | - }); | ||
362 | try { | 337 | try { |
338 | + newFilterMap.value = []; | ||
339 | + newConditionFilterMap.value = []; | ||
340 | + newActionFilterMap.value = []; | ||
341 | + clearAllArrayFunc(); | ||
342 | + editTriggerPushData.value = []; | ||
343 | + editTriggerPushData.value.length = 0; | ||
344 | + editConditionPushData.value = []; | ||
345 | + editConditionPushData.value.length = 0; | ||
346 | + editActionPushData.value = []; | ||
347 | + editActionPushData.value.length = 0; | ||
348 | + lastEditRefTriggerChildDataArray.value = []; | ||
349 | + getId.value = data.record.id; | ||
350 | + getTenantId.value = data.record.tenantId; | ||
351 | + await setFieldsValue({ | ||
352 | + ...data.record, | ||
353 | + }); | ||
354 | + editTriggerPushData.value = data.record.triggers; | ||
355 | + editConditionPushData.value = data.record.doConditions; | ||
356 | + editActionPushData.value = data.record.doActions; | ||
357 | + const options = await screenLinkPageByDeptIdGetDevice({ | ||
358 | + organizationId: data.record.organizationId, | ||
359 | + }); | ||
363 | data.record.triggers.forEach((f1) => { | 360 | data.record.triggers.forEach((f1) => { |
364 | options.items?.forEach((f2) => { | 361 | options.items?.forEach((f2) => { |
365 | - if (f2.id == f1.entityId) { | 362 | + if (f2.tbDeviceId == f1.entityId) { |
366 | newFilterMap.value.push({ | 363 | newFilterMap.value.push({ |
367 | - value: f2.id, | 364 | + value: f2.tbDeviceId, |
368 | label: f2.name, | 365 | label: f2.name, |
369 | }); | 366 | }); |
370 | } | 367 | } |
371 | }); | 368 | }); |
372 | }); | 369 | }); |
373 | - | ||
374 | data.record.doConditions.forEach((f1) => { | 370 | data.record.doConditions.forEach((f1) => { |
375 | options.items?.forEach((f2) => { | 371 | options.items?.forEach((f2) => { |
376 | - if (f2.id == f1.entityId) { | 372 | + if (f2.tbDeviceId == f1.entityId) { |
377 | newConditionFilterMap.value.push({ | 373 | newConditionFilterMap.value.push({ |
378 | - value: f2.id, | 374 | + value: f2.tbDeviceId, |
379 | label: f2.name, | 375 | label: f2.name, |
380 | }); | 376 | }); |
381 | } | 377 | } |
@@ -383,20 +379,22 @@ | @@ -383,20 +379,22 @@ | ||
383 | }); | 379 | }); |
384 | data.record.doActions.forEach((f1) => { | 380 | data.record.doActions.forEach((f1) => { |
385 | options.items?.forEach((f2) => { | 381 | options.items?.forEach((f2) => { |
386 | - if (f2.id == f1.entityId) { | 382 | + if (f2.tbDeviceId == f1.deviceId) { |
387 | newActionFilterMap.value.push({ | 383 | newActionFilterMap.value.push({ |
388 | - value: f2.id, | 384 | + value: f2.tbDeviceId, |
389 | label: f2.name, | 385 | label: f2.name, |
390 | }); | 386 | }); |
391 | } | 387 | } |
392 | }); | 388 | }); |
393 | }); | 389 | }); |
394 | - } catch (e) {} | 390 | + } catch (e) { |
391 | + return e; | ||
392 | + } | ||
395 | } | 393 | } |
396 | }); | 394 | }); |
397 | const getTitle = computed(() => (!unref(isUpdate) ? '新增场景联动' : '编辑场景联动')); | 395 | const getTitle = computed(() => (!unref(isUpdate) ? '新增场景联动' : '编辑场景联动')); |
398 | const handleClose = () => { | 396 | const handleClose = () => { |
399 | - pushEditArray.length = 0; | 397 | + pushEditArray.value.length = 0; |
400 | lastRefTriggerChildDataArray.value.length = 0; | 398 | lastRefTriggerChildDataArray.value.length = 0; |
401 | lastRefTriggerChildDataArray.value = []; | 399 | lastRefTriggerChildDataArray.value = []; |
402 | lastRefConditionChildDataArray.value.length = 0; | 400 | lastRefConditionChildDataArray.value.length = 0; |
@@ -431,12 +429,9 @@ | @@ -431,12 +429,9 @@ | ||
431 | } | 429 | } |
432 | }; | 430 | }; |
433 | watch(getData, async (newV) => { | 431 | watch(getData, async (newV) => { |
434 | - // getDeviceInfo.value = newV; | ||
435 | - // getDeviceInfo1.value = newV; | ||
436 | - // getDeviceInfo2.value = newV; | ||
437 | const options = await screenLinkPageByDeptIdGetDevice({ organizationId: newV }); | 432 | const options = await screenLinkPageByDeptIdGetDevice({ organizationId: newV }); |
438 | options.items.forEach((v) => { | 433 | options.items.forEach((v) => { |
439 | - return (v.value = v.id), (v.label = v.name); | 434 | + return (v.value = v.tbDeviceId), (v.label = v.name); |
440 | }); | 435 | }); |
441 | optionsItemArray.value = options.items; | 436 | optionsItemArray.value = options.items; |
442 | updateDeviceIdFunc(optionsItemArray.value); | 437 | updateDeviceIdFunc(optionsItemArray.value); |
@@ -457,7 +452,7 @@ | @@ -457,7 +452,7 @@ | ||
457 | } | 452 | } |
458 | }; | 453 | }; |
459 | 454 | ||
460 | - //触发器方法 | 455 | + //获取触发器方法 |
461 | const refTriggerChildDataFunc = () => { | 456 | const refTriggerChildDataFunc = () => { |
462 | try { | 457 | try { |
463 | refTriggerChildData = proxy.$refs.refTriggerChild.getFieldsValueFunc(); | 458 | refTriggerChildData = proxy.$refs.refTriggerChild.getFieldsValueFunc(); |
@@ -465,7 +460,7 @@ | @@ -465,7 +460,7 @@ | ||
465 | return e; | 460 | return e; |
466 | } | 461 | } |
467 | }; | 462 | }; |
468 | - //执行条件方法 | 463 | + //获取执行条件方法 |
469 | const refConditionChildDataFunc = () => { | 464 | const refConditionChildDataFunc = () => { |
470 | try { | 465 | try { |
471 | refConditionChildData = proxy.$refs.refConditionChild.getFieldsValueFunc(); | 466 | refConditionChildData = proxy.$refs.refConditionChild.getFieldsValueFunc(); |
@@ -473,7 +468,7 @@ | @@ -473,7 +468,7 @@ | ||
473 | return e; | 468 | return e; |
474 | } | 469 | } |
475 | }; | 470 | }; |
476 | - //执行动作方法 | 471 | + //获取执行动作方法 |
477 | const refActionChildDataFunc = () => { | 472 | const refActionChildDataFunc = () => { |
478 | try { | 473 | try { |
479 | refActionChildData = proxy.$refs.refActionChild.getFieldsValueFunc(); | 474 | refActionChildData = proxy.$refs.refActionChild.getFieldsValueFunc(); |
@@ -484,101 +479,54 @@ | @@ -484,101 +479,54 @@ | ||
484 | 479 | ||
485 | const getDefaultValue = () => { | 480 | const getDefaultValue = () => { |
486 | if (!unref(isUpdate)) { | 481 | if (!unref(isUpdate)) { |
482 | + refTriggerChildDataFunc(); | ||
483 | + refConditionChildDataFunc(); | ||
484 | + refActionChildDataFunc(); | ||
485 | + const newTriggerArray = addTriggerPushData.value.concat(refTriggerChildData); | ||
486 | + const newConditionArray = addConditionPushData.value.concat(refConditionChildData); | ||
487 | + const newActionArray = addActionPushData.value.concat(refActionChildData); | ||
488 | + newTriggerArray.shift(); | ||
489 | + newConditionArray.shift(); | ||
490 | + newActionArray.shift(); | ||
487 | delete getAllFormData.id; | 491 | delete getAllFormData.id; |
488 | delete getAllFormData.getTenantId; | 492 | delete getAllFormData.getTenantId; |
489 | triggersObj = { | 493 | triggersObj = { |
490 | - triggers: lastRefTriggerChildDataArray.value, | 494 | + triggers: newTriggerArray, |
491 | }; | 495 | }; |
492 | conditionsObj = { | 496 | conditionsObj = { |
493 | - doConditions: lastRefConditionChildDataArray.value, | 497 | + doConditions: newConditionArray, |
494 | }; | 498 | }; |
495 | actionsObj = { | 499 | actionsObj = { |
496 | - doActions: lastRefActionChildDataArray.value, | 500 | + doActions: newActionArray, |
497 | }; | 501 | }; |
498 | Object.assign(getAllFormData, triggersObj, conditionsObj, actionsObj); | 502 | Object.assign(getAllFormData, triggersObj, conditionsObj, actionsObj); |
499 | } else { | 503 | } else { |
500 | refTriggerChildDataFunc(); | 504 | refTriggerChildDataFunc(); |
501 | - refConditionChildDataFunc(); | ||
502 | - refActionChildDataFunc(); | ||
503 | - pushEditArray.push(refTriggerChildData as never); | ||
504 | - pushEditConditionArray.push(refConditionChildData as never); | ||
505 | - pushEditActionArray.push(refActionChildData as never); | ||
506 | - pushEditArray.forEach((f) => { | ||
507 | - editTriggerPushData.value.push(f as never); | ||
508 | - }); | ||
509 | - pushEditConditionArray.forEach((f) => { | ||
510 | - editConditionPushData.value.push(f as never); | ||
511 | - }); | ||
512 | - pushEditActionArray.forEach((f) => { | ||
513 | - editActionPushData.value.push(f as never); | ||
514 | - }); | ||
515 | - const filterTwoArrayTrigger = editTriggerPushData.value.filter((f) => | ||
516 | - f?.hasOwnProperty('id') | ||
517 | - ); | ||
518 | - | ||
519 | - const filterTwoArrayCondition = editConditionPushData.value.filter((f) => | ||
520 | - f?.hasOwnProperty('id') | ||
521 | - ); | ||
522 | - | ||
523 | - const filterTwoArrayAction = editActionPushData.value.filter((f) => | ||
524 | - f?.hasOwnProperty('id') | ||
525 | - ); | ||
526 | - | ||
527 | - const filterThreeArrayTrigger = editTriggerPushData.value.filter( | ||
528 | - (f) => f?.entityId == '' | ||
529 | - ); | ||
530 | - const filterThreeArrayCondition = editConditionPushData.value.filter( | ||
531 | - (f) => f?.entityId == '' | ||
532 | - ); | ||
533 | - const filterThreeArrayAction = editActionPushData.value.filter((f) => f?.entityId == ''); | ||
534 | - const filterFourArrayTrigger = filterThreeArrayTrigger.filter( | ||
535 | - (f) => f?.triggerType !== '' | ||
536 | - ); | ||
537 | - const filterFourArrayCondition = filterThreeArrayCondition.filter( | ||
538 | - (f) => f?.triggerType !== '' | ||
539 | - ); | ||
540 | - | ||
541 | - const filterFourArrayAction = filterThreeArrayAction.filter((f) => f?.outTarget !== ''); | ||
542 | - | ||
543 | - filterFourArrayTrigger.forEach((f) => { | ||
544 | - filterTwoArrayTrigger.push(f); | ||
545 | - }); | ||
546 | - filterFourArrayCondition.forEach((f) => { | ||
547 | - filterTwoArrayCondition.push(f); | ||
548 | - }); | ||
549 | - filterFourArrayAction.forEach((f) => { | ||
550 | - filterTwoArrayAction.push(f); | ||
551 | - }); | ||
552 | - | ||
553 | - let editTriggersObj = { | ||
554 | - triggers: filterTwoArrayTrigger, | ||
555 | - }; | ||
556 | - let editConditionsObj = { | ||
557 | - doConditions: filterTwoArrayCondition, | ||
558 | - }; | ||
559 | - let editActionsObj = { | ||
560 | - doActions: filterTwoArrayAction, | 505 | + refTriggerChildData = {}; |
506 | + let newTriggerArray = editTriggerPushData.value.concat(refTriggerChildData); | ||
507 | + newTriggerArray = newTriggerArray.filter((f) => f != {}); | ||
508 | + triggersObj = { | ||
509 | + triggers: newTriggerArray, | ||
561 | }; | 510 | }; |
562 | - Object.assign(getAllFormData, editTriggersObj, editConditionsObj, editActionsObj); | 511 | + // newTriggerArray.pop(); |
512 | + console.log(newTriggerArray); | ||
513 | + // conditionsObj = { | ||
514 | + // doConditions: newConditionArray, | ||
515 | + // }; | ||
516 | + // actionsObj = { | ||
517 | + // doActions: newActionArray, | ||
518 | + // }; | ||
519 | + Object.assign(getAllFormData, triggersObj, conditionsObj, actionsObj); | ||
563 | } | 520 | } |
564 | }; | 521 | }; |
565 | 522 | ||
566 | const handleSubmit = async () => { | 523 | const handleSubmit = async () => { |
567 | if (!unref(isUpdate)) { | 524 | if (!unref(isUpdate)) { |
568 | - addTrigger(); | ||
569 | - addCondition(); | ||
570 | - addAction(); | ||
571 | getDefaultValue(); | 525 | getDefaultValue(); |
572 | getValuesFormData = await validateFields(); | 526 | getValuesFormData = await validateFields(); |
573 | if (!getValuesFormData) return; | 527 | if (!getValuesFormData) return; |
528 | + if (getAllFormData.doActions.length == 0) return createMessage.error('请填写执行动作'); | ||
574 | Object.assign(getAllFormData, getValuesFormData); | 529 | Object.assign(getAllFormData, getValuesFormData); |
575 | - let kongObj = true; | ||
576 | - lastRefActionChildDataArray.value.forEach((f) => { | ||
577 | - if (Object.keys(f).length == 0) { | ||
578 | - kongObj = false; | ||
579 | - } | ||
580 | - }); | ||
581 | - if (!kongObj) return createMessage.error('请填写执行动作'); | ||
582 | await screenLinkPageAddApi(getAllFormData); | 530 | await screenLinkPageAddApi(getAllFormData); |
583 | createMessage.success('场景联动新增成功'); | 531 | createMessage.success('场景联动新增成功'); |
584 | closeDrawer(); | 532 | closeDrawer(); |
@@ -595,43 +543,30 @@ | @@ -595,43 +543,30 @@ | ||
595 | emit('success'); | 543 | emit('success'); |
596 | } | 544 | } |
597 | }; | 545 | }; |
598 | - | ||
599 | - //默认添加触发器 | ||
600 | - const defaultAddTrigger = () => { | ||
601 | - if (unref(addTriggerPushData).length == 0) { | ||
602 | - setTimeout(() => { | ||
603 | - addTrigger(); | ||
604 | - }, 10); | ||
605 | - } | ||
606 | - }; | ||
607 | //新增触发器 | 546 | //新增触发器 |
608 | const addTrigger = () => { | 547 | const addTrigger = () => { |
609 | if (!unref(isUpdate)) { | 548 | if (!unref(isUpdate)) { |
610 | - unref(addTriggerPushData).push(addTriggerData as never); | ||
611 | refTriggerChildDataFunc(); | 549 | refTriggerChildDataFunc(); |
612 | - filterNewTriggerArr.push(refTriggerChildData as never); | ||
613 | - (lastRefTriggerChildDataArray.value as never[]) = filterNewTriggerArr.filter( | ||
614 | - (v) => Object.keys(v).length !== 0 | ||
615 | - ); | ||
616 | - const newGetTriggerData = lastRefTriggerChildDataArray.value.map((m) => { | 550 | + unref(addTriggerPushData).push(refTriggerChildData as never); |
551 | + addTriggerPushData.value = addTriggerPushData.value.map((m) => { | ||
617 | return { | 552 | return { |
618 | triggerType: m?.triggerType, | 553 | triggerType: m?.triggerType, |
619 | - entityId: m?.entityId, | 554 | + entityId: m?.entityId || m?.entityId1 || m?.entityId2, |
620 | triggerCondition: { | 555 | triggerCondition: { |
621 | condition: [ | 556 | condition: [ |
622 | { | 557 | { |
623 | key: { | 558 | key: { |
624 | - key: 'CO2', | ||
625 | - type: 'TIME_SERIES', | 559 | + key: m.key1 == null ? 'CO2' : m.key1, |
560 | + type: m.type1 == null ? 'TIME_SERIES' : m.type1, | ||
626 | }, | 561 | }, |
627 | - valueType: 'NUMERIC', | 562 | + valueType: m.type2 == null ? 'NUMERIC' : m.type2, |
628 | value: {}, | 563 | value: {}, |
629 | predicate: { | 564 | predicate: { |
630 | - type: 'NUMERIC', | 565 | + type: m.type2 == null ? 'NUMERIC' : m.type2, |
631 | value: { | 566 | value: { |
632 | - defaultValue: Number(m.value), | 567 | + defaultValue: Number(m.value) == null ? 0 : Number(m.value), |
633 | }, | 568 | }, |
634 | - operation: m.operation, | 569 | + operation: m.operation == null ? 'GREATER_OR_EQUAL' : m.operation, |
635 | }, | 570 | }, |
636 | }, | 571 | }, |
637 | ], | 572 | ], |
@@ -641,7 +576,6 @@ | @@ -641,7 +576,6 @@ | ||
641 | }, | 576 | }, |
642 | }; | 577 | }; |
643 | }); | 578 | }); |
644 | - lastRefTriggerChildDataArray.value = newGetTriggerData; | ||
645 | try { | 579 | try { |
646 | setTimeout(() => { | 580 | setTimeout(() => { |
647 | proxy.$refs.refTriggerChild.updateFieldDeviceId(optionsItemArray.value); | 581 | proxy.$refs.refTriggerChild.updateFieldDeviceId(optionsItemArray.value); |
@@ -651,44 +585,31 @@ | @@ -651,44 +585,31 @@ | ||
651 | } | 585 | } |
652 | } else { | 586 | } else { |
653 | refTriggerChildDataFunc(); | 587 | refTriggerChildDataFunc(); |
654 | - pushEditArray.push(refTriggerChildData as never); | ||
655 | - unref(editTriggerPushData).push(addTriggerData as never); | 588 | + unref(editTriggerPushData).push(refTriggerChildData as never); |
656 | } | 589 | } |
657 | }; | 590 | }; |
658 | const removeTrigger = () => { | 591 | const removeTrigger = () => { |
659 | if (!unref(isUpdate)) { | 592 | if (!unref(isUpdate)) { |
660 | try { | 593 | try { |
661 | - unref(addTriggerPushData).splice(0, 1); | ||
662 | - lastRefTriggerChildDataArray.value.splice(0, 1); | 594 | + unref(addTriggerPushData).pop(); |
663 | } catch (e) { | 595 | } catch (e) { |
664 | return e; | 596 | return e; |
665 | } | 597 | } |
666 | } else { | 598 | } else { |
667 | try { | 599 | try { |
668 | - unref(editTriggerPushData).splice(0, 1); | ||
669 | - lastEditRefTriggerChildDataArray.value.pop(); | 600 | + unref(editTriggerPushData).pop(); |
670 | } catch (e) { | 601 | } catch (e) { |
671 | return e; | 602 | return e; |
672 | } | 603 | } |
673 | } | 604 | } |
674 | }; | 605 | }; |
675 | 606 | ||
676 | - //默认添加执行条件 | ||
677 | - const defaultAddCondition = () => { | ||
678 | - if (unref(addConditionPushData).length == 0) { | ||
679 | - addCondition(); | ||
680 | - } | ||
681 | - }; | ||
682 | //新增执行条件 | 607 | //新增执行条件 |
683 | const addCondition = () => { | 608 | const addCondition = () => { |
684 | if (!unref(isUpdate)) { | 609 | if (!unref(isUpdate)) { |
685 | - unref(addConditionPushData).push(addConditionData as never); | ||
686 | refConditionChildDataFunc(); | 610 | refConditionChildDataFunc(); |
687 | - filterNewConditionArr.push(refConditionChildData as never); | ||
688 | - (lastRefConditionChildDataArray.value as never[]) = filterNewConditionArr.filter( | ||
689 | - (v) => Object.keys(v).length !== 0 | ||
690 | - ); | ||
691 | - const newGetConditionData = lastRefConditionChildDataArray.value.map((m) => { | 611 | + unref(addConditionPushData).push(refConditionChildData as never); |
612 | + addConditionPushData.value = addConditionPushData.value.map((m) => { | ||
692 | return { | 613 | return { |
693 | triggerType: m?.triggerType, | 614 | triggerType: m?.triggerType, |
694 | entityId: m?.entityId, | 615 | entityId: m?.entityId, |
@@ -699,14 +620,29 @@ | @@ -699,14 +620,29 @@ | ||
699 | type: 'TIME_SERIES', | 620 | type: 'TIME_SERIES', |
700 | key: 'CO2', | 621 | key: 'CO2', |
701 | }, | 622 | }, |
702 | - valueType: 'NUMERIC', | 623 | + valueType: |
624 | + m.type == 'NUMERIC1' | ||
625 | + ? 'NUMERIC' | ||
626 | + : m.type == 'NUMERIC2' | ||
627 | + ? 'NUMERIC' | ||
628 | + : 'NUMERIC', | ||
703 | value: {}, | 629 | value: {}, |
704 | predicate: { | 630 | predicate: { |
705 | - type: 'NUMERIC', | 631 | + type: |
632 | + m.type == 'NUMERIC1' | ||
633 | + ? 'NUMERIC' | ||
634 | + : m.type == 'NUMERIC2' | ||
635 | + ? 'NUMERIC' | ||
636 | + : 'NUMERIC', | ||
706 | value: { | 637 | value: { |
707 | - defaultValue: Number(m.value), | 638 | + defaultValue: |
639 | + Number(m.value1) == null | ||
640 | + ? 0 | ||
641 | + : Number(m.value1) || Number(m.value2) == null | ||
642 | + ? 0 | ||
643 | + : Number(m.value2), | ||
708 | }, | 644 | }, |
709 | - operation: m.operation, | 645 | + operation: m.operation1 || m.operatio2, |
710 | }, | 646 | }, |
711 | }, | 647 | }, |
712 | ], | 648 | ], |
@@ -716,7 +652,6 @@ | @@ -716,7 +652,6 @@ | ||
716 | }, | 652 | }, |
717 | }; | 653 | }; |
718 | }); | 654 | }); |
719 | - lastRefConditionChildDataArray.value = newGetConditionData; | ||
720 | try { | 655 | try { |
721 | setTimeout(() => { | 656 | setTimeout(() => { |
722 | proxy.$refs.refConditionChild.updateFieldDeviceId(optionsItemArray.value); | 657 | proxy.$refs.refConditionChild.updateFieldDeviceId(optionsItemArray.value); |
@@ -733,8 +668,7 @@ | @@ -733,8 +668,7 @@ | ||
733 | const removeCondition = () => { | 668 | const removeCondition = () => { |
734 | if (!unref(isUpdate)) { | 669 | if (!unref(isUpdate)) { |
735 | try { | 670 | try { |
736 | - unref(addConditionPushData).splice(0, 1); | ||
737 | - lastRefConditionChildDataArray.value.pop(); | 671 | + unref(addConditionPushData).pop(); |
738 | } catch (e) { | 672 | } catch (e) { |
739 | return e; | 673 | return e; |
740 | } | 674 | } |
@@ -757,12 +691,8 @@ | @@ -757,12 +691,8 @@ | ||
757 | //新增执行动作 | 691 | //新增执行动作 |
758 | const addAction = () => { | 692 | const addAction = () => { |
759 | if (!unref(isUpdate)) { | 693 | if (!unref(isUpdate)) { |
760 | - unref(addActionPushData).push(addActionData as never); | ||
761 | refActionChildDataFunc(); | 694 | refActionChildDataFunc(); |
762 | - filterNewActionArr.push(refActionChildData as never); | ||
763 | - (lastRefActionChildDataArray.value as never[]) = filterNewActionArr.filter( | ||
764 | - (v) => Object.keys(v).length !== 0 | ||
765 | - ); | 695 | + unref(addActionPushData).push(refActionChildData as never); |
766 | try { | 696 | try { |
767 | setTimeout(() => { | 697 | setTimeout(() => { |
768 | proxy.$refs.refActionChild.updateFieldDeviceId(optionsItemArray.value); | 698 | proxy.$refs.refActionChild.updateFieldDeviceId(optionsItemArray.value); |
@@ -779,8 +709,7 @@ | @@ -779,8 +709,7 @@ | ||
779 | const removeAction = () => { | 709 | const removeAction = () => { |
780 | if (!unref(isUpdate)) { | 710 | if (!unref(isUpdate)) { |
781 | try { | 711 | try { |
782 | - unref(addActionPushData).splice(0, 1); | ||
783 | - lastRefActionChildDataArray.value.pop(); | 712 | + unref(addActionPushData).pop(); |
784 | } catch (e) { | 713 | } catch (e) { |
785 | return e; | 714 | return e; |
786 | } | 715 | } |
@@ -797,8 +726,6 @@ | @@ -797,8 +726,6 @@ | ||
797 | return { | 726 | return { |
798 | updateDeviceIdFunc, | 727 | updateDeviceIdFunc, |
799 | handleClose, | 728 | handleClose, |
800 | - defaultAddTrigger, | ||
801 | - defaultAddCondition, | ||
802 | newFilterMap, | 729 | newFilterMap, |
803 | newConditionFilterMap, | 730 | newConditionFilterMap, |
804 | newActionFilterMap, | 731 | newActionFilterMap, |