Files
dvcp_v2_wxcp_app/src/project/pidu/AppDataStatistics/components/sensitive.vue
2023-06-21 13:38:51 +08:00

264 lines
6.0 KiB
Vue

<template>
<div class="sensitive">
<div class="card">
<div class="item">
<div class="item_name">敏感词累计</div>
<div class="item_num">{{ Number(info.recordSum) }}</div>
</div>
<div class="item">
<div class="item_name">群聊敏感词</div>
<div class="item_num">{{ Number(info.groupRecordSum)}}
<img src="../img/up.png" alt="" class="imgs" v-show="info.groupRecordSum != 0">
</div>
</div>
<div class="item">
<div class="item_name">私聊敏感词</div>
<div class="item_num">{{ Number(info.personRecordSum)}}
<img src="../img/down.png" alt="" class="imgs" v-show="info.personRecordSum !=0"></div>
</div>
</div>
<div class="head">
<span>群聊敏感词统计</span>
</div>
<div class="friends_box">
<div id="group" v-if="groupData.length > 0"></div>
<AiEmpty style="padding-top: 10px;" description="暂无数据" v-else></AiEmpty>
</div>
<div class="head">
<span>单聊敏感词统计</span>
</div>
<div class="groups_box">
<div id="user" v-if="userData.length > 0"></div>
<AiEmpty style="padding-top: 10px;" description="暂无数据" v-else></AiEmpty>
</div>
</div>
</template>
<script>
import echarts from 'echarts';
export default {
name: "sensitive",
props: {
departmentId: String
},
data() {
return {
info: {},
groupData: [],
userData: []
}
},
created() {
this.getData()
},
methods: {
getData() {
// 居民好友
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)
var userMonth = res.data.personRecordListMap.map(e=> e.dateDay)
this.userData = res.data.personRecordListMap.map(e=> e.cnt)
this.$nextTick(()=> {
this.getGroupEcharts(groupMonth, this.groupData)
this.getUserEcharts(userMonth, this.userData)
})
}
})
},
getGroupEcharts(groupMonth, groupData) {
let groupDom = document.getElementById('group');
let groupChart = echarts.init(groupDom);
let option = {
tooltip: {
trigger: "axis",
},
xAxis: {
type: 'category',
data: groupMonth,
axisTick: {
show: false,
}
},
yAxis: {
type: 'value',
axisLine: {
show: false,
},
axisTick: {
show: false,
}
},
grid:{
x:50,
y:50,
},
series: [
{
data: groupData,
type: 'line',
lineStyle: {
color: '#3975C6', // 折线线条颜色
},
itemStyle: {
color: '#3975C6', // 折角颜色
},
areaStyle: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [ // 渐变颜色
{
offset: 0,
color: '#2891ff33',
},
{
offset: 1,
color: '#2891ff00',
},
],
global: false,
},
},
}
]
};
option && groupChart.setOption(option);
},
getUserEcharts(userMonth, userData) {
let userDom = document.getElementById('user');
let userChart = echarts.init(userDom);
let option = {
tooltip: {
trigger: "axis",
},
xAxis: {
type: 'category',
data: userMonth,
axisTick: {
show: false,
}
},
yAxis: {
type: 'value',
axisLine: {
show: false,
},
axisTick: {
show: false,
}
},
grid:{
x:50,
y:50,
},
series: [
{
data: userData,
type: 'line',
lineStyle: {
color: '#3975C6', // 折线线条颜色
},
itemStyle: {
color: '#3975C6', // 折角颜色
},
areaStyle: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [ // 渐变颜色
{
offset: 0,
color: '#2891ff33',
},
{
offset: 1,
color: '#2891ff00',
},
],
global: false,
},
},
}
]
};
option && userChart.setOption(option);
}
},
}
</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;
background: #FFF;
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;
background: #FFF;
#user,
#group {
width: 100%;
height: 100%;
}
}
}
</style>