|
@@ -1,5 +1,5 @@
|
|
|
-var hotChart = null;
|
|
|
-var pieChart = null;
|
|
|
+// var hotChart = null;
|
|
|
+// var pieChart = null;
|
|
|
var vNode = {
|
|
|
delimiters: ['${', '}'],
|
|
|
el: '#unit_portrayal',
|
|
@@ -42,7 +42,6 @@ var vNode = {
|
|
|
showLine: ['项目金额'],
|
|
|
axisSite: { right: ['项目金额'] }
|
|
|
},
|
|
|
- // hotChart: null,
|
|
|
isShow:{
|
|
|
showDynamic: false,
|
|
|
showYearData: false,
|
|
@@ -117,7 +116,9 @@ var vNode = {
|
|
|
},
|
|
|
bigStatus: 0,
|
|
|
encryptId: '', // 首次埋点返回的加密id 用于点击去开通传参
|
|
|
- power: []
|
|
|
+ power: [],
|
|
|
+ hotChart: null,
|
|
|
+ pieChart: null
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -157,9 +158,26 @@ var vNode = {
|
|
|
return this.power.indexOf(5) == -1 // power == 5
|
|
|
},
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ // 监听热力图
|
|
|
+ hotChart: function (newVal) {
|
|
|
+ // console.log(newVal, chartOptions.hotChart, '热力图')
|
|
|
+ if (newVal) {
|
|
|
+ newVal.setOption(chartOptions.hotChart);
|
|
|
+ newVal.resize()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 监听饼图
|
|
|
+ pieChart: function (newVal) {
|
|
|
+ // console.log(newVal, chartOptions.deformPieChart, '饼图')
|
|
|
+ if (newVal) {
|
|
|
+ newVal.setOption(chartOptions.deformPieChart);
|
|
|
+ newVal.resize()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
created () {
|
|
|
this.getPowerInfo()
|
|
|
- this.init();
|
|
|
},
|
|
|
mounted: function () {
|
|
|
this.buyer.name = decodeURIComponent(utils.getParam('entName'))
|
|
@@ -170,20 +188,19 @@ var vNode = {
|
|
|
sessionStorage.removeItem('buyer_high_set')
|
|
|
sessionStorage.removeItem('buyer_high_name')
|
|
|
}
|
|
|
- // var storageSet = JSON.parse(sessionStorage.getItem('buyer_high_set'))
|
|
|
- // if (storageSet && this.getStatus) {
|
|
|
- this.getNewMsg(); // 中标动态
|
|
|
- this.getChartData(); // 企业画像
|
|
|
- // }
|
|
|
+
|
|
|
+ this.getNewMsg(); // 中标动态
|
|
|
+ this.getChartData(); // 企业画像
|
|
|
+ this.init();
|
|
|
},
|
|
|
beforeDestroy() {
|
|
|
- window.removeEventListener("resize", this.init,20);
|
|
|
- if(hotChart) {
|
|
|
- hotChart.dispose();
|
|
|
- }
|
|
|
- if(pieChart) {
|
|
|
- pieChart.dispose();
|
|
|
- }
|
|
|
+ window.removeEventListener("resize", this.init,20);
|
|
|
+ if(this.hotChart) {
|
|
|
+ this.hotChart.dispose();
|
|
|
+ }
|
|
|
+ if(this.pieChart) {
|
|
|
+ this.pieChart.dispose();
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
// 获取权限信息
|
|
@@ -279,11 +296,16 @@ var vNode = {
|
|
|
})
|
|
|
},
|
|
|
init() {
|
|
|
- setTimeout(function() {
|
|
|
- window.addEventListener('resize', function() {
|
|
|
- hotChart.resize();
|
|
|
- })
|
|
|
- }, 20)
|
|
|
+ setTimeout(function() {
|
|
|
+ window.addEventListener('resize', function() {
|
|
|
+ if (this.hotChart) {
|
|
|
+ this.hotChart.resize();
|
|
|
+ }
|
|
|
+ if (this.pieChart) {
|
|
|
+ this.pieChart.resize();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }, 20)
|
|
|
},
|
|
|
goEntInfo: function(item) {
|
|
|
location.href = './ent_portrait?eId=' + encodeURIComponent(item.entId)
|
|
@@ -975,30 +997,30 @@ var vNode = {
|
|
|
var index;
|
|
|
that.$nextTick(function(){
|
|
|
var ref = that.$refs.hotChart;
|
|
|
- hotChart = echarts.init(ref,null,{renderer: "svg"});
|
|
|
- hotChart.setOption(chartOptions.hotChart);
|
|
|
+ that.hotChart = echarts.init(ref,null,{renderer: "svg"});
|
|
|
+ that.hotChart.setOption(chartOptions.hotChart);
|
|
|
setTimeout(function(){
|
|
|
// 默认展示某一个tooltip
|
|
|
- hotChart.dispatchAction({
|
|
|
+ that.hotChart.dispatchAction({
|
|
|
type: 'highlight',
|
|
|
seriesIndex: 0, // 显示第几个series
|
|
|
dataIndex: that.getMaxProjectCount(data) // 显示第几个数据
|
|
|
});
|
|
|
},20)
|
|
|
- hotChart.on("mouseover", function(e) {
|
|
|
+ that.hotChart.on("mouseover", function(e) {
|
|
|
index = that.getMaxProjectCount(data)
|
|
|
if (e.dataIndex != index) {
|
|
|
- hotChart.dispatchAction({
|
|
|
+ that.hotChart.dispatchAction({
|
|
|
type: "downplay",
|
|
|
seriesIndex: 0,
|
|
|
dataIndex: index
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
- hotChart.on("mouseout", function(e) {
|
|
|
+ that.hotChart.on("mouseout", function(e) {
|
|
|
index = that.getMaxProjectCount(data)
|
|
|
if (e.dataIndex != index) {
|
|
|
- hotChart.dispatchAction({
|
|
|
+ that.hotChart.dispatchAction({
|
|
|
type: "highlight",
|
|
|
seriesIndex: 0,
|
|
|
dataIndex: that.getMaxProjectCount(data)
|
|
@@ -1080,9 +1102,9 @@ var vNode = {
|
|
|
}
|
|
|
that.$nextTick(function(){
|
|
|
var ref = that.$refs.pieChart;
|
|
|
- pieChart = echarts.init(ref,null,{renderer: "svg"});
|
|
|
- pieChart.setOption(chartOptions.deformPieChart);
|
|
|
- pieChart.resize();
|
|
|
+ that.pieChart = echarts.init(ref,null,{renderer: "svg"});
|
|
|
+ that.pieChart.setOption(chartOptions.deformPieChart);
|
|
|
+ that.pieChart.resize();
|
|
|
})
|
|
|
},
|
|
|
arrTrans: function(num, arr) { // 一维数组转换为二维数组
|