Explorar o código

perf(views): 完善“报警管理”模块

1.新增,编辑,删除,查询功能开发。
2.多语言添加
wangshun hai 1 mes
pai
achega
2aa4074386
Modificáronse 1 ficheiros con 364 adicións e 165 borrados
  1. 364 165
      src/views/alarm-manage/AlarmManage.vue

+ 364 - 165
src/views/alarm-manage/AlarmManage.vue

@@ -8,14 +8,31 @@ import SvgIcon from '@/components/SvgIcon.vue';
 import { useDictData } from '@/hooks/dict-data';
 import { useRequest } from '@/hooks/request';
 import { t } from '@/i18n';
-import { addAlarmEvent } from '@/api';
+import {
+  addAlarmEvent,
+  alarmEventChangeState,
+  deleteAlarmEvent,
+  getAlarmEventGetPageList,
+  getAlarmEventInfo,
+  getAlarmHistoryList,
+  updateAlarmEvent,
+} from '@/api';
 import { DictCode } from '@/constants';
 
 import AlarmConditions from './AlarmConditions.vue';
 import AlarmExecution from './AlarmExecution.vue';
 
 import type { FormInstance, Rule } from 'ant-design-vue/es/form';
-import type { AlarmEventItem, AlarmForm, ExecutionAction, TriggerConditionItem } from '@/types';
+import type {
+  AlarmEventHistoryItem,
+  AlarmEventItem,
+  AlarmForm,
+  AlarmHistory,
+  AlarmPageParams,
+  EventTrigger,
+  ExecutionAction,
+  TriggerConditionItem,
+} from '@/types';
 
 const { handleRequest } = useRequest();
 const { dictData: alarmCondition, getDictData: getAlarmCondition } = useDictData(DictCode.AlarmCondition);
@@ -30,56 +47,67 @@ const formRef = ref<FormInstance>();
 const triggerConditionRefs = ref<InstanceType<typeof AlarmConditions>[]>([]);
 const judgmentConditionRefs = ref<InstanceType<typeof AlarmConditions>[]>([]);
 const executionActionRefs = ref<InstanceType<typeof AlarmConditions>[]>([]);
+const alarmPageParams = ref<AlarmPageParams>({
+  pageIndex: 1,
+  pageSize: 10,
+  searchContent: '',
+});
 
 const triggerConditionList = ref<TriggerConditionItem[]>([
   {
     type: 0,
-    subType: '',
+    subType: undefined,
     groupId: undefined,
     childGroupId: undefined,
     deviceId: undefined,
     paramCode: '',
-    alarmAlgOperator: '',
-    alarmThreshold: '',
-    alarmDeviceState: '',
+    alarmAlgOperator: undefined,
+    alarmThreshold: undefined,
+    alarmDeviceState: undefined,
     alarmScheduledTime: undefined,
-    alarmRepeatTime: '',
+    alarmRepeatTime: undefined,
+    paramName: '',
+    deviceName: '',
   },
 ]);
 
 const judgmentConditionList = ref<TriggerConditionItem[]>([
   {
     type: 1,
-    subType: '',
+    subType: undefined,
     groupId: undefined,
     childGroupId: undefined,
     deviceId: undefined,
     paramCode: '',
-    alarmAlgOperator: '',
-    alarmThreshold: '',
-    alarmDeviceState: '',
+    alarmAlgOperator: undefined,
+    alarmThreshold: undefined,
+    alarmDeviceState: undefined,
     alarmScheduledTime: undefined,
-    alarmRepeatTime: '',
+    alarmRepeatTime: undefined,
+    paramName: '',
+    deviceName: '',
   },
 ]);
 
 const executionActionList = ref<ExecutionAction[]>([
   {
     type: 2,
-    subType: '',
+    subType: undefined,
     groupId: undefined,
     childGroupId: undefined,
     deviceId: undefined,
     paramCode: '',
-    alarmAdjustmentValue: '',
+    alarmAdjustmentValue: undefined,
     alarmContact: undefined,
-    alarmAlertContent: '',
+    alarmAlertContent: undefined,
     alarmWaitTime: undefined,
-    alarmNotifyMethod: '',
+    alarmNotifyMethod: undefined,
+    paramName: '',
   },
 ]);
 const historyOpen = ref<boolean>(false);
 const alarmOpen = ref<boolean>(false);
