feat: 抽取时间参数至vuex
This commit is contained in:
@@ -39,7 +39,6 @@
|
||||
ref="logTable"
|
||||
class="nz-table2"
|
||||
size="mini"
|
||||
width="100%"
|
||||
v-if="tableData.length"
|
||||
>
|
||||
<el-table-column
|
||||
|
||||
@@ -21,6 +21,14 @@ export default {
|
||||
chartOption: Object,
|
||||
isFullscreen: Boolean
|
||||
},
|
||||
computed: {
|
||||
filterTime () {
|
||||
return this.$store.getters.getTimeRange
|
||||
},
|
||||
nowTimeType () {
|
||||
return this.$store.getters.getNowTimeType
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleTimeSeries (chartInfo, seriesTemplate, originalDatas) {
|
||||
const series = []
|
||||
|
||||
@@ -524,6 +524,10 @@ export default {
|
||||
this.filter.id = this.$refs.pickTime.$refs.timePicker.showTime.id
|
||||
this.getTableData()
|
||||
this.getData(this.filter)
|
||||
this.$store.dispatch('dispatchPanelTime',{
|
||||
time: this.searchTime,
|
||||
nowTimeType: this.nowTimeType
|
||||
})
|
||||
},
|
||||
setSearchTime (type, val, nowTimeType) { // 设置searchTime
|
||||
if (type === 'minute') {
|
||||
@@ -763,6 +767,15 @@ export default {
|
||||
},
|
||||
created () {
|
||||
this.getTableData()
|
||||
this.$store.dispatch('dispatchPanelTime',{
|
||||
time: this.searchTime,
|
||||
nowTimeType: {
|
||||
id: 4,
|
||||
text: this.$t('dashboard.panel.lastOneHour'),
|
||||
type: 'hour',
|
||||
value: 1
|
||||
}
|
||||
})
|
||||
},
|
||||
mounted () {
|
||||
this.scrollbarWrap = this.$refs.dashboardScrollbar
|
||||
|
||||
@@ -4,7 +4,9 @@ const panel = {
|
||||
chart: '',
|
||||
delChart: false,
|
||||
groupId: '',
|
||||
type: ''
|
||||
type: '',
|
||||
timeRange: [],
|
||||
nowTimeType: {}
|
||||
},
|
||||
mutations: {
|
||||
setShowRightBox (state, flag) {
|
||||
@@ -22,6 +24,12 @@ const panel = {
|
||||
setGroupId (state, id) {
|
||||
state.groupId = id
|
||||
},
|
||||
setPanelTime (state, time) {
|
||||
state.timeRange = time
|
||||
},
|
||||
setPanelNowTimeType (state, nowTimeType) {
|
||||
state.nowTimeType = nowTimeType
|
||||
},
|
||||
cleanPanel (state) {
|
||||
state.showRightBox = false
|
||||
state.chart = ''
|
||||
@@ -43,6 +51,12 @@ const panel = {
|
||||
getGroupId (state) {
|
||||
return state.groupId
|
||||
},
|
||||
getTimeRange (state) {
|
||||
return state.timeRange
|
||||
},
|
||||
getNowTimeType (state) {
|
||||
return state.nowTimeType
|
||||
},
|
||||
getDelChart (state) {
|
||||
return state.delChart
|
||||
}
|
||||
@@ -59,6 +73,10 @@ const panel = {
|
||||
store.commit('setChart', playload.chart)
|
||||
store.commit('setType', playload.type)
|
||||
},
|
||||
dispatchPanelTime (store, playload) {
|
||||
store.commit('setPanelTime', playload.time)
|
||||
store.commit('setPanelNowTimeType', playload.nowTimeType)
|
||||
},
|
||||
dispatchEditChart (store, playload) {
|
||||
store.commit('setShowRightBox', true)
|
||||
store.commit('setChart', playload.chart)
|
||||
|
||||
Reference in New Issue
Block a user