fix: 修复自定义知识库不能正常访问的问题

This commit is contained in:
chenjinsong
2023-10-27 11:45:58 +08:00
parent 20a4bb22ef
commit 00df0414c2
2 changed files with 16 additions and 11 deletions

View File

@@ -250,15 +250,17 @@ export default {
} }
}, },
colorText () { colorText () {
const vm = this
return function (color) { return function (color) {
const t = this.knowledgeBaseColor.find(t => t.value === color) const t = vm.knowledgeBaseColor.find(t => t.value === color)
return t ? t.label : this.knowledgeBaseColor[0].label return t ? t.label : vm.knowledgeBaseColor[0].label
} }
}, },
colorName () { colorName () {
const vm = this
return function (color) { return function (color) {
const t = this.knowledgeBaseColor.find(t => t.value === color) const t = vm.knowledgeBaseColor.find(t => t.value === color)
return t ? t.name : this.knowledgeBaseColor[0].name return t ? t.name : vm.knowledgeBaseColor[0].name
} }
} }
} }

View File

@@ -189,7 +189,7 @@
</div> </div>
<div style="height: calc(100% - 24px); position: relative"> <div style="height: calc(100% - 24px); position: relative">
<chart-no-data v-if="isNoDataForPsiphon3 && !showErrorForPsiphon3"></chart-no-data> <chart-no-data v-if="isNoDataForPsiphon3 && !showErrorForPsiphon3"></chart-no-data>
<div class="chart-drawing" v-show="!isNoDataForPsiphon3 && !showErrorForPsiphon3" ref="psiphonBarChart"></div> <div class="chart-drawing" v-show="!isNoDataForPsiphon3 && !showErrorForPsiphon3" id="psiphonBarChart"></div>
</div> </div>
</div> </div>
</div> </div>
@@ -462,7 +462,7 @@ export default {
if (this.myChart) { if (this.myChart) {
this.myChart.dispose() this.myChart.dispose()
} }
this.myChart = echarts.init(this.$refs.psiphonBarChart) this.myChart = echarts.init(document.getElementById('psiphonBarChart'))
this.myChart.setOption(this.chartOption) this.myChart.setOption(this.chartOption)
this.myChart.dispatchAction({ this.myChart.dispatchAction({
@@ -846,15 +846,18 @@ export default {
beforeUnmount () { beforeUnmount () {
clearTimeout(this.timer) clearTimeout(this.timer)
window.removeEventListener('resize', this.resize) window.removeEventListener('resize', this.resize)
const dom = document.getElementById('psiphonBarChart')
let myChart = echarts.getInstanceByDom(this.$refs.psiphonBarChart) if (dom) {
if (myChart) { let myChart = echarts.getInstanceByDom(document.getElementById('psiphonBarChart'))
echarts.dispose(myChart) if (myChart) {
echarts.dispose(myChart)
}
myChart = null
} }
if (this.myChart) { if (this.myChart) {
echarts.dispose(this.myChart) echarts.dispose(this.myChart)
} }
myChart = null
}, },
computed: { computed: {
uploadParams () { uploadParams () {