You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

272 lines
8.3 KiB

<!--
* @Author: xw
* @Date: 2021-10-12 09:32:35
* @LastEditTime: 2021-12-29 17:11:53
* @LastEditors: Please set LastEditors
* @Description: 舆情传播趋势
* @FilePath: /data-show/src/views/BrandInsight/titsopo/index.vue
-->
<template>
<div class="tit-outter" v-loading="load">
<div class="tit-header">
<a-button type="primary" size="small" @click="goIDE" v-has="'btn_brand_datalist'">进入数据列表页</a-button>
<a-button type="primary" style="margin-left: 1rem;margin-right: 1rem;" size="small" :loading="btnLoading" @click="exportData" v-has="'btn_brand_toppt'">导出报告</a-button>
</div>
<div class="tit-inner">
<vLabel-div title="舆情传播趋势"></vLabel-div>
<div class="tit-bd">
<v-echarts :opt="opt" @clickMark="clickMark" @getData="clickEchars"></v-echarts>
</div>
</div>
<div class="con-box">
<div id="gxid" @click.prevent="boxss"></div>
<div class="vshow" v-if="modelShow" :style="modelStyle">
<vLabel-div title="实时热点事件">
<a-button @click="closeBox">关闭</a-button>
</vLabel-div>
<div class="vshow-item" v-for="(item, index) in urlArr" :key="index">
<a class="vshow-link" :href="item.url" target="tar">{{item.title}}</a>
</div>
</div>
</div>
</div>
</template>
<script>
import { getSourcetypeTime, getToPptTask } from "@/api/BrandInsight";
import {doStr} from "@/utils/gol/dataTool"
import moment from "moment";
import createOpt from "./opt";
export default {
name: "titsopo",
props: ["brand"],
data() {
return {
//弹出框//
modelStyle:{
left: '',
top: ''
},
modelShow: false,
ecbox:{//图表宽高
width:618,
height:490
},
ecmodel:{//弹框宽高
width:300,
height:280
},
//-*-//
load: false,
btnLoading: false,
form: {
token: "",
sBrand: "奥迪",
},
opt: {},
markPointUrl: '',
urlArr: []
};
},
created() {
this.form.token = this.getToken;
this.form.sBrand = this.getBrand.brandname || this.brand;
this.getData();
},
methods: {
// 获取数据
getData() {
let obj = Object.assign({}, this.getCtime2, this.form);
this.load = true;
getSourcetypeTime(obj).then((res) => {
let data = res.data || [];
let dx = [];
let ds = [];
let hotTopArr = [];
let urlArr = [];
let hotIndex = [];
data.forEach((ele) => {
let time = ele.Time;
let value = ele.Data;
dx.push(time);
ds.push(value);
if(ele.hotTop[0]) {
this.markPointUrl = ele.hotTop[0].url;
ele.hotTop.forEach((e) => {
let urlObj = {
title: doStr(e.title, 30),
url: e.url
};
urlArr.push(urlObj);
})
}
let obj = {
label: time,
hotTop: ele.hotTop
}
hotTopArr.push(obj)
});
this.urlArr = urlArr;
//获取有热点信息的索引
for(let i = 0; i<hotTopArr.length; i++) {
if(hotTopArr[i].hotTop != '') {
hotIndex.push(i)
}
}
this.opt = createOpt(dx, ds, hotTopArr, hotIndex);
this.load = false;
});
},
//
goIDE() {
if(!this.btnPrm('btn_brand_datalist')) {
return
}
let startTime = "";
let endTime = moment(new Date()).format("YYYY-MM-DD HH:mm:ss");
let cTime2 = this.getCtime2;
let sTimeType = 34;
sTimeType = cTime2.sTimeType
if(cTime2.sTimeType == 4) {
startTime = cTime2.sStartTime;
endTime = cTime2.sEndTime;
} else {
startTime = "";
endTime = ""
}
this.$router.push({
path: "/industryDataExport",
query: {
startTime,
endTime,
sTimeType,
token: this.getToken,
action: "getList",
sType: "BrandData",
brand: this.form.sBrand,
title: "-",
},
});
},
clickMark(data) {
this.modelShow = true;
let mw = window.event;
if((this.ecbox.width - mw.offsetX - 20) > this.ecmodel.width) {
this.modelStyle.left = mw.offsetX + 20 + "px"
} else {
this.modelStyle.left = mw.offsetX - this.ecmodel.width - 20 + "px"
}
if((this.ecbox.height - mw.offsetY - 20) > this.ecmodel.height) {
this.modelStyle.top = mw.offsetY + "px"
} else {
this.modelStyle.top = mw.offsetY - this.ecmodel.height + "px"
}
},
closeBox() {
this.modelShow = false;
},
boxss() {
this.modelShow = false;
},
clickEchars(data) {
if(!this.btnPrm('btn_brand_datalist')) {
return
}
let qudao = [];
let startTime = "";
let endTime = moment(new Date()).format("YYYY-MM-DD HH:mm:ss");
data.forEach((ele) => {
let seriesName = ele.seriesName;
startTime = ele.name;
qudao.push(seriesName);
});
let sTimeType = 4;
this.$router.push({
path: "/industryDataExport",
query: {
startTime,
endTime,
qudao,
sTimeType,
token: this.getToken,
action: "getList",
sType: "BrandData",
brand: this.form.sBrand,
title: "品牌-行业数据",
},
});
},
// 导出报告
exportData() {
let obj = Object.assign({}, this.getCtime2, this.form);
obj.sType = 'ToBrandPptV6'
this.btnLoading = true;
getToPptTask(obj).then(() => {
this.$notification.open({
message: `数据生成中`,
description: '请前往个人中心查看下载进度',
placement: 'bottomRight',
});
this.btnLoading = false;
})
}
},
};
</script>
<style lang="less" scoped>
.tit-outter {
width: 618px;
height: 560px;
margin-left: 16px;
.tit-header {
width: 100%;
height: 48px;
background: linear-gradient(270deg, #07192f 0%, #010b19 100%);
display: flex;
justify-content: flex-end;
align-items: center;
}
.tit-inner {
width: 100%;
height: 490px;
margin-top: 16px;
border: 2px solid #0f2a4d;
.tit-bd {
width: 100%;
height: calc(100% - 48px);
}
}
}
.pop-item {
padding: 8px;
color: white;
}
#gxid {
height: 100%;
width: 100%;
}
.con_box{
position: relative;
height: 600px;
width: 900px;
margin: 0 auto;
}
.vshow{
position: absolute;
width: 300px;
background: rgb(3, 18, 36);
border: 4px solid #0f2a4d;
.vshow-item {
padding: 11px;
width: 100%;
font-size: 15px;
.vshow-link {
color: rgb(54, 189, 239);
width: 100%;
}
}
}
</style>