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,