echarts-wordcloud

This commit is contained in:
liuye
2024-07-12 17:20:57 +08:00
parent 1c9a736274
commit a52278552c

View File

@@ -86,12 +86,15 @@
</section> </section>
</template> </template>
<script> <script>
import {mapState} from "vuex" import {mapState} from "vuex";
;
import AiDetail from "dui/packages/layout/AiDetail.vue"; import AiDetail from "dui/packages/layout/AiDetail.vue";
import AiTitle from "dui/packages/basic/AiTitle.vue"; import AiTitle from "dui/packages/basic/AiTitle.vue";
import "echarts-wordcloud"; // import * as echarts from 'echarts';
// import "echarts-wordcloud";
export default { export default {
name: "AppSensitiveStatistics", name: "AppSensitiveStatistics",
@@ -143,16 +146,29 @@ export default {
}, },
}, },
created() { created() {
this.getDeptList() this.$injectLib("https://cdn.bootcdn.net/ajax/libs/echarts/5.3.3/echarts.min.js", () => {
this.getTotal() if (window.echarts) {
this.getStatistics() this.$nextTick(() => {
this.$injectLib("https://cdn.cunwuyun.cn/wechat/echarts-wordcloud.min.js", () => {
this.init()
})
})
}
})
}, },
methods: { methods: {
init() {
this.getDeptList()
this.getTotal()
this.getStatistics()
},
getTotal() { getTotal() {
var totalDepartmentId = this.totalDeptList.length ? this.totalDeptList[this.totalDeptList.length-1] : '' var totalDepartmentId = this.totalDeptList.length ? this.totalDeptList[this.totalDeptList.length-1] : ''
this.instance.post(`/app/appsessionarchivekeywordrecord/statistics1?deptFullId=${totalDepartmentId}`).then(res => { this.instance.post(`/app/appsessionarchivekeywordrecord/statistics1?deptFullId=${totalDepartmentId}`).then(res => {
if (res?.data) { if (res?.data) {
console.log(res)
this.totalInfo = res.data this.totalInfo = res.data
} }
}) })
@@ -191,7 +207,6 @@ export default {
this.barChartInit(barX, this.barData) this.barChartInit(barX, this.barData)
}) })
} }
this.info.wordNames.map((item) => { this.info.wordNames.map((item) => {
var i = { name: item.wordName, value: item.wordCount }; var i = { name: item.wordName, value: item.wordCount };
this.wordData.push(i); this.wordData.push(i);
@@ -213,6 +228,7 @@ export default {
}, },
trendChartInit(xData, yData) { trendChartInit(xData, yData) {
this.trendChart = echarts.init(document.getElementById('trendChart')) this.trendChart = echarts.init(document.getElementById('trendChart'))
let option = { let option = {
xAxis: { xAxis: {
type: 'category', type: 'category',
@@ -289,7 +305,7 @@ export default {
this.barChart.setOption(option) this.barChart.setOption(option)
}, },
wordChartInit(data) { wordChartInit(data) {
this.wordChart = echarts.init(document.getElementById('wordChart')) this.wordChart = window.echarts.init(document.getElementById('wordChart'))
var option = { var option = {
series: [ series: [
{ {