Files
dvcp_v2_wxcp_app/library/project/pidu/AppDataStatistics/components/sensitive.vue

330 lines
7.6 KiB
Vue
Raw Normal View History

2023-06-19 17:28:47 +08:00
<template>
<div class="sensitive">
<div class="card">
<div class="item">
<div class="item_name">敏感词累计</div>
2023-06-21 11:25:04 +08:00
<div class="item_num">{{ Number(info.recordSum) }}</div>
2023-06-19 17:28:47 +08:00
</div>
<div class="item">
<div class="item_name">群聊敏感词</div>
2023-06-21 15:54:43 +08:00
<div class="item_num">{{ Number(info.groupRecordSum) }}</div>
2023-06-19 17:28:47 +08:00
</div>
<div class="item">
<div class="item_name">私聊敏感词</div>
2023-06-21 15:54:43 +08:00
<div class="item_num">{{ Number(info.personRecordSum) }}</div>
<!-- <img src="../img/down.png" alt="" class="imgs" v-show="info.personRecordSum !=0"> -->
2023-06-19 17:28:47 +08:00
</div>
</div>
<div class="head">
<span>群聊敏感词统计</span>
</div>
<div class="friends_box">
2023-06-21 11:25:04 +08:00
<div id="group" v-if="groupData.length > 0"></div>
2023-06-21 15:54:43 +08:00
<AiEmpty
style="padding-top: 10px"
description="暂无数据"
v-else
></AiEmpty>
2023-06-19 17:28:47 +08:00
</div>
<div class="head">
<span>单聊敏感词统计</span>
</div>
<div class="groups_box">
2023-06-21 11:25:04 +08:00
<div id="user" v-if="userData.length > 0"></div>
2023-06-21 15:54:43 +08:00
<AiEmpty
style="padding-top: 10px"
description="暂无数据"
v-else
></AiEmpty>
2023-06-19 17:28:47 +08:00
</div>
2023-06-21 15:54:43 +08:00
<div class="groups_box" v-if="wordData">
2023-06-21 17:01:24 +08:00
<div id="main"></div>
2023-06-21 15:54:43 +08:00
</div>
2023-06-19 17:28:47 +08:00
</div>
</template>
<script>
2023-06-21 15:54:43 +08:00
import echarts from "echarts";
2023-06-21 17:01:24 +08:00
import "echarts-wordcloud";
2023-06-19 17:28:47 +08:00
export default {
name: "sensitive",
props: {
2023-06-21 15:54:43 +08:00
departmentId: String,
2023-06-19 17:28:47 +08:00
},
data() {
return {
2023-06-21 11:25:04 +08:00
info: {},
groupData: [],
2023-06-21 15:54:43 +08:00
userData: [],
2023-06-21 17:01:24 +08:00
wordData: [],
2023-06-21 15:54:43 +08:00
};
2023-06-19 17:28:47 +08:00
},
created() {
2023-06-21 15:54:43 +08:00
this.getData();
2023-06-19 17:28:47 +08:00
},
methods: {
getData() {
2023-06-21 15:54:43 +08:00
this.$http
.post(
`/app/appsessionarchivekeywordrecord/getKeywordRecordStatistic?departmentId=${this.departmentId}`
)
.then((res) => {
if (res?.data) {
this.info = { ...res.data };
var groupMonth = res.data.groupRecordListMap.map((e) => e.dateDay);
this.groupData = res.data.groupRecordListMap.map((e) => e.cnt);
2023-06-21 13:38:51 +08:00
2023-06-21 15:54:43 +08:00
var userMonth = res.data.personRecordListMap.map((e) => e.dateDay);
this.userData = res.data.personRecordListMap.map((e) => e.cnt);
2023-06-21 11:25:04 +08:00
2023-06-21 15:54:43 +08:00
res.data.wordNames.map((item) => {
2023-06-21 17:01:24 +08:00
var i = { name: item.wordName, value: item.wordCount };
this.wordData.push(i);
});
2023-06-21 15:54:43 +08:00
this.$nextTick(() => {
this.getGroupEcharts(groupMonth, this.groupData);
this.getUserEcharts(userMonth, this.userData);
2023-06-21 17:01:24 +08:00
if (this.wordData) {
this.getKeyWordEcharts(this.wordData);
2023-06-21 15:54:43 +08:00
}
});
}
});
2023-06-19 17:28:47 +08:00
},
2023-06-21 11:25:04 +08:00
getGroupEcharts(groupMonth, groupData) {
2023-06-21 15:54:43 +08:00
let groupDom = document.getElementById("group");
2023-06-21 11:25:04 +08:00
let groupChart = echarts.init(groupDom);
2023-06-19 17:28:47 +08:00
let option = {
tooltip: {
trigger: "axis",
},
xAxis: {
2023-06-21 15:54:43 +08:00
type: "category",
2023-06-21 11:25:04 +08:00
data: groupMonth,
2023-06-19 17:28:47 +08:00
axisTick: {
show: false,
2023-06-21 15:54:43 +08:00
},
2023-06-19 17:28:47 +08:00
},
yAxis: {
2023-06-21 15:54:43 +08:00
type: "value",
2023-06-19 17:28:47 +08:00
axisLine: {
show: false,
},
axisTick: {
show: false,
2023-06-21 15:54:43 +08:00
},
},
grid: {
x: 50,
y: 50,
2023-06-19 17:28:47 +08:00
},
series: [
{
2023-06-21 11:25:04 +08:00
data: groupData,
2023-06-21 15:54:43 +08:00
type: "line",
2023-06-19 17:28:47 +08:00
lineStyle: {
2023-06-21 15:54:43 +08:00
color: "#3975C6", // 折线线条颜色
2023-06-19 17:28:47 +08:00
},
itemStyle: {
2023-06-21 15:54:43 +08:00
color: "#3975C6", // 折角颜色
2023-06-19 17:28:47 +08:00
},
areaStyle: {
color: {
2023-06-21 15:54:43 +08:00
type: "linear",
2023-06-19 17:28:47 +08:00
x: 0,
y: 0,
x2: 0,
y2: 1,
2023-06-21 15:54:43 +08:00
colorStops: [
// 渐变颜色
2023-06-19 17:28:47 +08:00
{
offset: 0,
2023-06-21 15:54:43 +08:00
color: "#2891ff33",
2023-06-19 17:28:47 +08:00
},
{
offset: 1,
2023-06-21 15:54:43 +08:00
color: "#2891ff00",
2023-06-19 17:28:47 +08:00
},
],
global: false,
},
},
2023-06-21 15:54:43 +08:00
},
],
2023-06-19 17:28:47 +08:00
};
2023-06-21 11:25:04 +08:00
option && groupChart.setOption(option);
2023-06-19 17:28:47 +08:00
},
2023-06-21 11:25:04 +08:00
getUserEcharts(userMonth, userData) {
2023-06-21 15:54:43 +08:00
let userDom = document.getElementById("user");
2023-06-21 11:25:04 +08:00
let userChart = echarts.init(userDom);
2023-06-19 17:28:47 +08:00
let option = {
tooltip: {
trigger: "axis",
},
xAxis: {
2023-06-21 15:54:43 +08:00
type: "category",
2023-06-21 11:25:04 +08:00
data: userMonth,
2023-06-19 17:28:47 +08:00
axisTick: {
show: false,
2023-06-21 15:54:43 +08:00
},
2023-06-19 17:28:47 +08:00
},
yAxis: {
2023-06-21 15:54:43 +08:00
type: "value",
2023-06-19 17:28:47 +08:00
axisLine: {
show: false,
},
axisTick: {
show: false,
2023-06-21 15:54:43 +08:00
},
},
grid: {
x: 50,
y: 50,
2023-06-19 17:28:47 +08:00
},
series: [
{
2023-06-21 11:25:04 +08:00
data: userData,
2023-06-21 15:54:43 +08:00
type: "line",
2023-06-19 17:28:47 +08:00
lineStyle: {
2023-06-21 15:54:43 +08:00
color: "#3975C6", // 折线线条颜色
2023-06-19 17:28:47 +08:00
},
itemStyle: {
2023-06-21 15:54:43 +08:00
color: "#3975C6", // 折角颜色
2023-06-19 17:28:47 +08:00
},
areaStyle: {
color: {
2023-06-21 15:54:43 +08:00
type: "linear",
2023-06-19 17:28:47 +08:00
x: 0,
y: 0,
x2: 0,
y2: 1,
2023-06-21 15:54:43 +08:00
colorStops: [
// 渐变颜色
2023-06-19 17:28:47 +08:00
{
offset: 0,
2023-06-21 15:54:43 +08:00
color: "#2891ff33",
2023-06-19 17:28:47 +08:00
},
{
offset: 1,
2023-06-21 15:54:43 +08:00
color: "#2891ff00",
2023-06-19 17:28:47 +08:00
},
],
global: false,
},
},
2023-06-21 15:54:43 +08:00
},
],
2023-06-19 17:28:47 +08:00
};
2023-06-21 11:25:04 +08:00
option && userChart.setOption(option);
2023-06-21 15:54:43 +08:00
},
2023-06-21 17:01:24 +08:00
getKeyWordEcharts(data) {
var chart = echarts.init(document.getElementById("main"));
chart.setOption({
series: [
{
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,
},
],
2023-06-21 15:54:43 +08:00
});
},
2023-06-19 17:28:47 +08:00
},
2023-06-21 15:54:43 +08:00
};
2023-06-19 17:28:47 +08:00
</script>
<style lang="scss" scoped>
.sensitive {
padding: 0 32px;
box-sizing: border-box;
.head {
margin-top: 32px;
span:first-child {
font-size: 32px;
color: #333333;
font-weight: 600;
}
span:last-child {
font-size: 26px;
color: #999999;
}
}
.card {
padding: 24px 0;
box-sizing: border-box;
display: flex;
text-align: center;
align-items: center;
2023-06-21 15:54:43 +08:00
background: #fff;
2023-06-19 17:28:47 +08:00
border-radius: 16px;
margin-top: 24px;
.item {
flex: 1;
.item_name {
color: #666666;
}
.item_num {
color: #000000;
font-size: 36px;
font-weight: 600;
}
.imgs {
width: 30px;
height: 30px;
}
}
}
.friends_box,
.groups_box {
margin-top: 24px;
width: 100%;
height: 514px;
2023-06-21 15:54:43 +08:00
background: #fff;
2023-06-21 11:25:04 +08:00
#user,
2023-06-21 15:54:43 +08:00
#group,
#main {
2023-06-19 17:28:47 +08:00
width: 100%;
height: 100%;
}
}
}
</style>