|
@@ -40,18 +40,18 @@ var vNode = {
|
|
|
},
|
|
|
// hotChart: null,
|
|
|
isShow:{
|
|
|
- showDynamic: true,
|
|
|
- showYearData: true,
|
|
|
- showMonthScale: true,
|
|
|
- showScaleFb:true,
|
|
|
- showBidType: true,
|
|
|
- showSaveRate: true,
|
|
|
- showScaleRate: true,
|
|
|
- showClient: true,
|
|
|
- showCapital: true,
|
|
|
- showAge:true,
|
|
|
- showArea:true,
|
|
|
- showAgency: true
|
|
|
+ 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:{
|
|
@@ -138,7 +138,7 @@ var vNode = {
|
|
|
},
|
|
|
computedClientList: function (){
|
|
|
return this.clientList.map(function (v) {
|
|
|
- v.topData = v.topData.filter(function(s) {
|
|
|
+ v.topData = v.topData.filter(function(s) {
|
|
|
return s.winnerName && s.winnerName.trim().length
|
|
|
})
|
|
|
return v
|
|
@@ -204,400 +204,460 @@ var vNode = {
|
|
|
},
|
|
|
// 获取中标动态数据
|
|
|
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)) {
|
|
|
- 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') {
|
|
|
- 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 {
|
|
|
- that.isShow.showDynamic = false;
|
|
|
+ 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 {
|
|
|
- console.log(res.error_code)
|
|
|
+ } else if (that.dt.isMore === 'more') {
|
|
|
+ that.dt.isMore = 'max'
|
|
|
+ if(res.data.count <= 23) {
|
|
|
+ that.dt.isNext = false
|
|
|
+ }
|
|
|
+ } else if (that.dt.isMore === 'max') {
|
|
|
+ that.dt.isNext = false
|
|
|
}
|
|
|
- },
|
|
|
- error:function(err) {
|
|
|
- console.log(err)
|
|
|
+ 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) {
|
|
|
- // console.log(res)
|
|
|
- if(res.error_code == 0) {
|
|
|
- that.reqCount++;
|
|
|
- if(res.data && Object.keys(res.data).length > 0) {
|
|
|
- that.chartLoading = false;
|
|
|
- // 统计信息
|
|
|
- that.statistics.province = res.data.province ? res.data.province.replace(/省|市|自治区|特别行政区|壮族|回族|维吾尔/g, '') : '--';
|
|
|
- that.statistics.city = res.data.city;
|
|
|
- that.statistics.buyerClass = res.data.buyerclass ? res.data.buyerclass : '--';
|
|
|
- that.statistics.start = new Date(Number(res.data.timeRange.start + '000')).pattern('yyyy/MM/dd');
|
|
|
- that.statistics.end = new Date(Number(res.data.timeRange.end + '000')).pattern('yyyy/MM/dd');
|
|
|
- that.statistics.buyerCount = res.data.project_count ? res.data.project_count + '个' : '--';
|
|
|
- that.statistics.winnerCount = res.data.winner_count ? res.data.winner_count + '个' : '--';
|
|
|
- that.statistics.otherWinner = res.data.otherProvincesWinnerCount ? res.data.otherProvincesWinnerCount + '个' : '--';
|
|
|
- that.statistics.buyerScale = res.data.bidamount_count ? utils.moneyUnit(res.data.bidamount_count) : '--';
|
|
|
- that.statistics.fail_count = res.data.fail_count ? res.data.fail_count + '条': '--';
|
|
|
-
|
|
|
- // 年度项目统计图表数据
|
|
|
- if(res.data.yearData && Object.keys(res.data.yearData).length > 0){
|
|
|
- var rows = [];
|
|
|
- var data = res.data.yearData;
|
|
|
- for (var key in data) {
|
|
|
- rows.push({
|
|
|
- '年份': key,
|
|
|
- '项目数量': data[key].Count,
|
|
|
- '项目金额': (data[key].Money/10000).fixed(0),
|
|
|
- })
|
|
|
- }
|
|
|
- that.projectData.columns = ['年份', '项目数量', '项目金额'];
|
|
|
- that.projectData.rows = rows;
|
|
|
- } else {
|
|
|
- that.isShow.showYearData = false;
|
|
|
- }
|
|
|
- // 月度采购规模统计
|
|
|
- if(res.data.monthData && Object.keys(res.data.monthData).length > 0) {
|
|
|
- that.formatterMonthData(res.data.monthData)
|
|
|
- } else {
|
|
|
- that.isShow.showMonthScale = false;
|
|
|
- }
|
|
|
-
|
|
|
- // 采购规模分布
|
|
|
- if(res.data.moneyRange && res.data.moneyRange.length > 0) {
|
|
|
- // 数据都为0 隐藏
|
|
|
- var countArr = res.data.moneyRange.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
|
|
|
- }
|
|
|
- that.$nextTick(function(){
|
|
|
- that.getHotChartData(res.data.moneyRange);
|
|
|
- })
|
|
|
- } else {
|
|
|
- that.isShow.showScaleFb = false;
|
|
|
- }
|
|
|
-
|
|
|
- // 各类招标方式占比
|
|
|
- if(res.data.bidtypeData && res.data.bidtypeData.length > 0) {
|
|
|
- var data = res.data.bidtypeData;
|
|
|
- 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;
|
|
|
- }
|
|
|
- })
|
|
|
- that.doubleBar.list = res.data.bidtypeData;
|
|
|
- that.formatterBarChart();
|
|
|
- } else {
|
|
|
- that.isShow.showBidType = false;
|
|
|
- }
|
|
|
- // 各行业项目平均节支率
|
|
|
- if(res.data.rate && Object.keys(res.data.rate).length > 0) {
|
|
|
- that.formatterSaveRateData(res.data.rate)
|
|
|
- } else {
|
|
|
- that.isShow.showSaveRate = false
|
|
|
- }
|
|
|
- // 各行业项目规模占比
|
|
|
- if (res.data.top12 && res.data.top12.length > 0) {
|
|
|
- that.$nextTick(function(){
|
|
|
- that.getPieCharData(res.data.top12)
|
|
|
- })
|
|
|
- } else {
|
|
|
- that.isShow.showScaleRate = false
|
|
|
- }
|
|
|
- // 重点客户
|
|
|
- if (res.data.topShow && res.data.topShow.length > 0) {
|
|
|
- var data = res.data.topShow;
|
|
|
- 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')
|
|
|
- })
|
|
|
- })
|
|
|
- that.clientList = res.data.topShow;
|
|
|
- } else {
|
|
|
- that.isShow.showClient = false;
|
|
|
- }
|
|
|
- // 合作企业注册资本分布
|
|
|
- if(res.data.withCapitalData && res.data.withCapitalData.length > 0) {
|
|
|
- var columns = ['注册资本', '企业数量', '累计采购规模'];
|
|
|
- var rows = [];
|
|
|
- var capData = [];
|
|
|
- res.data.withCapitalData.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;
|
|
|
- } else {
|
|
|
- that.isShow.showCapital = false;
|
|
|
- }
|
|
|
- // 合作企业年龄分布
|
|
|
- if (res.data.withEstablishData && res.data.withEstablishData) {
|
|
|
- var ageRows = [];
|
|
|
- var customRows = []
|
|
|
- res.data.withEstablishData.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
|
|
|
- })
|
|
|
- })
|
|
|
- that.workingAgeData.rows = ageRows;
|
|
|
- that.workingAgeData.customData = customRows;
|
|
|
- } else {
|
|
|
- that.isShow.showAge = false;
|
|
|
- }
|
|
|
- // 合作企业注册地分布
|
|
|
- if (res.data.withAreaData && res.data.withAreaData.length > 0) {
|
|
|
- var areaRows = [];
|
|
|
- var custom = []
|
|
|
- res.data.withAreaData.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
|
|
|
- })
|
|
|
- })
|
|
|
- that.mapChartData.rows = areaRows;
|
|
|
- that.mapChartData.customData = custom;
|
|
|
- } else {
|
|
|
- that.isShow.showArea = false;
|
|
|
- }
|
|
|
-
|
|
|
- // 重点合作代理机构
|
|
|
- if(res.data.topAgencyData && res.data.topAgencyData.length > 0) {
|
|
|
- var data = res.data.topAgencyData;
|
|
|
- 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 + "%";
|
|
|
- })
|
|
|
- that.agencyList = res.data.topAgencyData;
|
|
|
- } else {
|
|
|
- that.isShow.showAgency = false
|
|
|
- }
|
|
|
- } else {
|
|
|
- console.log('请求了获取不到data数据,再次请求')
|
|
|
- if(that.reqCount < 3) {
|
|
|
- that.timer = setTimeout(function() {
|
|
|
- that.getChartData();
|
|
|
- })
|
|
|
- } else {
|
|
|
- console.log('请求了仍获取不到图表数据,不再请求')
|
|
|
- clearTimeout(that.timer);
|
|
|
- that.chartLoading = false;
|
|
|
- that.isShow.showDynamic = false
|
|
|
- that.isShow.showYearData = false
|
|
|
- that.isShow.showMonthScale = false
|
|
|
- that.isShow.showScaleFb = false
|
|
|
- that.isShow.showBidType = false
|
|
|
- that.isShow.showSaveRate = false
|
|
|
- that.isShow.showScaleRate = false
|
|
|
- that.isShow.showClient = false
|
|
|
- that.isShow.showCapital = false
|
|
|
- that.isShow.showAge = false
|
|
|
- that.isShow.showArea = false
|
|
|
- that.isShow.showAgency = false
|
|
|
- }
|
|
|
- }
|
|
|
- console.log(that.reqCount)
|
|
|
- }else{
|
|
|
- that.chartLoading = false;
|
|
|
- that.isShow.showDynamic = false
|
|
|
- that.isShow.showYearData = false
|
|
|
- that.isShow.showMonthScale = false
|
|
|
- that.isShow.showScaleFb = false
|
|
|
- that.isShow.showBidType = false
|
|
|
- that.isShow.showSaveRate = false
|
|
|
- that.isShow.showScaleRate = false
|
|
|
- that.isShow.showClient = false
|
|
|
- that.isShow.showCapital = false
|
|
|
- that.isShow.showAge = false
|
|
|
- that.isShow.showArea = false
|
|
|
- that.isShow.showAgency = false
|
|
|
+ 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')
|
|
|
}
|
|
|
- },
|
|
|
- error:function(err) {
|
|
|
- console.log(err)
|
|
|
+ } else {
|
|
|
+ console.log('请求了获取不到data数据,再次请求')
|
|
|
+ if (that.reqCount < 5) {
|
|
|
+ that.getSectionChartData(type)
|
|
|
+ } else {
|
|
|
+ that.chartLoading = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- })
|
|
|
+ },
|
|
|
+ error:function(err) {
|
|
|
+ console.log(err)
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
- // 处理金额区间转换
|
|
|
- formatMoneyRange: function(key){
|
|
|
- if(!key) return;
|
|
|
- if(key.indexOf('_')) {
|
|
|
- key = key.split('_');
|
|
|
- } else {
|
|
|
- key = key.split('-');
|
|
|
+ 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 = new Date(Number(data.timeRange.start + '000')).pattern('yyyy/MM/dd');
|
|
|
+ this.statistics.end = 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),
|
|
|
+ })
|
|
|
}
|
|
|
- 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];
|
|
|
+ this.projectData.columns = ['年份', '项目数量', '项目金额'];
|
|
|
+ this.projectData.rows = rows;
|
|
|
+ this.isShow.showYearData = true;
|
|
|
+ }
|
|
|
},
|
|
|
- // 处理月度采购规模数据
|
|
|
+ // 3.处理月度采购规模数据
|
|
|
formatterMonthData: function(data) {
|
|
|
- if (!data) return;
|
|
|
+ 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.push(parseInt(key))
|
|
|
}
|
|
|
yearArr.sort(function (a, b) { return a - b })
|
|
|
yearArr.forEach(function (item) {
|
|
|
- columns.push(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)
|
|
|
+ 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.monthScaleData.columns = columns;
|
|
|
+ this.monthScaleData.rows = rows;
|
|
|
+ this.isShow.showMonthScale = true;
|
|
|
} else {
|
|
|
- this.isShow.showMonthScale = false;
|
|
|
+ this.isShow.showMonthScale = false;
|
|
|
}
|
|
|
+ }
|
|
|
},
|
|
|
- // 处理行业项目平均节支率数据
|
|
|
- formatterSaveRateData: function(data) {
|
|
|
- if (!data) return;
|
|
|
+ // 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)
|
|
|
- }
|
|
|
+ if(key !== '全部行业') {
|
|
|
+ columns.push(key)
|
|
|
+ }
|
|
|
}
|
|
|
var industryArr = []
|
|
|
for (var key in data['全部行业']) {
|
|
|
- industryArr.push(key)
|
|
|
+ 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)
|
|
|
+ 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.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 {
|
|
|
- this.isShow.showSaveRate = false
|
|
|
+ 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.年度项目统计配置
|
|
@@ -1017,17 +1077,6 @@ var vNode = {
|
|
|
}
|
|
|
return options
|
|
|
},
|
|
|
- // 各类招标方式占比数据(双向柱图)
|
|
|
- formatterBarChart:function(){
|
|
|
- var that = this;
|
|
|
- var maxLeftNum = Math.max.apply(Math, that.doubleBar.list.map(function(o) {return o.numShare}))
|
|
|
- var maxRightNum = Math.max.apply(Math, that.doubleBar.list.map(function(o) {return o.moneyShare}))
|
|
|
- that.doubleBar.list.forEach(function(v,i){
|
|
|
- v.lPercent = (v.numShare/maxLeftNum*100).fixed(2);
|
|
|
- v.rPercent = (v.moneyShare/maxRightNum*100).fixed(2);
|
|
|
- })
|
|
|
- },
|
|
|
-
|
|
|
// 4.各类招标方式占比图自定义tooltip
|
|
|
tooltipHandle:function(item,index){
|
|
|
// console.log(item,index)
|