123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <template>
- <div v-if="refresh">
- <component :is="chartType.component" :myId="myId" :formData="formData" :formCount="formCount" :selectedData="selectedData" :width="width" :height="height"></component>
- </div>
- </template>
- <script>
- import { customPage } from "../../mixins";
- export default {
- mixins: [customPage],
- props: {
- width: {
- type: String,
- default: '100%'
- },
- height: {
- type: String,
- default: '500px'
- },
- },
- data() {
- return {
- refresh: false,
- chartType: {},
- }
- },
- mounted() {
- this.refreshChart()
- },
- methods: {
- initData() {
- if (!this.form.setting.type) {
- return false
- }
-
- this.chartType = this.$constants.chartType.find(item => item.value === this.form.setting.type)
- if (this.chartType.type === 1 && this.form.schema.y.field) {
- return false
- }
- this.$store.commit('SET_MY_CHART', null)
- return true
- },
- refreshChart() {
- this.refresh = false
- const ret = this.initData()
- this.$nextTick(() => {
- this.refresh = ret
- })
- },
- }
- }
- </script>
- <style lang="less">
- </style>
|