This commit is contained in:
liuye
2023-06-21 17:01:24 +08:00
parent cdc1531293
commit 5278e235a6
3 changed files with 49 additions and 22 deletions

View File

@@ -50,14 +50,14 @@
"core-js": "^3.11.0", "core-js": "^3.11.0",
"dayjs": "^1.10.6", "dayjs": "^1.10.6",
"echarts": "^4.9.0", "echarts": "^4.9.0",
"echarts-wordcloud": "^1.1.3",
"recorder-core": "^1.1.21080800", "recorder-core": "^1.1.21080800",
"regenerator-runtime": "^0.12.1", "regenerator-runtime": "^0.12.1",
"vue": "^2.6.11", "vue": "^2.6.11",
"vuedraggable": "^2.24.3", "vuedraggable": "^2.24.3",
"vuex": "^3.2.0", "vuex": "^3.2.0",
"vuex-persistedstate": "^4.0.0-beta.3", "vuex-persistedstate": "^4.0.0-beta.3",
"wangeditor": "^4.7.10", "wangeditor": "^4.7.10"
"wordcloud": "^1.2.2"
}, },
"devDependencies": { "devDependencies": {
"@babel/runtime": "~7.12.0", "@babel/runtime": "~7.12.0",

View File

@@ -41,15 +41,15 @@
</div> </div>
<div class="groups_box" v-if="wordData"> <div class="groups_box" v-if="wordData">
<canvas id="main"></canvas> <div id="main"></div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import echarts from "echarts"; import echarts from "echarts";
import WordCloud from 'wordcloud'; import "echarts-wordcloud";
export default { export default {
name: "sensitive", name: "sensitive",
props: { props: {
@@ -60,7 +60,7 @@ export default {
info: {}, info: {},
groupData: [], groupData: [],
userData: [], userData: [],
wordData: [] wordData: [],
}; };
}, },
created() { created() {
@@ -68,7 +68,6 @@ export default {
}, },
methods: { methods: {
getData() { getData() {
// 居民好友
this.$http this.$http
.post( .post(
`/app/appsessionarchivekeywordrecord/getKeywordRecordStatistic?departmentId=${this.departmentId}` `/app/appsessionarchivekeywordrecord/getKeywordRecordStatistic?departmentId=${this.departmentId}`
@@ -83,14 +82,14 @@ export default {
this.userData = res.data.personRecordListMap.map((e) => e.cnt); this.userData = res.data.personRecordListMap.map((e) => e.cnt);
res.data.wordNames.map((item) => { res.data.wordNames.map((item) => {
var i = [item.wordName, item.wordCount*8] var i = { name: item.wordName, value: item.wordCount };
this.wordData.push(i) this.wordData.push(i);
}) });
this.$nextTick(() => { this.$nextTick(() => {
this.getGroupEcharts(groupMonth, this.groupData); this.getGroupEcharts(groupMonth, this.groupData);
this.getUserEcharts(userMonth, this.userData); this.getUserEcharts(userMonth, this.userData);
if (this.wordData) { if (this.wordData) {
this.getKeyWordEcharts(this.wordData) this.getKeyWordEcharts(this.wordData);
} }
}); });
} }
@@ -222,15 +221,44 @@ export default {
}; };
option && userChart.setOption(option); option && userChart.setOption(option);
}, },
getKeyWordEcharts(list) { getKeyWordEcharts(data) {
WordCloud(document.getElementById('main'), { var chart = echarts.init(document.getElementById("main"));
list: list
// [ chart.setOption({
// ['foo', 50], series: [
// ['bar', 6], {
// // ... type: "wordCloud",
// ], sizeRange: [15, 80],
// 其他自定义选项 rotationRange: [0, 0],
rotationStep: 45,
gridSize: 8,
shape: "pentagon",
width: "100%",
height: "100%",
textStyle: {
normal: {
color: function () {
return (
"rgb(" +
[
Math.round(Math.random() * 160),
Math.round(Math.random() * 160),
Math.round(Math.random() * 160),
].join(",") +
")"
);
},
fontFamily: "sans-serif",
fontWeight: "normal",
},
emphasis: {
shadowBlur: 10,
shadowColor: "#333",
},
},
data,
},
],
}); });
}, },
}, },

View File

@@ -84,7 +84,6 @@ export default {
}else { }else {
item.text = this.changeKeyRed(item.content, item.wordName) item.text = this.changeKeyRed(item.content, item.wordName)
} }
}) })
this.list = this.current > 1 ? [...this.list, ...res.data.records] : res.data.records this.list = this.current > 1 ? [...this.list, ...res.data.records] : res.data.records
this.pages = res.data.pages this.pages = res.data.pages