|
@@ -1,5 +1,3 @@
|
|
|
-var hotChart = null;
|
|
|
-var pieChart = null;
|
|
|
var vNode = {
|
|
|
delimiters: ['${', '}'],
|
|
|
el: '#analysis-result',
|
|
@@ -103,7 +101,9 @@ var vNode = {
|
|
|
winnerVal: '',
|
|
|
buyerVal: '',
|
|
|
scrollTop: 0,
|
|
|
- defaultProjectDetail: []
|
|
|
+ defaultProjectDetail: [],
|
|
|
+ hotChartRef: null,
|
|
|
+ pieChartRef: null
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -117,6 +117,34 @@ var vNode = {
|
|
|
return 320 - 22*this.minusRows + 'px'
|
|
|
}
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ active: function(newVal) {
|
|
|
+ // 监听切换到类似项目明细 页面滚动到筛选条件位置
|
|
|
+ if (newVal == 1) {
|
|
|
+ this.$nextTick(function() {
|
|
|
+ if (this.$refs.detailFilter) {
|
|
|
+ this.$refs.detailFilter.scrollIntoView()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 监听热力图
|
|
|
+ hotChartRef: function (newVal) {
|
|
|
+ // console.log(newVal, chartOptions.hotChart, '热力图')
|
|
|
+ if (newVal) {
|
|
|
+ newVal.setOption(chartOptions.hotChart);
|
|
|
+ newVal.resize()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 监听饼图
|
|
|
+ pieChartRef: function (newVal) {
|
|
|
+ // console.log(newVal, chartOptions.deformPieChart, '饼图')
|
|
|
+ if (newVal) {
|
|
|
+ newVal.setOption(chartOptions.deformPieChart);
|
|
|
+ newVal.resize()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
created () {
|
|
|
try {
|
|
|
this.mobileModel = JyObj.getPhoneBrand();
|
|
@@ -144,7 +172,6 @@ var vNode = {
|
|
|
this.currentVal.buyerClass = prevState.currentVal.buyerClass;
|
|
|
}
|
|
|
this.isFollowProject();
|
|
|
- this.init();
|
|
|
var restore = this.restoreData()
|
|
|
if (!restore) {
|
|
|
this.getChartData();
|
|
@@ -153,18 +180,19 @@ var vNode = {
|
|
|
},
|
|
|
beforeDestroy() {
|
|
|
window.removeEventListener("resize", this.init,20);
|
|
|
- if(hotChart) {
|
|
|
- hotChart.dispose();
|
|
|
- }
|
|
|
- if(pieChart) {
|
|
|
- pieChart.dispose();
|
|
|
- }
|
|
|
+ // if(hotChart) {
|
|
|
+ // hotChart.dispose();
|
|
|
+ // }
|
|
|
+ // if(pieChart) {
|
|
|
+ // pieChart.dispose();
|
|
|
+ // }
|
|
|
},
|
|
|
mounted() {
|
|
|
this.year = new Date().getFullYear() - 2;
|
|
|
// 动态调整sticky距离顶部的高度
|
|
|
this.getStickyTop()
|
|
|
window.addEventListener('scroll', this.handleScroll, true);
|
|
|
+ this.init();
|
|
|
},
|
|
|
methods: {
|
|
|
showLoading: function () {
|
|
@@ -190,13 +218,11 @@ var vNode = {
|
|
|
// resize 屏幕尺寸
|
|
|
init: function(){
|
|
|
var that = this
|
|
|
- setTimeout(function() {
|
|
|
- window.addEventListener('resize', function() {
|
|
|
- hotChart.resize();
|
|
|
- pieChart.resize();
|
|
|
- that.screenWidth = document.body.clientWidth
|
|
|
- })
|
|
|
- }, 20)
|
|
|
+ window.addEventListener('resize', function() {
|
|
|
+ that.hotChartRef.resize();
|
|
|
+ that.pieChartRef.resize();
|
|
|
+ that.screenWidth = document.body.clientWidth || window.screen.width
|
|
|
+ })
|
|
|
},
|
|
|
// 跳企业画像
|
|
|
goEntImg:function(name) {
|
|
@@ -253,7 +279,6 @@ var vNode = {
|
|
|
},
|
|
|
getStickyTop: function () {
|
|
|
this.stickyTop = $('.jy-app-header').height() - 1;
|
|
|
- console.log(this.stickyTop)
|
|
|
},
|
|
|
// 取消关注
|
|
|
cancelFollow:function(){
|
|
@@ -690,30 +715,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.hotChartRef = echarts.init(ref,null,{renderer: "svg"});
|
|
|
+ that.hotChartRef.setOption(chartOptions.hotChart);
|
|
|
setTimeout(function(){
|
|
|
// 默认展示某一个
|
|
|
- hotChart.dispatchAction({
|
|
|
+ that.hotChartRef.dispatchAction({
|
|
|
type: 'highlight',
|
|
|
seriesIndex: 0, // 显示第几个series
|
|
|
dataIndex: that.getMaxProjectCount(data) // 最大值所在数组的索引
|
|
|
});
|
|
|
},20)
|
|
|
- hotChart.on("mouseover", function(e) {
|
|
|
+ that.hotChartRef.on("mouseover", function(e) {
|
|
|
index = that.getMaxProjectCount(data)
|
|
|
if (e.dataIndex != index) {
|
|
|
- hotChart.dispatchAction({
|
|
|
+ that.hotChartRef.dispatchAction({
|
|
|
type: "downplay",
|
|
|
seriesIndex: 0,
|
|
|
dataIndex: index
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
- hotChart.on("mouseout", function(e) {
|
|
|
+ that.hotChartRef.on("mouseout", function(e) {
|
|
|
index = that.getMaxProjectCount(data)
|
|
|
if (e.dataIndex != index) {
|
|
|
- hotChart.dispatchAction({
|
|
|
+ that.hotChartRef.dispatchAction({
|
|
|
type: "highlight",
|
|
|
seriesIndex: 0,
|
|
|
dataIndex: that.getMaxProjectCount(data)
|
|
@@ -762,7 +787,7 @@ var vNode = {
|
|
|
}
|
|
|
var maxNum = Math.max.apply(null,arr);
|
|
|
var curIndex = this.getArrayIndex(arr,maxNum,'count')
|
|
|
- console.log('最大值:'+ maxNum + ',索引:' + curIndex)
|
|
|
+ // console.log('最大值:'+ maxNum + ',索引:' + curIndex)
|
|
|
setTimeout(function(){
|
|
|
$event.dispatchAction({
|
|
|
type: 'showTip',
|
|
@@ -828,12 +853,12 @@ var vNode = {
|
|
|
var curIndex = that.getArrayIndex(data,true,'pie'); // 当前项目采购类型在饼图数组中的坐标
|
|
|
that.$nextTick(function(){
|
|
|
var ref = that.$refs.pieChart;
|
|
|
- pieChart = echarts.init(ref);
|
|
|
- pieChart.setOption(chartOptions.deformPieChart);
|
|
|
- pieChart.resize();
|
|
|
+ that.pieChartRef = echarts.init(ref);
|
|
|
+ that.pieChartRef.setOption(chartOptions.deformPieChart);
|
|
|
+ that.pieChartRef.resize();
|
|
|
if(curIndex) {
|
|
|
setTimeout(function(){
|
|
|
- pieChart.dispatchAction({
|
|
|
+ that.pieChartRef.dispatchAction({
|
|
|
type: 'showTip',
|
|
|
seriesIndex:0,
|
|
|
dataIndex: curIndex
|
|
@@ -979,9 +1004,9 @@ var vNode = {
|
|
|
this.buyerVal = buyer ? buyer : ''
|
|
|
this.scrollTop = this.$refs.wrapper.scrollTop
|
|
|
if (buyer) {
|
|
|
- this.getProjectDetail(2, winner, buyer)
|
|
|
+ this.getProjectDetail(0, winner, buyer)
|
|
|
} else {
|
|
|
- this.getProjectDetail(1, winner)
|
|
|
+ this.getProjectDetail(0, winner)
|
|
|
}
|
|
|
},
|
|
|
onTabClick (page) {
|
|
@@ -1029,7 +1054,7 @@ var vNode = {
|
|
|
appVersion: this.appVersion,
|
|
|
// 以下为新增
|
|
|
winner: winner,
|
|
|
- searchType: 3
|
|
|
+ searchType: 1
|
|
|
}
|
|
|
if (winner || buyer) {
|
|
|
sessionStorage.setItem('analysis_other_project', JSON.stringify(data))
|