|
|
|
@ -350,6 +350,7 @@ export default {
|
|
|
|
|
//将敏感和非敏感区分开来
|
|
|
|
|
positiveOpinion: [],
|
|
|
|
|
negativeOpinion: [],
|
|
|
|
|
allDate: [],
|
|
|
|
|
date: [],
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
@ -363,8 +364,6 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
//舆情走势图
|
|
|
|
|
this.getyqData();
|
|
|
|
|
// 获取舆情信息量统计
|
|
|
|
|
this.getyqMsgStats();
|
|
|
|
|
},
|
|
|
|
@ -442,6 +441,7 @@ export default {
|
|
|
|
|
// })
|
|
|
|
|
this.changeBtn();
|
|
|
|
|
this.getFilterData();
|
|
|
|
|
//舆情走势图
|
|
|
|
|
this.getyqData();
|
|
|
|
|
},
|
|
|
|
|
beforeDestroy() {
|
|
|
|
@ -495,20 +495,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) => {
|
|
|
|
|
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.date);
|
|
|
|
|
console.log(this.negativeOpinion);
|
|
|
|
|
console.log(this.positiveOpinion);
|
|
|
|
|
});
|
|
|
|
@ -541,7 +563,7 @@ export default {
|
|
|
|
|
left: "17%",
|
|
|
|
|
right: "1%",
|
|
|
|
|
},
|
|
|
|
|
legend: {
|
|
|
|
|
length: {
|
|
|
|
|
data: ["非敏感", "敏感"],
|
|
|
|
|
top: "3%",
|
|
|
|
|
right: "2%",
|
|
|
|
@ -568,7 +590,7 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
xAxis: {
|
|
|
|
|
// data: this.opinionTime,
|
|
|
|
|
data: ["7.23", "7.24", "7.25", "7.26", "7.27", "7.28", "7.29"],
|
|
|
|
|
data: this.date,
|
|
|
|
|
axisLine: {
|
|
|
|
|
show: true, // 隐藏X轴轴线
|
|
|
|
|
lineStyle: {
|
|
|
|
|