+const titleShow = ref<boolean>(true);
 // 日期时间格式
 const dateFormat = 'HH:mm';
 const alarmForm = ref<AlarmForm>({
@@ -88,62 +116,15 @@ const alarmForm = ref<AlarmForm>({
   conditionLogic: 0,
   enabled: true,
 });
-const historyData = ref([
-  {
-    alarm: '启动命令执行失败',
-    state: '智控预警提醒',
-    state1: '2023-12-31 23:12:00',
-    state2: '2024-01-31 23:12:10',
-  },
-  {
-    alarm: '启动命令执行失败1',
-    state: '智控预警提醒',
-    state1: '2024-12-31 23:12:00',
-    state2: '2025-01-31 23:12:10',
-  },
-  {
-    alarm: '启动命令执行失败2',
-    state: '智控预警提醒',
-    state1: '2023-10-31 23:12:00',
-    state2: '2024-02-31 23:12:10',
-  },
-]);
-const alarmData = ref([
-  {
-    alarm: '2025年4月7日09:24:59产生报警内容',
-    state1: '群控柜设备',
-    state2: 10,
-    state3: '2024-12-31 23:12:00',
-    state4: '2024-12-31 23:12:10',
-    state: true,
-  },
-  {
-    alarm: '2025年4月7日15:04:56产生报警内容',
-    state1: '群控柜设备',
-    state2: 10,
-    state3: '2024-12-31 23:12:00',
-    state4: '2024-11-31 23:11:10',
-    state: false,
-  },
-  {
-    alarm: '2025年4月7日15:04:56产生报警内容',
-    state1: '群控柜设备',
-    state2: 10,
-    state3: '2024-12-31 23:12:00',
-    state4: '2024-12-31 23:11:10',
-    state: true,
-  },
-]);
-const historyQuery = ref({
-  pageIndex: 1,
-  pageSize: 10,
-  total: 0,
-});
-const alarmQuery = ref({
+const alarmIdData = ref<EventTrigger[]>([]);
+const alarmTotal = ref<number>(0);
+const alarmId = ref<number | undefined>(undefined);
+const historyData = ref<AlarmEventHistoryItem[]>([]);
+const historyTotal = ref<number>(0);
+const historyQuery = ref<AlarmHistory>({
   pageIndex: 1,
   pageSize: 10,
-  searchContent: '',
-  total: 0,
+  eventId: 0,
 });
 
 const rules: Record<string, Rule[]> = {
@@ -158,19 +139,19 @@ const historyColumns = [
     width: 40,
   },
   {
-    title: '故障信息',
-    dataIndex: 'alarm',
-    key: 'alarm',
+    title: t('algorithmManage.faultInformAtion'),
+    dataIndex: 'errorMsg',
+    key: 'errorMsg',
     ellipsis: true,
   },
   {
-    title: '类型',
-    dataIndex: 'state',
-    key: 'state',
+    title: t('algorithmManage.type'),
+    dataIndex: 'type',
+    key: 'type',
     ellipsis: true,
   },
   {
-    title: '发生日期',
+    title: t('algorithmManage.dateOccurrence'),
     dataIndex: 'state1',
     key: 'state1',
     ellipsis: true,
@@ -181,7 +162,7 @@ const historyColumns = [
     },
   },
   {
-    title: '解决日期',
+    title: t('algorithmManage.settlementDate'),
     dataIndex: 'state2',
     key: 'state2',
     ellipsis: true,
@@ -189,35 +170,35 @@ const historyColumns = [
 ];
 const alarmColumns = [
   {
-    title: '报警内容',
-    dataIndex: 'alarm',
-    key: 'alarm',
+    title: t('algorithmManage.eventName'),
+    dataIndex: 'eventName',
+    key: 'eventName',
     ellipsis: true,
   },
   {
-    title: '设备',
-    dataIndex: 'state1',
-    key: 'state1',
+    title: t('navigation.device'),
+    dataIndex: 'deviceName',
+    key: 'deviceName',
     ellipsis: true,
   },
   {
-    title: '触发次数',
-    dataIndex: 'state2',
-    key: 'state2',
+    title: t('algorithmManage.triggerCount'),
+    dataIndex: 'triggerTimes',
+    key: 'triggerTimes',
     ellipsis: true,
     width: 100,
   },
   {
-    title: '最近触发',
-    dataIndex: 'state3',
-    key: 'state3',
+    title: t('algorithmManage.recentlyTriggered'),
+    dataIndex: 'lastTriggerTime',
+    key: 'lastTriggerTime',
     ellipsis: true,
     width: 220,
   },
   {
-    title: '更新时间',
-    dataIndex: 'state4',
-    key: 'state4',
+    title: t('common.updateTime'),
+    dataIndex: 'updateTime',
+    key: 'updateTime',
     ellipsis: true,
     width: 220,
     sorter: (a: { state4: string | number | Date }, b: { state4: string | number | Date }) => {
@@ -227,95 +208,276 @@ const alarmColumns = [
     },
   },
   {
-    title: '启用',
-    dataIndex: 'state',
-    key: 'state',
+    title: t('algorithmManage.enable'),
+    dataIndex: 'enabled',
+    key: 'enabled',
     ellipsis: true,
     width: 80,
   },
   {
-    title: '操作',
+    title: t('common.operation'),
     dataIndex: 'action',
     key: 'action',
     width: 152,
   },
 ];
 
+const getAlarmEventGetPageData = () => {
+  handleRequest(async () => {
+    const { records, total } = await getAlarmEventGetPageList(alarmPageParams.value);
+    alarmTotal.value = total;
+    alarmIdData.value = records;
+  });
+};
 const addAlarm = () => {
   alarmOpen.value = true;
+  titleShow.value = true;
 };
-const alarmSearch = () => {};
-const alarmReset = () => {};
+const alarmSearch = () => {
+  alarmPageParams.value.pageIndex = 1;
+  getAlarmEventGetPageData();
+};
+const alarmReset = () => {
+  alarmPageParams.value.searchContent = '';
+  alarmPageParams.value.pageSize = 10;
+  alarmSearch();
+};
+
+// 转换方法
+const convertBtoA = (arr: AlarmEventItem[]): TriggerConditionItem[] | ExecutionAction[] => {
+  return arr.map((item) => {
+    // 基础字段
+    const baseFields = {
+      type: item.type,
+      subType: String(item.subType),
+      groupId: item.groupId,
+      childGroupId: item.childGroupId,
+      deviceId: item.deviceId,
+      paramCode: item.paramCode,
+      paramName: item.paramName,
+      deviceName: item.deviceName,
+    };
+
+    // 处理动态字段
+    const dynamicFields = item.dataList.reduce(
+      (acc, { code, value }) => {
+        // 特殊处理时间字段
+        if (code === 'alarmScheduledTime') {
+          const timeStr = dayjs(value, 'HH:mm');
+          if (timeStr) acc[code] = timeStr;
+          return acc;
+        }
+
+        if (code === 'alarmWaitTime') {
+          const timeStr = dayjs(value, 'mm:ss');
+          if (timeStr) acc[code] = timeStr;
+          return acc;
+        }
+
+        // 自动类型转换逻辑
+        if (value === '') return acc; // 过滤空字符串
+        if (/^\d+$/.test(value)) {
+          acc[code] = String(parseInt(value, 10));
+        } else if (/^\d+\.\d+$/.test(value)) {
+          acc[code] = String(parseFloat(value));
+        } else {
+          acc[code] = String(value);
+        }
+        return acc;
+      },
+      {} as Record<string, unknown>,
+    );
+
+    return { ...baseFields, ...dynamicFields };
+  });
+};
+
 const alarmEditor = (id: number) => {
-  console.log(id);
+  alarmId.value = id;
+  handleRequest(async () => {
+    const {
+      eventName,
+      startTime,
+      endTime,
+      enabled,
+      conditionLogic,
+      triggerConditionList: triggerList,
+      judgmentConditionList: judgmentList,
+      executionActionList: executionList,
+    } = await getAlarmEventInfo(id);
+    titleShow.value = false;
+    alarmOpen.value = true;
+    alarmForm.value = {
+      eventName,
+      time: [dayjs(startTime, 'HH:mm'), dayjs(endTime, 'HH:mm')],
+      conditionLogic: conditionLogic ? 1 : 0,
+      enabled,
+    };
+
+    triggerConditionList.value = convertBtoA(triggerList);
+    judgmentConditionList.value = convertBtoA(judgmentList);
+    executionActionList.value = convertBtoA(executionList);
+  });
+};
+
+const getAlarmHistory = () => {
+  handleRequest(async () => {
+    const { records, total } = await getAlarmHistoryList(historyQuery.value);
+    historyData.value = records;
+    historyTotal.value = total;
+  });
 };
+
 const alarmHistory = (id: number) => {
-  console.log(id);
+  historyQuery.value.eventId = id;
+  getAlarmHistory();
   historyOpen.value = true;
 };
 const alarmDelete = (id: number) => {
-  console.log(id);
+  alarmId.value = id;
   modalComponentRef.value?.showView();
 };
 const confirm = () => {
-  modalComponentRef.value?.hideView();
+  handleRequest(async () => {
+    if (alarmId.value) {
+      await deleteAlarmEvent(alarmId.value);
+      getAlarmEventGetPageData();
+      modalComponentRef.value?.hideView();
+    }
+  });
+};
+const switchalarm = (item: EventTrigger) => {
+  handleRequest(async () => {
+    await alarmEventChangeState({
+      id: item.id,
+      enabled: item.enabled,
+    });
+  });
+};
+const switchPages = () => {
+  getAlarmEventGetPageData();
+};
+const switchHistoryPages = () => {
+  getAlarmHistory();
 };
-const switchPages = () => {};
-const switchHistoryPages = () => {};
 const addTriggerConditions = () => {
   triggerConditionList.value.push({
     type: 0,
-    subType: '',
+    subType: undefined,
     groupId: undefined,
     childGroupId: undefined,
     deviceId: undefined,
     paramCode: '',
-    alarmAlgOperator: '',
-    alarmThreshold: '',
-    alarmDeviceState: '',
+    alarmAlgOperator: undefined,
+    alarmThreshold: undefined,
+    alarmDeviceState: undefined,
     alarmScheduledTime: undefined,
-    alarmRepeatTime: '',
+    alarmRepeatTime: undefined,
+    paramName: '',
+    deviceName: '',
   });
 };
 
 const addJudgmentConditions = () => {
   judgmentConditionList.value.push({
     type: 1,
-    subType: '',
+    subType: undefined,
     groupId: undefined,
     childGroupId: undefined,
     deviceId: undefined,
     paramCode: '',
-    alarmAlgOperator: '',
-    alarmThreshold: '',
-    alarmDeviceState: '',
+    alarmAlgOperator: undefined,
+    alarmThreshold: undefined,
+    alarmDeviceState: undefined,
     alarmScheduledTime: undefined,
-    alarmRepeatTime: '',
+    alarmRepeatTime: undefined,
+    paramName: '',
+    deviceName: '',
   });
 };
 
 const addExecutionConditions = () => {
   executionActionList.value.push({
     type: 2,
-    subType: '',
+    subType: undefined,
     groupId: undefined,
     childGroupId: undefined,
     deviceId: undefined,
     paramCode: '',
-    alarmAdjustmentValue: '',
+    alarmAdjustmentValue: undefined,
     alarmContact: undefined,
-    alarmAlertContent: '',
+    alarmAlertContent: undefined,
     alarmWaitTime: undefined,
-    alarmNotifyMethod: '',
+    alarmNotifyMethod: undefined,
+    paramName: '',
   });
 };
 
+const closeModal = () => {
+  alarmForm.value = {
+    eventName: '',
+    time: [dayjs(), dayjs()],
+    conditionLogic: 0,
+    enabled: true,
+  };
+  triggerConditionList.value = [
+    {
+      type: 0,
+      subType: undefined,
+      groupId: undefined,
+      childGroupId: undefined,
+      deviceId: undefined,
+      paramCode: '',
+      alarmAlgOperator: undefined,
+      alarmThreshold: undefined,
+      alarmDeviceState: undefined,
+      alarmScheduledTime: undefined,
+      alarmRepeatTime: undefined,
+      paramName: '',
+      deviceName: '',
+    },
+  ];
+  judgmentConditionList.value = [
+    {
+      type: 1,
+      subType: undefined,
+      groupId: undefined,
+      childGroupId: undefined,
+      deviceId: undefined,
+      paramCode: '',
+      alarmAlgOperator: undefined,
+      alarmThreshold: undefined,
+      alarmDeviceState: undefined,
+      alarmScheduledTime: undefined,
+      alarmRepeatTime: undefined,
+      paramName: '',
+      deviceName: '',
+    },
+  ];
+  executionActionList.value = [
+    {
+      type: 2,
+      subType: undefined,
+      groupId: undefined,
+      childGroupId: undefined,
+      deviceId: undefined,
+      paramCode: '',
+      alarmAdjustmentValue: undefined,
+      alarmContact: undefined,
+      alarmAlertContent: undefined,
+      alarmWaitTime: undefined,
+      alarmNotifyMethod: undefined,
+      paramName: '',
+    },
+  ];
+};
+
 // 添加格式转换
 const formatDate = (date: Dayjs) => date.format('HH:mm');
 
 const deleteTriggerClick = (index: number) => {
-  if (index === 0) {
-    return message.warning('触发条件不能为空!');
+  if (triggerConditionList.value.length === 1) {
+    return message.warning(t('algorithmManage.triggerConditionEmpty'));
   }
   triggerConditionList.value.splice(index, 1);
 };
@@ -325,8 +487,8 @@ const deleteJudgmentClick = (index: number) => {
 };
 
 const deleteExecutionClick = (index: number) => {
-  if (index === 0) {
-    return message.warning('执行动作不能为空!');
+  if (executionActionList.value.length === 1) {
+    return message.warning(t('algorithmManage.performActionEmpty'));
   }
   executionActionList.value.splice(index, 1);
 };
@@ -334,8 +496,7 @@ const deleteExecutionClick = (index: number) => {
 const convertAtoB = (arr: TriggerConditionItem[] | ExecutionAction[]): AlarmEventItem[] => {
   return arr.map((item) => {
     // 解构固定字段和剩余属性
-    const { type, subType, groupId, childGroupId, deviceId, paramCode, ...dynamicFields } = item;
-
+    const { type, subType, groupId, childGroupId, deviceId, paramCode, paramName, deviceName, ...dynamicFields } = item;
     // 转换动态字段到 dataList
     const dataList = Object.entries(dynamicFields)
       .map(([code, value]) => ({
@@ -352,6 +513,8 @@ const convertAtoB = (arr: TriggerConditionItem[] | ExecutionAction[]): AlarmEven
       childGroupId,
       deviceId,
       paramCode,
+      paramName,
+      deviceName,
       dataList,
     };
   });
@@ -371,17 +534,34 @@ const okConfirm = async () => {
           const triggerList = convertAtoB(triggerConditionList.value);
           const judgmentList = convertAtoB(judgmentConditionList.value);
           const executionList = convertAtoB(executionActionList.value);
-          await addAlarmEvent({
-            eventName,
-            startTime: data[0],
-            endTime: data[1],
-            enabled,
-            conditionLogic: conditionLogic === 1 ? true : false,
-            triggerConditionList: triggerList,
-            judgmentConditionList: judgmentList,
-            executionActionList: executionList,
-          });
+
+          if (titleShow.value) {
+            await addAlarmEvent({
+              eventName,
+              startTime: data[0],
+              endTime: data[1],
+              enabled,
+              conditionLogic: conditionLogic === 1 ? true : false,
+              triggerConditionList: triggerList,
+              judgmentConditionList: judgmentList,
+              executionActionList: executionList,
+            });
+          } else {
+            await updateAlarmEvent({
+              id: alarmId.value,
+              eventName,
+              startTime: data[0],
+              endTime: data[1],
+              enabled,
+              conditionLogic: conditionLogic === 1 ? true : false,
+              triggerConditionList: triggerList,
+              judgmentConditionList: judgmentList,
+              executionActionList: executionList,
+            });
+          }
+
           alarmOpen.value = false;
+          getAlarmEventGetPageData();
         });
       })
       .catch(() => {});
@@ -398,18 +578,19 @@ onMounted(() => {
     await getAlarmDeviceState();
     await getAlarmNotifyMethod();
   });
+  getAlarmEventGetPageData();
 });
 </script>
 
 <template>
   <div>
     <AFlex justify="space-between">
-      <div class="text-top">报警管理</div>
+      <div class="text-top">{{ $t('navigation.deviceManage') }}</div>
       <div>
         <AButton type="primary" class="icon-button" @click="addAlarm">
           <AFlex align="center">
             <SvgIcon name="plus" />
-            <span> 新增 </span>
+            <span> {{ $t('common.addNew') }} </span>
           </AFlex>
         </AButton>
       </div>
@@ -417,23 +598,23 @@ onMounted(() => {
     <div class="content">
       <AFlex justify="space-between" class="content-header">
         <div>
-          <span class="query-text">搜索</span>
+          <span class="query-text">{{ $t('common.search') }}</span>
           <AInput
-            v-model:value="alarmQuery.searchContent"
-            placeholder="请输入报警内容、设备"
+            v-model:value="alarmPageParams.searchContent"
+            :placeholder="t('algorithmManage.pleaseEnterAlarm')"
             class="query-input button-margin"
           />
         </div>
         <div>
-          <AButton type="primary" @click="alarmSearch"> 查询 </AButton>
-          <AButton class="button-margin" @click="alarmReset">重置</AButton>
+          <AButton type="primary" @click="alarmSearch"> {{ $t('common.query') }} </AButton>
+          <AButton class="button-margin" @click="alarmReset">{{ $t('common.reset') }}</AButton>
         </div>
       </AFlex>
 
-      <ATable :columns="alarmColumns" :data-source="alarmData" :pagination="false">
+      <ATable :columns="alarmColumns" :data-source="alarmIdData" :pagination="false">
         <template #bodyCell="{ column, record }">
-          <template v-if="column.key === 'state'">
-            <ASwitch v-model:checked="record.state" />
+          <template v-if="column.key === 'enabled'">
+            <ASwitch @change="switchalarm(record as EventTrigger)" v-model:checked="record.enabled" />
           </template>
           <template v-else-if="column.key === 'action'">
             <SvgIcon @click="alarmEditor(record.id)" class="icon-style" name="edit-o" />
@@ -446,9 +627,9 @@ onMounted(() => {
       <br />
       <AFlex justify="flex-end" class="gateway-left-footer">
         <APagination
-          v-model:current="alarmQuery.pageIndex"
-          v-model:page-size="alarmQuery.pageSize"
-          :total="alarmQuery.total"
+          v-model:current="alarmPageParams.pageIndex"
+          v-model:page-size="alarmPageParams.pageSize"
+          :total="alarmTotal"
           :show-size-changer="true"
           @change="switchPages"
           show-quick-jumper
@@ -456,12 +637,23 @@ onMounted(() => {
         />
       </AFlex>
     </div>
-    <AModal v-model:open="alarmOpen" title="预警条件添加" width="920px" :mask-closable="false" @ok="okConfirm">
+    <AModal
+      v-model:open="alarmOpen"
+      :title="titleShow ? t('algorithmManage.addWarningConditions') : t('algorithmManage.editWarningConditions')"
+      width="920px"
+      :mask-closable="false"
+      @ok="okConfirm"
+      :after-close="closeModal"
+    >
       <AForm ref="formRef" class="alarm-modal" :model="alarmForm" label-align="left" layout="vertical" :rules="rules">
-        <AFormItem label="事件名称" name="eventName">
-          <AInput v-model:value="alarmForm.eventName" placeholder="请输入" class="query-input query-bottom" />
+        <AFormItem :label="t('algorithmManage.eventName')" name="eventName">
+          <AInput
+            v-model:value="alarmForm.eventName"
+            :placeholder="t('common.pleaseEnter')"
+            class="query-input query-bottom"
+          />
         </AFormItem>
-        <AFormItem label="生效时间段" name="time">
+        <AFormItem :label="t('algorithmManage.effectiveTime')" name="time">
           <ATimeRangePicker
             :format="dateFormat"
             v-model:value="alarmForm.time"
@@ -469,7 +661,7 @@ onMounted(() => {
             show-time
           />
         </AFormItem>
-        <div class="alarm-text">当任一情况发生</div>
+        <div class="alarm-text">{{ $t('algorithmManage.inAnySituations') }}</div>
 
         <div v-for="(item, index) in triggerConditionList" :key="index">
           <AlarmConditions
@@ -487,14 +679,14 @@ onMounted(() => {
         <AButton type="primary" ghost class="icon-button button-top" @click="addTriggerConditions">
           <AFlex align="center">
             <SvgIcon name="plus" />
-            <span> 添加触发条件 </span>
+            <span> {{ $t('algorithmManage.addTriggerConditions') }} </span>
           </AFlex></AButton
         >
         <br />
 
         <ASelect class="status-style" v-model:value="alarmForm.conditionLogic">
-          <ASelectOption :value="0">且满足任一状态</ASelectOption>
-          <ASelectOption :value="1">且满足全部状态</ASelectOption>
+          <ASelectOption :value="0">{{ $t('algorithmManage.satisfyAnyState') }}</ASelectOption>
+          <ASelectOption :value="1">{{ $t('algorithmManage.satisfyAllStates') }}</ASelectOption>
         </ASelect>
         <br />
         <div v-for="(item, index) in judgmentConditionList" :key="index">
@@ -514,12 +706,12 @@ onMounted(() => {
         <AButton type="primary" ghost class="icon-button button-top" @click="addJudgmentConditions">
           <AFlex align="center">
             <SvgIcon name="plus" />
-            <span> 添加判断条件 </span>
+            <span> {{ $t('algorithmManage.addJudgmentConditions') }} </span>
           </AFlex></AButton
         >
         <br />
 
-        <div class="execute-text"></div>
+        <div class="execute-text">{{ $t('algorithmManage.just') }}</div>
         <div v-for="(item, index) in executionActionList" :key="index">
           <AlarmExecution
             ref="executionActionRefs"
@@ -534,21 +726,28 @@ onMounted(() => {
         <AButton type="primary" ghost class="icon-button button-top" @click="addExecutionConditions">
           <AFlex align="center">
             <SvgIcon name="plus" />
-            <span> 添加执行动作 </span>
+            <span> {{ $t('algorithmManage.addExecutionAction') }} </span>
           </AFlex></AButton
         >
       </AForm>
       <AFlex align="center" class="enable-style">
-        <div class="enable-text">启用</div>
+        <div class="enable-text">{{ $t('algorithmManage.enable') }}</div>
         <ASwitch v-model:checked="alarmForm.enabled" />
       </AFlex>
     </AModal>
-    <AModal v-model:open="historyOpen" title="历史报警" width="920px" :footer="null">
+    <AModal v-model:open="historyOpen" :title="t('algorithmManage.historicalAlarm')" width="920px" :footer="null">
       <ATable :columns="historyColumns" :data-source="historyData" :pagination="false">
-        <template #bodyCell="{ column, index }">
+        <template #bodyCell="{ column, index, record }">
           <template v-if="column.key === 'index'">
             {{ index + 1 }}
           </template>
+          <template v-if="column.key === 'type'">
+            {{
+              record.type === 0
+                ? $t('algorithmManage.equipmentFailureAlert')
+                : $t('algorithmManage.intelligentControlformAtion')
+            }}
+          </template>
         </template>
       </ATable>
       <br />
@@ -557,7 +756,7 @@ onMounted(() => {
         <APagination
           v-model:current="historyQuery.pageIndex"
           v-model:page-size="historyQuery.pageSize"
-          :total="historyQuery.total"
+          :total="historyTotal"
           :show-size-changer="true"
           @change="switchHistoryPages"
           show-quick-jumper
@@ -567,8 +766,8 @@ onMounted(() => {
     </AModal>
     <ConfirmModal
       ref="modalComponent"
-      :title="'删除确定'"
-      :description-text="'是否确认删除?'"
+      :title="t('common.deleteConfirmation')"
+      :description-text="t('common.confirmDeletion')"
       :icon="{ name: 'delete' }"
       :icon-bg-color="'#F56C6C'"
       @confirm="confirm"