From d262e54a1ac1383f67bc9d7431415e21fff42fc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E4=BA=91=E9=B9=8F?= Date: Tue, 19 Nov 2024 16:37:06 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=A9=E6=A8=A1=E5=9E=8B=EF=BC=9A=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=91=8A=E8=AD=A6=E7=B1=BB=E5=9E=8B=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=20=E6=97=A5=E5=BF=97=E7=AE=A1=E7=90=86=EF=BC=9A=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=9B=BE=E8=A1=A8x=E8=BD=B4=E3=80=81=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=AD=97=E6=AE=B5=E8=BD=AC=E6=9E=9A=E4=B8=BE=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=20=E6=95=85=E9=9A=9C=E5=BD=95=E6=B3=A2=EF=BC=9A?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9B=BE=E8=A1=A8x=E8=BD=B4=E3=80=81?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=AD=97=E6=AE=B5=E8=BD=AC=E6=9E=9A=E4=B8=BE?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/backend/deviceModel/request.ts | 7 +++- .../src/api/backend/logRecord/request.ts | 11 ++++++ .../src/api/backend/malfunction/request.ts | 11 ++++++ .../src/views/backend/auth/model/index.vue | 11 ++++++ .../src/views/backend/auth/model/type.ts | 2 + .../src/views/backend/logRecord/index.vue | 39 ++++++++++++++++--- .../src/views/backend/malfunction/index.vue | 39 ++++++++++++++++--- 7 files changed, 106 insertions(+), 14 deletions(-) diff --git a/ui/dasadmin/src/api/backend/deviceModel/request.ts b/ui/dasadmin/src/api/backend/deviceModel/request.ts index 04fdc47a..15acc000 100644 --- a/ui/dasadmin/src/api/backend/deviceModel/request.ts +++ b/ui/dasadmin/src/api/backend/deviceModel/request.ts @@ -48,7 +48,10 @@ export const delModelReq = (data: DelModelType) => { url: '/api/equipment/model/delete', method: 'post', data: data, - }) + }, + { + showErrorMessage: false + }) } export const getModelAttributeListReq = (data: GetModelAttributeType) => { @@ -156,7 +159,7 @@ export const getRealValueListReq = (data: { deviceId: string, attributes?: strin }) } -export const getRealValueRangeReq = (data: { startTime: number, endTime: number, devices: { deviceId: string, attributes?: string[] }[],interval?:string }) => { +export const getRealValueRangeReq = (data: { startTime: number, endTime: number, devices: { deviceId: string, attributes?: string[] }[], interval?: string }) => { return createAxios>({ url: '/api/data/history', method: 'post', diff --git a/ui/dasadmin/src/api/backend/logRecord/request.ts b/ui/dasadmin/src/api/backend/logRecord/request.ts index 10aec0c5..17959807 100644 --- a/ui/dasadmin/src/api/backend/logRecord/request.ts +++ b/ui/dasadmin/src/api/backend/logRecord/request.ts @@ -48,4 +48,15 @@ export const downloadFileReq = (data: { }, { reductDataFormat: false }) +} + +export const getFileKeyEnumsReq = (data: { + madeinfactory: string + model: string +}) => { + return createAxios>>({ + url: '/api/plc/queryPlcDesc', + method: 'post', + data + }) } \ No newline at end of file diff --git a/ui/dasadmin/src/api/backend/malfunction/request.ts b/ui/dasadmin/src/api/backend/malfunction/request.ts index 04ee1155..e0cb9e2e 100644 --- a/ui/dasadmin/src/api/backend/malfunction/request.ts +++ b/ui/dasadmin/src/api/backend/malfunction/request.ts @@ -49,4 +49,15 @@ export const downloadFileReq = (data: { }, { reductDataFormat: false }) +} + +export const getFileKeyEnumsReq = (data: { + madeinfactory: string + model: string +}) => { + return createAxios>>({ + url: '/api/fdr/queryFdrDesc', + method: 'post', + data + }) } \ No newline at end of file diff --git a/ui/dasadmin/src/views/backend/auth/model/index.vue b/ui/dasadmin/src/views/backend/auth/model/index.vue index 022a55d8..9a40f574 100644 --- a/ui/dasadmin/src/views/backend/auth/model/index.vue +++ b/ui/dasadmin/src/views/backend/auth/model/index.vue @@ -239,6 +239,11 @@ + + + + +
@@ -768,6 +773,11 @@ const attributeFormDataTypeOptions: { value: attributeTypeDataType }[] = [ { value: 'int' }, { value: 'bigint' }, ] +const attributeFormDataLevelOptions = [ + { value: 0, label: '提示' }, + { value: 1, label: '告警' }, + { value: 2, label: '故障' }, +] const originAttributeForm: AddModelAttributeType & UpdateModelAttributeType = { id: null, iotModelId: '', @@ -780,6 +790,7 @@ const originAttributeForm: AddModelAttributeType & UpdateModelAttributeType = { dataType: '', visible: true, unit: '', + level: undefined, revision: 1, createdBy: undefined, createdTime: undefined, diff --git a/ui/dasadmin/src/views/backend/auth/model/type.ts b/ui/dasadmin/src/views/backend/auth/model/type.ts index 41d66071..07bc9c4e 100644 --- a/ui/dasadmin/src/views/backend/auth/model/type.ts +++ b/ui/dasadmin/src/views/backend/auth/model/type.ts @@ -67,6 +67,7 @@ export enum ModelAttributeFieldsEnums { 'dataType' = '数据类型', 'visible' = '是否可见', 'unit' = '单位', + 'level' = '告警等级', 'revision' = '乐观锁', 'createdBy' = '创建人', 'createdTime' = '创建时间', @@ -111,6 +112,7 @@ export type AddModelAttributeType = { subSystem: string dataType: attributeTypeDataType | '' unit: string + level?: 0 | 1 | 2 visible: 0 | 1 | boolean revision: number createdBy?: string diff --git a/ui/dasadmin/src/views/backend/logRecord/index.vue b/ui/dasadmin/src/views/backend/logRecord/index.vue index 872c072a..49d957e6 100644 --- a/ui/dasadmin/src/views/backend/logRecord/index.vue +++ b/ui/dasadmin/src/views/backend/logRecord/index.vue @@ -136,7 +136,7 @@ import { ref, reactive, computed, onMounted, nextTick, onUnmounted } from 'vue' import { dayjs, ElMessage, FormInstance, TreeInstance } from 'element-plus' import { Search, Setting } from '@element-plus/icons-vue' -import { getLogRecordListReq, setConfigReq, previewFileReq, downloadFileReq } from '/@/api/backend/logRecord/request' +import { getLogRecordListReq, setConfigReq, previewFileReq, downloadFileReq, getFileKeyEnumsReq } from '/@/api/backend/logRecord/request' import { equipList } from '/@/api/backend/temperature/request' import * as echarts from 'echarts' import { tableItemData } from './type' @@ -189,15 +189,19 @@ const curTreeData = ref<{ id: string code: string options: any + model: string + madeinFactory: string children?: any[] }>({ label: '风机列表', id: '0', code: '0', + model: '', + madeinFactory: '', options: {}, }) -const handleNodeClick = (target: { label: string; id: string; code: string; options: any }) => { +const handleNodeClick = (target: { label: string; id: string; code: string; model: string; madeinFactory: string; options: any }) => { curTreeData.value = target if (target.id === '0') return getListForAirBlower() @@ -211,6 +215,8 @@ const getTreeDataList = () => { label: item.name, code: item.code, id: item.id, + model: item.model, + madeinFactory: item.madeinFactory, options: item.options ? JSON.parse(item.options).plcFormat : {}, } }) @@ -372,7 +378,9 @@ const setAirBlowerConfig = () => { const previewFileDialogVisible = ref(false) const readFile = (data: tableItemData) => { previewFileDialogVisible.value = true - getFileData(data.path) + getFileKeyEnum().finally(() => { + getFileData(data.path) + }) } const downloadFile = (data: tableItemData) => { downloadFileReq({ url: data.path }).then((res) => { @@ -415,6 +423,8 @@ const previewSearchTree = (val: string) => { const filterData = originPreviewTreeData.filter((item: any) => regex.test(item.label)) previewTreeData.value = filterData nextTick(() => { + // console.log('勾选-----',selectPreviewTree); + previewTreeRef.value?.setCheckedKeys(selectPreviewTree) }) } @@ -433,6 +443,7 @@ const handleCheckChange = (data: any, state: boolean) => { previewChartInstance && previewChartInstance.clear() if (state) { selectPreviewTree.push(data.key) + // console.log('添加-----',selectPreviewTree); } else { const index = selectPreviewTree.findIndex((item: string) => item === data.key) selectPreviewTree.splice(index, 1) @@ -491,7 +502,7 @@ const initPreviewChart = () => { grid: { top: 50, right: 23, - bottom: 10, + bottom: 50, left: 18, containLabel: true, }, @@ -517,7 +528,7 @@ const initPreviewChart = () => { color: '#4E5969', interval: 'auto', formatter: function (value: any) { - return value.slice(0, 10) + return value.slice(11) }, //rotate: 45 }, @@ -599,7 +610,7 @@ const getFileData = (url: string) => { }) } else { data.push({ - label: item, + label: fileKeyEnums?.[item] ?? item, key: item, isLeaf: true, }) @@ -612,6 +623,22 @@ const getFileData = (url: string) => { }) } +const fileKeyEnums: any = {} +const getFileKeyEnum = () => { + return new Promise((resolve) => { + getFileKeyEnumsReq({ + madeinfactory: curTreeData.value.madeinFactory, + model: curTreeData.value.model, + }).then((res) => { + if (res.success) { + res.data.forEach((item: any) => { + fileKeyEnums[item.variable] = item.description + }) + resolve(true) + } + }) + }) +} onMounted(() => { getTreeDataList().then((data: any) => { treeRef.value && treeRef.value.setCurrentKey(data.id, true) diff --git a/ui/dasadmin/src/views/backend/malfunction/index.vue b/ui/dasadmin/src/views/backend/malfunction/index.vue index cf76e8d6..69dbde95 100644 --- a/ui/dasadmin/src/views/backend/malfunction/index.vue +++ b/ui/dasadmin/src/views/backend/malfunction/index.vue @@ -139,7 +139,7 @@ import { ref, reactive, computed, onMounted, nextTick, onUnmounted } from 'vue' import { dayjs, ElMessage, FormInstance, TreeInstance } from 'element-plus' import { Search, Setting } from '@element-plus/icons-vue' -import { getMalFunctionListReq, setConfigReq, previewFileReq, downloadFileReq } from '/@/api/backend/malfunction/request' +import { getMalFunctionListReq, setConfigReq, previewFileReq, downloadFileReq, getFileKeyEnumsReq } from '/@/api/backend/malfunction/request' import { equipList } from '/@/api/backend/temperature/request' import * as echarts from 'echarts' import { tableItemData } from './type' @@ -191,16 +191,20 @@ const curTreeData = ref<{ label: string id: string code: string + model: string + madeinFactory: string options: any children?: any[] }>({ label: '风机列表', id: '0', code: '0', + model: '', + madeinFactory: '', options: {}, }) -const handleNodeClick = (target: { label: string; id: string; code: string; options: any }) => { +const handleNodeClick = (target: { label: string; id: string; code: string; model: string; madeinFactory: string; options: any }) => { curTreeData.value = target if (target.id === '0') return getListForAirBlower() @@ -214,6 +218,8 @@ const getTreeDataList = () => { label: item.name, code: item.code, id: item.id, + model: item.model, + madeinFactory: item.madeinFactory, options: item.options ? JSON.parse(item.options).fdrFormat : {}, } }) @@ -374,7 +380,9 @@ const setAirBlowerConfig = () => { const previewFileDialogVisible = ref(false) const readFile = (data: tableItemData) => { previewFileDialogVisible.value = true - getFileData(data.path) + getFileKeyEnum().finally(() => { + getFileData(data.path) + }) } const downloadFile = (data: tableItemData) => { downloadFileReq({ url: data.path }).then((res) => { @@ -499,7 +507,7 @@ const initPreviewChart = () => { grid: { top: 50, right: 23, - bottom: 10, + bottom: 50, left: 18, containLabel: true, }, @@ -525,7 +533,7 @@ const initPreviewChart = () => { color: '#4E5969', interval: 'auto', formatter: function (value: any) { - return value.slice(0, 10) + return value.slice(11) }, //rotate: 45 }, @@ -600,6 +608,8 @@ const getFileData = (url: string) => { previewChartData = res.data const attrName = Object.keys(res.data) const data: any = [] + console.log(fileKeyEnums); + attrName.forEach((item) => { if (item === 'TimeStamp') { previewChartData.TimeStamp = previewChartData.TimeStamp.map((item: any) => { @@ -607,7 +617,7 @@ const getFileData = (url: string) => { }) } else { data.push({ - label: item, + label: fileKeyEnums?.[item] ?? item, key: item, isLeaf: true, }) @@ -619,6 +629,23 @@ const getFileData = (url: string) => { }) } +const fileKeyEnums: any = {} +const getFileKeyEnum = () => { + return new Promise((resolve) => { + getFileKeyEnumsReq({ + madeinfactory: curTreeData.value.madeinFactory, + model: curTreeData.value.model, + }).then((res) => { + if (res.success) { + res.data.forEach((item: any) => { + fileKeyEnums[item.variable] = item.description + }) + resolve(true) + } + }) + }) +} + onMounted(() => { getTreeDataList().then((data: any) => { treeRef.value && treeRef.value.setCurrentKey(data.id, true)