This commit is contained in:
xiaoguangbin 2023-10-26 14:29:53 +08:00
commit 35978b7b43

View File

@ -285,9 +285,9 @@
<a-list :dataSource="dataSource_alarm_info"> <a-list :dataSource="dataSource_alarm_info">
<a-list-item slot="renderItem" slot-scope="item"> <a-list-item slot="renderItem" slot-scope="item">
<img class="alarm-info-list-img" src="@/assets/images/abnormalAlarm/icon-r.png" alt="" /> <img class="alarm-info-list-img" src="@/assets/images/abnormalAlarm/icon-r.png" alt="" />
<div class="alarm-info-list-info">{{ JSON.parse(item.alarmInfo).info }}</div> <div class="alarm-info-list-info">{{ JSON.parse(item.alarmInfo).value }}</div>
<div class="alarm-info-list-date">{{ item.alarmStartDate }}</div> <div class="alarm-info-list-date">{{ item.alarmStartDate }}</div>
<a slot="actions" class="alarm-info-list-actions">Detail</a> <!-- <a slot="actions" class="alarm-info-list-actions">Detail</a> -->
</a-list-item> </a-list-item>
<div v-if="loading_alarm_info && !busy" class="demo-loading-container"> <div v-if="loading_alarm_info && !busy" class="demo-loading-container">
<a-spin /> <a-spin />
@ -363,7 +363,6 @@
<script> <script>
var data1 = [] var data1 = []
// var dataCount = 3
var startTime, endTime var startTime, endTime
var categories = ['cpu'] var categories = ['cpu']
var types = [ var types = [
@ -374,24 +373,6 @@ var types = [
var legendData = types.map((item) => { var legendData = types.map((item) => {
return item.name return item.name
}) })
// Generate mock data
// categories.forEach((category, index) => {
// var baseTime = startTime
// for (var i = 0; i < dataCount; i++) {
// var typeItem = types[i]
// var duration = Math.round(Math.random() * 10000)
// data1.push({
// name: typeItem.name,
// value: [index, baseTime, (baseTime += duration), duration],
// itemStyle: {
// normal: {
// color: typeItem.color,
// },
// },
// })
// baseTime += Math.round(Math.random() * 2000)
// }
// })
function renderItem1(params, api) { function renderItem1(params, api) {
var categoryIndex = api.value(0) var categoryIndex = api.value(0)
var start = api.coord([api.value(1), categoryIndex]) var start = api.coord([api.value(1), categoryIndex])
@ -425,7 +406,7 @@ import infiniteScroll from 'vue-infinite-scroll'
import { getAction, postAction, httpAction, deleteAction } from '@/api/manage' import { getAction, postAction, httpAction, deleteAction } from '@/api/manage'
import * as echarts from 'echarts' import * as echarts from 'echarts'
import dateFormat from '@/components/jeecg/JEasyCron/format-date' import dateFormat from '@/components/jeecg/JEasyCron/format-date'
import { Bar, G2 } from '@antv/g2plot' // import { Bar, G2 } from '@antv/g2plot'
import moment from 'moment' import moment from 'moment'
import { log } from '@antv/g2plot/lib/utils' import { log } from '@antv/g2plot/lib/utils'
export default { export default {
@ -457,7 +438,8 @@ export default {
guageCpu: null, guageCpu: null,
guageMemory: null, guageMemory: null,
guageLoads: null, guageLoads: null,
currId: '', currHostId: '',
currSourceId: '',
detailInfo: {}, detailInfo: {},
currItemId: '', currItemId: '',
// cpu // cpu
@ -470,7 +452,6 @@ export default {
} }
}, },
mounted() { mounted() {
// this.currId = this.$route.query.serverId||""
this.getSysServer((res) => { this.getSysServer((res) => {
this.loading = false this.loading = false
if (res.success) { if (res.success) {
@ -479,14 +460,16 @@ export default {
if (this.$route.query.serverId) { if (this.$route.query.serverId) {
this.serverId = this.$route.query.serverId this.serverId = this.$route.query.serverId
this.currIndex = this.dataSource.findIndex((item) => item.sourceId === this.serverId) this.currIndex = this.dataSource.findIndex((item) => item.sourceId === this.serverId)
this.currId = this.dataSource.find((item) => item.sourceId === this.serverId).hostId this.currHostId = this.dataSource.find((item) => item.sourceId === this.serverId).hostId
this.currSourceId = this.dataSource.find((item) => item.sourceId === this.serverId).sourceId
this.currItemId = this.dataSource.find((item) => item.sourceId === this.serverId).cpuUsedItemId this.currItemId = this.dataSource.find((item) => item.sourceId === this.serverId).cpuUsedItemId
} else { } else {
this.currId = this.dataSource[0].hostId this.currHostId = this.dataSource[0].hostId
this.currSourceId = this.dataSource[0].sourceId
this.currItemId = this.dataSource[0].cpuUsedItemId this.currItemId = this.dataSource[0].cpuUsedItemId
this.currIndex = 0 this.currIndex = 0
} }
this.getBasiclnfo(this.currId) this.getBasiclnfo(this.currHostId)
this.getCpuUtilizationData() this.getCpuUtilizationData()
this.getTimeLineData() this.getTimeLineData()
// this.EchartsTimeline() // this.EchartsTimeline()
@ -494,7 +477,7 @@ export default {
this.$message.warning('This operation fails. Contact your system administrator') this.$message.warning('This operation fails. Contact your system administrator')
} }
}) })
this.getServerAlarmHistory((res) => { this.getDetailsAlarmInfo((res) => {
this.loading_alarm_info = false this.loading_alarm_info = false
if (res.success) { if (res.success) {
this.ipagination_alarm_info.total = res.result.total this.ipagination_alarm_info.total = res.result.total
@ -744,19 +727,20 @@ export default {
handleBasicItem(i, item) { handleBasicItem(i, item) {
this.currIndex = i this.currIndex = i
this.currItemId = item.cpuUsedItemId this.currItemId = item.cpuUsedItemId
this.currSourceId = item.sourceId
this.getBasiclnfo(item.hostId) this.getBasiclnfo(item.hostId)
this.getCpuUtilizationData() this.getCpuUtilizationData()
this.getTimeLineData() this.getTimeLineData()
}, },
getServerAlarmHistory(callBack) { getDetailsAlarmInfo(callBack) {
this.loading = true this.loading = true
let params = { let params = {
startDate: '2022-08-01', // sourceId:this.currSourceId,
endDate: '2023-08-07', sourceId: 'e2',
pageNo: this.ipagination_alarm_info.current, pageNo: this.ipagination_alarm_info.current,
pageSize: this.ipagination_alarm_info.pageSize, pageSize: this.ipagination_alarm_info.pageSize,
} }
getAction('/sysServer/findAlarmHistory', params).then((res) => { getAction('/sysServer/detailsAlarmInfo', params).then((res) => {
callBack(res) callBack(res)
}) })
}, },
@ -771,7 +755,7 @@ export default {
return return
} else { } else {
this.ipagination_alarm_info.current += 1 this.ipagination_alarm_info.current += 1
this.getServerAlarmHistory((res) => { this.getDetailsAlarmInfo((res) => {
this.ipagination_alarm_info.total = res.result.total this.ipagination_alarm_info.total = res.result.total
this.dataSource_alarm_info = dataSource_alarm_info.concat(res.result.records) this.dataSource_alarm_info = dataSource_alarm_info.concat(res.result.records)
this.loading_alarm_info = false this.loading_alarm_info = false