|
|
|
@ -350,7 +350,9 @@ export default {
|
|
|
|
|
//将敏感和非敏感区分开来
|
|
|
|
|
positiveOpinion: [],
|
|
|
|
|
negativeOpinion: [],
|
|
|
|
|
allDate: [],
|
|
|
|
|
date: [],
|
|
|
|
|
newDate: [],
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
computed: {},
|
|
|
|
@ -363,8 +365,6 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
//舆情走势图
|
|
|
|
|
this.getyqData();
|
|
|
|
|
// 获取舆情信息量统计
|
|
|
|
|
this.getyqMsgStats();
|
|
|
|
|
},
|
|
|
|
@ -442,6 +442,7 @@ export default {
|
|
|
|
|
// })
|
|
|
|
|
this.changeBtn();
|
|
|
|
|
this.getFilterData();
|
|
|
|
|
//舆情走势图
|
|
|
|
|
this.getyqData();
|
|
|
|
|
},
|
|
|
|
|
beforeDestroy() {
|
|
|
|
@ -495,22 +496,42 @@ export default {
|
|
|
|
|
// 获取舆情走势图的数据
|
|
|
|
|
getyqData() {
|
|
|
|
|
yuqingChart().then((res) => {
|
|
|
|
|
console.log(res);
|
|
|
|
|
this.allDate = res.data;
|
|
|
|
|
//已经排序过的数组
|
|
|
|
|
this.allDate.sort(function (a, b) {
|
|
|
|
|
return new Date(a.publishTime) - new Date(b.publishTime);
|
|
|
|
|
});
|
|
|
|
|
let arr = [];
|
|
|
|
|
res.data.forEach((value) => {
|
|
|
|
|
if (value.type == 2) {
|
|
|
|
|
this.positiveOpinion.push(value.count);
|
|
|
|
|
} else if (value.type == 1) {
|
|
|
|
|
this.negativeOpinion.push(value.count);
|
|
|
|
|
}
|
|
|
|
|
//把日期存储起来
|
|
|
|
|
arr.push(value.publishTime);
|
|
|
|
|
});
|
|
|
|
|
//日期已经处理好了
|
|
|
|
|
this.date = arr.filter(function (item, index) {
|
|
|
|
|
//当前元素,在原始数组中的第一个索引==当前索引值,否则返回当前元素
|
|
|
|
|
return arr.indexOf(item) === index;
|
|
|
|
|
});
|
|
|
|
|
this.date.forEach((value) => {
|
|
|
|
|
this.newDate.push(value.slice(6));
|
|
|
|
|
let arr2 = res.data.filter((m) => {
|
|
|
|
|
return m.publishTime == value;
|
|
|
|
|
});
|
|
|
|
|
console.log(arr2);
|
|
|
|
|
arr2.forEach((e) => {
|
|
|
|
|
if (e.type == 1 && arr2.length < 2) {
|
|
|
|
|
this.negativeOpinion.push(e.count);
|
|
|
|
|
this.positiveOpinion.push(0);
|
|
|
|
|
} else if (e.type == 2 && arr2.length < 2) {
|
|
|
|
|
this.positiveOpinion.push(e.count);
|
|
|
|
|
this.negativeOpinion.push(0);
|
|
|
|
|
} else if (e.type == 1 && arr2.length == 2) {
|
|
|
|
|
this.negativeOpinion.push(e.count);
|
|
|
|
|
} else if (e.type == 2 && arr2.length == 2) {
|
|
|
|
|
this.positiveOpinion.push(e.count);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
// const res = new Map();
|
|
|
|
|
// let arr = res.data.filter(
|
|
|
|
|
// (item) => !res.has(item[uniId]) && res.set(item[uniId], 1)
|
|
|
|
|
// );
|
|
|
|
|
this.lineBox();
|
|
|
|
|
console.log(this.negativeOpinion);
|
|
|
|
|
console.log(this.positiveOpinion);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 获取舆情信息量统计
|
|
|
|
@ -533,52 +554,52 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
// 折线图
|
|
|
|
|
lineBox() {
|
|
|
|
|
const myChart = this.$echarts.init(document.getElementById("lineBox"));
|
|
|
|
|
const myChart = this.$echarts.init(document.getElementById('lineBox'))
|
|
|
|
|
const options = {
|
|
|
|
|
grid: {
|
|
|
|
|
top: "20%",
|
|
|
|
|
bottom: "15%",
|
|
|
|
|
left: "17%",
|
|
|
|
|
right: "1%",
|
|
|
|
|
top: '20%',
|
|
|
|
|
bottom: '15%',
|
|
|
|
|
left: '17%',
|
|
|
|
|
right: '1%'
|
|
|
|
|
},
|
|
|
|
|
legend: {
|
|
|
|
|
data: ["非敏感", "敏感"],
|
|
|
|
|
top: "3%",
|
|
|
|
|
right: "2%",
|
|
|
|
|
data: ['非敏感', '敏感'],
|
|
|
|
|
top: '3%',
|
|
|
|
|
right: '2%',
|
|
|
|
|
itemHeight: 10,
|
|
|
|
|
itemWidth: 10,
|
|
|
|
|
textStyle: {
|
|
|
|
|
padding: [10, 30, 10, 14],
|
|
|
|
|
color: "rgba(250,250,250,1)",
|
|
|
|
|
fontSize: 28,
|
|
|
|
|
},
|
|
|
|
|
color: 'rgba(250,250,250,1)',
|
|
|
|
|
fontSize: 28
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
tooltip: {
|
|
|
|
|
trigger: "item",
|
|
|
|
|
formatter: "{a} <br/>{b} : {c} ",
|
|
|
|
|
trigger: 'item',
|
|
|
|
|
formatter: '{a} <br/>{b} : {c} ',
|
|
|
|
|
axisPointer: {
|
|
|
|
|
lineStyle: {
|
|
|
|
|
width: 0,
|
|
|
|
|
},
|
|
|
|
|
width: 0
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
backgroundColor: "#fff",
|
|
|
|
|
backgroundColor: '#fff',
|
|
|
|
|
textStyle: {
|
|
|
|
|
color: "#5c6c7c",
|
|
|
|
|
},
|
|
|
|
|
color: '#5c6c7c'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
xAxis: {
|
|
|
|
|
// data: this.opinionTime,
|
|
|
|
|
data: ["7.23", "7.24", "7.25", "7.26", "7.27", "7.28", "7.29"],
|
|
|
|
|
data: this.newDate,
|
|
|
|
|
// data: ['7.23', '7.24', '7.25', '7.26', '7.27', '7.28', '7.29'],
|
|
|
|
|
axisLine: {
|
|
|
|
|
show: true, // 隐藏X轴轴线
|
|
|
|
|
lineStyle: {
|
|
|
|
|
color: "rgb(119,123,132,1)",
|
|
|
|
|
width: 1,
|
|
|
|
|
},
|
|
|
|
|
color: 'rgb(119,123,132,1)',
|
|
|
|
|
width: 1
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
axisTick: {
|
|
|
|
|
show: true, // 隐藏X轴刻度
|
|
|
|
|
length: 0.2,
|
|
|
|
|
length: 0.2
|
|
|
|
|
},
|
|
|
|
|
axisLabel: {
|
|
|
|
|
show: true,
|
|
|
|
@ -588,14 +609,14 @@ export default {
|
|
|
|
|
// margin: 15,
|
|
|
|
|
// position: [100, 100],
|
|
|
|
|
textStyle: {
|
|
|
|
|
color: "#6ddefb", // X轴文字颜色
|
|
|
|
|
fontSize: 28,
|
|
|
|
|
},
|
|
|
|
|
color: '#6ddefb', // X轴文字颜色
|
|
|
|
|
fontSize: 28
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
grid: {
|
|
|
|
|
left: "50%",
|
|
|
|
|
bottom: "35%",
|
|
|
|
|
},
|
|
|
|
|
left: '50%',
|
|
|
|
|
bottom: '35%'
|
|
|
|
|
}
|
|
|
|
|
// splitArea: {
|
|
|
|
|
// interval: 0,
|
|
|
|
|
// show: true,
|
|
|
|
@ -606,65 +627,67 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
yAxis: [
|
|
|
|
|
{
|
|
|
|
|
name: "单位:件",
|
|
|
|
|
name: '单位:件',
|
|
|
|
|
min: 0,
|
|
|
|
|
// max: 3500,
|
|
|
|
|
splitNumber: 7,
|
|
|
|
|
type: "value",
|
|
|
|
|
type: 'value',
|
|
|
|
|
nameTextStyle: {
|
|
|
|
|
padding: [10, 0, 10, 0],
|
|
|
|
|
color: "rgb(255,255,255,1)",
|
|
|
|
|
color: 'rgb(255,255,255,1)',
|
|
|
|
|
fontSize: 28,
|
|
|
|
|
left: 20,
|
|
|
|
|
left: 20
|
|
|
|
|
},
|
|
|
|
|
splitLine: {
|
|
|
|
|
show: true,
|
|
|
|
|
lineStyle: {
|
|
|
|
|
type: "dashed",
|
|
|
|
|
color: "rgba(77, 128, 254, 0.4)",
|
|
|
|
|
width: 1,
|
|
|
|
|
},
|
|
|
|
|
type: 'dashed',
|
|
|
|
|
color: 'rgba(77, 128, 254, 0.4)',
|
|
|
|
|
width: 1
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
axisTick: {
|
|
|
|
|
show: true,
|
|
|
|
|
show: true
|
|
|
|
|
},
|
|
|
|
|
axisLine: {
|
|
|
|
|
show: false,
|
|
|
|
|
show: false
|
|
|
|
|
},
|
|
|
|
|
axisLabel: {
|
|
|
|
|
show: true,
|
|
|
|
|
textStyle: {
|
|
|
|
|
color: "rgba(250,250,250,1)",
|
|
|
|
|
fontSize: 28,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
color: 'rgba(250,250,250,1)',
|
|
|
|
|
fontSize: 28
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
series: [
|
|
|
|
|
{
|
|
|
|
|
name: "非敏感",
|
|
|
|
|
type: "bar",
|
|
|
|
|
name: '非敏感',
|
|
|
|
|
type: 'bar',
|
|
|
|
|
barWidth: 12,
|
|
|
|
|
itemStyle: {
|
|
|
|
|
normal: {
|
|
|
|
|
color: "#38c5ff",
|
|
|
|
|
},
|
|
|
|
|
color: '#38c5ff'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
data: this.positiveOpinion,
|
|
|
|
|
data: this.positiveOpinion
|
|
|
|
|
// data: [70, 50, 70, 60, 30, 40, 70]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "敏感",
|
|
|
|
|
type: "bar",
|
|
|
|
|
name: '敏感',
|
|
|
|
|
type: 'bar',
|
|
|
|
|
barWidth: 12,
|
|
|
|
|
itemStyle: {
|
|
|
|
|
color: "#fc6a31",
|
|
|
|
|
color: '#fc6a31'
|
|
|
|
|
},
|
|
|
|
|
data: this.negativeOpinion,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
};
|
|
|
|
|
myChart.setOption(options, true);
|
|
|
|
|
echartsJump(myChart, options);
|
|
|
|
|
data: this.negativeOpinion
|
|
|
|
|
// data: [30, 10, 70, 64, 60, 10, 20]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
myChart.setOption(options, true)
|
|
|
|
|
echartsJump(myChart, options)
|
|
|
|
|
},
|
|
|
|
|
//点击显示弹出框列表
|
|
|
|
|
clickDetails(val, type) {
|
|
|
|
|