|
@@ -0,0 +1,1245 @@
|
|
|
+var hotChart = null;
|
|
|
+var pieChart = null;
|
|
|
+var vNode = {
|
|
|
+ delimiters: ['${', '}'],
|
|
|
+ el: '#unit_portrayal',
|
|
|
+ components: {
|
|
|
+ hisproComponent: hisproComponent,
|
|
|
+ buyerExample: buyerExample,
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ // 修改柱状条颜色为渐变色
|
|
|
+ this.colorGreen = [new echarts.graphic.LinearGradient(
|
|
|
+ 0, 0, 0, 1,
|
|
|
+ [
|
|
|
+ {offset: 1, color: '#2ABED1'},
|
|
|
+ {offset: 0.5, color: '#2ABED1'},
|
|
|
+ {offset: 0, color: '#8DE0EB'}
|
|
|
+ ], false
|
|
|
+ ), '#FF9F40']
|
|
|
+ return {
|
|
|
+ chartLoading: true,
|
|
|
+ showAll:false,
|
|
|
+ buyer:{
|
|
|
+ name:'',
|
|
|
+ area: '',
|
|
|
+ city: '',
|
|
|
+ },
|
|
|
+ // 采购单位统计信息
|
|
|
+ statistics: {
|
|
|
+ province: '',
|
|
|
+ city: '',
|
|
|
+ buyerClass:'',
|
|
|
+ buyerCount: '',
|
|
|
+ buyerScale: '',
|
|
|
+ winnerCount:'',
|
|
|
+ otherWinner:'',
|
|
|
+ fail_count: '',
|
|
|
+ start: '',
|
|
|
+ end: ''
|
|
|
+ },
|
|
|
+ projectChartSettings:{
|
|
|
+ showLine: ['项目金额'],
|
|
|
+ axisSite: { right: ['项目金额'] }
|
|
|
+ },
|
|
|
+ // hotChart: null,
|
|
|
+ isShow:{
|
|
|
+ showDynamic: false,
|
|
|
+ showYearData: false,
|
|
|
+ showMonthScale: false,
|
|
|
+ showScaleFb:false,
|
|
|
+ showBidType: false,
|
|
|
+ showSaveRate: false,
|
|
|
+ showScaleRate: false,
|
|
|
+ showClient: false,
|
|
|
+ showCapital: false,
|
|
|
+ showAge:false,
|
|
|
+ showArea:false,
|
|
|
+ showAgency: false
|
|
|
+ },
|
|
|
+ // 中标动态
|
|
|
+ dt:{
|
|
|
+ list: [],
|
|
|
+ isMore:'',
|
|
|
+ pageCount: '',
|
|
|
+ isNext: true
|
|
|
+ },
|
|
|
+ regCapSettings:{
|
|
|
+ showLine: ['累计采购规模'],
|
|
|
+ axisSite: { right: ['累计采购规模'] },
|
|
|
+ // stack: { '注册资本分布': ['注册资本','企业数量', '采购项目数量', '平均节支率'] }
|
|
|
+ },
|
|
|
+ // 合作企业注册资本分布
|
|
|
+ regCapitalData:{
|
|
|
+ columns: ['注册资本', '企业数量', '累计采购规模'],
|
|
|
+ rows: [],
|
|
|
+ customData:[]
|
|
|
+ },
|
|
|
+ // 年度项目统计
|
|
|
+ projectData: {
|
|
|
+ columns: [],
|
|
|
+ rows: []
|
|
|
+ },
|
|
|
+ // 月度采购规模统计
|
|
|
+ monthScaleData: {
|
|
|
+ columns: [],
|
|
|
+ rows: []
|
|
|
+ },
|
|
|
+ doubleBar:{
|
|
|
+ list:[],
|
|
|
+ info:{},
|
|
|
+ showTooltip:false
|
|
|
+ },
|
|
|
+ savingsRateData:{
|
|
|
+ columns: [],
|
|
|
+ rows: []
|
|
|
+ },
|
|
|
+ // 重点合作企业
|
|
|
+ clientList:[],
|
|
|
+ workingAgeData:{
|
|
|
+ columns: ['企业年龄', '企业数量'],
|
|
|
+ rows: [],
|
|
|
+ customData:[]
|
|
|
+ },
|
|
|
+ mapChartData:{
|
|
|
+ columns: ['企业注册地', '企业数量','累计采购规模','采购项目数量','平均节支率'],
|
|
|
+ rows: [],
|
|
|
+ customData:[]
|
|
|
+ },
|
|
|
+ // 重点合作代理机构
|
|
|
+ agencyList: [],
|
|
|
+ // 热力图减去数据为0的行
|
|
|
+ minusRows:0,
|
|
|
+ reqCount: 0,
|
|
|
+ timer: null,
|
|
|
+ initRendererSvg:{
|
|
|
+ renderer:'svg'
|
|
|
+ },
|
|
|
+ bigStatus: 0,
|
|
|
+ encryptId: '', // 首次埋点返回的加密id 用于点击去开通传参
|
|
|
+ power: []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ allNot: function() {
|
|
|
+ var show_1 = this.isShow.showDynamic;
|
|
|
+ var show_2 = this.isShow.showYearData;
|
|
|
+ var show_3 = this.isShow.showMonthScale;
|
|
|
+ var show_4 = this.isShow.showScaleFb;
|
|
|
+ var show_5 = this.isShow.showBidType;
|
|
|
+ var show_6 = this.isShow.showSaveRate;
|
|
|
+ var show_7 = this.isShow.showScaleRate;
|
|
|
+ var show_8 = this.isShow.showClient;
|
|
|
+ var show_9 = this.isShow.showCapital;
|
|
|
+ var show_10 = this.isShow.showAge;
|
|
|
+ var show_11 = this.isShow.showArea;
|
|
|
+ var show_12 = this.isShow.showAgency;
|
|
|
+ if(!show_1 && !show_2 && !show_3 && !show_4 && !show_5 && !show_6 && !show_7 && !show_8 && !show_9 && !show_10 && !show_11 && !show_12 && this.power.indexOf(5) > -1) {
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ heatMapHeight: function(){
|
|
|
+ return 320 - 22*this.minusRows + 'px'
|
|
|
+ },
|
|
|
+ computedClientList: function (){
|
|
|
+ return this.clientList.map(function (v) {
|
|
|
+ v.topData = v.topData.filter(function(s) {
|
|
|
+ return s.winnerName && s.winnerName.trim().length
|
|
|
+ })
|
|
|
+ return v
|
|
|
+ }).filter(function (v,i) {
|
|
|
+ return v.topData.length
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getStatus: function () {
|
|
|
+ return this.power.indexOf(5) == -1 // power == 5
|
|
|
+ },
|
|
|
+ },
|
|
|
+ created () {
|
|
|
+ this.getPowerInfo()
|
|
|
+ this.init();
|
|
|
+ },
|
|
|
+ mounted: function () {
|
|
|
+ this.buyer.name = decodeURIComponent(utils.getParam('entName'));
|
|
|
+ this.getNewMsg(); // 中标动态
|
|
|
+ this.getChartData(); // 企业画像
|
|
|
+ },
|
|
|
+ beforeDestroy() {
|
|
|
+ window.removeEventListener("resize", this.init,20);
|
|
|
+ if(hotChart) {
|
|
|
+ hotChart.dispose();
|
|
|
+ }
|
|
|
+ if(pieChart) {
|
|
|
+ pieChart.dispose();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 获取权限信息
|
|
|
+ getPowerInfo: function () {
|
|
|
+ var _this = this
|
|
|
+ $.ajax({
|
|
|
+ type: 'GET',
|
|
|
+ url: '/bigmember/use/isAdd?t=' + Date.now(),
|
|
|
+ success: function (res) {
|
|
|
+ if (res.data) {
|
|
|
+ _this.power = res.data.power
|
|
|
+ _this.bigStatus = res.data.memberStatus
|
|
|
+ var entniche = res.data.entniche
|
|
|
+ var member = res.data.memberStatus
|
|
|
+ var vip = res.data.vipStatus
|
|
|
+ var userType = ''
|
|
|
+ if (vip > 0) {
|
|
|
+ userType = '1'
|
|
|
+ }
|
|
|
+ if (member > 0) {
|
|
|
+ if (userType !== '') {
|
|
|
+ userType += ','
|
|
|
+ }
|
|
|
+ userType += '2'
|
|
|
+ }
|
|
|
+ if (entniche) {
|
|
|
+ if (userType !== '') {
|
|
|
+ userType += ','
|
|
|
+ }
|
|
|
+ userType += '3'
|
|
|
+ }
|
|
|
+ if (userType === '') {
|
|
|
+ userType = '0'
|
|
|
+ }
|
|
|
+ // 没有采购单位画像权限的 则添加埋点
|
|
|
+ if (res.data.power.indexOf(5) === -1) {
|
|
|
+ _this.getBuried(userType)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function (error) {
|
|
|
+ console.log(error)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 进入页面埋点 非大会员用户请求
|
|
|
+ getBuried: function(type) {
|
|
|
+ var _this = this
|
|
|
+ var params = {
|
|
|
+ userType: type,
|
|
|
+ platform: 'W'
|
|
|
+ }
|
|
|
+ $.ajax({
|
|
|
+ type: 'POST',
|
|
|
+ url: '/publicapply/drainage/buyerunit',
|
|
|
+ contentType: "application/json",
|
|
|
+ data: JSON.stringify(params),
|
|
|
+ success: function (res) {
|
|
|
+ if (res.data && res.data.status) {
|
|
|
+ _this.encryptId = res.data.id
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function (error) {
|
|
|
+ console.log(error)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 点击去开通埋点方法
|
|
|
+ goBuyBuried: function(text) {
|
|
|
+ var _this = this
|
|
|
+ var params = {
|
|
|
+ mold: 'isCBBT',
|
|
|
+ id: _this.encryptId,
|
|
|
+ introduce: text
|
|
|
+ }
|
|
|
+ $.ajax({
|
|
|
+ type: 'POST',
|
|
|
+ url: '/publicapply/drainage/buyerunit',
|
|
|
+ contentType: "application/json",
|
|
|
+ data: JSON.stringify(params),
|
|
|
+ success: function (res) {
|
|
|
+ console.log(res)
|
|
|
+ setTimeout(function() {
|
|
|
+ location.href = '/big/wx/page/buy_commit?bid=' + _this.encryptId
|
|
|
+ }, 200)
|
|
|
+ },
|
|
|
+ error: function (error) {
|
|
|
+ console.log(error)
|
|
|
+ location.href = '/big/wx/page/buy_commit?bid=' + _this.encryptId
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ init() {
|
|
|
+ setTimeout(function() {
|
|
|
+ window.addEventListener('resize', function() {
|
|
|
+ hotChart.resize();
|
|
|
+ })
|
|
|
+ }, 20)
|
|
|
+ },
|
|
|
+ goEntInfo: function(item) {
|
|
|
+ location.href = "/weixin/frontPage/collection/sess/ent_portrait?eId=" + encodeURIComponent(item.entId)
|
|
|
+ },
|
|
|
+ // 查询采购单位地址(暂不需要)
|
|
|
+ getBuyer:function(){
|
|
|
+ var that = this;
|
|
|
+ $.ajax({
|
|
|
+ type:'POST',
|
|
|
+ url:'/bigmember/portrait/ent/buyerAddress',
|
|
|
+ data:{
|
|
|
+ entName: decodeURIComponent(utils.getParam('entName'))
|
|
|
+ },
|
|
|
+ success:function(res) {
|
|
|
+ // console.log(res)
|
|
|
+ if(res.error_code == 0) {
|
|
|
+ if(res.data.province) {
|
|
|
+ that.buyer.area = res.data.province.replace(/省|市|自治区|特别行政区|壮族|回族|维吾尔/g, '');
|
|
|
+ }
|
|
|
+ if(res.data.city){
|
|
|
+ that.buyer.city = res.data.city;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ console.log("未获取到")
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error:function(err) {
|
|
|
+ console.log(err)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 获取中标动态数据
|
|
|
+ getNewMsg: function(){
|
|
|
+ var that = this;
|
|
|
+ var data = {
|
|
|
+ buyer: decodeURIComponent(utils.getParam('entName')),
|
|
|
+ count: that.dt.pageCount,
|
|
|
+ pageSign: that.dt.isMore
|
|
|
+ }
|
|
|
+ $.ajax({
|
|
|
+ type:'POST',
|
|
|
+ url:'/bigmember/portrait/buyer/getNewMsg',
|
|
|
+ data:data,
|
|
|
+ success:function(res) {
|
|
|
+ if(res.error_code == 0) {
|
|
|
+ if (res.data.list && res.data.list.length && res.data.list.length > 0) {
|
|
|
+ that.dt.pageCount = res.data.count
|
|
|
+ if (res.data.list && $.isArray(res.data.list)) {
|
|
|
+ that.isShow.showDynamic = true;
|
|
|
+ res.data.list.forEach(function(v,i){
|
|
|
+ v.firsttime = new Date(Number(v.firsttime + '000')).pattern('yyyy/MM/dd');
|
|
|
+ v.bidamount = v.bidamount ? utils.moneyUnit(v.bidamount) : ''
|
|
|
+ })
|
|
|
+ if (!that.dt.isMore) {
|
|
|
+ that.dt.list = []
|
|
|
+ that.dt.isMore = 'more'
|
|
|
+ if(res.data.count <= 3) {
|
|
|
+ that.dt.isNext = false
|
|
|
+ }
|
|
|
+ } else if (that.dt.isMore === 'more') {
|
|
|
+ if (that.power.indexOf(5) == -1) {
|
|
|
+ that.openDialog()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ that.dt.isMore = 'max'
|
|
|
+ if(res.data.count <= 23) {
|
|
|
+ that.dt.isNext = false
|
|
|
+ }
|
|
|
+ } else if (that.dt.isMore === 'max') {
|
|
|
+ that.dt.isNext = false
|
|
|
+ }
|
|
|
+ that.dt.list = that.dt.list.concat(res.data.list)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ console.log(res.error_code)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error:function(err) {
|
|
|
+ console.log(err)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 获取采购单位画像所有数据
|
|
|
+ getChartData: function() {
|
|
|
+ var that = this;
|
|
|
+ $.ajax({
|
|
|
+ type:'POST',
|
|
|
+ url:'/bigmember/portrait/buyer/getData',
|
|
|
+ data:{
|
|
|
+ buyer: decodeURIComponent(utils.getParam('entName'))
|
|
|
+ },
|
|
|
+ success:function(res) {
|
|
|
+ if(res.error_code == 0) {
|
|
|
+ if(res.data && Object.keys(res.data).length > 0) {
|
|
|
+ that.chartLoading = false;
|
|
|
+ that.initChartData('', res.data)
|
|
|
+ } else {
|
|
|
+ that.getSectionChartData('a')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error:function(err) {
|
|
|
+ console.log(err)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 分段获取画像数据
|
|
|
+ getSectionChartData: function(type) {
|
|
|
+ var that = this;
|
|
|
+ $.ajax({
|
|
|
+ type:'POST',
|
|
|
+ url:'/bigmember/portrait/buyer/getData',
|
|
|
+ data:{
|
|
|
+ buyer: decodeURIComponent(utils.getParam('entName')),
|
|
|
+ flag: type
|
|
|
+ },
|
|
|
+ success:function(res) {
|
|
|
+ if(res.error_code == 0) {
|
|
|
+ that.reqCount++;
|
|
|
+ if(res.data && Object.keys(res.data).length > 0) {
|
|
|
+ that.chartLoading = false;
|
|
|
+ that.initChartData(type, res.data)
|
|
|
+ if (type === 'a') {
|
|
|
+ that.reqCount = 0
|
|
|
+ that.getSectionChartData('b')
|
|
|
+ } else if (type === 'b') {
|
|
|
+ that.reqCount = 0
|
|
|
+ that.getSectionChartData('c')
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ console.log('请求了获取不到data数据,再次请求')
|
|
|
+ if (that.reqCount < 5) {
|
|
|
+ that.getSectionChartData(type)
|
|
|
+ } else {
|
|
|
+ that.chartLoading = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error:function(err) {
|
|
|
+ console.log(err)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ initChartData: function(flag, res) {
|
|
|
+ // a段数据 timeRange、city、province、buyerclass、bidamount_count、fail_count、project_count、winner_count、otherProvincesWinnerCount、yearData、monthData、moneyRange、bidtypeData、rate、top12、topAgencyData
|
|
|
+ // b段数据 topShow
|
|
|
+ // c段数据 withCapitalData、withAreaData、withEstablishData
|
|
|
+ if (flag === 'a') {
|
|
|
+ // 1.初始化画像基本信息
|
|
|
+ this.formatBaseInfo(res)
|
|
|
+ // 2.初始化年度统计数据
|
|
|
+ this.formatYearsData(res.yearData)
|
|
|
+ // 3.初始化月度统计数据
|
|
|
+ this.formatterMonthData(res.monthData)
|
|
|
+ // 4.初始化采购规模分布数据
|
|
|
+ this.formatHotData(res.moneyRange)
|
|
|
+ // 5.格式化各类招标方式占比数据
|
|
|
+ this.formatBidTypeData(res.bidtypeData)
|
|
|
+ // 6.初始化各行业项目平均节支率数据
|
|
|
+ this.formatSaveRateData(res.rate)
|
|
|
+ // 7.初始化各行业项目规模占比数据
|
|
|
+ this.formatTopData(res.top12)
|
|
|
+ // 12.初始化重点合作代理机构数据
|
|
|
+ this.formatAgencyData(res.topAgencyData)
|
|
|
+ } else if (flag === 'b') {
|
|
|
+ // 8.初始化重点合作企业数据
|
|
|
+ this.formatClientData(res.topShow)
|
|
|
+ } else if (flag === 'c') {
|
|
|
+ // 9.初始化合作企业注册资本分布数据
|
|
|
+ this.formatCapitalData(res.withCapitalData)
|
|
|
+ // 10.初始化合作企业年龄分布数据
|
|
|
+ this.formatAgeData(res.withEstablishData)
|
|
|
+ // 11.初始化合作企业注册地分布数据
|
|
|
+ this.formatAreaData(res.withAreaData)
|
|
|
+ } else {
|
|
|
+ // 1.初始化画像基本信息
|
|
|
+ this.formatBaseInfo(res)
|
|
|
+ // 2.初始化年度统计数据
|
|
|
+ this.formatYearsData(res.yearData)
|
|
|
+ // 3.初始化月度统计数据
|
|
|
+ this.formatterMonthData(res.monthData)
|
|
|
+ // 4.初始化采购规模分布数据
|
|
|
+ this.formatHotData(res.moneyRange)
|
|
|
+ // 5.格式化各类招标方式占比数据
|
|
|
+ this.formatBidTypeData(res.bidtypeData)
|
|
|
+ // 6.初始化各行业项目平均节支率数据
|
|
|
+ this.formatSaveRateData(res.rate)
|
|
|
+ // 7.初始化各行业项目规模占比数据
|
|
|
+ this.formatTopData(res.top12)
|
|
|
+ // 8.初始化重点合作企业数据
|
|
|
+ this.formatClientData(res.topShow)
|
|
|
+ // 9.初始化合作企业注册资本分布数据
|
|
|
+ this.formatCapitalData(res.withCapitalData)
|
|
|
+ // 10.初始化合作企业年龄分布数据
|
|
|
+ this.formatAgeData(res.withEstablishData)
|
|
|
+ // 11.初始化合作企业注册地分布数据
|
|
|
+ this.formatAreaData(res.withAreaData)
|
|
|
+ // 12.初始化重点合作代理机构数据
|
|
|
+ this.formatAgencyData(res.topAgencyData)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 1.处理画像基本信息数据
|
|
|
+ formatBaseInfo: function(data) {
|
|
|
+ this.statistics.province = data.province ? data.province.replace(/省|市|自治区|特别行政区|壮族|回族|维吾尔/g, '') : '--';
|
|
|
+ this.statistics.city = data.city;
|
|
|
+ this.statistics.buyerClass = data.buyerclass ? data.buyerclass : '--';
|
|
|
+ this.statistics.start = data.timeRange ? new Date(Number(data.timeRange.start + '000')).pattern('yyyy/MM/dd'): '';
|
|
|
+ this.statistics.end = data.timeRange ? new Date(Number(data.timeRange.end + '000')).pattern('yyyy/MM/dd') : '';
|
|
|
+ this.statistics.buyerCount = data.project_count ? data.project_count + '个' : '--';
|
|
|
+ this.statistics.winnerCount = data.winner_count ? data.winner_count + '个' : '--';
|
|
|
+ this.statistics.otherWinner = data.otherProvincesWinnerCount ? data.otherProvincesWinnerCount + '个' : '--';
|
|
|
+ this.statistics.buyerScale = data.bidamount_count ? utils.moneyUnit(data.bidamount_count) : '--';
|
|
|
+ this.statistics.fail_count = data.fail_count ? data.fail_count + '条': '--';
|
|
|
+ },
|
|
|
+ // 2.处理年度统计数据
|
|
|
+ formatYearsData: function(data) {
|
|
|
+ if(data && Object.keys(data).length > 0){
|
|
|
+ var rows = [];
|
|
|
+ for (var key in data) {
|
|
|
+ rows.push({
|
|
|
+ '年份': key,
|
|
|
+ '项目数量': data[key].Count,
|
|
|
+ '项目金额': (data[key].Money/10000).fixed(0),
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.projectData.columns = ['年份', '项目数量', '项目金额'];
|
|
|
+ this.projectData.rows = rows;
|
|
|
+ this.isShow.showYearData = true;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 3.处理月度采购规模数据
|
|
|
+ formatterMonthData: function(data) {
|
|
|
+ if (data && Object.keys(data).length > 0) {
|
|
|
+ var rows = [];
|
|
|
+ var columns = ['月份'];
|
|
|
+ var count = 0;
|
|
|
+ var yearArr = []
|
|
|
+ for (var key in data) {
|
|
|
+ yearArr.push(parseInt(key))
|
|
|
+ }
|
|
|
+ yearArr.sort(function (a, b) { return a - b })
|
|
|
+ yearArr.forEach(function (item) {
|
|
|
+ columns.push(item + '年')
|
|
|
+ })
|
|
|
+ for (var i = 1; i <= 12; i++) {
|
|
|
+ var columnsItem = {}
|
|
|
+ columns.forEach(function (item) {
|
|
|
+ var value = ''
|
|
|
+ if (item == '月份') {
|
|
|
+ value = i + '月'
|
|
|
+ } else if (/年/g.test(item)) {
|
|
|
+ if (data[item.slice(0, -1)]) {
|
|
|
+ value = data[item.slice(0, -1)][i];
|
|
|
+ value = (value /10000).fixed(2);
|
|
|
+ count += value
|
|
|
+ }
|
|
|
+ }
|
|
|
+ columnsItem[item] = value
|
|
|
+ })
|
|
|
+ rows.push(columnsItem)
|
|
|
+ }
|
|
|
+ // 数据总量为0,不赋值
|
|
|
+ if (count != 0) {
|
|
|
+ this.monthScaleData.columns = columns;
|
|
|
+ this.monthScaleData.rows = rows;
|
|
|
+ this.isShow.showMonthScale = true;
|
|
|
+ } else {
|
|
|
+ this.isShow.showMonthScale = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 4.处理采购规模分布数据
|
|
|
+ formatHotData: function(res) {
|
|
|
+ var that = this
|
|
|
+ if(res && res.length > 0) {
|
|
|
+ // 数据都为0 隐藏
|
|
|
+ var countArr = res.map(function(v){
|
|
|
+ return v.project_count;
|
|
|
+ })
|
|
|
+ var max = Math.max.apply(null,countArr);
|
|
|
+ console.log(max,'max')
|
|
|
+ if(max == 0) {
|
|
|
+ that.isShow.showScaleFb = false
|
|
|
+ } else {
|
|
|
+ that.isShow.showScaleFb = true;
|
|
|
+ that.$nextTick(function(){
|
|
|
+ that.getHotChartData(res);
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 5.处理各类招标方式占比数据
|
|
|
+ formatBidTypeData: function(data) {
|
|
|
+ // 各类招标方式占比
|
|
|
+ if(data && data.length > 0) {
|
|
|
+ data.forEach(function(item){
|
|
|
+ item.money = (item.money / 10000).fixed(2);
|
|
|
+ item.moneyShare = (item.moneyShare*100).fixed(2);
|
|
|
+ item.numShare = (item.numShare *100).fixed(2)
|
|
|
+ switch (item.type) {
|
|
|
+ case '招标':
|
|
|
+ item.type = '公开招标'
|
|
|
+ break;
|
|
|
+ case '邀标':
|
|
|
+ item.type = '邀请招标'
|
|
|
+ break;
|
|
|
+ case '询价':
|
|
|
+ item.type = '询价采购'
|
|
|
+ break;
|
|
|
+ case '单一':
|
|
|
+ item.type = '单一来源采购'
|
|
|
+ break;
|
|
|
+ case '竞价':
|
|
|
+ item.type = '竞价采购'
|
|
|
+ break;
|
|
|
+ case '竞谈':
|
|
|
+ item.type = '竞争性谈判'
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ var maxLeftNum = Math.max.apply(Math, data.map(function(o) {return o.numShare}))
|
|
|
+ var maxRightNum = Math.max.apply(Math, data.map(function(o) {return o.moneyShare}))
|
|
|
+ data.forEach(function(v,i){
|
|
|
+ v.lPercent = (v.numShare/maxLeftNum*100).fixed(2);
|
|
|
+ v.rPercent = (v.moneyShare/maxRightNum*100).fixed(2);
|
|
|
+ })
|
|
|
+ this.doubleBar.list = data;
|
|
|
+ this.isShow.showBidType = true;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 6.处理行业项目平均节支率数据
|
|
|
+ formatSaveRateData: function(data) {
|
|
|
+ if (data && Object.keys(data).length > 0) {
|
|
|
+ var rows = [];
|
|
|
+ var columns = ['日期','全部行业'];
|
|
|
+ var count = 0;
|
|
|
+ for (var key in data) {
|
|
|
+ if(key !== '全部行业') {
|
|
|
+ columns.push(key)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ var industryArr = []
|
|
|
+ for (var key in data['全部行业']) {
|
|
|
+ industryArr.push(key)
|
|
|
+ }
|
|
|
+ industryArr.sort(function (a, b) { return a - b })
|
|
|
+ industryArr.forEach(function (item) {
|
|
|
+ var rowsItem = {
|
|
|
+ '日期': item + '年'
|
|
|
+ }
|
|
|
+ for (var k in data) {
|
|
|
+ count += (data[k][item] * 100)
|
|
|
+ rowsItem[k] = data[k][item] == null ? null : (data[k][item] * 100).fixed(2)
|
|
|
+ }
|
|
|
+ rows.push(rowsItem)
|
|
|
+ })
|
|
|
+ // 数据总量为0,不赋值
|
|
|
+ if (count != 0) {
|
|
|
+ this.savingsRateData.columns = columns;
|
|
|
+ this.savingsRateData.rows = rows;
|
|
|
+ this.isShow.showSaveRate = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 7.处理各行业项目规模占比数据
|
|
|
+ formatTopData : function(data) {
|
|
|
+ var that = this
|
|
|
+ if (data && data.length > 0) {
|
|
|
+ that.isShow.showScaleRate = true
|
|
|
+ that.$nextTick(function(){
|
|
|
+ that.getPieCharData(data)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 8.处理重点合作企业数据
|
|
|
+ formatClientData: function(data) {
|
|
|
+ if (data && data.length > 0) {
|
|
|
+ data.forEach(function(v,i){
|
|
|
+ v.topData.forEach(function(s,j){
|
|
|
+ s.parent = s.countMoney / v.topData[0].countMoney*100 + "%";
|
|
|
+ s.lastTime = new Date(Number(s.lastTime + '000')).pattern('yyyy/MM/dd')
|
|
|
+ })
|
|
|
+ })
|
|
|
+ this.clientList = data;
|
|
|
+ this.isShow.showClient = true;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 9.处理合作企业注册资本分布数据
|
|
|
+ formatCapitalData: function (data) {
|
|
|
+ var that = this
|
|
|
+ if(data && data.length > 0) {
|
|
|
+ var columns = ['注册资本', '企业数量', '累计采购规模'];
|
|
|
+ var rows = [];
|
|
|
+ var capData = [];
|
|
|
+ data.forEach(function(item){
|
|
|
+ rows.push({
|
|
|
+ '注册资本': that.formatMoneyRange(item.key),
|
|
|
+ '企业数量': item.ent_count,
|
|
|
+ '累计采购规模': (item.money_count /10000).fixed(2)
|
|
|
+ })
|
|
|
+ capData.push({
|
|
|
+ '注册资本': that.formatMoneyRange(item.key),
|
|
|
+ '企业数量': item.ent_count,
|
|
|
+ '累计采购规模': (item.money_count /10000).fixed(2),
|
|
|
+ '采购项目数量': item.project_count,
|
|
|
+ '平均节支率': item.rate_avg
|
|
|
+ })
|
|
|
+ })
|
|
|
+ that.regCapitalData.columns = columns;
|
|
|
+ that.regCapitalData.rows = rows;
|
|
|
+ that.regCapitalData.customData = capData;
|
|
|
+ that.isShow.showCapital = true;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 10.处理合作企业年龄分布数据
|
|
|
+ formatAgeData: function(data) {
|
|
|
+ if (data && data.length > 0) {
|
|
|
+ var ageRows = [];
|
|
|
+ var customRows = []
|
|
|
+ data.forEach(function(item){
|
|
|
+ if(item.key == '0_1'){
|
|
|
+ item.key = '<1'
|
|
|
+ }
|
|
|
+ if(item.key == '40'){
|
|
|
+ item.key = '≥40'
|
|
|
+ }
|
|
|
+ ageRows.push({
|
|
|
+ '企业年龄': item.key.replace('_','-'),
|
|
|
+ '企业数量': item.ent_count
|
|
|
+ })
|
|
|
+ customRows.push({
|
|
|
+ '企业年龄': item.key.replace('_','-'),
|
|
|
+ '企业数量': item.ent_count,
|
|
|
+ '累计采购规模': (item.money_count /10000).fixed(2),
|
|
|
+ '采购项目数量': item.project_count,
|
|
|
+ '平均节支率': item.rate_avg
|
|
|
+ })
|
|
|
+ })
|
|
|
+ this.workingAgeData.rows = ageRows;
|
|
|
+ this.workingAgeData.customData = customRows;
|
|
|
+ this.isShow.showAge = true;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 11.处理合作企业注册地分布数据
|
|
|
+ formatAreaData: function(data) {
|
|
|
+ if (data && data.length > 0) {
|
|
|
+ var areaRows = []
|
|
|
+ var custom = []
|
|
|
+ data.forEach(function(item){
|
|
|
+ areaRows.push({
|
|
|
+ '企业注册地': item.area_name,
|
|
|
+ '企业数量': item.ent_count
|
|
|
+ })
|
|
|
+ custom.push({
|
|
|
+ '企业注册地': item.area_name,
|
|
|
+ '企业数量': item.ent_count,
|
|
|
+ '累计采购规模': (item.money_count /10000).fixed(2),
|
|
|
+ '采购项目数量': item.project_count,
|
|
|
+ '平均节支率': item.rate_avg
|
|
|
+ })
|
|
|
+ })
|
|
|
+ this.mapChartData.rows = areaRows;
|
|
|
+ this.mapChartData.customData = custom;
|
|
|
+ this.isShow.showArea = true;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 12.处理重点合作代理机构数据
|
|
|
+ formatAgencyData: function(data) {
|
|
|
+ if(data && data.length > 0) {
|
|
|
+ data.forEach(function(v,i){
|
|
|
+ v.last_with_time = new Date(Number(v.last_with_time + '000')).pattern('yyyy/MM/dd')
|
|
|
+ v.parent = v.project_count / data[0].project_count*100 + "%";
|
|
|
+ })
|
|
|
+ this.agencyList = data;
|
|
|
+ this.isShow.showAgency = true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 处理金额区间转换
|
|
|
+ formatMoneyRange: function(key){
|
|
|
+ if(!key) return;
|
|
|
+ if(key.indexOf('_')) {
|
|
|
+ key = key.split('_');
|
|
|
+ } else {
|
|
|
+ key = key.split('-');
|
|
|
+ }
|
|
|
+ if(!key[1]) return '>' + (key[0] / 100000000).fixed(2) + '亿';
|
|
|
+ key[0] = key[0] >= 100000000 ? (key[0] / 100000000).fixed(2) : (key[0] / 10000).fixed(2);
|
|
|
+ key[1] = key[1] >= 100000000 ? (key[1] / 100000000).fixed(2) + '亿' : (key[1] / 10000).fixed(2) + '万';
|
|
|
+ return key[0] + '-' + key[1];
|
|
|
+ },
|
|
|
+ /* ***** 配置项部分 ******* */
|
|
|
+ // 1.年度项目统计配置
|
|
|
+ projectConfig:function(options){
|
|
|
+ var that = this;
|
|
|
+ options.grid = {
|
|
|
+ left:16,
|
|
|
+ right: 16,
|
|
|
+ top: 20,
|
|
|
+ bottom: 60
|
|
|
+ }
|
|
|
+ options.yAxis[1].axisLabel.formatter = function(value, index) {
|
|
|
+ return value.toString().replace(/,/,'');
|
|
|
+ }
|
|
|
+ options.tooltip.axisPointer.shadowStyle.color = 'rgba(42, 190, 209,0.1)';
|
|
|
+ options.legend.show = true;
|
|
|
+ options.yAxis[1].axisLabel.show = true; // 显示右侧y轴刻度
|
|
|
+ options.series[1].lineStyle.width = 2 // 折线
|
|
|
+ options.series[1].lineStyle.color = '#FF9F40'
|
|
|
+ var maxCountList = this.projectData.rows.map(function(v){
|
|
|
+ return v['项目数量']
|
|
|
+ })
|
|
|
+ var maxPriceList = this.projectData.rows.map(function(v){
|
|
|
+ return v['项目金额']
|
|
|
+ })
|
|
|
+ var maxCount = Math.ceil(Math.max.apply(null,maxCountList)).toString();// 取出数量中最大值
|
|
|
+ var maxPrice = Math.ceil(Math.max.apply(null,maxPriceList)).toString();// 取出金额中最大值
|
|
|
+ // var minPrice = Math.min.apply(null,maxPriceList);// 去除金额最小值
|
|
|
+ maxPrice = Math.ceil(maxPrice / (Math.pow(10,maxPrice.length -1))) * Math.pow(10,maxPrice.length -1)
|
|
|
+ maxCount = Math.ceil(maxCount / (Math.pow(10,maxCount.length -1))) * Math.pow(10,maxCount.length -1)
|
|
|
+ var item = options.yAxis
|
|
|
+ item[0].min = 0;
|
|
|
+ item[1].min = 0;
|
|
|
+ item[0].max = maxCount;
|
|
|
+ item[0].interval = Math.ceil(maxCount / 5);
|
|
|
+ item[1].max = maxPrice;
|
|
|
+ item[1].interval = Math.ceil((maxPrice - 0) / 5);
|
|
|
+ options.tooltip.formatter = function(params) {
|
|
|
+ return that.formatter(params)
|
|
|
+ }
|
|
|
+ options.legend.formatter = function(name) {
|
|
|
+ if(name == '项目金额') {
|
|
|
+ name = name + '(万元)-右轴'
|
|
|
+ }
|
|
|
+ if(name == '项目数量') {
|
|
|
+ name = name + '(个)'
|
|
|
+ }
|
|
|
+ return name;
|
|
|
+ }
|
|
|
+ return options
|
|
|
+ },
|
|
|
+ // 修改年度项目统计里点击浮窗显示效果
|
|
|
+ formatter: function (params) {
|
|
|
+ var tip = '';
|
|
|
+ for (var i = 0; i < params.length; i++) {
|
|
|
+ // 因柱状图颜色为渐变色,此处获取到的柱状图颜色,css不能识别,需单独设置小圆点的颜色
|
|
|
+ params[0].marker = '<span style="display:inline-block;margin-right:5px;border-radius:8px;width:8px;height:8px;background-color:#2ABED1"></span>'
|
|
|
+ if( i=== 0) {
|
|
|
+ tip = tip + params[i].marker + params[i].seriesName + ':' + params[i].value + '个' + '<br/>';
|
|
|
+ }else if(i == 1){
|
|
|
+ tip = tip + params[i].marker + params[i].seriesName + ':' + params[i].value + '万元' + '<br/>';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ tip += '<div style="padding-top:2px;text-align:center;color:#9B9CA3;">' + ' - ' + params[0].name + ' - ' + '</div>'
|
|
|
+ return tip;
|
|
|
+ },
|
|
|
+ // 2.月度采购规模统计配置(折线图)
|
|
|
+ lineChartConfig: function(options) {
|
|
|
+ options.grid.top = 15;
|
|
|
+ options.yAxis[0].splitNumber = 5;
|
|
|
+ options.tooltip.formatter = function(params) {
|
|
|
+ var tip = '';
|
|
|
+ for (var i = 0; i < params.length; i++) {
|
|
|
+ params[i].marker = '<span style="display:inline-block;margin-right:5px;border-radius:8px;width:8px;height:8px;background-color:' + params[i].color + ';"></span>'
|
|
|
+ if(!params[i].value[1] && params[i].value[1] != 0) {
|
|
|
+ tip = tip + ''
|
|
|
+ } else {
|
|
|
+ tip = tip + params[i].marker + params[i].seriesName + params[i].name + '采购规模:' + params[i].value[1].toString().replace(/,/,'') + '万元' +'<br/>';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ tip += '<div style="padding-top:2px;text-align:center;color:#9B9CA3;">' + ' - ' + params[0].name + ' - ' + '</div>'
|
|
|
+ return tip;
|
|
|
+ }
|
|
|
+ return options;
|
|
|
+ },
|
|
|
+ // 3.采购规模分布(热力图)
|
|
|
+ getHotChartData:function(arr){
|
|
|
+ var that = this;
|
|
|
+ var data = [];
|
|
|
+ var waitDelCount = 0;
|
|
|
+ var yAxis = chartOptions.hotChart.yAxis;
|
|
|
+ data = arr.map((v,i) => {
|
|
|
+ v.bidamount_avg = v.bidamount_avg == null ? '0' : v.bidamount_avg
|
|
|
+ var x = i % 10
|
|
|
+ var y = 10 - Math.ceil((i + 1)/10)
|
|
|
+ return [x,y,v.bidamount_avg,v.project_count,v.range]
|
|
|
+ })
|
|
|
+
|
|
|
+ for (var i = 9;i > -1;i--) {
|
|
|
+ var nowArr = data.slice(i*10, (i + 1)*10)
|
|
|
+ var nowDelStatus = nowArr.filter(function(v) { return v[3] > 0})
|
|
|
+ if (nowDelStatus.length > 0) {
|
|
|
+ break
|
|
|
+ } else {
|
|
|
+ waitDelCount ++
|
|
|
+ data.splice(i*10, 10)
|
|
|
+ yAxis[0].data.splice(0,1)
|
|
|
+ yAxis[1].data.splice(0,1)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ data.map(v => {
|
|
|
+ v[1] = v[1] - waitDelCount;
|
|
|
+ return v
|
|
|
+ })
|
|
|
+ console.log(waitDelCount,'减掉几行')
|
|
|
+ that.minusRows = waitDelCount;
|
|
|
+ chartOptions.hotChart.series[0].data = data;
|
|
|
+ var maxNum = Math.max.apply(Math, data.map(function(o) {return o[3]}))
|
|
|
+ chartOptions.hotChart.visualMap.max = maxNum < 10 ? 10 : maxNum;
|
|
|
+ var opt = chartOptions.hotChart;
|
|
|
+ opt.graphic[opt.graphic.length - 2].children[0].style.text = maxNum > 10 ? maxNum.toString() : '10';
|
|
|
+ opt.graphic[0].children[0].style.text = '项目数量(个)';
|
|
|
+ var pj = Math.floor((opt.visualMap.max / 5)*100)/100;
|
|
|
+ opt.visualMap[0].pieces = [
|
|
|
+ {min: 0, max: 0, color: '#FFF4EB',symbol:'rect'},
|
|
|
+ {min: 1, max: pj*1, color: '#FFE7CF',symbol:'rect'},
|
|
|
+ {min: pj*1, max: pj*2,color: '#FFCF9F',symbol:'rect'},
|
|
|
+ {min: pj*2, max: pj*3,color: '#FFB366',symbol:'rect'},
|
|
|
+ {min: pj*3, max: pj*4,color: '#F48A5D',symbol:'rect'},
|
|
|
+ {min: pj*4, color: '#F06326',symbol:'rect'},
|
|
|
+ ];
|
|
|
+ opt.series[0].tooltip.formatter = function(params){
|
|
|
+ // console.log(params.value[2])
|
|
|
+ var data = params.value[4];
|
|
|
+ var newRange = data.split('-');
|
|
|
+ var sRange = utils.moneyUnit(newRange[0]);
|
|
|
+ var mRange = utils.moneyUnit(newRange[1]);
|
|
|
+ var totalRange;
|
|
|
+ if(sRange == '10000元') {
|
|
|
+ sRange = '1万元'
|
|
|
+ }
|
|
|
+ if(mRange == '10000元') {
|
|
|
+ mRange = '1万元'
|
|
|
+ }
|
|
|
+ if(sRange == '10000万元') {
|
|
|
+ sRange = '1亿元'
|
|
|
+ }
|
|
|
+ if(mRange == '10000万元') {
|
|
|
+ mRange = '1亿元'
|
|
|
+ }
|
|
|
+ if(sRange == '100亿元') {
|
|
|
+ totalRange = sRange + '以上'
|
|
|
+ } else {
|
|
|
+ totalRange = sRange + '-' + mRange
|
|
|
+ }
|
|
|
+ var tip = '';
|
|
|
+ var count = '<span>项目数量:' + params.value[3] + '个</span></br>';
|
|
|
+ var rate = (typeof params.value[2] === 'number' && !isNaN(params.value[2])) ? '<span>平均节支率:' + (params.value[2]*100).fixed(2) + '%</span></br>' : '';
|
|
|
+ var budget = '<span>采购规模:' + totalRange + '</span></br>';
|
|
|
+ tip = budget + count + rate;
|
|
|
+ return tip;
|
|
|
+ }
|
|
|
+ chartOptions.hotChart.series.pop();
|
|
|
+ chartOptions.hotChart.graphic.pop();
|
|
|
+ var index;
|
|
|
+ that.$nextTick(function(){
|
|
|
+ var ref = that.$refs.hotChart;
|
|
|
+ hotChart = echarts.init(ref,null,{renderer: "svg"});
|
|
|
+ hotChart.setOption(chartOptions.hotChart);
|
|
|
+ setTimeout(function(){
|
|
|
+ // 默认展示某一个tooltip
|
|
|
+ hotChart.dispatchAction({
|
|
|
+ type: 'highlight',
|
|
|
+ seriesIndex: 0, // 显示第几个series
|
|
|
+ dataIndex: that.getMaxProjectCount(data) // 显示第几个数据
|
|
|
+ });
|
|
|
+ },20)
|
|
|
+ hotChart.on("mouseover", function(e) {
|
|
|
+ index = that.getMaxProjectCount(data)
|
|
|
+ if (e.dataIndex != index) {
|
|
|
+ hotChart.dispatchAction({
|
|
|
+ type: "downplay",
|
|
|
+ seriesIndex: 0,
|
|
|
+ dataIndex: index
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ hotChart.on("mouseout", function(e) {
|
|
|
+ index = that.getMaxProjectCount(data)
|
|
|
+ if (e.dataIndex != index) {
|
|
|
+ hotChart.dispatchAction({
|
|
|
+ type: "highlight",
|
|
|
+ seriesIndex: 0,
|
|
|
+ dataIndex: that.getMaxProjectCount(data)
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 4.各行业项目平均节支率
|
|
|
+ savingsRateConfig: function(options) {
|
|
|
+ var data = this.savingsRateData.rows;
|
|
|
+ var arr = [];
|
|
|
+ for (var i = 0; i < data.length; i++) {
|
|
|
+ var obj = data[i];
|
|
|
+ for (var key in obj) {
|
|
|
+ if(key !== '日期' && obj[key]){
|
|
|
+ arr.push(obj[key])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ var maxRate = Math.ceil(Math.max.apply(null,arr)).toString();
|
|
|
+ maxRate = Math.ceil(maxRate / (Math.pow(10,maxRate.length -1))) * Math.pow(10,maxRate.length -1);
|
|
|
+ console.log(maxRate)
|
|
|
+ options.color = ['#FB483D', '#05A6F3', '#0BD991', '#FF9F40','#8E6DF2','#C0C4CC'];
|
|
|
+ options.xAxis[0].axisLabel.margin = 12
|
|
|
+ options.yAxis[0].axisLabel.formatter = '{value}%';
|
|
|
+ options.yAxis[0].min = 0;
|
|
|
+ options.yAxis[0].max = maxRate;
|
|
|
+ options.yAxis[0].interval = Math.ceil(maxRate / 5);
|
|
|
+ options.grid = {
|
|
|
+ top: 20,
|
|
|
+ right: 16,
|
|
|
+ bottom: 70,
|
|
|
+ left: 10
|
|
|
+ }
|
|
|
+ options.legend.textStyle.padding = [0, 18, 0,0];
|
|
|
+ options.legend.left = 16;
|
|
|
+ options.legend.bottom = 10;
|
|
|
+ options.tooltip.formatter = function(params) {
|
|
|
+ var tip = '';
|
|
|
+ for (var i = 0; i < params.length; i++) {
|
|
|
+ params[i].marker = '<span style="display:inline-block;margin-right:5px;border-radius:8px;width:8px;height:8px;background-color:' + params[i].color + ';"></span>'
|
|
|
+ if(params[i].value[1] === undefined || params[i].value[1] === null || isNaN(params[i].value[1])) {
|
|
|
+ tip = tip + params[i].marker + params[i].seriesName + ':--<br/>';
|
|
|
+ } else {
|
|
|
+ tip = tip + params[i].marker + params[i].seriesName + ':' + params[i].value[1] +'%<br/>';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ tip += '<div style="padding-top:2px;text-align:center;color:#9B9CA3;">' + ' - ' + params[0].name + ' - ' + '</div>'
|
|
|
+ return tip;
|
|
|
+ }
|
|
|
+ return options;
|
|
|
+ },
|
|
|
+ // 5.各行业项目规模占比(饼图自定义配置)
|
|
|
+ getPieCharData: function(data) {
|
|
|
+ var that = this;
|
|
|
+ var arr = [];
|
|
|
+ // 降序排列
|
|
|
+ data.sort(function(a,b){
|
|
|
+ return b.bidamount_share - a.bidamount_share
|
|
|
+ })
|
|
|
+ data.forEach(function(item){
|
|
|
+ arr.push(item.scopeclassName,item.bidamount_share,item.bidamount_count,item.project_count,item.rate_avg)
|
|
|
+ })
|
|
|
+ var normal =['行业','采购规模占比','采购规模', '采购项目数量','平均节支率'];
|
|
|
+ var newArr = that.arrTrans(5,arr);
|
|
|
+ newArr.unshift(normal)
|
|
|
+ chartOptions.deformPieChart.dataset.source = newArr;
|
|
|
+ chartOptions.deformPieChart.tooltip.formatter = function(params){
|
|
|
+ var tip = '';
|
|
|
+ var data = params.data;
|
|
|
+ params.marker = '<span style="display:inline-block;margin-right:5px;border-radius:8px;width:8px;height:8px;background-color:' + params.color +'"></span>';
|
|
|
+ var percent = '<span style="padding-left:13px;">采购规模占比:' + (data[1]*100).fixed(2) + '%</span></br>';
|
|
|
+ var scale = '<span style="padding-left:13px;">采购规模:' + utils.moneyUnit(data[2].fixed(2)) + '</span></br>';
|
|
|
+ var count = '<span style="padding-left:13px;">采购项目数量:' + data[3] + '个</span></br>';
|
|
|
+ var rate = (typeof data[4] === 'number' && !isNaN(data[4])) ? '<span style="padding-left:13px;">平均节支率:' + (data[4]*100).fixed(2) + '%</span></br>' : '';
|
|
|
+ tip = params.marker + params.name +'<br/>' + percent + scale + count + rate
|
|
|
+ return tip;
|
|
|
+ }
|
|
|
+ that.$nextTick(function(){
|
|
|
+ var ref = that.$refs.pieChart;
|
|
|
+ pieChart = echarts.init(ref,null,{renderer: "svg"});
|
|
|
+ pieChart.setOption(chartOptions.deformPieChart);
|
|
|
+ pieChart.resize();
|
|
|
+ })
|
|
|
+ },
|
|
|
+ arrTrans: function(num, arr) { // 一维数组转换为二维数组
|
|
|
+ var iconsArr = [];
|
|
|
+ arr.forEach(function(item, index) {
|
|
|
+ var page = Math.floor(index / num); // 计算该元素为第几个素组内
|
|
|
+ if (!iconsArr[page]) { // 判断是否存在
|
|
|
+ iconsArr[page] = [];
|
|
|
+ }
|
|
|
+ iconsArr[page].push(item);
|
|
|
+ });
|
|
|
+ return iconsArr;
|
|
|
+ },
|
|
|
+ // 6.合作企业注册资本分布(柱状图+折线图配置)
|
|
|
+ regCapConfig: function (options) {
|
|
|
+ // console.log(options,'合作企业注册资本分布(柱状图+折线图)')
|
|
|
+ var customData = this.regCapitalData.customData;
|
|
|
+
|
|
|
+ var maxCountList = this.regCapitalData.rows.map(function(v){
|
|
|
+ return v['企业数量'];
|
|
|
+ })
|
|
|
+ var maxPriceList = this.regCapitalData.rows.map(function(v){
|
|
|
+ return v['累计采购规模'];
|
|
|
+ })
|
|
|
+ var maxLeft = Math.max.apply(null,maxCountList);
|
|
|
+ var maxRight = Math.max.apply(null,maxPriceList);
|
|
|
+ maxLeft = Math.ceil(maxLeft).toString();
|
|
|
+ maxRight = Math.ceil(maxRight).toString();
|
|
|
+ var l = Math.ceil(maxLeft / (Math.pow(10,maxLeft.length -1))) * Math.pow(10,maxLeft.length -1);
|
|
|
+ var r = Math.ceil(maxRight / (Math.pow(10,maxRight.length -1))) * Math.pow(10,maxRight.length -1);
|
|
|
+ var item = options.yAxis
|
|
|
+ item[0].min = 0;
|
|
|
+ item[1].min = 0;
|
|
|
+ item[0].max = l;
|
|
|
+ item[0].interval = Math.ceil(l / 5);
|
|
|
+ item[1].max = Math.ceil(r);
|
|
|
+ item[1].interval = Math.ceil((r - 0) / 5);
|
|
|
+ item[0].minInterval = 1;
|
|
|
+ options.tooltip.formatter = function(params) {
|
|
|
+ var obj = {}
|
|
|
+ var tip = '';
|
|
|
+ customData.forEach(function(v) {
|
|
|
+ if(v['注册资本'] == params[0].name) {
|
|
|
+ for(var key in v){
|
|
|
+ obj[key] = v[key];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ var regMoney = '<span>注册资本:' + obj['注册资本'] + '</span></br>';
|
|
|
+ var count = '<span>企业数量:' + obj['企业数量'] + '个</span></br>';
|
|
|
+ var scale = '<span>累计采购规模:' + obj['累计采购规模'] + '万元</span></br>';
|
|
|
+ var pCount = '<span>采购项目数量:' + obj['采购项目数量'] + '个</span></br>';
|
|
|
+ var rate = (typeof obj['平均节支率'] === 'number' && !isNaN(obj['平均节支率'])) ? '<span>平均节支率:' + (obj['平均节支率']*100).fixed(2) + '%</span></br>' : '';
|
|
|
+ tip = regMoney + count + scale + pCount + rate
|
|
|
+ return tip;
|
|
|
+ }
|
|
|
+ options.series.forEach(function(item) {
|
|
|
+ if(item.name == "累计采购规模") {
|
|
|
+ item.type = 'line'
|
|
|
+ } else {
|
|
|
+ item.type= 'bar'
|
|
|
+ item.barWidth = 12
|
|
|
+ }
|
|
|
+ })
|
|
|
+ options.legend.formatter = function(name){
|
|
|
+ if(name == "累计采购规模" ) {
|
|
|
+ name = "累计采购规模(万元)-右轴"
|
|
|
+ }
|
|
|
+ if(name == "企业数量" ) {
|
|
|
+ name = "企业数量(个)"
|
|
|
+ }
|
|
|
+ return name;
|
|
|
+ }
|
|
|
+ return options;
|
|
|
+ },
|
|
|
+ // 7.合作企业年龄分布配置项
|
|
|
+ workingAgeConfig: function(options) {
|
|
|
+ for (var i = 0; i < options.series.length; i++) {
|
|
|
+ options.series[i].barWidth = 20;
|
|
|
+ options.series[i].stack = '企业年龄分布'
|
|
|
+ }
|
|
|
+ var arr = this.workingAgeData.customData;
|
|
|
+ options.yAxis[0].minInterval = 1;
|
|
|
+ options.xAxis[0].name = '企业年龄(年)'
|
|
|
+ options.xAxis[0].axisLabel.interval = 0
|
|
|
+ options.tooltip.formatter = function(params) {
|
|
|
+ var obj = {}
|
|
|
+ var tip = '';
|
|
|
+ arr.forEach(function(v) {
|
|
|
+ if(v['企业年龄'] == params[0].name) {
|
|
|
+ for(var key in v){
|
|
|
+ obj[key] = v[key];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ var regMoney = '<span>企业年龄:' + obj['企业年龄'] + '</span></br>';
|
|
|
+ var count = '<span>企业数量:' + obj['企业数量'] + '个</span></br>';
|
|
|
+ var scale = '<span>累计采购规模:' + obj['累计采购规模'] + '万元</span></br>';
|
|
|
+ var pCount = '<span>采购项目数量:' + obj['采购项目数量'] + '个</span></br>';
|
|
|
+ var rate = (typeof obj['平均节支率'] == 'number' && !isNaN(obj['平均节支率'])) ? '<span>平均节支率:' + (obj['平均节支率']*100).fixed(2) + '%</span></br>' : '';
|
|
|
+ tip = regMoney + count + scale + pCount + rate
|
|
|
+ return tip;
|
|
|
+ }
|
|
|
+ options.color = ['#05A6F3']
|
|
|
+ return options;
|
|
|
+ },
|
|
|
+ // 8.合作企业注册地分布(地图配单独置项)
|
|
|
+ mapConfig: function(options) {
|
|
|
+ // console.log(options, '地图配置')
|
|
|
+ options.grid = {
|
|
|
+ left: 16,
|
|
|
+ right: 16
|
|
|
+ }
|
|
|
+ var arr = this.mapChartData.customData;
|
|
|
+ var maxNum = Math.max.apply(Math, arr.map(function(o) {return o['企业数量']}))
|
|
|
+ options.visualMap.min = 1;
|
|
|
+ options.visualMap.max = maxNum < 100 ? 100 : maxNum;
|
|
|
+ options.graphic[0].children[0].style.text = '企业数量(个)'
|
|
|
+ options.graphic[options.graphic.length - 1].children[0].style.text = maxNum > 100 ? maxNum : 100;
|
|
|
+ options.graphic[options.graphic.length - 1].children[1].style.text = 1;
|
|
|
+ options.tooltip.formatter = function(params) {
|
|
|
+ var obj = {}
|
|
|
+ var tip = '';
|
|
|
+ arr.forEach(function(v) {
|
|
|
+ if(v['企业注册地'] == params.name) {
|
|
|
+ for(var key in v){
|
|
|
+ obj[key] = v[key];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if(Object.keys(obj).length > 0) {
|
|
|
+ var regArea = '<span>企业注册地:' + obj['企业注册地'] + '</span></br>';
|
|
|
+ var count = '<span>企业数量:' + obj['企业数量'] + '个</span></br>';
|
|
|
+ var scale = '<span>累计采购规模:' + obj['累计采购规模'] + '万元</span></br>';
|
|
|
+ var pCount = '<span>采购项目数量:' + obj['采购项目数量'] + '个</span></br>';
|
|
|
+ var rate = (typeof obj['平均节支率'] == 'number' && !isNaN(obj['平均节支率']))? '<span>平均节支率:' + (obj['平均节支率']*100).fixed(2) + '%</span></br>' : '';
|
|
|
+ tip = regArea + count + scale + pCount + rate
|
|
|
+ } else {
|
|
|
+ tip = ''
|
|
|
+ }
|
|
|
+ return tip;
|
|
|
+ }
|
|
|
+ return options
|
|
|
+ },
|
|
|
+ // 4.各类招标方式占比图自定义tooltip
|
|
|
+ tooltipHandle:function(item,index){
|
|
|
+ // console.log(item,index)
|
|
|
+ this.doubleBar.showTooltip = true
|
|
|
+ item.positionLeft = Math.random()*100 + 'px'
|
|
|
+ item.positionTop = (index + 1)*20 + 'px'
|
|
|
+ this.doubleBar.info = item
|
|
|
+ },
|
|
|
+ openDialog: function () {
|
|
|
+ var _this = this
|
|
|
+ this.$dialog.confirm({
|
|
|
+ width: 303,
|
|
|
+ className: 'custom-dialog',
|
|
|
+ title: '您暂无使用权限',
|
|
|
+ message: '开通大会员,采购单位项目动态全面获取,帮助企业洞察采购需求,开发新客户!',
|
|
|
+ messageAlign:'left',
|
|
|
+ confirmButtonText: _this.power.indexOf(5) < 0 && _this.bigStatus > 0 ? '联系客服' : '去开通',
|
|
|
+ confirmButtonColor: '#2ABED1',
|
|
|
+ showCancelButton: true,
|
|
|
+ cancelButtonText: '取消'
|
|
|
+ }).then(function(){
|
|
|
+ if (_this.power.indexOf(5) < 0 && _this.bigStatus > 0) {
|
|
|
+ location.href = "tel: 400-108-6670"
|
|
|
+ } else {
|
|
|
+ _this.goBuyBuried('开通大会员,采购单位项目动态全面获取,帮助企业洞察采购需求,开发新客户!')
|
|
|
+ }
|
|
|
+ }).catch(function(err) {
|
|
|
+ console.log(err)
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 跳转三级页
|
|
|
+ goDetail: function(item){
|
|
|
+ if (item.id) {
|
|
|
+ var href = '/article/content/' + item.id + '.html'
|
|
|
+ location.href = href
|
|
|
+ } else {
|
|
|
+ if (this.power.indexOf(5) == -1) {
|
|
|
+ this.openDialog()
|
|
|
+ } else {
|
|
|
+ console.log('没有id')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 求最大项目数量
|
|
|
+ getMaxProjectCount: function (analysisArr) {
|
|
|
+ if (!analysisArr || !$.isArray(analysisArr)) return
|
|
|
+ var itemMaxKey = 3 // 每一项中要比较大小的索引
|
|
|
+ var arr = JSON.parse(JSON.stringify(analysisArr))
|
|
|
+ utils.bSort(arr, itemMaxKey)
|
|
|
+ var maxCount = arr[arr.length - 1][itemMaxKey];
|
|
|
+ var maxIndex = -1
|
|
|
+ analysisArr.some(function (item, index) {
|
|
|
+ var gotIt = item[itemMaxKey] == maxCount
|
|
|
+ if (gotIt) maxIndex = index
|
|
|
+ return gotIt
|
|
|
+ })
|
|
|
+ return maxIndex
|
|
|
+ },
|
|
|
+ }
|
|
|
+}
|
|
|
+var unit = new Vue(vNode)
|