| | |
| | | import { getPollConfig, changeRunType, getCamerasByServer, updateChannelCount } from "@/api/pollConfig"; |
| | | import { getSysThresholds } from "@/api/system" |
| | | import { |
| | | clusterStatisticRunInfo, |
| | | deviceStatisticRunInfo, |
| | | devicesSysInfo, |
| | | clusterSysInfo |
| | | } from "@/api/clusterManage"; |
| | | import { getPollConfig, changeRunType, getCamerasByServer, updateChannelCount } from "@/api/pollConfig" |
| | | import { getSysThresholds } from "@/api/system" |
| | | import { clusterStatisticRunInfo, deviceStatisticRunInfo, devicesSysInfo, clusterSysInfo } from "@/api/clusterManage" |
| | | |
| | | export default class PollData { |
| | | public Config: Object = {}; |
| | | public SearchName: String = ""; |
| | | public CameraList: Array<object> = []; |
| | | public Enabled: boolean = false; |
| | | public Config: Object = {} |
| | | public SearchName: String = "" |
| | | public CameraList: Array<object> = [] |
| | | public Enabled: boolean = false |
| | | |
| | | //总算力 |
| | | public channelTotal: number = 0; |
| | | public channelTotal: number = 0 |
| | | |
| | | public Running: number = 0; |
| | | public Idle: number = 0; |
| | | public Running: number = 0 |
| | | public Idle: number = 0 |
| | | //实时全部打开 |
| | | public RealTimeSum: number = 0; |
| | | public RealTimeSum: number = 0 |
| | | //实时算力总数 |
| | | public RealTimeValidCount: number = 0; |
| | | public RealTimeValidCount: number = 0 |
| | | //实时配置不全 |
| | | public RealTimeInvalid: number = 0; |
| | | public RealTimeInvalid: number = 0 |
| | | //实时正在处理 |
| | | public RealTimeRun: number = 0; |
| | | public RealTimeRun: number = 0 |
| | | //实时故障 |
| | | public RealTimeNoDeal: number = 0; |
| | | |
| | | public RealTimeNoDeal: number = 0 |
| | | |
| | | //轮询算力总数 |
| | | public PollValidCount: number = 0; |
| | | public PollValidCount: number = 0 |
| | | //轮询全部打开 |
| | | public PollSum: number = 0; |
| | | public PollSum: number = 0 |
| | | //轮询正在执行 |
| | | public PollRun: number = 0; |
| | | public PollRun: number = 0 |
| | | //轮询配置不全 |
| | | public PollInvalid: number = 0; |
| | | public PollInvalid: number = 0 |
| | | //轮询故障 |
| | | public PollNoDeal: number = 0; |
| | | public PollChannelTotal: number = 0; |
| | | |
| | | public PollNoDeal: number = 0 |
| | | public PollChannelTotal: number = 0 |
| | | |
| | | //数据栈算力总数 |
| | | public stackChannelCount: number = 0; |
| | | public stackChannelCount: number = 0 |
| | | //数据栈总数 |
| | | public stackTotal: number = 0; |
| | | public stackTotal: number = 0 |
| | | //数据栈配置不全 |
| | | public stackInvalidCount: number = 0; |
| | | public stackInvalidCount: number = 0 |
| | | //数据栈正在执行 |
| | | public stackRunningCount: number = 0; |
| | | public stackRunningCount: number = 0 |
| | | //数据栈故障 |
| | | public stackNoDeal: number = 0; |
| | | |
| | | public stackNoDeal: number = 0 |
| | | |
| | | //本地算力通道数 |
| | | public localVideo: number = 0; |
| | | public localVideo: number = 0 |
| | | |
| | | public CpuUsedPercent: number = 0; |
| | | public MemUsedPercent: number = 0; |
| | | public GpuUsedPercent: number = 0; |
| | | public DiskUsePercent: number = 0; |
| | | public barCharts: Array<any> = []; |
| | | public Thresholds: Array<object> = []; |
| | | public CpuUsedPercent: number = 0 |
| | | public MemUsedPercent: number = 0 |
| | | public GpuUsedPercent: number = 0 |
| | | public DiskUsePercent: number = 0 |
| | | public barCharts: Array<any> = [] |
| | | public Thresholds: Array<object> = [] |
| | | |
| | | //算力配置中滑块数据 |
| | | public sliderList: Array<any> = []; |
| | | |
| | | public sliderList: Array<any> = [] |
| | | |
| | | public init() { |
| | | this.fetchPollConfig(); |
| | | this.fetchPollList(); |
| | | this.sysThresholds(); |
| | | this.statisticTaskInfo(); |
| | | this.fetchPollConfig() |
| | | this.fetchPollList() |
| | | this.sysThresholds() |
| | | this.statisticTaskInfo() |
| | | } |
| | | |
| | | public async fetchPollConfig() { |
| | | const rsp: any = await getPollConfig(); |
| | | const rsp: any = await getPollConfig() |
| | | if (rsp && rsp.success) { |
| | | this.Config = rsp.data; |
| | | this.Config = rsp.data |
| | | if (rsp.data.enable) { |
| | | this.Enabled = true; |
| | | this.Enabled = true |
| | | } |
| | | } |
| | | } |
| | | |
| | | public async fetchPollList() { |
| | | this.CameraList = [] |
| | | let rsp: any = await getCamerasByServer({ cameraName: this.SearchName }); |
| | | let rsp: any = await getCamerasByServer({ cameraName: this.SearchName }) |
| | | if (rsp && rsp.success) { |
| | | if (rsp.data) { |
| | | this.CameraList = rsp.data.sort(function (obj1: any, obj2: any) { |
| | | var val1 = obj1.run_type; |
| | | var val2 = obj2.run_type; |
| | | return (val2 - val1) |
| | | }); |
| | | this.CameraList = rsp.data.sort(function(obj1: any, obj2: any) { |
| | | var val1 = obj1.run_type |
| | | var val2 = obj2.run_type |
| | | return val2 - val1 |
| | | }) |
| | | } |
| | | } |
| | | |
| | | // 根据rtsp 提取ip地址 |
| | | const ipReg = /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/; |
| | | const ipReg = /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/ |
| | | this.CameraList.forEach((cam: any) => { |
| | | // 国标摄像机不显示ip |
| | | if (cam.type === 1) { |
| | |
| | | } |
| | | |
| | | public async switchType(id: string, type: number) { |
| | | let rsp: any = await changeRunType({ camera_ids: [id], run_type: type }); |
| | | let rsp: any = await changeRunType({ camera_ids: [id], run_type: type }) |
| | | } |
| | | |
| | | public async sysThresholds() { |
| | | let rsp: any = await getSysThresholds() |
| | | if (rsp && rsp.success) { |
| | | this.Thresholds = rsp.data; |
| | | this.Thresholds = rsp.data |
| | | } |
| | | } |
| | | public async statistics() { |
| | |
| | | // this.Idle = RealTimeSum + PollSum - this.Running |
| | | |
| | | // 计算系统信息 |
| | | let res: any |
| | | if(sessionStorage.getItem("clusterId")) { |
| | | res = await clusterSysInfo({ |
| | | clusterId: "", |
| | | }); |
| | | let res: any |
| | | if (sessionStorage.getItem("clusterId")) { |
| | | res = await clusterSysInfo({ |
| | | clusterId: "" |
| | | }) |
| | | } else { |
| | | res = await devicesSysInfo({ |
| | | deviceId: [sessionStorage.getItem("devId")] |
| | | }) |
| | | } |
| | | else { |
| | | res = await devicesSysInfo({ |
| | | deviceId:[sessionStorage.getItem('devId')], |
| | | }); |
| | | } |
| | | if (res && res.success ) { |
| | | this.CpuUsedPercent =res.data.cpu.usedPercent.toFixed(2) |
| | | if (res && res.success) { |
| | | this.CpuUsedPercent = res.data.cpu.usedPercent.toFixed(2) |
| | | this.MemUsedPercent = res.data.mem.usedPercent.toFixed(2) |
| | | this.DiskUsePercent =res.data.disk.usedPercent.toFixed(2) |
| | | this.DiskUsePercent = res.data.disk.usedPercent.toFixed(2) |
| | | this.GpuUsedPercent = res.data.gpu.usedPercent.toFixed(2) |
| | | this.barCharts = [this.DiskUsePercent,this.CpuUsedPercent,this.GpuUsedPercent,this.MemUsedPercent] |
| | | console.log(this.barCharts); |
| | | |
| | | this.barCharts = [this.DiskUsePercent, this.CpuUsedPercent, this.GpuUsedPercent, this.MemUsedPercent] |
| | | } |
| | | } |
| | | |
| | | public async statisticTaskInfo() { |
| | | let res: any |
| | | if(sessionStorage.getItem("clusterId")) { |
| | | res = await clusterStatisticRunInfo({}); |
| | | if (sessionStorage.getItem("clusterId")) { |
| | | res = await clusterStatisticRunInfo({}) |
| | | } else { |
| | | res = await deviceStatisticRunInfo({ |
| | | deviceId: [sessionStorage.getItem("devId")], |
| | | userId: "" |
| | | }) |
| | | } |
| | | else { |
| | | res = await deviceStatisticRunInfo({ |
| | | deviceId:[sessionStorage.getItem('devId')], |
| | | userId:'' |
| | | }); |
| | | } |
| | | |
| | | |
| | | if (res && res.success) { |
| | | // console.log(res,'统计实时、轮询数量') |
| | | this.RealTimeSum = res.data.realTotal |
| | | this.RealTimeRun = res.data.realRunningCount |
| | | this.RealTimeValidCount = res.data.realValidCount |
| | |
| | | let totalCount = res.data.channelTotal |
| | | let realCount = res.data.realValidCount |
| | | let pollCount = res.data.pollChannelCount |
| | | this.sliderList = [0,realCount,realCount + pollCount] |
| | | this.sliderList = [0, realCount, realCount + pollCount] |
| | | // if(realCount + pollCount == totalCount){ |
| | | // this.sliderList = [0,realCount,realCount + pollCount] |
| | | // }else{ |
| | | // this.sliderList = [0,realCount,realCount + pollCount,totalCount] |
| | | // } |
| | | |
| | | } |
| | | } |
| | | |
| | | public async updateChannelCount(fileChannelCount,pollChannelCount){ |
| | | public async updateChannelCount(fileChannelCount, pollChannelCount) { |
| | | let res: any = await updateChannelCount({ |
| | | videoChannelCount: fileChannelCount, |
| | | pollChannelCount: pollChannelCount |
| | | }) |
| | | this.statisticTaskInfo() |
| | | } |
| | | } |
| | | } |