CN-468 fix: 时间、刷新问题修复
This commit is contained in:
@@ -76,7 +76,6 @@ export default {
|
|||||||
const data = lineData.map(d => {
|
const data = lineData.map(d => {
|
||||||
return [getMillisecond(new Date(d[2]).getTime()), d[1]]
|
return [getMillisecond(new Date(d[2]).getTime()), d[1]]
|
||||||
})
|
})
|
||||||
console.info(JSON.stringify(data))
|
|
||||||
const option = this.$_.cloneDeep(lineOption)
|
const option = this.$_.cloneDeep(lineOption)
|
||||||
option.series.data = data
|
option.series.data = data
|
||||||
const dom = document.getElementById('lineCanvas')
|
const dom = document.getElementById('lineCanvas')
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
<chart-no-data v-if="isNoData"></chart-no-data>
|
<chart-no-data v-if="isNoData"></chart-no-data>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<chart-tabs
|
<chart-tabs
|
||||||
|
ref="chart"
|
||||||
v-if="isTabs"
|
v-if="isTabs"
|
||||||
:chart-info="chartInfo"
|
:chart-info="chartInfo"
|
||||||
:time-filter="timeFilter"
|
:time-filter="timeFilter"
|
||||||
@@ -42,6 +43,7 @@
|
|||||||
></chart-block>
|
></chart-block>
|
||||||
|
|
||||||
<chart-group
|
<chart-group
|
||||||
|
ref="chart"
|
||||||
v-else-if="isGroup"
|
v-else-if="isGroup"
|
||||||
:query-params="queryParams"
|
:query-params="queryParams"
|
||||||
:time-filter="timeFilter"
|
:time-filter="timeFilter"
|
||||||
@@ -452,15 +454,8 @@ export default {
|
|||||||
tabHandleClickType: {
|
tabHandleClickType: {
|
||||||
deep: true,
|
deep: true,
|
||||||
handler (n) {
|
handler (n) {
|
||||||
console.log(n)
|
|
||||||
this.tabHandleClickType = n
|
this.tabHandleClickType = n
|
||||||
}
|
}
|
||||||
},
|
|
||||||
chartData: {
|
|
||||||
deep: true,
|
|
||||||
immediate: true,
|
|
||||||
handler (n) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setup (props) {
|
setup (props) {
|
||||||
|
|||||||
@@ -165,21 +165,21 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/* 参数 extraParams 额外请求参数,isRefresh 是否是刷新 */
|
/* 参数 extraParams 额外请求参数 */
|
||||||
getChartData (url, extraParams = {}, isRefresh, chartTimeFilter, num) {
|
getChartData (url, extraParams = {}, chartTimeFilter, num) {
|
||||||
const vm = this
|
const vm = this
|
||||||
this.loading = true
|
this.loading = true
|
||||||
this.standaloneTimeRange.use = !!isRefresh
|
|
||||||
try {
|
try {
|
||||||
// 单个图表刷新时,使用单独的时间
|
|
||||||
if (chartTimeFilter) {
|
if (chartTimeFilter) {
|
||||||
this.queryTimeRange = { startTime: getSecond(chartTimeFilter.startTime), endTime: getSecond(chartTimeFilter.endTime) }
|
// 图表自带timeFilter刷新时
|
||||||
|
this.queryTimeRange = { startTime: getSecond(chartTimeFilter.startTime), endTime: getSecond(chartTimeFilter.endTime), dateRangeValue: chartTimeFilter.dateRangeValue }
|
||||||
} else if (this.standaloneTimeRange.use) {
|
} else if (this.standaloneTimeRange.use) {
|
||||||
this.queryTimeRange = { startTime: getSecond(this.standaloneTimeRange.startTime), endTime: getSecond(this.standaloneTimeRange.endTime) }
|
// 单个图表刷新时,使用单独的时间
|
||||||
|
this.queryTimeRange = { startTime: getSecond(this.standaloneTimeRange.startTime), endTime: getSecond(this.standaloneTimeRange.endTime), dateRangeValue: this.timeFilter.dateRangeValue }
|
||||||
} else if (this.timeFilter) {
|
} else if (this.timeFilter) {
|
||||||
this.queryTimeRange = { startTime: getSecond(this.timeFilter.startTime), endTime: getSecond(this.timeFilter.endTime) }
|
this.queryTimeRange = { startTime: getSecond(this.timeFilter.startTime), endTime: getSecond(this.timeFilter.endTime), dateRangeValue: this.timeFilter.dateRangeValue }
|
||||||
} else {
|
} else {
|
||||||
this.queryTimeRange = { startTime: getSecond(this.chartTimeFilter.startTime), endTime: getSecond(this.chartTimeFilter.endTime) }
|
this.queryTimeRange = { startTime: getSecond(this.chartTimeFilter.startTime), endTime: getSecond(this.chartTimeFilter.endTime), dateRangeValue: this.chartTimeFilter.dateRangeValue }
|
||||||
}
|
}
|
||||||
const chartParams = this.chartInfo.params
|
const chartParams = this.chartInfo.params
|
||||||
if (this.isAlarmInfo && JSON.stringify(extraParams) === '{}') {
|
if (this.isAlarmInfo && JSON.stringify(extraParams) === '{}') {
|
||||||
@@ -270,9 +270,9 @@ export default {
|
|||||||
}
|
}
|
||||||
}, 200)
|
}, 200)
|
||||||
})
|
})
|
||||||
} else if (isGroup(this.chartInfo.type)) {
|
} else if (this.isGroup || this.isTabs) {
|
||||||
this.chartInfo.children = [...this.chartInfo.children]
|
this.$refs.chart.$refs.chart.reload()
|
||||||
} else if (isBlock(this.chartInfo.type)) {
|
} else if (this.isBlock) {
|
||||||
if (!this.chartInfo.firstShow) {
|
if (!this.chartInfo.firstShow) {
|
||||||
this.chartInfo.firstShow = true
|
this.chartInfo.firstShow = true
|
||||||
} else {
|
} else {
|
||||||
@@ -309,15 +309,19 @@ export default {
|
|||||||
this.timeFilter.startTime = chartTimeFilter.startTime
|
this.timeFilter.startTime = chartTimeFilter.startTime
|
||||||
this.timeFilter.endTime = chartTimeFilter.endTime
|
this.timeFilter.endTime = chartTimeFilter.endTime
|
||||||
this.timeFilter.dateRangeValue = chartTimeFilter.dateRangeValue
|
this.timeFilter.dateRangeValue = chartTimeFilter.dateRangeValue
|
||||||
this.getChartData(null, {}, true, chartTimeFilter)
|
this.getChartData(null, {}, chartTimeFilter)
|
||||||
} else {
|
} else {
|
||||||
|
if (this.timeFilter.dateRangeValue && this.timeFilter.dateRangeValue > 0) {
|
||||||
const myEndTime = window.$dayJs.tz().valueOf()
|
const myEndTime = window.$dayJs.tz().valueOf()
|
||||||
const myStartTime = myEndTime - this.timeFilter.dateRangeValue * 60 * 1000
|
const myStartTime = myEndTime - this.timeFilter.dateRangeValue * 60 * 1000
|
||||||
this.standaloneTimeRange.use = true
|
this.standaloneTimeRange.use = true
|
||||||
this.standaloneTimeRange.startTime = myStartTime
|
this.standaloneTimeRange.startTime = myStartTime
|
||||||
this.standaloneTimeRange.endTime = myEndTime
|
this.standaloneTimeRange.endTime = myEndTime
|
||||||
|
} else {
|
||||||
|
this.standaloneTimeRange.use = false
|
||||||
|
}
|
||||||
this.emitter.emit('chart-pageNo')
|
this.emitter.emit('chart-pageNo')
|
||||||
this.getChartData(null, {}, true)
|
this.getChartData(null, {})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
tabHandleClick (value) {
|
tabHandleClick (value) {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<panel-chart-list
|
<panel-chart-list
|
||||||
:time-filter="timeFilter"
|
:time-filter="timeFilter"
|
||||||
:query-params="queryParams"
|
:query-params="queryParams"
|
||||||
:data-list="chartInfo.children"
|
:data-list="dataList"
|
||||||
:panel-lock="true"
|
:panel-lock="true"
|
||||||
:entity="entity"
|
:entity="entity"
|
||||||
>
|
>
|
||||||
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import chartMixin from '@/views/charts/charts/chart-mixin'
|
import chartMixin from '@/views/charts/charts/chart-mixin'
|
||||||
|
import _ from 'lodash'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ChartGroup',
|
name: 'ChartGroup',
|
||||||
@@ -18,6 +19,17 @@ export default {
|
|||||||
props: {
|
props: {
|
||||||
timeFilter: Object,
|
timeFilter: Object,
|
||||||
queryParams: Object
|
queryParams: Object
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
reload () {
|
||||||
|
this.dataList = _.cloneDeep(this.dataList)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
setup (props) {
|
||||||
|
const dataList = [...props.chartInfo.children]
|
||||||
|
return {
|
||||||
|
dataList
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
:ref="`chart-${chartInfo.id}`"
|
:ref="`chart-${chartInfo.id}`"
|
||||||
>
|
>
|
||||||
<el-tab-pane
|
<el-tab-pane
|
||||||
v-for="tab in chartInfo.children"
|
v-for="tab in dataList"
|
||||||
:label="tab.i18n ? $t(tab.i18n) : tab.name" :name="`${tab.id}`"
|
:label="tab.i18n ? $t(tab.i18n) : tab.name" :name="`${tab.id}`"
|
||||||
:key="tab.id"
|
:key="tab.id"
|
||||||
:ref="`chart-${chartInfo.id}`"
|
:ref="`chart-${chartInfo.id}`"
|
||||||
@@ -29,14 +29,6 @@ import chartMixin from '@/views/charts/charts/chart-mixin'
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ChartTabs',
|
name: 'ChartTabs',
|
||||||
computed: {
|
|
||||||
timeFilter () {
|
|
||||||
return {
|
|
||||||
startTime: this.queryParams.startTime,
|
|
||||||
endTime: this.queryParams.endTime
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mixins: [chartMixin],
|
mixins: [chartMixin],
|
||||||
methods: {
|
methods: {
|
||||||
showFullscreen () {
|
showFullscreen () {
|
||||||
@@ -44,6 +36,9 @@ export default {
|
|||||||
},
|
},
|
||||||
changeTab (tab) {
|
changeTab (tab) {
|
||||||
this.activeTab = tab.paneName
|
this.activeTab = tab.paneName
|
||||||
|
},
|
||||||
|
reload () {
|
||||||
|
this.dataList = _.cloneDeep(this.dataList)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setup (props) {
|
setup (props) {
|
||||||
@@ -51,8 +46,10 @@ export default {
|
|||||||
if (!_.isEmpty(props.chartInfo.children)) {
|
if (!_.isEmpty(props.chartInfo.children)) {
|
||||||
activeTab = `${props.chartInfo.children[0].id}`
|
activeTab = `${props.chartInfo.children[0].id}`
|
||||||
}
|
}
|
||||||
|
const dataList = [...props.chartInfo.children]
|
||||||
return {
|
return {
|
||||||
activeTab
|
activeTab,
|
||||||
|
dataList
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -673,7 +673,6 @@ export default {
|
|||||||
'filterData.securityEvent.0.value': {
|
'filterData.securityEvent.0.value': {
|
||||||
deep: true,
|
deep: true,
|
||||||
handler (n, o) {
|
handler (n, o) {
|
||||||
console.info(n, o)
|
|
||||||
this.$refs.search.changeParams({ column: this.filterData.securityEvent[0].column, oldValue: o, newValue: n })
|
this.$refs.search.changeParams({ column: this.filterData.securityEvent[0].column, oldValue: o, newValue: n })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user