|
@@ -1,6 +1,21 @@
|
|
|
<template>
|
|
|
- <m-card>
|
|
|
-
|
|
|
+ <m-card shadow="never" :bodyStyle="{ position: 'relative' }">
|
|
|
+ <e-charts ref="chart" style="height: 400px;"></e-charts>
|
|
|
+ <el-drawer
|
|
|
+ :visible.sync="drawer"
|
|
|
+ direction="rtl"
|
|
|
+ :show-close="false"
|
|
|
+ :modal-append-to-body="false"
|
|
|
+ :modal="false"
|
|
|
+ size="70%"
|
|
|
+ :withHeader="false"
|
|
|
+ style="position: absolute;"
|
|
|
+ v-loading="loading"
|
|
|
+ >
|
|
|
+ <div style="width: 100%; height: 100%; padding: 20px;">
|
|
|
+ <e-charts ref="drawerChart" style="height: 400px;"></e-charts>
|
|
|
+ </div>
|
|
|
+ </el-drawer>
|
|
|
</m-card>
|
|
|
</template>
|
|
|
|
|
@@ -10,13 +25,59 @@ import {
|
|
|
} from '@/api/accumulatePoint'
|
|
|
export default {
|
|
|
name: 'accumulatePointsStatisticsTop',
|
|
|
+ props: {
|
|
|
+ option: {
|
|
|
+ type: Object,
|
|
|
+ default: () => ({})
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ drawer: false,
|
|
|
+ chart: null,
|
|
|
+ drawerChart: null,
|
|
|
+ loading: false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ option: {
|
|
|
+ handler (val) {
|
|
|
+ if (this.chart) {
|
|
|
+ this.chart.setOption(val)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ deep: true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted () {
|
|
|
+ this.chart = this.$refs.chart.onInit()
|
|
|
+ if (Object.keys(this.option).length) {
|
|
|
+ this.chart.setOption(this.option)
|
|
|
+ }
|
|
|
+ this.chart.on('click', this.onInit)
|
|
|
+ },
|
|
|
+ beforeDestroy () {
|
|
|
+ if (!this.chart) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.chart.off('click', this.onInit)
|
|
|
+ },
|
|
|
methods: {
|
|
|
- async onInit () {
|
|
|
+ async onInit (e) {
|
|
|
+ this.drawer = true
|
|
|
+ this.loading = true
|
|
|
try {
|
|
|
- const { data } = await getAccumulatePointStatisticsTop()
|
|
|
- console.log(data)
|
|
|
+ const { data } = await getAccumulatePointStatisticsTop({
|
|
|
+ organizationNo: e.data.organizationNo
|
|
|
+ })
|
|
|
+ if (!this.drawerChart) {
|
|
|
+ this.drawerChart = this.$refs.drawerChart.onInit()
|
|
|
+ }
|
|
|
+ this.drawerChart.setOption(data)
|
|
|
} catch (error) {
|
|
|
- this.$snackbar.error(error)
|
|
|
+ this.$message.error(error)
|
|
|
+ } finally {
|
|
|
+ this.loading = false
|
|
|
}
|
|
|
}
|
|
|
}
|