From 2f86b8712ba8439d9dc46bc9276be0fb764a5c27 Mon Sep 17 00:00:00 2001
From: xjf <378266566@qq.com>
Date: Fri, 12 Dec 2025 11:06:09 +0800
Subject: [PATCH 1/4] =?UTF-8?q?fix:=E5=9B=9E=E7=AE=97=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/locales/lang/en/action.json | 3 +-
src/locales/lang/zh-CN/action.json | 3 +-
src/views/run/calc/calc.data.ts | 34 +++----
src/views/run/calc/index.vue | 143 +++++++++++++++++------------
4 files changed, 105 insertions(+), 78 deletions(-)
diff --git a/src/locales/lang/en/action.json b/src/locales/lang/en/action.json
index 562ff38..529585c 100644
--- a/src/locales/lang/en/action.json
+++ b/src/locales/lang/en/action.json
@@ -15,5 +15,6 @@
"createInstant": "CreateInstant",
"pointConfig": "PointConfig",
"warnConfig": "WarnConfig",
- "backCalc": "backCalc"
+ "backCalc": "backCalc",
+ "calcIng": "calcIng"
}
diff --git a/src/locales/lang/zh-CN/action.json b/src/locales/lang/zh-CN/action.json
index c84a365..5c0bb93 100644
--- a/src/locales/lang/zh-CN/action.json
+++ b/src/locales/lang/zh-CN/action.json
@@ -16,5 +16,6 @@
"createInstant": "新增实例",
"pointConfig": "测点配置",
"warnConfig": "预警配置",
- "backCalc": "回算"
+ "backCalc": "回算",
+ "calcIng": "回算中"
}
diff --git a/src/views/run/calc/calc.data.ts b/src/views/run/calc/calc.data.ts
index f0df0ad..071a08c 100644
--- a/src/views/run/calc/calc.data.ts
+++ b/src/views/run/calc/calc.data.ts
@@ -9,48 +9,48 @@ import type { systemSelectParams } from '@/api/alert/model/model/optionsModel'
export const columns: BasicColumn[] = [
{
title: '编号',
- dataIndex: 'id',
- width: 80,
+ dataIndex: 'mpId',
+ width: 60,
fixed: 'left',
},
{
title: '模型名称',
dataIndex: 'modelName',
- width: 250,
+ width: 200,
className: 'instant',
slots: { customRender: 'detail' },
fixed: 'left',
},
{
title: '算法',
- dataIndex: 'Algorithm',
- width: 200,
+ dataIndex: 'algorithmShortname',
+ width: 100,
},
{
title: '模式覆盖率',
dataIndex: 'CoveredPercent',
- width: 200,
+ width: 100,
},
{
title: '报警次数',
dataIndex: 'AlarmNumber',
- width: 200,
+ width: 100,
},
{
title: '总报警时间(m)',
dataIndex: 'AlarmToatlMinutes',
- width: 200,
+ width: 100,
},
{
title: '系统维度',
dataIndex: 'Dimension',
- width: 200,
+ width: 100,
},
{
title: '计算耗时(s)',
dataIndex: 'CalcSeconds',
- width: 200,
+ width: 100,
},
{
title: '状态',
@@ -71,7 +71,7 @@ export const searchFormSchema: FormSchema[] = [
field: 'unit',
component: 'Select',
defaultValue: optionList.units[0].id || null,
- colProps: { span: 4 },
+ colProps: { span: 5 },
componentProps: ({ formModel }) => {
return {
@@ -99,7 +99,7 @@ export const searchFormSchema: FormSchema[] = [
field: 'type',
component: 'Select',
defaultValue: optionList.types[0].id || null,
- colProps: { span: 4 },
+ colProps: { span: 5 },
componentProps: ({ formModel }) => {
return {
allowClear: false,
@@ -124,7 +124,7 @@ export const searchFormSchema: FormSchema[] = [
field: 'system',
component: 'Select',
defaultValue: systemOptions.value[0].id || null,
- colProps: { span: 4 },
+ colProps: { span: 5 },
componentProps: () => {
return {
allowClear: false,
@@ -143,7 +143,7 @@ export const searchFormSchema: FormSchema[] = [
componentProps: {
placeholder: '请输入模型名称',
},
- colProps: { span: 4 },
+ colProps: { span: 6 },
},
]
@@ -167,11 +167,11 @@ export const calcFormSchemas: FormSchema[] = [
required: true,
colProps: {
- span: 8,
+ span: 10,
},
},
{
- label: '回算采样周期',
+ label: '采样周期',
field: 'interval',
component: 'Select',
defaultValue: 60,
@@ -181,7 +181,7 @@ export const calcFormSchemas: FormSchema[] = [
},
required: true,
colProps: {
- span: 4,
+ span: 5,
},
},
diff --git a/src/views/run/calc/index.vue b/src/views/run/calc/index.vue
index efe594c..f5032e0 100644
--- a/src/views/run/calc/index.vue
+++ b/src/views/run/calc/index.vue
@@ -1,6 +1,6 @@
@@ -128,34 +154,33 @@ function handleCalc(values: any) {
-
- {{ t('action.create') }}
+
+
+ {{ t('action.backCalc') }}
+
+
+ {{ t('action.export') }}
+
-
-
-
-
- {{ record.pointSte }}
-
-
-
-
+
+
+
+
+
-
-
-
--
2.30.2
From 74ec3701460f4e77cb6039fc2ac7dd9d8ec6a8b3 Mon Sep 17 00:00:00 2001
From: xjf <378266566@qq.com>
Date: Mon, 15 Dec 2025 09:12:03 +0800
Subject: [PATCH 2/4] =?UTF-8?q?fix:=E5=9B=9E=E7=AE=97=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/alert/run/instant/index.ts | 17 +++++++++
src/views/run/calc/calc.data.ts | 3 ++
src/views/run/calc/index.vue | 58 ++++++++++++++++++------------
3 files changed, 55 insertions(+), 23 deletions(-)
diff --git a/src/api/alert/run/instant/index.ts b/src/api/alert/run/instant/index.ts
index a4747ce..fccbb4e 100644
--- a/src/api/alert/run/instant/index.ts
+++ b/src/api/alert/run/instant/index.ts
@@ -54,6 +54,16 @@ export interface EXAPoint {
Comment?: string
Note?: string
}
+
+export interface InstantCalcReqVO {
+ startTime?: Date
+ endTime?: Date
+ interval?: string
+ mpId?: number
+}
+
+
+
// 查询模型实例列表
export function getInstantPage(params: InstantPageReqVO) {
return defHttp.get({ url: '/alert/instant/page', params })
@@ -92,3 +102,10 @@ export function getInstantPoint(mpId: number) {
export function getInstantChart(data: InstantChartReqVO) {
return defHttp.post({ url: `/alert/instant/getChart`, data })
}
+
+// 回算模型实例
+export function calcInstant(data: InstantCalcReqVO) {
+ return defHttp.post({ url: `/alert/instant/calc`, data })
+}
+
+
diff --git a/src/views/run/calc/calc.data.ts b/src/views/run/calc/calc.data.ts
index 071a08c..ada0c78 100644
--- a/src/views/run/calc/calc.data.ts
+++ b/src/views/run/calc/calc.data.ts
@@ -163,7 +163,10 @@ export const calcFormSchemas: FormSchema[] = [
onChange: (e: any) => {
console.log(e)
},
+
+ allowClear: false, // ← 必须用这个
},
+
required: true,
colProps: {
diff --git a/src/views/run/calc/index.vue b/src/views/run/calc/index.vue
index f5032e0..ebeecc9 100644
--- a/src/views/run/calc/index.vue
+++ b/src/views/run/calc/index.vue
@@ -8,7 +8,7 @@ import { calcFormSchemas, columns, searchFormSchema } from './calc.data'
import { BasicTable, TableAction, useTable } from '@/components/Table'
import { BasicForm, useForm } from '@/components/Form'
-import { getInstantCount, getInstantPage, updateInstant } from '@/api/alert/run/instant'
+import {calcInstant, getInstantCount, getInstantPage, updateInstant} from '@/api/alert/run/instant'
import { getExaNow } from '@/api/alert/exa'
import { useI18n } from '@/hooks/web/useI18n'
import { router } from '@/router'
@@ -63,7 +63,7 @@ const [registerTable, { getForm, reload, getDataSource, updateTableDataRecord }]
/**
* BasicForm绑定注册;
*/
-const [registerForm] = useForm({
+const [registerForm,{getFieldsValue,validate,validateFields}] = useForm({
// 注册表单列
schemas: calcFormSchemas,
// 是否显示展开收起按钮,默认false
@@ -76,7 +76,7 @@ const [registerForm] = useForm({
model: { time: [moment().subtract(1, 'day').format('YYYY-MM-DD HH:mm:ss'), moment().format('YYYY-MM-DD HH:mm:ss')] },
fieldMapToTime: [
// data为时间组件在表单内的字段,startTime,endTime为转化后的开始时间于结束时间
- ['time', ['startTime', 'endTime'], 'YYYY-MM-DD HH:mm:ss'],
+ ['time', ['st', 'et'], 'YYYY-MM-DD HH:mm:ss']
],
actionColOptions: { span: 5,style: { textAlign: 'left' ,marginLeft: '10px',} },
@@ -97,21 +97,30 @@ function handleExport(values: any) {
console.log('导出按钮数据::::', values)
}
-async function handlebeforeCalc() {
- console.log("触发了回算按钮")
- //获取选中的实例
- console.log('选中的实例:', selectedRowss.value)
- const selectedRowIds = selectedRowss.value.map(row => row.mpId)
+async function handlebeforeCalc(rowMpId?: string) {
+ console.log('点击回算按钮数据::::', rowMpId)
+ let targetMpIds: string[] = []
- //check selectedRows
- if (selectedRowIds.length === 0) {
- createMessage.error('请选择要回算的实例')
- return
+ // 1. 行内按钮点击:直接使用当前行的mpId
+ if (rowMpId) {
+ alert("行内回算")
+ targetMpIds = [rowMpId]
}
- // 校验表单数据
- const formData = await getForm().validateFields()
+ // 2. 顶部按钮点击:使用选中的实例
+ else {
+ alert("表单回算")
+
+ targetMpIds = selectedRowss.value.map(row => row.mpId)
+ if (targetMpIds.length === 0) {
+ createMessage.error('请选择要回算的实例')
+ return
+ }
+ }
+
+ // 校验表单数据
+ const formData = await validate()
// 给函数传递需要回算的实例id数组
- formData.mpIds = selectedRowIds;
+ formData.mpIds = targetMpIds;
handleCalc(formData)
}
// 回算
@@ -124,12 +133,13 @@ async function handlebeforeCalc() {
console.log('行内回算loading状态:', mpId, rowCalcLoading[mpId])
try {
// 调用后端的回算接口 - 行内回算
- // 模拟3秒接口调用延迟
- await new Promise(resolve => {
- setTimeout(() => {
- resolve()
- }, 3000)
- })
+ formData.mpId=mpId
+ // 调用后端的回算接口 - 行内回算
+ console.log(formData)
+ const res = await calcInstant(formData)
+ console.log('回算结果:', res)
+ // 更新实例列表
+ // updateTableDataRecord(res)
createMessage.success(t('common.success'))
} catch (error) {
createMessage.error(t('common.fail'))
@@ -155,7 +165,7 @@ async function handlebeforeCalc() {
-
+
{{ t('action.backCalc') }}
@@ -174,9 +184,11 @@ async function handlebeforeCalc() {
--
2.30.2
From 85e1e05dd2e636c9f192455875ba690682aa0e0d Mon Sep 17 00:00:00 2001
From: xjf <378266566@qq.com>
Date: Mon, 15 Dec 2025 17:14:36 +0800
Subject: [PATCH 3/4] =?UTF-8?q?fix:=E5=9B=9E=E7=AE=97=E5=8A=9F=E8=83=BD?=
=?UTF-8?q?=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/run/calc/calc.data.ts | 19 ++--
src/views/run/calc/index.vue | 182 +++++++++++++++++++-------------
2 files changed, 116 insertions(+), 85 deletions(-)
diff --git a/src/views/run/calc/calc.data.ts b/src/views/run/calc/calc.data.ts
index ada0c78..9b4c4dd 100644
--- a/src/views/run/calc/calc.data.ts
+++ b/src/views/run/calc/calc.data.ts
@@ -5,6 +5,7 @@ import type { BasicColumn, FormSchema } from '@/components/Table'
import { DICT_TYPE, getDictOptions } from '@/utils/dict'
import { optionListApi, subSystemListApi } from '@/api/alert/model/select'
import type { systemSelectParams } from '@/api/alert/model/model/optionsModel'
+import {Tag} from "ant-design-vue";
export const columns: BasicColumn[] = [
{
@@ -30,7 +31,7 @@ export const columns: BasicColumn[] = [
{
title: '模式覆盖率',
dataIndex: 'CoveredPercent',
- width: 100,
+ width: 100
},
{
title: '报警次数',
@@ -46,6 +47,7 @@ export const columns: BasicColumn[] = [
title: '系统维度',
dataIndex: 'Dimension',
width: 100,
+
},
{
title: '计算耗时(s)',
@@ -54,10 +56,11 @@ export const columns: BasicColumn[] = [
},
{
title: '状态',
- dataIndex: 'status',
+ dataIndex: 'calcStatus',
width: 100,
- slots: { customRender: 'status' },
fixed: 'right',
+ slots: { customRender: 'calcStatus' },
+
},
]
@@ -65,6 +68,7 @@ const optionList = await optionListApi()
const systemOptions = ref([])
systemOptions.value = optionList.systems
+console.log(systemOptions.value)
export const searchFormSchema: FormSchema[] = [
{
label: '机组',
@@ -80,10 +84,6 @@ export const searchFormSchema: FormSchema[] = [
placeholder: '请选择机组',
options: optionList.units.map(unit => ({ value: unit.id, label: unit.name })),
onChange: async (e: any) => {
- // const { reload } = tableAction
- // reload()
- // or
- console.log(e)
const param: systemSelectParams = {
unitId: e,
typeId: formModel.type,
@@ -106,15 +106,12 @@ export const searchFormSchema: FormSchema[] = [
placeholder: '请选择系统',
options: optionList.types.map(type => ({ value: type.id, label: type.name })),
onChange: async (e: any) => {
- // const { reload } = tableAction
- // reload()
- // or
- console.log(e)
const param: systemSelectParams = {
unitId: formModel.unit,
typeId: e,
}
systemOptions.value = await subSystemListApi(param)
+ console.log(systemOptions.value)
},
}
},
diff --git a/src/views/run/calc/index.vue b/src/views/run/calc/index.vue
index ebeecc9..a44a829 100644
--- a/src/views/run/calc/index.vue
+++ b/src/views/run/calc/index.vue
@@ -1,27 +1,35 @@
-
-
- 回算
-
+
+
+
-
- {{ t('action.backCalc') }}
-
-
- {{ t('action.export') }}
-
+
+ {{ t('action.backCalc') }}
+
+
+ {{ t('action.export') }}
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+ {{ statusMap[record.calcStatus].label }}
+
+
--
2.30.2
From fd5d695a7dd2706d16727e642a36eda301b3d38a Mon Sep 17 00:00:00 2001
From: xjf <378266566@qq.com>
Date: Tue, 16 Dec 2025 21:35:18 +0800
Subject: [PATCH 4/4] =?UTF-8?q?feat:=E9=9B=86=E4=B8=AD=E5=91=8A=E8=AD=A6?=
=?UTF-8?q?=E6=A8=A1=E5=9D=97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/alert/warn/index.ts | 4 +
src/views/warn/alarm/alarm.data.ts | 183 +++++++++++++++++++++++++++++
src/views/warn/alarm/index.vue | 117 ++++++++++++++++++
3 files changed, 304 insertions(+)
create mode 100644 src/views/warn/alarm/alarm.data.ts
create mode 100644 src/views/warn/alarm/index.vue
diff --git a/src/api/alert/warn/index.ts b/src/api/alert/warn/index.ts
index b71c2d5..4ca8de8 100644
--- a/src/api/alert/warn/index.ts
+++ b/src/api/alert/warn/index.ts
@@ -21,6 +21,10 @@ export interface EXAHistoryReqVO {
export function getWarnPage(params: WarnPageReqVO) {
return defHttp.get({ url: '/alert/warn/page', params })
}
+// 查询预警列表-分页-转换实时值
+export function getWarnPageReal(params: WarnPageReqVO) {
+ return defHttp.get({ url: '/alert/warn/page-real', params })
+}
// 修改预警
export function updateWarn(data: WarnVO) {
diff --git a/src/views/warn/alarm/alarm.data.ts b/src/views/warn/alarm/alarm.data.ts
new file mode 100644
index 0000000..589b208
--- /dev/null
+++ b/src/views/warn/alarm/alarm.data.ts
@@ -0,0 +1,183 @@
+import type { BasicColumn, FormSchema } from '@/components/Table'
+import {optionListApi, subSystemListApi} from "@/api/alert/model/select";
+import {h, ref} from "vue";
+import {systemSelectParams} from "@/api/alert/model/model/optionsModel";
+import {FileItem, UploadResultStatus} from "@/components/Upload/src/typing";
+import {Progress} from "ant-design-vue";
+const optionList = await optionListApi()
+
+const systemOptions = ref([])
+systemOptions.value = optionList.systems
+export const searchFormSchema: FormSchema[] = [
+ {
+ label: '机组',
+ field: 'unit',
+ component: 'Select',
+ defaultValue: optionList.units[0].id || null,
+ colProps: { span: 4 },
+
+ componentProps: ({ schema, tableAction, formActionType, formModel }) => {
+ return {
+ // xxxx props
+ allowClear: false,
+ placeholder: '请选择机组',
+ options: optionList.units.map(unit => ({ value: unit.id, label: unit.name })),
+ onChange: async (e: any) => {
+ // const { reload } = tableAction
+ // reload()
+ // or
+ console.log(e)
+ const param: systemSelectParams = {
+ unitId: e,
+ typeId: formModel.type,
+ }
+ systemOptions.value = await subSystemListApi(param)
+ formModel.system = systemOptions.value[0].id
+ },
+ }
+ },
+ },
+ {
+ label: '系统',
+ field: 'type',
+ component: 'Select',
+ defaultValue: optionList.types[0].id || null,
+ colProps: { span: 4 },
+ componentProps: ({ formModel }) => {
+ return {
+ allowClear: false,
+ placeholder: '请选择系统',
+ options: optionList.types.map(type => ({ value: type.id, label: type.name })),
+ onChange: async (e: any) => {
+ // const { reload } = tableAction
+ // reload()
+ // or
+ console.log(e)
+ const param: systemSelectParams = {
+ unitId: formModel.unit,
+ typeId: e,
+ }
+ systemOptions.value = await subSystemListApi(param)
+ },
+ }
+ },
+ },
+ {
+ label: '子系统',
+ field: 'system',
+ component: 'Select',
+ defaultValue: systemOptions.value[0].id || null,
+ colProps: { span: 4 },
+ componentProps: () => {
+ return {
+ allowClear: false,
+ placeholder: '请选择子系统',
+ options: systemOptions.value.map(system => ({ value: system.id, label: system.name })),
+ }
+ },
+ },
+
+ {
+ label: '模型实例名称',
+ field: 'mpName',
+ component: 'Input',
+ labelWidth: 120,
+ defaultValue: '',
+ colProps: { span: 7 },
+ }
+]
+
+export const columns: BasicColumn[] = [
+ {
+ title: '编号',
+ dataIndex: 'warnId',
+ width: 80,
+ fixed: 'left',
+ },
+ {
+ title: '机组',
+ dataIndex: 'unitName',
+ width: 80,
+ fixed: 'left',
+ },
+ {
+ title: '报警名称',
+ dataIndex: 'alarmName',
+ width: 180,
+ fixed: 'left',
+ // 将 JSX 改为 h 函数调用
+ customRender: ({ record }) => {
+ return h('div', [
+ h('div', record.pointName),
+ h('div', { style: 'color: #999; font-size: 12px' }, record.pointId)
+ ]);
+ },
+ },
+ {
+ title: '单位',
+ dataIndex: 'unit',
+ width: 50,
+ fixed: 'left',
+ },
+ {
+ title: '测点值',
+ dataIndex: 'unit',
+ width: 150,
+ // 将 JSX 改为 h 函数调用
+ customRender: ({ record }) => {
+ return h('div', [
+ h('div', { style: 'color: #006400;font-weight:bold' },'实时值:'+record.pointValue),
+ h('div', { style: 'color: #0960BD;font-weight:bold' },'重构值:'+record.outputPointValue),
+ ]);
+ },
+ },
+ {
+ title: '偏差值',
+ dataIndex: 'biasValue',
+ width: 50
+ },
+ {
+ title: '安全区间',
+ dataIndex: 'limit',
+ width: 100,
+ // 将 JSX 改为 h 函数调用
+ customRender: ({ record }) => {
+ return h('div', [
+ h('div', record.lowlimit),
+ h('div', record.uplimit),
+ ]);
+ },
+
+ },
+ {
+ title: '模型实例名称',
+ dataIndex: 'mpName',
+ width: 150,
+ ellipsis: false, // ⭐ 关键
+
+ },
+ {
+ title: '预警时间',
+ dataIndex: 'createTime',
+ width: 150
+ },
+ {
+ title: '持续时长',
+ dataIndex: 'timeDiffStr',
+ width: 90,
+ ellipsis: false, // ⭐ 关键
+
+ },
+ {
+ title: '告警级别',
+ dataIndex: 'alarmModelRuleName',
+ width: 80,
+ ellipsis: false, // ⭐ 关键
+
+ },
+ {
+ title: '专业',
+ dataIndex: 'systemName',
+ width: 100,
+ }
+]
diff --git a/src/views/warn/alarm/index.vue b/src/views/warn/alarm/index.vue
new file mode 100644
index 0000000..4730507
--- /dev/null
+++ b/src/views/warn/alarm/index.vue
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ `${record.timeDurationThreshold}秒` }}
+
+
+
+
+
+
+
--
2.30.2