From 1146b314e395ed4129e2455b8769280b6fc73927 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=82=96=E6=99=8B=E9=A3=9E?= <378266566@qq.com> Date: Fri, 23 May 2025 18:45:44 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=E8=BF=90=E8=A1=8C=E4=B8=AD=E5=BF=83-?= =?UTF-8?q?=E9=A2=84=E8=AD=A6=E5=AE=9E=E4=BE=8BV1.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 2 +- src/api/alert/run/calcgroup/index.ts | 10 + src/api/alert/run/instant/index.ts | 87 +++++ src/api/alert/run/model/index.ts | 19 ++ src/enums/appEnum.ts | 3 + src/hooks/web/useECharts.ts | 9 +- src/locales/lang/en/action.json | 6 +- src/locales/lang/zh-CN/action.json | 5 +- src/utils/http/axios/index.ts | 2 +- src/views/exa/EXAHistoryLine.vue | 114 ------- src/views/exa/HistoryLine.vue | 189 +++++++++++ src/views/exa/config/HistoryModal.vue | 28 +- src/views/exa/config/index.vue | 9 +- src/views/exa/history/PointModal.vue | 73 ++--- src/views/exa/history/index copy.vue | 260 --------------- src/views/exa/history/index.vue | 5 +- src/views/run/instant/CreateModal.vue | 211 +++++++++++++ src/views/run/instant/detail.vue | 195 ++++++++++++ src/views/run/instant/index.vue | 257 +++++++++++++++ src/views/run/instant/instant.data.ts | 439 ++++++++++++++++++++++++++ src/views/run/model/ModelTable.vue | 66 ++++ src/views/run/model/PointTable.vue | 110 +++++++ src/views/run/model/model.data.ts | 55 ++++ src/views/run/model/point.data.ts | 34 ++ src/views/system/role/index.vue | 4 +- 25 files changed, 1754 insertions(+), 438 deletions(-) create mode 100644 src/api/alert/run/calcgroup/index.ts create mode 100644 src/api/alert/run/instant/index.ts create mode 100644 src/api/alert/run/model/index.ts delete mode 100644 src/views/exa/EXAHistoryLine.vue create mode 100644 src/views/exa/HistoryLine.vue delete mode 100644 src/views/exa/history/index copy.vue create mode 100644 src/views/run/instant/CreateModal.vue create mode 100644 src/views/run/instant/detail.vue create mode 100644 src/views/run/instant/index.vue create mode 100644 src/views/run/instant/instant.data.ts create mode 100644 src/views/run/model/ModelTable.vue create mode 100644 src/views/run/model/PointTable.vue create mode 100644 src/views/run/model/model.data.ts create mode 100644 src/views/run/model/point.data.ts diff --git a/.env b/.env index b081852..5a936b2 100644 --- a/.env +++ b/.env @@ -14,7 +14,7 @@ VITE_GLOB_APP_TENANT_ENABLE = false VITE_GLOB_APP_CAPTCHA_ENABLE = true # 文档地址的开关 -VITE_APP_DOCALERT_ENABLE=true +VITE_APP_DOCALERT_ENABLE=false # 百度统计 VITE_APP_BAIDU_CODE = eb21166668bf766b9d059a6fd1c10777 diff --git a/src/api/alert/run/calcgroup/index.ts b/src/api/alert/run/calcgroup/index.ts new file mode 100644 index 0000000..ab0d93e --- /dev/null +++ b/src/api/alert/run/calcgroup/index.ts @@ -0,0 +1,10 @@ +import { defHttp } from '@/utils/http/axios' + +export interface CalcGroupPageReqVO extends PageParam { + unitId?: number +} + +// 查询计算组列表-不分页 +export function getCalcGroupList(params: CalcGroupPageReqVO) { + return defHttp.get({ url: '/alert/calcgroup/list', params }) +} diff --git a/src/api/alert/run/instant/index.ts b/src/api/alert/run/instant/index.ts new file mode 100644 index 0000000..e1d393a --- /dev/null +++ b/src/api/alert/run/instant/index.ts @@ -0,0 +1,87 @@ +import qs from 'qs' +import { defHttp } from '@/utils/http/axios' + +export interface InstantPageReqVO extends PageParam { + mpName?: string + +} + +export interface InstantVO { + id: number + status: number + modelId: number + pointInfo: Array + mpName: string + intervalTime: number + visible: number + hisSto: number + calcGroup: number + modelVersionId: number +} + +export interface EXAHistoryReqVO { + itemName?: string + startTime?: Date + endTime?: Date + interval?: string +} + +export interface InstantChartReqVO extends EXAHistoryReqVO { + id?: number + +} + +export interface EXANowReqVO { + itemName?: string + +} + +export interface EXAPoint { + AssetCode?: string + ItemName?: string + GroupName?: string + ItemType?: number + Descriptor?: string + EngUnits?: string + Source?: string + AutoSave?: number + UpperBound?: number + LowerBound?: number + UpperLimit?: number + LowerLimit?: number + UpperUpperLimit?: number + LowerLowerLimit?: number + Comment?: string + Note?: string +} +// 查询模型实例列表 +export function getInstantPage(params: InstantPageReqVO) { + return defHttp.get({ url: '/alert/instant/page', params }) +} +// 查询模型实例详情 +export function getInstant(id: number) { + return defHttp.get({ url: `/alert/instant/get?id=${id}` }) +} +// 新增模型实例 +export function createInstant(data: InstantVO) { + return defHttp.post({ url: '/alert/instant/create', data }) +} + +// 修改模型实例 +export function updateInstant(data: InstantVO) { + return defHttp.put({ url: '/alert/instant/update', data }) +} + +// 获取模型实例数量 +export function getInstantCount() { + return defHttp.get({ url: '/alert/instant/count' }) +} + +// 查询模型实例测点列表 +export function getInstantPoint(id: number) { + return defHttp.get({ url: `/alert/instant/getPoint?id=${id}` }) +} +// 查询模型实例测点曲线 +export function getInstantChart(data: InstantChartReqVO) { + return defHttp.post({ url: `/alert/instant/getChart`, data }) +} diff --git a/src/api/alert/run/model/index.ts b/src/api/alert/run/model/index.ts new file mode 100644 index 0000000..c5f7c57 --- /dev/null +++ b/src/api/alert/run/model/index.ts @@ -0,0 +1,19 @@ +import { defHttp } from '@/utils/http/axios' + +export interface ModelPageReqVO extends PageParam { + modelName?: string +} + +export interface ModelVersionPageReqVO extends PageParam { + modelId?: number +} + +// 查询模型实例列表 +export function getModelPage(params: ModelPageReqVO) { + return defHttp.get({ url: '/alert/model/page', params }) +} + +// 查询模型版本列表-不分页 +export function getModelVersionList(params: ModelVersionPageReqVO) { + return defHttp.get({ url: '/alert/model/version/list', params }) +} diff --git a/src/enums/appEnum.ts b/src/enums/appEnum.ts index b6fb930..bf54049 100644 --- a/src/enums/appEnum.ts +++ b/src/enums/appEnum.ts @@ -71,4 +71,7 @@ export enum IconEnum { SETTING = 'ant-design:setting-outlined', SEND = 'ant-design:send-outlined', ADDS = 'ant-design:plus-circle-outlined', + CHANGE = 'ant-design:one-to-one-outlined', + WARN = 'ant-design:warning-outlined', + } diff --git a/src/hooks/web/useECharts.ts b/src/hooks/web/useECharts.ts index c4a767a..c82f0bc 100644 --- a/src/hooks/web/useECharts.ts +++ b/src/hooks/web/useECharts.ts @@ -8,13 +8,14 @@ import echarts from '@/utils/lib/echarts' import { useRootSetting } from '@/hooks/setting/useRootSetting' import { useMenuSetting } from '@/hooks/setting/useMenuSetting' -export function useECharts(elRef: Ref, theme: 'light' | 'dark' | 'default' = 'default') { +export function useECharts(elRef: Ref, theme: 'light' | 'dark' | 'default' = 'default', isAsync) { const { getDarkMode: getSysDarkMode } = useRootSetting() const { getCollapsed } = useMenuSetting() const getDarkMode = computed(() => { return theme === 'default' ? getSysDarkMode.value : theme }) + let chartInstance: echarts.ECharts | null = null let resizeFn: Fn = resize const cacheOptions = ref({}) as Ref @@ -38,6 +39,11 @@ export function useECharts(elRef: Ref, theme: 'light' | 'dark' | return chartInstance = echarts.init(el, t) + + // 是否做同步 + if (isAsync === true) + chartInstance.group = 'async' + const { removeEvent } = useEventListener({ el: window, name: 'resize', @@ -120,6 +126,7 @@ export function useECharts(elRef: Ref, theme: 'light' | 'dark' | } return { + chartInstance, setOptions, resize, echarts, diff --git a/src/locales/lang/en/action.json b/src/locales/lang/en/action.json index 0800382..819a633 100644 --- a/src/locales/lang/en/action.json +++ b/src/locales/lang/en/action.json @@ -11,5 +11,9 @@ "test": "Test", "view": "View", "clearAllandClose": "ClearAllAndClose", - "createBatch": "CreateBatch" + "createBatch": "CreateBatch", + "createInstant": "CreateInstant", + "pointConfig": "PointConfig", + "warnConfig": "WarnConfig" + } diff --git a/src/locales/lang/zh-CN/action.json b/src/locales/lang/zh-CN/action.json index 138352f..84fcdee 100644 --- a/src/locales/lang/zh-CN/action.json +++ b/src/locales/lang/zh-CN/action.json @@ -12,5 +12,8 @@ "test": "测试", "view": "查看", "clearAllandClose": "清空并关闭", - "createBatch": "批量导入" + "createBatch": "批量导入", + "createInstant": "新增实例", + "pointConfig": "测点配置", + "warnConfig": "预警配置" } diff --git a/src/utils/http/axios/index.ts b/src/utils/http/axios/index.ts index e595a5a..11fc3f6 100644 --- a/src/utils/http/axios/index.ts +++ b/src/utils/http/axios/index.ts @@ -277,7 +277,7 @@ function createAxios(opt?: Partial) { // authentication schemes,e.g: Bearer // authenticationScheme: 'Bearer', authenticationScheme: 'Bearer', - timeout: 20 * 1000, + timeout: 60 * 1000, // 基础接口地址 // baseURL: globSetting.apiUrl, diff --git a/src/views/exa/EXAHistoryLine.vue b/src/views/exa/EXAHistoryLine.vue deleted file mode 100644 index c490b73..0000000 --- a/src/views/exa/EXAHistoryLine.vue +++ /dev/null @@ -1,114 +0,0 @@ - - - diff --git a/src/views/exa/HistoryLine.vue b/src/views/exa/HistoryLine.vue new file mode 100644 index 0000000..b028ba0 --- /dev/null +++ b/src/views/exa/HistoryLine.vue @@ -0,0 +1,189 @@ + + + diff --git a/src/views/exa/config/HistoryModal.vue b/src/views/exa/config/HistoryModal.vue index 4bbe05a..d9b71a4 100644 --- a/src/views/exa/config/HistoryModal.vue +++ b/src/views/exa/config/HistoryModal.vue @@ -4,16 +4,27 @@ import moment from 'moment' import { Card } from 'ant-design-vue' import { formHistory } from '../exa.data' -import EXAHistoryLine from '../EXAHistoryLine.vue' +import HistoryLine from '../HistoryLine.vue' import { BasicModal, useModalInner } from '@/components/Modal' import { BasicForm, useForm } from '@/components/Form' import { getExaHistorys } from '@/api/alert/exa' +const props = defineProps({ + itemName: { + type: String, + default: '', + }, + legendName: { + type: Array, + default: () => [], + }, +}) + const loading = ref(true) -const itemName = ref('') +// const itemName = ref('') const [registerForm, { getFieldsValue }] = useForm({ labelWidth: 100, @@ -29,14 +40,14 @@ const [registerForm, { getFieldsValue }] = useForm({ actionColOptions: { span: 2 }, }) const historyData = ref() -const legendName = ref([]) +// const legendName = ref([]) const [registerHistoryModal, { setModalProps }] = useModalInner(async (data) => { console.log(543) setModalProps({ confirmLoading: false, showCancelBtn: false, showOkBtn: false }) - itemName.value = data.record.itemName - legendName.value = [] - legendName.value.push(`${data.record.descriptor}-${data.record.itemName}`) + // props.itemName = data.record.itemName + // legendName.value = [] + // legendName.value.push(`${data.record.descriptor}-${data.record.itemName}`) handleSubmitR() // 利用点号去获取历史数据,从而生成曲线 // setFieldsValue({ time: [moment().subtract(1, 'day').format('YYYY-MM-DD HH:mm:ss'), moment().format('YYYY-MM-DD HH:mm:ss')] }) @@ -59,7 +70,8 @@ async function handleSubmitR() { const exaHistoryReqVO = { startTime: serachFormData.startTime, endTime: serachFormData.endTime, - itemName: itemName.value, + itemName: props.itemName, + interval: 100, } historyData.value = await getExaHistorys(exaHistoryReqVO) @@ -71,7 +83,7 @@ async function handleSubmitR() { - + diff --git a/src/views/exa/config/index.vue b/src/views/exa/config/index.vue index db13c37..792e131 100644 --- a/src/views/exa/config/index.vue +++ b/src/views/exa/config/index.vue @@ -1,5 +1,5 @@ -