This commit is contained in:
yanran200730
2023-04-06 10:02:25 +08:00
parent 89c406d802
commit ec189139b6
6 changed files with 19 additions and 13 deletions

View File

@@ -13,7 +13,7 @@
<template v-else>
<el-option v-for="(item, index) in ops" :key="index"
:label="item.dictName||item[actionProp.label]"
:value="item.dictValue>-1?item.dictValue:item[actionProp.value]"
:value="item.dictValue>-1 || item.dictValue ?item.dictValue:item[actionProp.value]"
:disabled="check(item[actionProp.value])"/>
</template>
</el-select>

View File

@@ -1,6 +1,6 @@
<template>
<section class="AiEchart">
<div ref="AiEchart" class="chart" :style="{minWidth:grid.width,minHeight:grid.height}"/>
<div :ref="AiEchart" class="chart" :style="{minWidth:grid.width,minHeight:grid.height}"/>
<slot v-if="$slots.default"/>
<render-component v-else-if="ops.render" :render="ops.render" :options="chartOptions" :data="data"/>
</section>
@@ -39,7 +39,8 @@ export default {
data() {
return {
chart: null,
timer: null
timer: null,
AiEchart: `AiEchart-${new Date().getTime()}`
}
},
computed: {
@@ -176,14 +177,14 @@ export default {
}
},
initChart() {
this.chart = echarts.init(this.$refs.AiEchart)
this.chart = echarts.init(this.$refs[this.AiEchart])
this.chart.setOption(this.chartOptions || {})
},
watchResize() {
this.timer && clearInterval(this.timer)
this.timer = setInterval(() => {
if (this.chart?.getHeight() != this.$refs.AiEchart?.clientHeight ||
this.chart?.getWidth() != this.$refs.AiEchart?.clientWidth) {
if (this.chart?.getHeight() != this.$refs[this.AiEchart]?.clientHeight ||
this.chart?.getWidth() != this.$refs[this.AiEchart]?.clientWidth) {
this.chart?.resize()
}
}, 1000)
@@ -196,6 +197,7 @@ export default {
},
mounted() {
this.$nextTick(() => {
console.log(this.$refs[this.AiEchart])
this.watchResize()
this.initChart()
this.getChartData()