|
@@ -12,19 +12,21 @@
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="chart-content d-flex heightFull">
|
|
<div class="chart-content d-flex heightFull">
|
|
- <div class="chart-content-show heightFull white mr-3 overflow-hidden pa-3 position-relative" ref="box">
|
|
|
|
- <div v-if="!empty" class="position-absolute" style="right: 10px; top: 80px; z-index: 999">
|
|
|
|
- <v-btn
|
|
|
|
- icon
|
|
|
|
- color="primary"
|
|
|
|
- @click="setFullscreen"
|
|
|
|
- >
|
|
|
|
- <v-icon>{{ fullscreen ? 'mdi-arrow-collapse' : 'mdi-arrow-expand'}}</v-icon>
|
|
|
|
- </v-btn>
|
|
|
|
- </div>
|
|
|
|
- <MEmpty v-if="empty"></MEmpty>
|
|
|
|
- <InitChart ref="chart" class="heightFull widthFull"></InitChart>
|
|
|
|
- </div>
|
|
|
|
|
|
+ <FullscreenToggle class="chart-content-show heightFull white mr-3 overflow-hidden pa-3 position-relative" ref="box">
|
|
|
|
+ <template v-slot="{ toggle, isFullscreen }">
|
|
|
|
+ <div v-if="!empty" class="position-absolute" style="right: 10px; top: 80px; z-index: 999">
|
|
|
|
+ <v-btn
|
|
|
|
+ icon
|
|
|
|
+ color="primary"
|
|
|
|
+ @click="toggle"
|
|
|
|
+ >
|
|
|
|
+ <v-icon>{{ isFullscreen ? 'mdi-arrow-collapse' : 'mdi-arrow-expand'}}</v-icon>
|
|
|
|
+ </v-btn>
|
|
|
|
+ </div>
|
|
|
|
+ <MEmpty v-if="empty"></MEmpty>
|
|
|
|
+ <InitChart ref="chart" class="heightFull widthFull"></InitChart>
|
|
|
|
+ </template>
|
|
|
|
+ </FullscreenToggle>
|
|
<DataChartEditChat @render="onRender"></DataChartEditChat>
|
|
<DataChartEditChat @render="onRender"></DataChartEditChat>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -37,20 +39,18 @@ import * as Charts from './utils/options.js'
|
|
import DataChartEditChat from './dataChartEditChat.vue'
|
|
import DataChartEditChat from './dataChartEditChat.vue'
|
|
import InitChart from '@/charts/initChart'
|
|
import InitChart from '@/charts/initChart'
|
|
import { cloneDeep } from 'lodash'
|
|
import { cloneDeep } from 'lodash'
|
|
-import {
|
|
|
|
- requestFullscreen,
|
|
|
|
- exitFullscreen
|
|
|
|
-} from '@/utils/fullscreen'
|
|
|
|
|
|
+
|
|
|
|
+import FullscreenToggle from '@/components/FullscreenToggle'
|
|
export default {
|
|
export default {
|
|
name: 'dataChartEdit',
|
|
name: 'dataChartEdit',
|
|
components: {
|
|
components: {
|
|
DataChartEditChat,
|
|
DataChartEditChat,
|
|
InitChart,
|
|
InitChart,
|
|
- MEmpty
|
|
|
|
|
|
+ MEmpty,
|
|
|
|
+ FullscreenToggle
|
|
},
|
|
},
|
|
data () {
|
|
data () {
|
|
return {
|
|
return {
|
|
- fullscreen: false,
|
|
|
|
Charts,
|
|
Charts,
|
|
chart: null,
|
|
chart: null,
|
|
chartsOpt: {
|
|
chartsOpt: {
|
|
@@ -75,15 +75,6 @@ export default {
|
|
this.chartsOpt.key = key
|
|
this.chartsOpt.key = key
|
|
this.setData()
|
|
this.setData()
|
|
},
|
|
},
|
|
- setFullscreen () {
|
|
|
|
- this.fullscreen = !this.fullscreen
|
|
|
|
- const $el = this.$refs.box
|
|
|
|
- if (this.fullscreen) {
|
|
|
|
- requestFullscreen($el)
|
|
|
|
- } else {
|
|
|
|
- exitFullscreen($el)
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
onRender ({ type, data }) {
|
|
onRender ({ type, data }) {
|
|
this.chartsOpt.config.xAxisData = type
|
|
this.chartsOpt.config.xAxisData = type
|
|
this.chartsOpt.data = data
|
|
this.chartsOpt.data = data
|
|
@@ -120,8 +111,6 @@ export default {
|
|
if (_option.xAxis?.data) {
|
|
if (_option.xAxis?.data) {
|
|
_option.xAxis.data = config?.xAxisData ?? data[0].map((e, i) => i)
|
|
_option.xAxis.data = config?.xAxisData ?? data[0].map((e, i) => i)
|
|
}
|
|
}
|
|
- console.log(_option)
|
|
|
|
- console.log(this.chart)
|
|
|
|
this.chart.setOption(_option, true)
|
|
this.chart.setOption(_option, true)
|
|
this.chart.hideLoading()
|
|
this.chart.hideLoading()
|
|
}
|
|
}
|