From e97a677c3b187ddb1eb9ec12a6b0692516432e03 Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Wed, 27 Dec 2023 09:27:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/AlertMock.ts | 2 +- src/components/alarm/setAlarmText.vue | 25 +++++++++++++++++++------ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/api/AlertMock.ts b/src/api/AlertMock.ts index 97f24af..0f48670 100644 --- a/src/api/AlertMock.ts +++ b/src/api/AlertMock.ts @@ -14,7 +14,7 @@ export function mockLocalDemoTestSet( deviceType: string; status: string; groupId?: string; - }[][]; + }[]; } ) { return api.post(`${alertUriBase}/localDemoTest/${alertType}`, data); diff --git a/src/components/alarm/setAlarmText.vue b/src/components/alarm/setAlarmText.vue index a55e103..b1c60a7 100644 --- a/src/components/alarm/setAlarmText.vue +++ b/src/components/alarm/setAlarmText.vue @@ -25,6 +25,7 @@ v-model="setAlartTextData.alertType" :options="optionsAlertType" :rules="[(val) => val.length > 0 || '请选择故障类型!']" + @update:model-value="onChooseAlertType" /> { if (res) { + const deviceInfos = setAlartTextData.value.groupList + .map((item) => item.deviceInfos) + .flat(); try { const params = { lineId: +setAlartTextData.value.lineId, - deviceInfos: setAlartTextData.value.groupList.map( - (item) => item.deviceInfos - ), + deviceInfos, }; const alertType = (saveAlertTypeData as never)[ setAlartTextData.value.alertType + '' @@ -340,6 +341,18 @@ function deleteSelectConfig(index: number) { lineStore.getLineApp().updateSelected(); } +function onChooseAlertType() { + setAlartTextData.value.groupList = [ + { + groupName: '测试组', + groupId: '', + status: '', + deviceInfos: [], + expanded: false, + }, + ]; +} + function onReset() { setAlartTextData.value = { lineId: lineStore.lineId as unknown as string,