From eeaf55cba02be9c4724e38f2a14c80518996669d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=9D=E8=8E=89?= <1084050926@qq.com> Date: Fri, 6 Sep 2024 16:23:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=AE=BE=E5=A4=87=E4=B8=80=E5=BC=A0?= =?UTF-8?q?=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 2 +- .../useAreaDevCountRes.ts | 11 +- .../commonDataComponents/useAssetsClassRes.ts | 23 +- .../useCategoryBrandCountTableRes.ts | 5 +- .../useCompanyTempTopRes.ts | 99 +-- src/hooks/useChartCommonData.hook.ts | 17 +- .../Charts/Bars/BarCommon/index.vue | 73 +-- .../components/Charts/Maps/MapBase/index.vue | 246 ++++---- .../Charts/Pies/PieCommon3/config.ts | 104 ++-- .../Charts/Pies/PieCommon3/index.vue | 3 + .../RealTimeAlarmStatistics/configData.vue | 2 +- .../RealTimeEvent/BorderBoxV2.vue | 9 +- .../AlarmDiagram/RealTimeEvent/configData.vue | 4 +- .../AlarmDiagram/RealTimeEvent/index.vue | 349 ++++++----- .../AlarmLevelStatistic/configData.vue | 2 +- .../AlarmLevelStatistic/index.vue | 563 +++++++----------- .../AlarmTrend/configData.vue | 2 +- .../CustomComponents/AlarmTrend/index.vue | 352 ++++++----- .../ClassifiedStatistic/configData.vue | 25 +- .../ClassifiedStatistic/index.vue | 274 +++++---- .../CustomComponents/Overview/configData.vue | 25 +- .../CustomComponents/Overview/index.vue | 265 +++++---- .../Informations/Texts/TextCommon/config.ts | 1 + .../Informations/Texts/TextCommon/config.vue | 11 +- .../Informations/Texts/TextCommon/index.vue | 1 + .../Tables/Tables/TablesBasic/index.vue | 7 + src/packages/public/publicConfig.ts | 11 +- .../chartEditStore/chartEditStore.d.ts | 8 +- .../globalQueryParamsStore.ts | 17 +- .../ChartDataV2/components/AlarmTrend.vue | 2 +- .../ChartDataV2/components/AreaDevCount.vue | 21 + .../ChartDataV2/components/AssetsClass.vue | 36 +- .../components/CategoryBrandCountTable.vue | 35 +- .../ChartDataV2/components/CompanyTempTop.vue | 6 +- .../ChartDataV2/components/PointHistory.vue | 4 +- .../ChartDataV2/components/PointRealTime.vue | 4 +- .../ChartDataV2/components/PointTable.vue | 4 +- .../ChartDataV2/components/SinglePoint.vue | 4 +- .../components/ChartDataV2/index.vue | 91 +-- 39 files changed, 1412 insertions(+), 1306 deletions(-) create mode 100644 src/views/chart/ContentConfigurations/components/ChartDataV2/components/AreaDevCount.vue diff --git a/.env b/.env index 05d997d8..cb48cb71 100644 --- a/.env +++ b/.env @@ -5,7 +5,7 @@ VITE_DEV_PORT = '8080' # VITE_DEV_PATH = 'http://192.168.0.34:11887' VITE_DEV_PATH = 'http://192.168.0.34:8025/' # VITE_DEV_PATH = 'http://192.168.0.120:3001' -VITE_DEV_TOKEN = "2e51947c-5d8d-42f2-99e8-8d841cff7a00" +VITE_DEV_TOKEN = "197fccbc-0048-4552-aeb3-9b19edb351d6" # production path # VITE_PRO_PATH = 'http://192.168.0.235:8177' diff --git a/src/hooks/commonDataComponents/useAreaDevCountRes.ts b/src/hooks/commonDataComponents/useAreaDevCountRes.ts index 89e1c323..c05030de 100644 --- a/src/hooks/commonDataComponents/useAreaDevCountRes.ts +++ b/src/hooks/commonDataComponents/useAreaDevCountRes.ts @@ -3,14 +3,20 @@ import { CreateComponentType } from '@/packages/index.d' import { ResultErrcode } from "@/enums/httpEnum"; import { AreaDevCountType } from '@/store/modules/chartEditStore/chartEditStore.d' import dataJson from "./data.json"; +import {useGlobalQueryParamsStore} from '@/store/modules/globalQueryParamsStore/globalQueryParamsStore' export const handleAreaDevCountClass =async (targetComponent: CreateComponentType) => { +const globalQueryParamsStore = useGlobalQueryParamsStore() + const obj = targetComponent.commonData[targetComponent.commonData.currentSource] as AreaDevCountType // targetComponent?.option.series.forEach((item,index)=>{ // item.encode = { y:index===0? 'dev_count':'it_dev_count', x: 'space' } // }) const queryParams = { - space_complete_id:obj?.space_complete_id||null, + device_codes: obj.device_codes?.length + ? obj.device_codes.split(',') + : [], + ...globalQueryParamsStore.getAreaDevCountQueryParams, space_type:'station' } // 处理数据 @@ -24,7 +30,8 @@ export const handleAreaDevCountClass =async (targetComponent: CreateComponentTyp '配电设备总数':item?.dev_count, 'IT设备总数':item?.it_dev_count, - complete_id:item?.space?.complete_id + complete_id:item?.space?.complete_id, + complete_name:item?.space.complete_name } }) } diff --git a/src/hooks/commonDataComponents/useAssetsClassRes.ts b/src/hooks/commonDataComponents/useAssetsClassRes.ts index fd2c920d..d57b23d7 100644 --- a/src/hooks/commonDataComponents/useAssetsClassRes.ts +++ b/src/hooks/commonDataComponents/useAssetsClassRes.ts @@ -8,13 +8,16 @@ export const handleAssetsClass =async (targetComponent: CreateComponentType) => const globalQueryParamsStore = useGlobalQueryParamsStore() const obj = targetComponent.commonData[targetComponent.commonData.currentSource] as AssetsClassType - let { enable, dataSource } = obj + let { enable, dataSource,device_codes } = obj if(!enable) return { errcode: ResultErrcode.SUCCESS, data: { ...dataJson }, errmsg: '' } const query = { + device_codes:device_codes?.length + ? device_codes.split(',') + : [], ...globalQueryParamsStore.getGlobalQueryParams } // 处理数据 @@ -23,14 +26,13 @@ const globalQueryParamsStore = useGlobalQueryParamsStore() res!.data = { // dimensions: res?.data.brand_count.map((item: {})=>Object.keys(item).join('')), dimensions: ['品牌','data'], - source:res?.data?.brand_count.slice(0,7).map((item: {})=>{ + source:res?.data?.brand_count? res?.data?.brand_count.map((item: {})=>{ return { - '品牌':Object.keys(item)[0], + '品牌':Object.keys(item)[0]||'未知品牌', data:Object.values(item)[0], } - }) + }):[{'品牌':'品牌',data:'0'}] } - console.log(res,'调用了吗') return res }else{ @@ -39,14 +41,15 @@ const globalQueryParamsStore = useGlobalQueryParamsStore() res!.data = { // dimensions: res?.data.brand_count.map((item: {})=>Object.keys(item).join('')), dimensions: ['品牌','data'], - source:res?.data.slice(0,7).map((item: any)=>{ + source:res!.data.length? res?.data.map((item: any)=>{ return { - '品牌':item.name, - data:item.count, + '品牌':item?.name||'未知品牌', + data:item?.count||'0', } - }) + }):[{'品牌':'品牌',data:'0'}] } - console.log(res,'调用了吗1') + console.log(res,'调用了吗11') + return res } diff --git a/src/hooks/commonDataComponents/useCategoryBrandCountTableRes.ts b/src/hooks/commonDataComponents/useCategoryBrandCountTableRes.ts index 2c649eff..eb5b95bf 100644 --- a/src/hooks/commonDataComponents/useCategoryBrandCountTableRes.ts +++ b/src/hooks/commonDataComponents/useCategoryBrandCountTableRes.ts @@ -7,7 +7,7 @@ import { ResultErrcode } from '@/enums/httpEnum' import dataJson from './data.json' import {useGlobalQueryParamsStore} from '@/store/modules/globalQueryParamsStore/globalQueryParamsStore' export const handleCategoryBrandCountTable =async (targetComponent: CreateComponentType) => { - let { currentSource, enable } = (targetComponent.commonData as commonDataType).categoryBrandCountTable as CategoryBrandCountTableType + let { currentSource, enable,device_codes } = (targetComponent.commonData as commonDataType).categoryBrandCountTable as CategoryBrandCountTableType if(!enable) return { errcode: ResultErrcode.SUCCESS, data: { ...dataJson }, @@ -15,6 +15,9 @@ export const handleCategoryBrandCountTable =async (targetComponent: CreateCompon } const globalQueryParamsStore = useGlobalQueryParamsStore() const queryParams = { + device_codes:device_codes?.length + ? device_codes.split(',') + : [], ...globalQueryParamsStore.getGlobalQueryParams } const res = await publicInterface(currentSource==='IT'?'/dcim/asset':'/dcim/dems/device',currentSource==='IT'?'get_category_brand_count': 'get_dev_category_brand_count', queryParams) diff --git a/src/hooks/commonDataComponents/useCompanyTempTopRes.ts b/src/hooks/commonDataComponents/useCompanyTempTopRes.ts index a05e450e..2753c901 100644 --- a/src/hooks/commonDataComponents/useCompanyTempTopRes.ts +++ b/src/hooks/commonDataComponents/useCompanyTempTopRes.ts @@ -1,41 +1,70 @@ -import { publicInterface } from "@/api/path"; +import { publicInterface } from '@/api/path' import { CreateComponentType } from '@/packages/index.d' -import { ResultErrcode } from "@/enums/httpEnum"; +import { ResultErrcode } from '@/enums/httpEnum' import { CompanyTempTopType } from '@/store/modules/chartEditStore/chartEditStore.d' -import dataJson from "./data.json"; +import dataJson from './data.json' -export const handleCompanyTempTop =async (targetComponent: CreateComponentType) => { - console.log(targetComponent,'targetComponent.commonData'); - +export const handleCompanyTempTop = async (targetComponent: CreateComponentType) => { + console.log(targetComponent, 'targetComponent_targetComponent') + const option = targetComponent.option as any + const obj = targetComponent.commonData[targetComponent.commonData.currentSource] as CompanyTempTopType - let { enable, space_complete_id, signal_ids} = obj - if(!enable) return { - errcode: ResultErrcode.SUCCESS, - data: { ...dataJson }, - errmsg: '' - } - const res:any = await publicInterface('/dcim/dems/device_point', 'temp_list_dashboard', {signal_ids:[signal_ids],space_complete_id}) - console.log(res,'res_handleCompanyTempTop'); - - if (res && res.data) { - res.data = { - // dimensions: res?.data.brand_count.map((item: {})=>Object.keys(item).join('')), - dimensions: ['名称','温度值'], - source:res?.data.map((item: any)=>{ - return { - '名称':`${item.node_name}`, - '温度值':item.dems_device_point.node_value, - } - }) - } - return res - }else{ - // 后端没有给errcode,前端重置 - res.errcode = '00000' - res.data = { - dimensions:[], - source:[] - } - return res + let { enable, space_complete_id, signal_ids,spaceLevel } = obj + if (!enable) + return { + errcode: ResultErrcode.SUCCESS, + data: { ...dataJson }, + errmsg: '' } + option.tooltip.formatter = (value:any)=>{ + const item = value[0].data + // 将字符串按照 '/' 分割成数组 + const parts = item.space_complete_name.split('/'); + // 从数组开头开始,截取指定层级及以后的部分 + const space_complete_name = parts.slice(spaceLevel, parts.length ); + return ` + ${space_complete_name.join('/')}/${item.device_name}
+ ${item['名称']}    ${item['温度值']}°C + ` + + } + const res: any = await publicInterface('/dcim/dems/device_point', 'temp_list_dashboard', { + signal_ids: [signal_ids], + space_complete_id + }) + + if (res && res.data) { + // option.yAxis[0].data = res?.data.slice(0, 10).map((item: any) => item.dems_device_point.node_value) + // option.xAxis.data = res?.data.slice(0, 10).map((item: any) => item.node_name) + + res.data = { + dimensions: ['uid', '温度值',], + source: res?.data.slice(0, 10).map((item: any) => { + return { + uid: item.dems_device_point.uid, + 名称: `${item.dems_device_point.node_name}`, + 温度值: item.dems_device_point.node_value, + space_complete_name:item.space_complete_name, + device_name:item.node_name + + + } + }), + encode: { + x: '名称', + y: '温度值' + } + } + + + return res + } else { + // 后端没有给errcode,前端重置 + res.errcode = '00000' + res.data = { + dimensions: [], + source: [] + } + return res + } } diff --git a/src/hooks/useChartCommonData.hook.ts b/src/hooks/useChartCommonData.hook.ts index 4adde83a..92204189 100644 --- a/src/hooks/useChartCommonData.hook.ts +++ b/src/hooks/useChartCommonData.hook.ts @@ -23,8 +23,6 @@ import { handleNoParam } from './commonDataComponents/useNoParamRes' import { handleManulInput } from './commonDataComponents/useManualInputRes' import { handleManulInputSingle } from './commonDataComponents/useManualInputSingleRes' import { ResultErrcode } from '@/enums/httpEnum' -import { logDark } from 'naive-ui'; -import { fetchChartComponent } from '@/packages'; // 获取类型 @@ -42,7 +40,8 @@ export const useChartCommonData = ( updateCallback?: (...args: any) => any ) => { const vChartRef = ref(null) - let fetchInterval: any = 0 + // 如果用下方的变量每次执行都会新增一个定时器, 但清除的得是targetComponent里面的定时器 + // let fetchInterval: any = null // 组件类型 const { chartFrame } = targetComponent.chartConfig @@ -77,7 +76,8 @@ export const useChartCommonData = ( // 缓存组件的实例后续更新用得上 const instanceMap = new Map() // 存储构造函数引用,如果直接使用vChartRef.value的话会报错,因为json序列化无法对构造函数进行处理,先将它放到map中等使用的时候再获取 - instanceMap.set('$ref', vChartRef.value); + const mapGetOption = {getOption:vChartRef.value.getOption,setOption:vChartRef.value.setOption} + instanceMap.set('$ref',mapGetOption); targetComponent.$ref = instanceMap Object.assign(targetComponent.option, { // series, @@ -124,7 +124,8 @@ export const useChartCommonData = ( } = toRefs(targetComponent.request) try { - clearInterval(fetchInterval) + clearInterval(targetComponent.request.fetchInterval) + console.log(targetComponent.request.fetchInterval,'fetchInterval_fetchInterval') const fetchFn = async () => { let res, isMultiple = true @@ -157,7 +158,7 @@ export const useChartCommonData = ( break; case CurrentSourceEnum.COMPANYTEMPTOP: res = await handleCompanyTempTop(targetComponent) - console.log(res,'res',targetComponent,'触发了吗') + console.log(res,'res_触发了吗') break; case CurrentSourceEnum.ALARMTREND: @@ -247,7 +248,7 @@ export const useChartCommonData = ( // 开启轮询 if (time) { - fetchInterval = setInterval(fetchFn, intervalUnitHandle(time, unit)) + targetComponent.request.fetchInterval = setInterval(fetchFn, intervalUnitHandle(time, unit)) } else { fetchFn() } @@ -257,7 +258,7 @@ export const useChartCommonData = ( } requestIntervalFn() if(!isPreview()) { - clearInterval(fetchInterval) + clearInterval(targetComponent.request.fetchInterval) } return { vChartRef } } diff --git a/src/packages/components/Charts/Bars/BarCommon/index.vue b/src/packages/components/Charts/Bars/BarCommon/index.vue index e76bce97..bcad9dca 100644 --- a/src/packages/components/Charts/Bars/BarCommon/index.vue +++ b/src/packages/components/Charts/Bars/BarCommon/index.vue @@ -1,18 +1,18 @@ diff --git a/src/packages/components/CustomComponents/AlarmDiagram/RealTimeEvent/configData.vue b/src/packages/components/CustomComponents/AlarmDiagram/RealTimeEvent/configData.vue index 79c0d72b..8d820821 100644 --- a/src/packages/components/CustomComponents/AlarmDiagram/RealTimeEvent/configData.vue +++ b/src/packages/components/CustomComponents/AlarmDiagram/RealTimeEvent/configData.vue @@ -5,8 +5,8 @@ - - + + diff --git a/src/packages/components/CustomComponents/AlarmDiagram/RealTimeEvent/index.vue b/src/packages/components/CustomComponents/AlarmDiagram/RealTimeEvent/index.vue index 9f8a7755..151597d1 100644 --- a/src/packages/components/CustomComponents/AlarmDiagram/RealTimeEvent/index.vue +++ b/src/packages/components/CustomComponents/AlarmDiagram/RealTimeEvent/index.vue @@ -13,33 +13,59 @@ style="overflow: visible" >
-
- - - {{ item.confirm_status === 'ok'?'已确认':'未确认' }} +
+ + + {{ item.confirm_status === 'ok' ? '已确认' : '未确认' }} - - {{select1.options[item.level - 1].label}} + + {{ select1.options[item.level - 1].label }} -
{{ item.content }}
-
-
{{ moment(item.generate_time).format('yyyy-MM-DD HH:mm:ss') }}
- - +
{{ item.content }}
+
+
+ {{ moment(item.generate_time).format('yyyy-MM-DD HH:mm:ss') }} +
+ +
- -
查询结果为空
+ +
查询结果为空
- - + + @@ -49,11 +75,11 @@ import type { Ref } from 'vue' import { CreateComponentType } from '@/packages/index.d' import { publicInterface } from '@/api/path/business.api' import BorderBox from './BorderBoxV2.vue' -import {isPreview, postMessageToParent, useGetMessageByParent} from '@/utils' -import moment from "moment" -import {selectTimeOptions} from "@/views/chart/ContentConfigurations/components/ChartData/index.d"; -import {RequestHttpIntervalEnum} from "@/enums/httpEnum"; -import {icon} from '@/plugins/icon' +import { isPreview, postMessageToParent, useGetMessageByParent } from '@/utils' +import moment from 'moment' +import { selectTimeOptions } from '@/views/chart/ContentConfigurations/components/ChartData/index.d' +import { RequestHttpIntervalEnum } from '@/enums/httpEnum' +import { icon } from '@/plugins/icon' import VModal from './VModal.vue' import VModalV1 from './VModalV1.vue' import { useOriginStore } from '@/store/modules/originStore/originStore' @@ -109,59 +135,64 @@ interface Select2Type { color: string }[] } -const select2:Select2Type = reactive({ +const select2: Select2Type = reactive({ value: [], options: [ { label: '已确认', value: 'ok', number: 0, color: '#4DCA59' }, - { label: '未确认', value: 'not', number: 0, color: '#f5b442' }, + { label: '未确认', value: 'not', number: 0, color: '#f5b442' } ] }) - type tableDataItemType = { - id: number, - content: string, - generate_time: string, - checked: boolean, - confirm_status: 'ok' | 'not', - level: number, - color1: string, - color2: string, - position: string, - device_name: string, - node_name: string, - confirm_people: string, - confirm_time: string, - reconfirmation_time_str: string, - serial_no: string, - remark: string, - [k:string]: any, + id: number + content: string + generate_time: string + checked: boolean + confirm_status: 'ok' | 'not' + level: number + color1: string + color2: string + position: string + device_name: string + node_name: string + confirm_people: string + confirm_time: string + reconfirmation_time_str: string + serial_no: string + remark: string + [k: string]: any } -let tableData:tableDataItemType[] = reactive([]) -watch(() => tableData.map(_ => _.checked), (v:boolean[]) => { - if(!v.length) checkAll.value = false - else if(v.every(_ => _)) checkAll.value = true - else if(v.every(_ => !_)) checkAll.value = false -}) +let tableData: tableDataItemType[] = reactive([]) +watch( + () => tableData.map(_ => _.checked), + (v: boolean[]) => { + if (!v.length) checkAll.value = false + else if (v.every(_ => _)) checkAll.value = true + else if (v.every(_ => !_)) checkAll.value = false + } +) let checkAll = ref(false) -watch(() => checkAll.value, (v) => { - tableData.forEach(_ => _.checked = v) -}) +watch( + () => checkAll.value, + v => { + tableData.forEach(_ => (_.checked = v)) + } +) const getNumber = () => { - console.log(props.chartConfig.customData?.dems_device_point_signal_ids,'props.chartConfig.customData?.dems_device_point_signal_ids') + const q = { space_complete_id: props.chartConfig.customData?.space_complete_id, confirm_statuss: alarmConfirmStatus.value, handle_statuss: alarmHandleStatuss.value, recovery_statuss: alarmRecoveryStatus.value, - dems_device_point_signal_ids: props.chartConfig.customData?.dems_device_point_signal_ids.split(','), + signal_ids: props.chartConfig.customData?.dems_device_point_signal_ids.split(',') } publicInterface('/dcim/dems/devie_active_alarm', 'count_by_level_new', q).then(res => { if (res && JSON.stringify(res.data) !== '{}') { select1.options.forEach((item, i) => { - item.number = res.data[`level${i+1}`] + item.number = res.data[`level${i + 1}`] }) } }) @@ -172,7 +203,8 @@ const getNumber = () => { space_complete_id: props.chartConfig.customData?.space_complete_id, append_space_to_content: 'complete', handle_statuss: alarmHandleStatuss.value, - recovery_statuss: alarmRecoveryStatus.value + recovery_statuss: alarmRecoveryStatus.value, + dems_device_point_signal_ids: props.chartConfig.customData?.dems_device_point_signal_ids.split(',') } } publicInterface('/dcim/dems/devie_active_alarm', 'get_app_alarm_num_by_condition', param).then(res => { @@ -195,68 +227,74 @@ let alarmVideos = ref([]) // }) let currentVideo: any = ref({}) const getVideos = (ids: number[], alarmIds: number[]) => { - if(ids.length) { - publicInterface('/dcim/video_monitor/other_device', 'get_alarm_device', {device_uids: ids.toString()}).then((res: any) => { - // if(res.errcode !== '00000') return - if(!res?.data) return - let arr:any = [] - ids.forEach(id => { - arr.push(res.data[id] ? res.data[id][0] : null) - }) - alarmVideos.value = arr.concat() + if (ids.length) { + publicInterface('/dcim/video_monitor/other_device', 'get_alarm_device', { device_uids: ids.toString() }).then( + (res: any) => { + // if(res.errcode !== '00000') return + if (!res?.data) return + let arr: any = [] + ids.forEach(id => { + arr.push(res.data[id] ? res.data[id][0] : null) + }) + alarmVideos.value = arr.concat() - let index = 0, last:any = {} - for(let i = 0; i < arr.length; i++) { - if(arr[i]) { - last = arr[i] - index = i - break + let index = 0, + last: any = {} + for (let i = 0; i < arr.length; i++) { + if (arr[i]) { + last = arr[i] + index = i + break + } } - } - if(JSON.stringify(currentVideo.value) === '{}' && !last) return - let obj = JSON.stringify(currentVideo.value) !== '{}' ? JSON.parse(JSON.stringify(currentVideo.value)) : { - ip: '', - port: null, - account: '', - password: '', - channel: '', - brand: '', - plugin: '', - } - if(last) { - for(let k in obj) { - obj[k] = last[k] + if (JSON.stringify(currentVideo.value) === '{}' && !last) return + let obj = + JSON.stringify(currentVideo.value) !== '{}' + ? JSON.parse(JSON.stringify(currentVideo.value)) + : { + ip: '', + port: null, + account: '', + password: '', + channel: '', + brand: '', + plugin: '' + } + if (last) { + for (let k in obj) { + obj[k] = last[k] + } } + obj.alarmId = alarmIds[index] + currentVideo.value = obj + obj.showForce = false + postMessageToParent({ + type: 'openVideoV2', + data: obj + }) } - obj.alarmId = alarmIds[index] - currentVideo.value = obj - obj.showForce = false - postMessageToParent({ - type: 'openVideoV2', - data: obj - }) - }) + ) } } const showLoading = ref(false) -const {getMessageByParent} = useGetMessageByParent() -getMessageByParent('', (e) => { - if(e.data.type === 'openVideoV2_closeLoading' && e.data.page === 'customLargeScreen') { +const { getMessageByParent } = useGetMessageByParent() +getMessageByParent('', e => { + if (e.data.type === 'openVideoV2_closeLoading' && e.data.page === 'customLargeScreen') { showLoading.value = false } }) const showVideo = (obj: any, id: number) => { - let a: {[k: string]: string | null | boolean | number} = { + let a: { [k: string]: string | null | boolean | number } = { ip: '', port: null, account: '', password: '', channel: '', brand: '', - plugin: '', + plugin: '' } - for(let k in a) { + for (let k in a) { a[k] = obj[k] } // 点击时强制打开 @@ -281,8 +319,7 @@ const getData = () => { append_space_to_content: 'complete', handle_statuss: alarmHandleStatuss.value, recovery_statuss: alarmRecoveryStatus.value, - dems_device_point_signal_ids: props.chartConfig.customData?.dems_device_point_signal_ids.split(','), - + dems_device_point_signal_ids: props.chartConfig.customData?.dems_device_point_signal_ids.split(',') }, page: { page_size: 10, @@ -290,14 +327,14 @@ const getData = () => { } } publicInterface('/dcim/dems/devie_active_alarm', 'get_page', queryModel).then(res => { - if(res && !res.data) { + if (res && !res.data) { tableData.splice(0) return } - if(res && res.data) { + if (res && res.data) { res.data.item = res.data.item.filter((_: tableDataItemType) => _.level) const lastTableData = [...tableData] - let arr:tableDataItemType[] = res.data['item'].map((e:any) => ({ + let arr: tableDataItemType[] = res.data['item'].map((e: any) => ({ ...e, id: e.id, content: e.content, @@ -314,11 +351,14 @@ const getData = () => { confirm_time: e.confirm_time, reconfirmation_time_str: e.reconfirmation_time_str, serial_no: e.serial_no, - remark: e.remark, + remark: e.remark })) - getVideos(arr.map(_ => _.device?.uid), arr.map(_ => _.id)) + getVideos( + arr.map(_ => _.device?.uid), + arr.map(_ => _.id) + ) if (checkAll.value) { - arr = arr.map((e:any) => ({ ...e, checked: e.confirm_status !== 'ok' })) + arr = arr.map((e: any) => ({ ...e, checked: e.confirm_status !== 'ok' })) } else if (lastTableData.length) { arr.map(e => { const lastIndex = lastTableData.findIndex(item => item.id === e.id) @@ -336,10 +376,10 @@ const getData = () => { // show: false, // data: {} // }) -const clickItem = (i:number) => { +const clickItem = (i: number) => { postMessageToParent({ type: 'openRealTimeEventDetail', - currentAlarm: tableData[i], + currentAlarm: tableData[i] }) // 自己写的详情 @@ -357,15 +397,17 @@ const systemConstant = originStore.getOriginStore.user.systemConstant const systemConfig = originStore.getOriginStore.user.systemConfig if (systemConstant['warn_levels']) { - select1.options = systemConstant['warn_levels'].filter((item: any) => item.value !== '').map((item: any) => { - return { label: item.label, value: Number(item.value), number: 0, color: item.remark } - }) + select1.options = systemConstant['warn_levels'] + .filter((item: any) => item.value !== '') + .map((item: any) => { + return { label: item.label, value: Number(item.value), number: 0, color: item.remark } + }) } let alarmHandleStatuss: Ref = ref([]) let alarmRecoveryStatus: Ref = ref([]) let alarmConfirmStatus: Ref = ref([]) -if(systemConfig) { +if (systemConfig) { if (systemConfig['active_alarm_level']) { for (let i = 0; i < Number(systemConfig['active_alarm_level']); i++) { select1.value.push(i + 1) @@ -383,9 +425,12 @@ if(systemConfig) { } } -watch(() => select1.value.join('&&') + select2.value.join('&&'), (v) => { - getData() -}) +watch( + () => select1.value.join('&&') + select2.value.join('&&'), + v => { + getData() + } +) // const modalV1Obj = reactive({ // show: false, @@ -401,16 +446,16 @@ watch(() => select1.value.join('&&') + select2.value.join('&&'), (v) => { // singleIds: [], // }) const clickBatch = () => { - if(!tableData.filter(_ => _.checked).length) { + if (!tableData.filter(_ => _.checked).length) { window['$message'].warning('请先选择数据') return } let selectIds = tableData.filter(_ => _.checked && _.confirm_status !== 'ok').map(_ => _.id) - if(!selectIds.length) return + if (!selectIds.length) return postMessageToParent({ type: 'openRealTimeEventDialog', multipleConfirm: true, - selectIds, + selectIds }) // Object.assign(modalV1Obj, { // show: true, @@ -426,8 +471,8 @@ const clickBatch = () => { // }) } -getMessageByParent('', (e) => { - if(e.data.type === 'openRealTimeEventDialog_confirmed' && e.data.page === 'customLargeScreen') { +getMessageByParent('', e => { + if (e.data.type === 'openRealTimeEventDialog_confirmed' && e.data.page === 'customLargeScreen') { console.log('openRealTimeEventDialog_confirmed') getData() } @@ -436,7 +481,7 @@ const clickSingle = (id: number) => { postMessageToParent({ type: 'openRealTimeEventDialog', multipleConfirm: false, - selectIds: [id], + selectIds: [id] }) // 自己写的弹窗 @@ -468,7 +513,7 @@ const clickSingle = (id: number) => { // }) // } -const jumpTo = (row:any) => { +const jumpTo = (row: any) => { if (row.space && row.space.space_type !== 'device') { publicInterface('/dcim/space_page', 'get', { space_id: row.space_id, order: 'sort,id asc' }).then(res => { if (res && res.data && res.data.length) { @@ -476,13 +521,11 @@ const jumpTo = (row:any) => { type: 'changeRouterV1', url: `/dynamicRing/schematicDiagram/${res.data[0].id}` }) - } - else { + } else { window['$message'].warning('所选节点没有配置页面') } }) - } - else { + } else { window['$message'].warning('所选节点没有配置页面') } } @@ -490,29 +533,39 @@ const jumpTo = (row:any) => { const jumpMore = () => { postMessageToParent({ type: 'changeRouterV1', - url: `/alarmManage/monitorAlarm` + url: `/alarmManage/monitorAlarm`, + query:{dems_device_point_signal_ids:props.chartConfig.customData?.dems_device_point_signal_ids} + }) } -let timer:unknown -watch(() => [props.chartConfig.request.requestInterval, props.chartConfig.request.requestIntervalUnit, props.chartConfig.customData?.space_complete_id].join('&&'), v => { - if(!isPreview()) return - if(props.chartConfig.request.requestInterval) { - if(timer) clearInterval(timer as number) - const obj = selectTimeOptions.find(_ => _.value === props.chartConfig.request.requestIntervalUnit) || {unit: 0} - const unit = obj.unit - const number = unit * props.chartConfig.request.requestInterval - timer = setInterval(() => { - getData() - }, number) +let timer: unknown +watch( + () => + [ + props.chartConfig.request.requestInterval, + props.chartConfig.request.requestIntervalUnit, + props.chartConfig.customData?.space_complete_id + ].join('&&'), + v => { + if (!isPreview()) return + if (props.chartConfig.request.requestInterval) { + if (timer) clearInterval(timer as number) + const obj = selectTimeOptions.find(_ => _.value === props.chartConfig.request.requestIntervalUnit) || { unit: 0 } + const unit = obj.unit + const number = unit * props.chartConfig.request.requestInterval + timer = setInterval(() => { + getData() + }, number) + } } -}) +) onMounted(() => { nextTick(() => { getData() }) - if(!isPreview()) return - const obj = selectTimeOptions.find(_ => _.value === props.chartConfig.request.requestIntervalUnit) || {unit: 0} + if (!isPreview()) return + const obj = selectTimeOptions.find(_ => _.value === props.chartConfig.request.requestIntervalUnit) || { unit: 0 } const unit = obj.unit const number = unit * props.chartConfig.request.requestInterval! timer = setInterval(() => { @@ -549,18 +602,18 @@ onUnmounted(() => { animation: rotate 1s linear infinite; } -.mr5{ +.mr5 { margin-right: 5px; } -.mr10{ +.mr10 { margin-right: 10px; } -.textEllipsis{ +.textEllipsis { text-overflow: ellipsis; white-space: nowrap; overflow: hidden; } -.emptyBox{ +.emptyBox { height: 100%; width: 100%; display: flex; @@ -568,13 +621,13 @@ onUnmounted(() => { justify-content: center; } -.itemBox{ +.itemBox { width: 100%; height: 100%; display: flex; flex-direction: column; overflow-y: auto; - .item{ + .item { flex: none; height: 30px; display: flex; @@ -582,7 +635,7 @@ onUnmounted(() => { justify-content: center; padding: 0 10px; margin: 3px 0; - background: rgba(65,150,255,.05); + background: rgba(65, 150, 255, 0.05); cursor: pointer; } } diff --git a/src/packages/components/CustomComponents/CustomComponents/AlarmLevelStatistic/configData.vue b/src/packages/components/CustomComponents/CustomComponents/AlarmLevelStatistic/configData.vue index 86550138..04731205 100644 --- a/src/packages/components/CustomComponents/CustomComponents/AlarmLevelStatistic/configData.vue +++ b/src/packages/components/CustomComponents/CustomComponents/AlarmLevelStatistic/configData.vue @@ -3,7 +3,7 @@ - + - {{ alarmLevel["level_4"] }} + {{ alarmLevel['level_4'] }} - {{ alarmLevel["level_3"] }} + {{ alarmLevel['level_3'] }} - {{ alarmLevel["level_2"] }} + {{ alarmLevel['level_2'] }} - {{ alarmLevel["level_1"] }} + {{ alarmLevel['level_1'] }} - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 告警总数 - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 告警总数 @@ -390,21 +208,12 @@ points="36 0 36 22 37 22 37 1 395 1 395 219 37 219 37 198 36 198 36 220 396 220 396 0 36 0" /> - + {{ alarmLevelTotal }} - + @@ -416,7 +225,19 @@ \ No newline at end of file + diff --git a/src/packages/components/CustomComponents/CustomComponents/ClassifiedStatistic/configData.vue b/src/packages/components/CustomComponents/CustomComponents/ClassifiedStatistic/configData.vue index 584e0389..b149fb32 100644 --- a/src/packages/components/CustomComponents/CustomComponents/ClassifiedStatistic/configData.vue +++ b/src/packages/components/CustomComponents/CustomComponents/ClassifiedStatistic/configData.vue @@ -1,11 +1,18 @@ @@ -15,16 +22,14 @@ import { SettingItemBox } from '@/components/Pages/ChartItemSetting' const props = defineProps(['customData', 'request']) const multipleSourceOptions = [ { - label: '配电设备', - value:'device' + label: '动环设备', + value: 'device' }, { label: 'IT设备', - value:'IT' - }, - + value: 'IT' + } ] - + diff --git a/src/packages/components/CustomComponents/CustomComponents/ClassifiedStatistic/index.vue b/src/packages/components/CustomComponents/CustomComponents/ClassifiedStatistic/index.vue index 1d0e0e87..70688833 100644 --- a/src/packages/components/CustomComponents/CustomComponents/ClassifiedStatistic/index.vue +++ b/src/packages/components/CustomComponents/CustomComponents/ClassifiedStatistic/index.vue @@ -1,51 +1,73 @@ diff --git a/src/packages/components/CustomComponents/CustomComponents/Overview/configData.vue b/src/packages/components/CustomComponents/CustomComponents/Overview/configData.vue index 584e0389..b149fb32 100644 --- a/src/packages/components/CustomComponents/CustomComponents/Overview/configData.vue +++ b/src/packages/components/CustomComponents/CustomComponents/Overview/configData.vue @@ -1,11 +1,18 @@ @@ -15,16 +22,14 @@ import { SettingItemBox } from '@/components/Pages/ChartItemSetting' const props = defineProps(['customData', 'request']) const multipleSourceOptions = [ { - label: '配电设备', - value:'device' + label: '动环设备', + value: 'device' }, { label: 'IT设备', - value:'IT' - }, - + value: 'IT' + } ] - + diff --git a/src/packages/components/CustomComponents/CustomComponents/Overview/index.vue b/src/packages/components/CustomComponents/CustomComponents/Overview/index.vue index 9c671d40..a3ea5776 100644 --- a/src/packages/components/CustomComponents/CustomComponents/Overview/index.vue +++ b/src/packages/components/CustomComponents/CustomComponents/Overview/index.vue @@ -1,17 +1,19 @@ - + diff --git a/src/views/chart/ContentConfigurations/components/ChartDataV2/components/CompanyTempTop.vue b/src/views/chart/ContentConfigurations/components/ChartDataV2/components/CompanyTempTop.vue index bbb8521f..e61c4435 100644 --- a/src/views/chart/ContentConfigurations/components/ChartDataV2/components/CompanyTempTop.vue +++ b/src/views/chart/ContentConfigurations/components/ChartDataV2/components/CompanyTempTop.vue @@ -4,12 +4,16 @@ - + + + + + diff --git a/src/views/chart/ContentConfigurations/components/ChartDataV2/components/PointHistory.vue b/src/views/chart/ContentConfigurations/components/ChartDataV2/components/PointHistory.vue index f50c2258..63167f5f 100644 --- a/src/views/chart/ContentConfigurations/components/ChartDataV2/components/PointHistory.vue +++ b/src/views/chart/ContentConfigurations/components/ChartDataV2/components/PointHistory.vue @@ -10,13 +10,13 @@ - + diff --git a/src/views/chart/ContentConfigurations/components/ChartDataV2/components/PointRealTime.vue b/src/views/chart/ContentConfigurations/components/ChartDataV2/components/PointRealTime.vue index d21c7d1d..11547688 100644 --- a/src/views/chart/ContentConfigurations/components/ChartDataV2/components/PointRealTime.vue +++ b/src/views/chart/ContentConfigurations/components/ChartDataV2/components/PointRealTime.vue @@ -14,13 +14,13 @@ - + diff --git a/src/views/chart/ContentConfigurations/components/ChartDataV2/components/PointTable.vue b/src/views/chart/ContentConfigurations/components/ChartDataV2/components/PointTable.vue index 5c0f6af8..ce9f13cc 100644 --- a/src/views/chart/ContentConfigurations/components/ChartDataV2/components/PointTable.vue +++ b/src/views/chart/ContentConfigurations/components/ChartDataV2/components/PointTable.vue @@ -4,13 +4,13 @@ - + diff --git a/src/views/chart/ContentConfigurations/components/ChartDataV2/components/SinglePoint.vue b/src/views/chart/ContentConfigurations/components/ChartDataV2/components/SinglePoint.vue index 773444b6..3265a21b 100644 --- a/src/views/chart/ContentConfigurations/components/ChartDataV2/components/SinglePoint.vue +++ b/src/views/chart/ContentConfigurations/components/ChartDataV2/components/SinglePoint.vue @@ -4,10 +4,10 @@ - + diff --git a/src/views/chart/ContentConfigurations/components/ChartDataV2/index.vue b/src/views/chart/ContentConfigurations/components/ChartDataV2/index.vue index 3a2eb00a..71417a91 100644 --- a/src/views/chart/ContentConfigurations/components/ChartDataV2/index.vue +++ b/src/views/chart/ContentConfigurations/components/ChartDataV2/index.vue @@ -2,31 +2,31 @@
- + @@ -36,16 +36,26 @@ :show-button="false" placeholder="请输入" size="small" - style="flex: 1;" + style="flex: 1" > - +
- + - +
-
- 暂无数据 -
+
暂无数据