lijinlong
杜函宇 1 year ago
parent 5a583c074a
commit 531a3d4eef

@ -350,6 +350,7 @@ export default {
// //
positiveOpinion: [], positiveOpinion: [],
negativeOpinion: [], negativeOpinion: [],
allDate: [],
date: [], date: [],
}; };
}, },
@ -363,8 +364,6 @@ export default {
}, },
}, },
created() { created() {
//
this.getyqData();
// //
this.getyqMsgStats(); this.getyqMsgStats();
}, },
@ -442,6 +441,7 @@ export default {
// }) // })
this.changeBtn(); this.changeBtn();
this.getFilterData(); this.getFilterData();
//
this.getyqData(); this.getyqData();
}, },
beforeDestroy() { beforeDestroy() {
@ -495,20 +495,42 @@ export default {
// //
getyqData() { getyqData() {
yuqingChart().then((res) => { 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) => { 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(); this.lineBox();
console.log(this.date);
console.log(this.negativeOpinion); console.log(this.negativeOpinion);
console.log(this.positiveOpinion); console.log(this.positiveOpinion);
}); });
@ -541,7 +563,7 @@ export default {
left: "17%", left: "17%",
right: "1%", right: "1%",
}, },
legend: { length: {
data: ["非敏感", "敏感"], data: ["非敏感", "敏感"],
top: "3%", top: "3%",
right: "2%", right: "2%",
@ -568,7 +590,7 @@ export default {
}, },
xAxis: { xAxis: {
// data: this.opinionTime, // data: this.opinionTime,
data: ["7.23", "7.24", "7.25", "7.26", "7.27", "7.28", "7.29"], data: this.date,
axisLine: { axisLine: {
show: true, // X线 show: true, // X线
lineStyle: { lineStyle: {

Loading…
Cancel
Save