fix: 修复图表block刷新按钮无效的问题

This commit is contained in:
chenjinsong
2022-04-28 22:51:13 +08:00
parent ec829e64b3
commit 364c9a4458
6 changed files with 18 additions and 17 deletions

View File

@@ -103,6 +103,9 @@
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
.panel__time {
top: 7px;
}
.header__operation-btn { .header__operation-btn {
margin-left: 12px; margin-left: 12px;
cursor: pointer; cursor: pointer;

View File

@@ -396,7 +396,7 @@ export default {
isError: Boolean, isError: Boolean,
table: Object, table: Object,
timeFilter: Object, timeFilter: Object,
orderPieTable: Object, orderPieTable: String,
tabHandleClickType: String tabHandleClickType: String
}, },
computed: { computed: {

View File

@@ -264,7 +264,7 @@ export default {
default: false default: false
}, },
table: Object, table: Object,
orderPieTable: Object orderPieTable: String
}, },
components: { components: {
ChartError ChartError

View File

@@ -266,12 +266,14 @@ export default {
this.loading = false this.loading = false
}) })
} else if (this.isGroup || this.isTabs) { } else if (this.isGroup || this.isTabs) {
this.$refs.chart.$refs.chart.reload() this.$refs.chart && this.$refs.chart.$refs.chart && this.$refs.chart.$refs.chart.reload()
} else if (this.isBlock) { } else if (this.isBlock) {
if (!this.chartInfo.firstShow) { if (!this.chartInfo.firstShow) {
this.chartInfo.firstShow = true this.chartInfo.firstShow = true
} else { } else {
this.$refs.chart.$refs.chart.reload() if (this.$refs.chart && this.$refs.chart.$refs.chart) {
this.$refs.chart.$refs.chart.reload()
}
} }
} }
} catch (e) { } catch (e) {
@@ -400,7 +402,7 @@ export default {
const dateRangeValue = 60 const dateRangeValue = 60
const { startTime, endTime } = getNowTime(dateRangeValue) const { startTime, endTime } = getNowTime(dateRangeValue)
const chartTimeFilter = ref({ startTime, endTime, dateRangeValue }) const chartTimeFilter = ref({ startTime, endTime, dateRangeValue })
const table = ref('') const table = ref({})
if (isBasicTable(props.chartInfo.type)) { if (isBasicTable(props.chartInfo.type)) {
table.value = { table.value = {
pageSize: chartTableDefaultPageSize, pageSize: chartTableDefaultPageSize,

View File

@@ -11,22 +11,18 @@
<script> <script>
import chartMixin from '@/views/charts/charts/chart-mixin' import chartMixin from '@/views/charts/charts/chart-mixin'
import _ from 'lodash' import _ from 'lodash'
import { ref } from 'vue'
export default { export default {
name: 'ChartBlock', name: 'ChartBlock',
mixins: [chartMixin], mixins: [chartMixin],
data () {
return {
time: {},
firstShow: false
}
},
mounted () {
this.firstShow = true
},
methods: { methods: {
reload () { reload () {
this.dataList = _.cloneDeep(this.dataList) const t = _.cloneDeep(this.dataList)
this.dataList = []
this.$nextTick(() => {
this.dataList = t
})
} }
}, },
setup (props) { setup (props) {
@@ -36,7 +32,7 @@ export default {
return data1.x - data2.x return data1.x - data2.x
}) })
} }
const dataList = copyAndSort(props.chartInfo.children) const dataList = ref(copyAndSort(props.chartInfo.children))
return { return {
copyAndSort, copyAndSort,
dataList dataList

View File

@@ -30,7 +30,7 @@ export default {
props: { props: {
resultType: Object, resultType: Object,
queryParams: Object, queryParams: Object,
orderPieTable: Object orderPieTable: String
}, },
components: { components: {
PieTable PieTable