From 7a077c261d767f14248591c93a73f66d5d764a87 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=82=96=E6=99=8B=E9=A3=9E?= <378266566@qq.com>
Date: Wed, 28 May 2025 08:49:19 +0800
Subject: [PATCH] =?UTF-8?q?feat=20=E8=BF=90=E8=A1=8C=E4=B8=AD=E5=BF=83-?=
=?UTF-8?q?=E6=A8=A1=E5=9E=8B=E5=AE=9E=E4=BE=8BV2.0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/alert/warn/index.ts | 33 +++
src/views/run/instant/UpdateModal.vue | 88 +++++++
src/views/run/instant/index.vue | 11 +-
src/views/run/instant/instant.data.ts | 40 +++
src/views/warn/index.vue | 125 +++++++++
src/views/warn/updateModal.vue | 88 +++++++
src/views/warn/warn.data.ts | 352 ++++++++++++++++++++++++++
7 files changed, 733 insertions(+), 4 deletions(-)
create mode 100644 src/api/alert/warn/index.ts
create mode 100644 src/views/run/instant/UpdateModal.vue
create mode 100644 src/views/warn/index.vue
create mode 100644 src/views/warn/updateModal.vue
create mode 100644 src/views/warn/warn.data.ts
diff --git a/src/api/alert/warn/index.ts b/src/api/alert/warn/index.ts
new file mode 100644
index 0000000..b71c2d5
--- /dev/null
+++ b/src/api/alert/warn/index.ts
@@ -0,0 +1,33 @@
+import { defHttp } from '@/utils/http/axios'
+
+export interface WarnPageReqVO extends PageParam {
+ mpId?: string
+}
+
+export interface WarnVO {
+ id: number
+ warnStatus: number
+
+}
+
+export interface EXAHistoryReqVO {
+ itemName?: string
+ startTime?: string
+ endTime?: string
+ interval?: string
+}
+
+// 查询预警列表-分页
+export function getWarnPage(params: WarnPageReqVO) {
+ return defHttp.get({ url: '/alert/warn/page', params })
+}
+
+// 修改预警
+export function updateWarn(data: WarnVO) {
+ return defHttp.put({ url: '/alert/warn/update', data })
+}
+
+// 查询预警详情
+export function getWarn(id: number) {
+ return defHttp.get({ url: `/alert/warn/get?id=${id}` })
+}
diff --git a/src/views/run/instant/UpdateModal.vue b/src/views/run/instant/UpdateModal.vue
new file mode 100644
index 0000000..7acf4c3
--- /dev/null
+++ b/src/views/run/instant/UpdateModal.vue
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+
diff --git a/src/views/run/instant/index.vue b/src/views/run/instant/index.vue
index 90b2e52..6704613 100644
--- a/src/views/run/instant/index.vue
+++ b/src/views/run/instant/index.vue
@@ -2,10 +2,11 @@
import { Badge, Switch } from 'ant-design-vue'
import { onMounted, ref } from 'vue'
-import { color } from 'echarts'
import HistoryModal from '../../exa/config/HistoryModal.vue'
import { columns, searchFormSchema } from './instant.data'
import CreateModal from './CreateModal.vue'
+import UpdateModal from './UpdateModal.vue'
+
import { BasicTable, TableAction, useTable } from '@/components/Table'
import { getInstantCount, getInstantPage, updateInstant } from '@/api/alert/run/instant'
import { getExaNow } from '@/api/alert/exa'
@@ -21,6 +22,7 @@ const { t } = useI18n()
const [registerHistoryModal, { openModal: openHistoryModal }] = useModal()
const [registerCreateModal, { openModal: openCreateModal }] = useModal()
+const [registerUpdateModal, { openModal: openUpdateModal }] = useModal()
const [registerTable, { getForm, reload, getDataSource, updateTableDataRecord }] = useTable({
title: '实例列表',
@@ -67,7 +69,7 @@ function handleCreate() {
}
function handleEdit(record: Recordable) {
- openModal(true, { record, isUpdate: true })
+ openUpdateModal(true, { record, isUpdate: true })
}
async function handleDelete(record: Recordable) {
await deleteRole(record.id)
@@ -131,8 +133,8 @@ async function getNow() {
})
}
-function handleWarnConfig() {
-
+function handleWarnConfig(record: Recordable) {
+ router.push(`/run/warnConfig?id=${record.id}`)
}
@@ -228,6 +230,7 @@ function handleWarnConfig() {
+
diff --git a/src/views/run/instant/instant.data.ts b/src/views/run/instant/instant.data.ts
index 5a16b2d..54656ad 100644
--- a/src/views/run/instant/instant.data.ts
+++ b/src/views/run/instant/instant.data.ts
@@ -342,7 +342,47 @@ export const createInstantForm: FormSchema[] = [
},
]
+export const updateInstantForm: FormSchema[] = [
+ {
+ label: '编号',
+ field: 'id',
+ component: 'Input',
+ required: true,
+ show: false,
+ },
+ {
+ label: '实例名称',
+ field: 'mpName',
+ component: 'Input',
+ required: true,
+
+ componentProps: {
+ placeholder: '请输入实例名称',
+ },
+ rules: [{ required: true, message: '请输入实例名称' }],
+ },
+ {
+ label: '计算组',
+ field: 'calcGroup',
+ component: 'Select',
+ componentProps: {
+ options: [],
+ },
+
+ required: true,
+ },
+ {
+ label: '版本号',
+ field: 'modelVersionId',
+ component: 'Select',
+ componentProps: {
+ options: [],
+ },
+
+ required: true,
+ },
+]
export const InstantBasicInfo: any[] = [
{
diff --git a/src/views/warn/index.vue b/src/views/warn/index.vue
new file mode 100644
index 0000000..97c768e
--- /dev/null
+++ b/src/views/warn/index.vue
@@ -0,0 +1,125 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ `${record.timeDurationThreshold}秒` }}
+
+
+
+
+
+
+
diff --git a/src/views/warn/updateModal.vue b/src/views/warn/updateModal.vue
new file mode 100644
index 0000000..d6b4417
--- /dev/null
+++ b/src/views/warn/updateModal.vue
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+
diff --git a/src/views/warn/warn.data.ts b/src/views/warn/warn.data.ts
new file mode 100644
index 0000000..05e356b
--- /dev/null
+++ b/src/views/warn/warn.data.ts
@@ -0,0 +1,352 @@
+import type { BasicColumn, FormSchema } from '@/components/Table'
+
+export const columns: BasicColumn[] = [
+ {
+ title: '编号',
+ dataIndex: 'id',
+ width: 80,
+ fixed: 'left',
+ },
+ {
+ title: '点号',
+ dataIndex: 'pointId',
+ width: 150,
+ fixed: 'left',
+ },
+ {
+ title: '描述',
+ dataIndex: 'pointName',
+ width: 200,
+ },
+ {
+ title: '单位',
+ dataIndex: 'unit',
+ width: 80,
+ },
+ {
+ title: '上限',
+ dataIndex: 'uplimit',
+ width: 80,
+ },
+ {
+ title: '下限',
+ dataIndex: 'lowlimit',
+ width: 80,
+ },
+ {
+ title: '实例名称',
+ dataIndex: 'mpName',
+ width: 250,
+ fixed: 'left',
+ },
+ {
+ title: '专业',
+ dataIndex: 'systemName',
+ width: 200,
+
+ },
+ {
+ title: '报警类型',
+ dataIndex: 'alarmModelRuleName',
+ width: 120,
+
+ },
+ {
+ title: '报警限制',
+ dataIndex: 'warnConstraintName',
+ width: 120,
+
+ },
+ {
+ title: '报警类型',
+ dataIndex: 'alarmModelRuleName',
+ width: 120,
+
+ },
+ {
+ title: '告警延时',
+ dataIndex: 'timeDurationThreshold',
+ width: 100,
+ slots: { customRender: 'timeDurationThreshold' },
+ },
+ {
+ title: '短信告警',
+ dataIndex: 'shortMessageOnOff',
+ width: 100,
+ slots: { customRender: 'shortMessageOnOff' },
+
+ },
+ {
+ title: '光字牌告警',
+ dataIndex: 'gzpOnOff',
+ width: 100,
+ slots: { customRender: 'gzpOnOff' },
+
+ },
+ {
+ title: '推送诊断',
+ dataIndex: 'copyToDiagOnOff',
+ width: 100,
+ slots: { customRender: 'copyToDiagOnOff' },
+
+ },
+ {
+ title: '已有实例数量',
+ dataIndex: 'number',
+ width: 100,
+ },
+ {
+ title: '参与报警',
+ dataIndex: 'warnStatus',
+ width: 100,
+ slots: { customRender: 'warnStatus' },
+ fixed: 'right',
+ },
+ // {
+ // title: '实时值',
+ // dataIndex: 'value',
+ // width: 90,
+ // className: 'value',
+ // slots: { customRender: 'value' },
+
+ // }
+
+]
+
+export const searchFormSchema: FormSchema[] = [
+ {
+ label: '模型实例id',
+ field: 'mpId',
+ component: 'Input',
+ defaultValue: '',
+ required: true,
+ show: false,
+ colProps: { span: 8 },
+ },
+
+]
+
+export const updateWarnForm: FormSchema[] = [
+ {
+ label: '编号',
+ field: 'id',
+ component: 'Input',
+ required: true,
+ show: false,
+ },
+ {
+ label: '残差上限',
+ field: 'uplimit',
+ component: 'Input',
+ required: true,
+ componentProps: {
+ placeholder: '请输入残差上限',
+ },
+ rules: [{ required: true, message: '请输入残差上限' }],
+ colProps: {
+ span: 12,
+ },
+ },
+ {
+ label: '残差下限',
+ field: 'lowlimit',
+ component: 'Input',
+ required: true,
+ componentProps: {
+ placeholder: '请输入残差下限',
+ },
+ rules: [{ required: true, message: '请输入残差下限' }],
+ colProps: {
+ span: 12,
+ },
+ },
+ {
+ label: '延时告警',
+ field: 'timeDurationThreshold',
+ component: 'Input',
+ required: true,
+ componentProps: {
+ placeholder: '请输入延时告警',
+ },
+ rules: [{ required: true, message: '请输入延时告警' }],
+ colProps: {
+ span: 12,
+ },
+ },
+
+ {
+ label: '告警等级',
+ field: 'alarmLevel',
+ component: 'Select',
+ componentProps: {
+ options: [],
+ },
+ required: true,
+ colProps: {
+ span: 12,
+ },
+ },
+ {
+ label: '光字牌名称',
+ field: 'gzpName',
+ component: 'Input',
+ required: true,
+ colProps: {
+ span: 12,
+ },
+ },
+ {
+ label: '光字牌状态',
+ field: 'gzpOnOff',
+ component: 'RadioGroup',
+ componentProps: {
+ // 数据源1:固定数据
+ options: [
+ { label: '是', value: 1 },
+ { label: '否', value: 0 },
+ ],
+ },
+ required: true,
+ colProps: {
+ span: 12,
+ },
+ },
+
+ {
+ label: '短信推送',
+ field: 'shortMessageOnOff',
+ component: 'RadioGroup',
+ componentProps: {
+ options: [{ label: '是', value: 1 }, { label: '否', value: 0 }],
+ },
+ required: true,
+ colProps: {
+ span: 12,
+ },
+ },
+ {
+ label: '推送诊断',
+ field: 'copyToDiagOnOff',
+ component: 'RadioGroup',
+ componentProps: {
+ options: [{ label: '是', value: 1 }, { label: '否', value: 0 }],
+ },
+ required: true,
+ colProps: {
+ span: 12,
+ },
+ },
+ {
+ label: '告警限制名称',
+ field: 'warnConstraintName',
+ component: 'Input',
+
+ required: true,
+ colProps: {
+ span: 12,
+ },
+ },
+ {
+ label: '告警限制条件',
+ field: 'warnConstraint',
+ component: 'Input',
+ required: true,
+ colProps: {
+ span: 12,
+ },
+ },
+]
+export const InstantBasicInfo: any[] = [
+
+ {
+ label: '实例名称',
+ field: 'mpName',
+
+ },
+ {
+ label: '创建人',
+ field: 'creator',
+ },
+ {
+ label: '创建时间',
+ field: 'createTime',
+ },
+ {
+ label: '最近修改人',
+ field: 'updater',
+ },
+ {
+ label: '最近修改时间',
+ field: 'updateTime',
+ },
+ {
+ label: '算法',
+ field: 'algorithm_shortname',
+ },
+
+ // modelInfo中的字段
+ {
+ label: '训练采样间隔',
+ field: 'sampling',
+ },
+
+ {
+ label: '参数个数',
+ field: 'pointInfo',
+ },
+ {
+ label: '最小主元贡献率',
+ field: 'rate',
+ },
+ {
+ label: '主元个数',
+ field: 'principal',
+ },
+ {
+ label: '模型精度',
+ field: 'rate',
+ },
+]
+
+export const detailColumns: BasicColumn[] = [
+ {
+ title: '编号',
+ dataIndex: 'id',
+ width: 80,
+ fixed: 'left',
+ },
+ {
+ title: '测点编码',
+ dataIndex: 'inputInfo',
+ width: 150,
+ fixed: 'left',
+ },
+ {
+ title: '测点名称',
+ dataIndex: 'inputName',
+ width: 200,
+ fixed: 'left',
+ },
+ {
+ title: '单位',
+ dataIndex: 'unit',
+ width: 50,
+ fixed: 'left',
+ },
+ {
+ title: '重构值测点',
+ dataIndex: 'outPointInfo',
+ width: 200,
+
+ },
+ {
+ title: '偏差值测点',
+ dataIndex: 'biasPointInfo',
+ width: 200,
+ },
+ {
+ title: '错误状态测点',
+ dataIndex: 'faultVariablePointInfo',
+ width: 200,
+ },
+]