|
@@ -0,0 +1,1108 @@
|
|
|
+<template>
|
|
|
+ <div class="unit-chart" v-if="showChart">
|
|
|
+ <!-- 年度项目统计 -->
|
|
|
+ <div v-if="years.show">
|
|
|
+ <div class="chart-title">年度项目统计</div>
|
|
|
+ <bar-chart id="years" :options="years.options" :datas="years.data"></bar-chart>
|
|
|
+ <div class="chart-tips text-center">注:项目金额指所有项目的中标金额之和,少数缺失的中标金额,用项目预算补充。</div>
|
|
|
+ </div>
|
|
|
+ <!-- 月度采购规模 -->
|
|
|
+ <div v-if="monthScale.show">
|
|
|
+ <div class="chart-title">月度采购规模统计</div>
|
|
|
+ <div style="padding: 0 12px 12px;font-size: 12px;color: #9B9CA3;">采购规模(万元)</div>
|
|
|
+ <line-chart ref="monthScale" :options="monthScale.options" :datas="monthScale.data"></line-chart>
|
|
|
+ <div class="chart-tips text-center">注:采购规模指中标金额,少数缺失的中标金额,用项目预算补充。</div>
|
|
|
+ </div>
|
|
|
+ <!-- 采购规模分布 -->
|
|
|
+ <div v-if="buyScaleFb.show">
|
|
|
+ <div class="chart-title">采购规模分布</div>
|
|
|
+ <div style="padding: 0 12px 12px;font-size: 12px;color: #9B9CA3;">单位(元)</div>
|
|
|
+ <hot-chart v-if="buyScaleFb.flag" ref="hotChart" :datas="buyScaleFb.data" :options="buyScaleFb.options"></hot-chart>
|
|
|
+ <div class="chart-tips">注:平均节支率=(全部项目预算-全部中标金额)/全部项目预算,是指价格减让部分与原价的比率,仅统计预算和中标金额同时存在的项目。</div>
|
|
|
+ </div>
|
|
|
+ <!-- 各类招标方式占比 -->
|
|
|
+ <div v-if="bidType.show">
|
|
|
+ <div class="chart-title">各类招标方式占比</div>
|
|
|
+ <double-bar-chart :datas="bidType.data"></double-bar-chart>
|
|
|
+ </div>
|
|
|
+ <!-- 各行业项目平均节支率 -->
|
|
|
+ <div v-if="savingsRate.show">
|
|
|
+ <div class="chart-title">各行业项目平均节支率</div>
|
|
|
+ <line-chart v-if="savingsRate.flag" :options="savingsRate.options" :datas="savingsRate.data"></line-chart>
|
|
|
+ </div>
|
|
|
+ <!-- 合作企业注册地分布 -->
|
|
|
+ <div v-if="area.show">
|
|
|
+ <div class="chart-title">合作企业注册地分布</div>
|
|
|
+ <map-chart v-if="area.flag" id="area" :options="area.options" :datas="area.data"></map-chart>
|
|
|
+ </div>
|
|
|
+ <!-- 各行业项目规模占比 -->
|
|
|
+ <div v-if="projectScale.show">
|
|
|
+ <div class="chart-title">各行业项目规模占比</div>
|
|
|
+ <pie-chart v-if="projectScale.flag" :height="'380px'" :options="projectScale.options" :datas="projectScale.data"></pie-chart>
|
|
|
+ </div>
|
|
|
+ <!-- 合作企业注册资本分布 -->
|
|
|
+ <!-- <div v-if="capital.show">
|
|
|
+ <div class="chart-title">合作企业注册资本分布</div>
|
|
|
+ <bar-chart v-if="capital.flag" id="capital" :options="capital.options" :datas="capital.data"></bar-chart>
|
|
|
+ </div> -->
|
|
|
+ <!-- 合作企业年龄分布 -->
|
|
|
+ <!-- <div v-if="age.show">
|
|
|
+ <div class="chart-title">合作企业年龄分布</div>
|
|
|
+ <bar-chart v-if="age.flag" id="age" :options="age.options" :datas="age.data"></bar-chart>
|
|
|
+ </div> -->
|
|
|
+ <!-- 重点合作代理机构 -->
|
|
|
+ <div v-if="agency.show">
|
|
|
+ <div class="chart-title">重点合作代理机构</div>
|
|
|
+ <blue-progress-chart v-if="agency.flag" from="unit" :datas="agency.data"></blue-progress-chart>
|
|
|
+ </div>
|
|
|
+ <!-- 重点合作企业 -->
|
|
|
+ <div v-if="client.data.length > 0">
|
|
|
+ <div class="chart-title">重点合作企业</div>
|
|
|
+ <progress-chart type="unit" :datas="client.data"></progress-chart>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+import BarChart from '@/components/chart/BarLineChart'
|
|
|
+import HotChart from '@/components/chart/HotChart'
|
|
|
+import LineChart from '@/components/chart/LineChart'
|
|
|
+import DoubleBarChart from '@/components/chart/DoubleBarChart'
|
|
|
+import PieChart from '@/components/chart/PieChart'
|
|
|
+import ProgressChart from '@/components/chart/ProgressChart'
|
|
|
+import MapChart from '@/components/chart/MapChart'
|
|
|
+import BlueProgressChart from '@/components/chart/BlueProgressChart'
|
|
|
+import { getUnitChart, getVipUnitChart } from '@/api/modules/'
|
|
|
+import { bSort, moneyUnit } from '@/utils/'
|
|
|
+export default {
|
|
|
+ name: 'unit-chart',
|
|
|
+ components: {
|
|
|
+ BarChart,
|
|
|
+ HotChart,
|
|
|
+ LineChart,
|
|
|
+ DoubleBarChart,
|
|
|
+ PieChart,
|
|
|
+ ProgressChart,
|
|
|
+ MapChart,
|
|
|
+ BlueProgressChart
|
|
|
+ },
|
|
|
+ props: {
|
|
|
+ params: {
|
|
|
+ type: Object,
|
|
|
+ default () {
|
|
|
+ return {}
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ allBool: [],
|
|
|
+ showChart: false,
|
|
|
+ // 年度项目统计
|
|
|
+ years: {
|
|
|
+ show: false,
|
|
|
+ data: {
|
|
|
+ columns: [],
|
|
|
+ rows: []
|
|
|
+ },
|
|
|
+ options: {
|
|
|
+ height: '326px',
|
|
|
+ colors: [new this.$echarts.graphic.LinearGradient(
|
|
|
+ 0, 1, 0, 0,
|
|
|
+ [
|
|
|
+ { offset: 1, color: '#2ABED1' },
|
|
|
+ { offset: 0.5, color: '#2ABED1' },
|
|
|
+ { offset: 0, color: '#8DE0EB' }
|
|
|
+ ], false
|
|
|
+ ), '#FF9F40'],
|
|
|
+ config: this.configYears,
|
|
|
+ settings: {
|
|
|
+ showLine: ['项目金额'],
|
|
|
+ axisSite: { right: ['项目金额'] }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 月度采购规模
|
|
|
+ monthScale: {
|
|
|
+ show: false,
|
|
|
+ data: {
|
|
|
+ columns: [],
|
|
|
+ rows: []
|
|
|
+ },
|
|
|
+ options: {
|
|
|
+ height: '326px',
|
|
|
+ colors: ['#05A6F3', '#0BD991', '#FF9F40'],
|
|
|
+ config: this.configMonthScle
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 采购规模分布
|
|
|
+ buyScaleFb: {
|
|
|
+ show: false,
|
|
|
+ flag: false,
|
|
|
+ data: [],
|
|
|
+ options: {
|
|
|
+ tooltip: {
|
|
|
+ formatter: this.configBuyScaleFb
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 各类招标方式占比
|
|
|
+ bidType: {
|
|
|
+ show: false,
|
|
|
+ data: []
|
|
|
+ },
|
|
|
+ // 各行业项目平均节支率
|
|
|
+ savingsRate: {
|
|
|
+ show: false,
|
|
|
+ flag: false,
|
|
|
+ data: {
|
|
|
+ columns: [],
|
|
|
+ rows: []
|
|
|
+ },
|
|
|
+ options: {
|
|
|
+ height: '326px',
|
|
|
+ colors: ['#FB483D', '#05A6F3', '#0BD991', '#FF9F40', '#8E6DF2', '#C0C4CC'],
|
|
|
+ config: this.configSavingsRate
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 各行业项目规模占比(饼图)
|
|
|
+ projectScale: {
|
|
|
+ show: false,
|
|
|
+ flag: false,
|
|
|
+ data: [],
|
|
|
+ // 传入的配置
|
|
|
+ options: {
|
|
|
+ tooltip: {
|
|
|
+ formatter: event
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 重点合作企业
|
|
|
+ client: {
|
|
|
+ show: false,
|
|
|
+ flag: false,
|
|
|
+ data: []
|
|
|
+ },
|
|
|
+ // 合作企业注册资本分布
|
|
|
+ capital: {
|
|
|
+ show: false,
|
|
|
+ flag: false,
|
|
|
+ data: {
|
|
|
+ columns: [],
|
|
|
+ rows: [],
|
|
|
+ customData: []
|
|
|
+ },
|
|
|
+ options: {
|
|
|
+ height: '320px',
|
|
|
+ colors: ['#05a6f3', '#FF9F40'],
|
|
|
+ config: this.configCapital,
|
|
|
+ settings: {
|
|
|
+ showLine: ['累计采购规模'],
|
|
|
+ axisSite: { right: ['累计采购规模'] }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 合作企业年龄分布
|
|
|
+ age: {
|
|
|
+ show: false,
|
|
|
+ flag: false,
|
|
|
+ data: {
|
|
|
+ columns: ['企业年龄', '企业数量'],
|
|
|
+ rows: [],
|
|
|
+ customData: []
|
|
|
+ },
|
|
|
+ options: {
|
|
|
+ height: '320px',
|
|
|
+ colors: ['#05a6f3'],
|
|
|
+ config: this.configAge
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 合作企业年龄分布
|
|
|
+ area: {
|
|
|
+ show: false,
|
|
|
+ flag: false,
|
|
|
+ data: {
|
|
|
+ columns: ['企业注册地', '企业数量', '累计采购规模', '采购项目数量', '平均节支率'],
|
|
|
+ rows: [],
|
|
|
+ customData: []
|
|
|
+ },
|
|
|
+ options: {
|
|
|
+ height: '570px',
|
|
|
+ colors: ['#05a6f3'],
|
|
|
+ config: this.configArea
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 重点合作代理机构
|
|
|
+ agency: {
|
|
|
+ show: false,
|
|
|
+ flag: false,
|
|
|
+ data: []
|
|
|
+ },
|
|
|
+ reqCount: 0,
|
|
|
+ initParams: {
|
|
|
+ buyer: this.$route.params.entName,
|
|
|
+ match: '', // 关键词
|
|
|
+ exactMatch: 0, // 模糊、精准搜索
|
|
|
+ matchRange: '', // 搜索范围
|
|
|
+ area: {}, // 地区
|
|
|
+ scopeClass: '', // 行业
|
|
|
+ timeRange: ''
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ params (newval) {
|
|
|
+ this.getChartData(newval)
|
|
|
+ },
|
|
|
+ allBool: {
|
|
|
+ handler (newval) {
|
|
|
+ this.$emit('showEmpty', newval)
|
|
|
+ },
|
|
|
+ deep: true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted () {
|
|
|
+ this.getChartData(this.initParams)
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ initData (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') {
|
|
|
+ // 基本信息
|
|
|
+ this.formatBaseInfo(res)
|
|
|
+ // 年度项目统计图表数据
|
|
|
+ this.formatYearsData(res.yearData)
|
|
|
+ // 月度采购规模
|
|
|
+ this.formatMonthScaleData(res.monthData)
|
|
|
+ // 采购规模分布
|
|
|
+ this.formatHotChartData(res.moneyRange)
|
|
|
+ // 各类招标方式占比
|
|
|
+ this.formatterBarChart(res.bidtypeData)
|
|
|
+ // 各行业项目平均节支率
|
|
|
+ this.formatSavingsRateData(res.rate)
|
|
|
+ // 各行业项目规模占比
|
|
|
+ this.formatProjectScaleData(res.top12)
|
|
|
+ // 重点合作代理机构
|
|
|
+ this.formatAgencyData(res.topAgencyData)
|
|
|
+ } else if (flag === 'b') {
|
|
|
+ // 重点合作企业
|
|
|
+ this.formatClientData(res.topShow)
|
|
|
+ } else if (flag === 'c') {
|
|
|
+ // 合作企业注册资本分布
|
|
|
+ this.formatCapitalData(res.withCapitalData)
|
|
|
+ // 合作企业年龄分布
|
|
|
+ this.formatAgeData(res.withEstablishData)
|
|
|
+ // 合作企业注册地分布
|
|
|
+ this.formatAreaData(res.withAreaData)
|
|
|
+ } else {
|
|
|
+ // 基本信息
|
|
|
+ this.formatBaseInfo(res)
|
|
|
+ // 年度项目统计图表数据
|
|
|
+ this.formatYearsData(res.yearData)
|
|
|
+ // 月度采购规模
|
|
|
+ this.formatMonthScaleData(res.monthData)
|
|
|
+ // 采购规模分布
|
|
|
+ this.formatHotChartData(res.moneyRange)
|
|
|
+ // 各类招标方式占比
|
|
|
+ this.formatterBarChart(res.bidtypeData)
|
|
|
+ // 各行业项目平均节支率
|
|
|
+ this.formatSavingsRateData(res.rate)
|
|
|
+ // 各行业项目规模占比
|
|
|
+ this.formatProjectScaleData(res.top12)
|
|
|
+ // 重点合作企业
|
|
|
+ this.formatClientData(res.topShow)
|
|
|
+ // 合作企业注册资本分布
|
|
|
+ this.formatCapitalData(res.withCapitalData)
|
|
|
+ // 合作企业年龄分布
|
|
|
+ this.formatAgeData(res.withEstablishData)
|
|
|
+ // 合作企业注册地分布
|
|
|
+ this.formatAreaData(res.withAreaData)
|
|
|
+ // 重点合作代理机构
|
|
|
+ this.formatAgencyData(res.topAgencyData)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 画像数据
|
|
|
+ async getChartData (newval) {
|
|
|
+ this.allBool = []
|
|
|
+ const info = this.$store.state.user.info
|
|
|
+ const isMember = info.memberStatus > 0 && info.power.indexOf(5) > -1
|
|
|
+ const res = isMember ? await getUnitChart(newval) : await getVipUnitChart(newval)
|
|
|
+ if (res.error_code === 0) {
|
|
|
+ if (res.data && Object.keys(res.data).length > 0) {
|
|
|
+ this.showChart = true
|
|
|
+ if (res.data.onTrial) {
|
|
|
+ this.$emit('isTrial', res.data.onTrial)
|
|
|
+ }
|
|
|
+ this.initData('', res.data)
|
|
|
+ } else {
|
|
|
+ this.getSectionChartData('a', newval)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.showChart = false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getSectionChartData (type, newval) {
|
|
|
+ const flagAjaxParams = {
|
|
|
+ buyer: decodeURIComponent(this.$route.params.entName)
|
|
|
+ }
|
|
|
+ Object.assign(flagAjaxParams, newval)
|
|
|
+ getUnitChart(flagAjaxParams).then((res) => {
|
|
|
+ if (res.error_code === 0) {
|
|
|
+ this.reqCount++
|
|
|
+ if (res.data && Object.keys(res.data).length > 0) {
|
|
|
+ this.showChart = true
|
|
|
+ this.initData('', res.data)
|
|
|
+ if (type === 'a') {
|
|
|
+ this.reqCount = 0
|
|
|
+ this.getSectionChartData('b', newval)
|
|
|
+ } else if (type === 'b') {
|
|
|
+ this.reqCount = 0
|
|
|
+ this.getSectionChartData('c', newval)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (this.reqCount < 5) {
|
|
|
+ this.getSectionChartData(type, newval)
|
|
|
+ } else {
|
|
|
+ this.showChart = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /* ******** 配置项部分 ******* */
|
|
|
+ configYears (options) {
|
|
|
+ options.legend.show = true
|
|
|
+ options.yAxis[1].axisLabel.show = true // 显示右侧y轴刻度
|
|
|
+ var maxCountList = this.years.data.rows.map((v) => {
|
|
|
+ return v['项目数量']
|
|
|
+ })
|
|
|
+ var maxPriceList = this.years.data.rows.map((v) => {
|
|
|
+ return v['项目金额']
|
|
|
+ })
|
|
|
+ let maxCount = Math.ceil(Math.max.apply(null, maxCountList)).toString()
|
|
|
+ let maxPrice = Math.ceil(Math.max.apply(null, maxPriceList)).toString()
|
|
|
+ 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)
|
|
|
+ const 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 = (params) => {
|
|
|
+ let tip = ''
|
|
|
+ for (let 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/>'
|
|
|
+ } else {}
|
|
|
+ }
|
|
|
+ tip += '<div style="padding-top:2px;text-align:center;color:#9B9CA3;">' + ' - ' + params[0].name + ' - ' + '</div>'
|
|
|
+ return tip
|
|
|
+ }
|
|
|
+ options.legend.formatter = (name) => {
|
|
|
+ if (name === '项目金额') {
|
|
|
+ name = name + '(万元)-右轴'
|
|
|
+ }
|
|
|
+ if (name === '项目数量') {
|
|
|
+ name = name + '(个)'
|
|
|
+ }
|
|
|
+ return name
|
|
|
+ }
|
|
|
+ return options
|
|
|
+ },
|
|
|
+ // 月度采购规模数据及修改配置
|
|
|
+ configMonthScle (options) {
|
|
|
+ options.tooltip.formatter = (params) => {
|
|
|
+ let tip = ''
|
|
|
+ for (let 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
|
|
|
+ },
|
|
|
+ configSavingsRate (options) {
|
|
|
+ const data = this.savingsRate.data.rows
|
|
|
+ const arr = []
|
|
|
+ for (let i = 0; i < data.length; i++) {
|
|
|
+ var obj = data[i]
|
|
|
+ for (var key in obj) {
|
|
|
+ if (key !== '日期' && obj[key]) {
|
|
|
+ arr.push(obj[key])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let 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)
|
|
|
+ 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.bottom = 10
|
|
|
+ options.tooltip.formatter = (params) => {
|
|
|
+ let tip = ''
|
|
|
+ for (let 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
|
|
|
+ },
|
|
|
+ configCapital (options) {
|
|
|
+ const customData = this.capital.data.customData
|
|
|
+ var maxCountList = this.capital.data.rows.map((v) => {
|
|
|
+ return v['企业数量']
|
|
|
+ })
|
|
|
+ var maxPriceList = this.capital.data.rows.map((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.axisPointer.shadowStyle.color = 'rgba(5, 166, 243,0.1)'
|
|
|
+ options.tooltip.formatter = (params) => {
|
|
|
+ const obj = {}
|
|
|
+ let tip = ''
|
|
|
+ customData.forEach((v) => {
|
|
|
+ if (v['注册资本'] === params[0].name) {
|
|
|
+ for (const key in v) {
|
|
|
+ obj[key] = v[key]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ const regMoney = '<span>注册资本:' + obj['注册资本'] + '</span></br>'
|
|
|
+ const count = '<span>企业数量:' + obj['企业数量'] + '个</span></br>'
|
|
|
+ const scale = '<span>累计采购规模:' + obj['累计采购规模'] + '万元</span></br>'
|
|
|
+ const pCount = '<span>采购项目数量:' + obj['采购项目数量'] + '个</span></br>'
|
|
|
+ const rate = (typeof obj['平均节支率'] === 'number' && !isNaN(obj['平均节支率'])) ? '<span>平均节支率:' + (obj['平均节支率'] * 100).fixed(2) + '%</span></br>' : ''
|
|
|
+ tip = regMoney + count + scale + pCount + rate
|
|
|
+ return tip
|
|
|
+ }
|
|
|
+ options.series.forEach((item) => {
|
|
|
+ if (item.name === '累计采购规模') {
|
|
|
+ item.type = 'line'
|
|
|
+ } else {
|
|
|
+ item.type = 'bar'
|
|
|
+ item.barWidth = 12
|
|
|
+ }
|
|
|
+ })
|
|
|
+ options.legend.formatter = (name) => {
|
|
|
+ if (name === '累计采购规模') {
|
|
|
+ name = '累计采购规模(万元)-右轴'
|
|
|
+ }
|
|
|
+ if (name === '企业数量') {
|
|
|
+ name = '企业数量(个)'
|
|
|
+ }
|
|
|
+ return name
|
|
|
+ }
|
|
|
+ return options
|
|
|
+ },
|
|
|
+ configAge (options) {
|
|
|
+ for (let i = 0; i < options.series.length; i++) {
|
|
|
+ options.series[i].barWidth = 20
|
|
|
+ options.series[i].stack = '企业年龄分布'
|
|
|
+ }
|
|
|
+ const arr = this.age.data.customData
|
|
|
+ options.yAxis[0].minInterval = 1
|
|
|
+ options.xAxis[0].name = '企业年龄(年)'
|
|
|
+ options.xAxis[0].axisLabel.interval = 0
|
|
|
+ options.tooltip.axisPointer.shadowStyle.color = 'rgba(5, 166, 243,0.1)'
|
|
|
+ options.tooltip.formatter = (params) => {
|
|
|
+ const obj = {}
|
|
|
+ let tip = ''
|
|
|
+ arr.forEach((v) => {
|
|
|
+ if (v['企业年龄'] === params[0].name) {
|
|
|
+ for (const key in v) {
|
|
|
+ obj[key] = v[key]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ const regMoney = '<span>企业年龄:' + obj['企业年龄'] + '</span></br>'
|
|
|
+ const count = '<span>企业数量:' + obj['企业数量'] + '个</span></br>'
|
|
|
+ const scale = '<span>累计采购规模:' + obj['累计采购规模'] + '万元</span></br>'
|
|
|
+ const pCount = '<span>采购项目数量:' + obj['采购项目数量'] + '个</span></br>'
|
|
|
+ const rate = (typeof obj['平均节支率'] === 'number' && !isNaN(obj['平均节支率'])) ? '<span>平均节支率:' + (obj['平均节支率'] * 100).fixed(2) + '%</span></br>' : ''
|
|
|
+ tip = regMoney + count + scale + pCount + rate
|
|
|
+ return tip
|
|
|
+ }
|
|
|
+ return options
|
|
|
+ },
|
|
|
+ configArea (options) {
|
|
|
+ const arr = this.area.data.customData
|
|
|
+ const maxNum = Math.max.apply(Math, arr.map((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 = (params) => {
|
|
|
+ const obj = {}
|
|
|
+ let tip = ''
|
|
|
+ arr.forEach((v) => {
|
|
|
+ if (v['企业注册地'] === params.name) {
|
|
|
+ for (const key in v) {
|
|
|
+ obj[key] = v[key]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (Object.keys(obj).length > 0) {
|
|
|
+ const regArea = '<span>企业注册地:' + obj['企业注册地'] + '</span></br>'
|
|
|
+ const count = '<span>企业数量:' + obj['企业数量'] + '个</span></br>'
|
|
|
+ const scale = '<span>累计采购规模:' + obj['累计采购规模'] + '万元</span></br>'
|
|
|
+ const pCount = '<span>采购项目数量:' + obj['采购项目数量'] + '个</span></br>'
|
|
|
+ const 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
|
|
|
+ },
|
|
|
+ configBuyScaleFb (params) {
|
|
|
+ const data = params.value[4]
|
|
|
+ const newRange = data.split('-')
|
|
|
+ const sRange = moneyUnit(newRange[0])
|
|
|
+ const mRange = moneyUnit(newRange[1])
|
|
|
+ let totalRange
|
|
|
+ if (sRange === '100.0亿元以上') {
|
|
|
+ totalRange = sRange
|
|
|
+ } else {
|
|
|
+ totalRange = sRange + '-' + mRange
|
|
|
+ }
|
|
|
+ let tip = ''
|
|
|
+ const count = '<span>项目数量:' + params.value[3] + '个</span></br>'
|
|
|
+ const rate = (typeof params.value[2] === 'number' && !isNaN(params.value[2])) ? '<span>平均节支率:' + (params.value[2] * 100).fixed(2) + '%</span></br>' : ''
|
|
|
+ const budget = '<span>采购规模:' + totalRange + '</span></br>'
|
|
|
+ tip = budget + count + rate
|
|
|
+ return tip
|
|
|
+ },
|
|
|
+ /* ******** 数据格式化部分 ******* */
|
|
|
+ formatBaseInfo (res) {
|
|
|
+ if (res) {
|
|
|
+ const info = {}
|
|
|
+ info.buyerName = decodeURIComponent(this.$route.params.entName)
|
|
|
+ info.province = res.province ? res.province.replace(/省|市|自治区|特别行政区|壮族|回族|维吾尔/g, '') : '--'
|
|
|
+ info.city = res.city === res.province ? '' : res.city
|
|
|
+ info.buyerClass = res.buyerclass ? res.buyerclass : '--'
|
|
|
+ if (res.timeRange) {
|
|
|
+ info.start = new Date(Number(res.timeRange.start + '000')).pattern('yyyy/MM/dd')
|
|
|
+ info.end = new Date(Number(res.timeRange.end + '000')).pattern('yyyy/MM/dd')
|
|
|
+ }
|
|
|
+ info.buyerCount = res.project_count ? res.project_count + '个' : '--'
|
|
|
+ info.winnerCount = res.winner_count ? res.winner_count + '个' : '--'
|
|
|
+ info.otherWinner = res.otherProvincesWinnerCount ? res.otherProvincesWinnerCount + '个' : '--'
|
|
|
+ info.buyerScale = res.bidamount_count ? moneyUnit(res.bidamount_count) : '--'
|
|
|
+ info.fail_count = res.fail_count ? res.fail_count + '条' : '--'
|
|
|
+ this.$emit('baseInfo', info)
|
|
|
+ if (!res.project_count && !res.winner_count && !res.otherProvincesWinnerCount && !res.bidamount_count && !res.fail_count) {
|
|
|
+ this.$emit('baseInfoBool', false)
|
|
|
+ this.allBool.push(false)
|
|
|
+ } else {
|
|
|
+ this.$emit('baseInfoBool', true)
|
|
|
+ this.allBool.push(true)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$emit('baseInfoBool', false)
|
|
|
+ this.allBool.push(false)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 格式化年度项目统计数据
|
|
|
+ formatYearsData (data) {
|
|
|
+ if (data && Object.keys(data).length) {
|
|
|
+ const rows = []
|
|
|
+ let count = 0
|
|
|
+ /* eslint-disable */
|
|
|
+ for (const key in data) {
|
|
|
+ rows.push({
|
|
|
+ '年份': key,
|
|
|
+ '项目数量': data[key].Count,
|
|
|
+ '项目金额': (data[key].Money / 10000).fixed(0)
|
|
|
+ })
|
|
|
+ count += data[key].Count
|
|
|
+ }
|
|
|
+ /* eslint-enable */
|
|
|
+ if (count !== 0) {
|
|
|
+ this.years.data.columns = ['年份', '项目数量', '项目金额']
|
|
|
+ this.years.data.rows = rows
|
|
|
+ this.years.show = true
|
|
|
+ this.allBool.push(true)
|
|
|
+ } else {
|
|
|
+ this.allBool.push(false)
|
|
|
+ this.years.show = false
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.years.show = false
|
|
|
+ this.allBool.push(false)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 格式化月度采购规模数据
|
|
|
+ formatMonthScaleData (data) {
|
|
|
+ if (data && Object.keys(data).length > 0) {
|
|
|
+ const rows = []
|
|
|
+ const columns = ['月份']
|
|
|
+ let count = 0
|
|
|
+ const allNum = []
|
|
|
+ const years = []
|
|
|
+ for (var key in data) {
|
|
|
+ years.push(parseInt(key))
|
|
|
+ for (const n in data[key]) {
|
|
|
+ allNum.push(data[key][n])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ years.sort((a, b) => { return a - b })
|
|
|
+ years.forEach(function (item) {
|
|
|
+ columns.push(item + '年')
|
|
|
+ })
|
|
|
+ for (let i = 1; i <= 12; i++) {
|
|
|
+ const columnsItem = {}
|
|
|
+ columns.forEach((item) => {
|
|
|
+ let 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)
|
|
|
+ }
|
|
|
+ const maxNum = Math.max.apply(Math, allNum.map((o) => { return o }))
|
|
|
+ // console.log('数据最大值为:', maxNum)
|
|
|
+ if (count !== 0 && maxNum !== 0) {
|
|
|
+ this.monthScale.data.columns = columns
|
|
|
+ this.monthScale.data.rows = rows
|
|
|
+ this.monthScale.show = true
|
|
|
+ this.allBool.push(true)
|
|
|
+ } else {
|
|
|
+ this.monthScale.show = false
|
|
|
+ this.allBool.push(false)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.monthScale.show = false
|
|
|
+ this.allBool.push(false)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 格式化采购规模分布(热力图)数据
|
|
|
+ formatHotChartData (arr) {
|
|
|
+ if (arr && arr.length > 0) {
|
|
|
+ const countArr = arr.map((v) => {
|
|
|
+ return v.project_count
|
|
|
+ })
|
|
|
+ const max = Math.max.apply(null, countArr)
|
|
|
+ if (max === 0) {
|
|
|
+ this.buyScaleFb.show = false
|
|
|
+ }
|
|
|
+ let data = []
|
|
|
+ data = arr.map((v, i) => {
|
|
|
+ v.bidamount_avg = v.bidamount_avg === null ? '0' : v.bidamount_avg
|
|
|
+ const x = i % 10
|
|
|
+ const y = 10 - Math.ceil((i + 1) / 10)
|
|
|
+ return [x, y, v.bidamount_avg, v.project_count, v.range]
|
|
|
+ })
|
|
|
+ this.buyScaleFb.flag = true
|
|
|
+ this.buyScaleFb.data = data
|
|
|
+ this.buyScaleFb.show = true
|
|
|
+ this.allBool.push(true)
|
|
|
+ } else {
|
|
|
+ this.allBool.push(false)
|
|
|
+ this.buyScaleFb.flag = false
|
|
|
+ this.buyScaleFb.data = []
|
|
|
+ this.buyScaleFb.show = false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 格式化各类招标方式占比数据(双向柱图)
|
|
|
+ formatterBarChart (data) {
|
|
|
+ if (data && data.length > 0) {
|
|
|
+ data.forEach((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
|
|
|
+ }
|
|
|
+ })
|
|
|
+ const newData = data
|
|
|
+ const maxLeftNum = Math.max.apply(Math, data.map((o) => { return o.numShare }))
|
|
|
+ const maxRightNum = Math.max.apply(Math, data.map((o) => { return o.moneyShare }))
|
|
|
+ newData.forEach((v) => {
|
|
|
+ v.lPercent = (v.numShare / maxLeftNum * 100).fixed(2)
|
|
|
+ v.rPercent = (v.moneyShare / maxRightNum * 100).fixed(2)
|
|
|
+ })
|
|
|
+ this.bidType.data = newData
|
|
|
+ this.bidType.show = true
|
|
|
+ this.allBool.push(true)
|
|
|
+ } else {
|
|
|
+ this.allBool.push(false)
|
|
|
+ this.bidType.data = []
|
|
|
+ this.bidType.show = false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 格式化平均节支率数据
|
|
|
+ formatSavingsRateData (data) {
|
|
|
+ if (data && Object.keys(data).length > 0) {
|
|
|
+ const rows = []
|
|
|
+ const columns = ['日期', '全部行业']
|
|
|
+ let count = 0
|
|
|
+ for (const key in data) {
|
|
|
+ if (key !== '全部行业') {
|
|
|
+ columns.push(key)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const industryArr = []
|
|
|
+ for (const key in data['全部行业']) {
|
|
|
+ industryArr.push(key)
|
|
|
+ }
|
|
|
+ industryArr.sort((a, b) => { return a - b })
|
|
|
+ industryArr.forEach((item) => {
|
|
|
+ const rowsItem = {
|
|
|
+ '日期': item + '年' // eslint-disable-line
|
|
|
+ }
|
|
|
+ for (const k in data) {
|
|
|
+ count += (data[k][item] * 100)
|
|
|
+ rowsItem[k] = data[k][item] == null ? null : (data[k][item] * 100).fixed(2)
|
|
|
+ }
|
|
|
+ rows.push(rowsItem)
|
|
|
+ })
|
|
|
+ if (count !== 0) {
|
|
|
+ this.savingsRate.data.columns = columns
|
|
|
+ this.savingsRate.data.rows = rows
|
|
|
+ this.savingsRate.show = true
|
|
|
+ this.savingsRate.flag = true
|
|
|
+ this.allBool.push(true)
|
|
|
+ } else {
|
|
|
+ this.savingsRate.show = false
|
|
|
+ this.allBool.push(false)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.savingsRate.show = false
|
|
|
+ this.allBool.push(false)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 格式化各行业项目规模占比数据
|
|
|
+ formatProjectScaleData (data) {
|
|
|
+ if (data && data.length > 0) {
|
|
|
+ const arr = []
|
|
|
+ // 降序排列
|
|
|
+ data.sort((a, b) => {
|
|
|
+ return b.bidamount_share - a.bidamount_share
|
|
|
+ })
|
|
|
+ data.forEach((item) => {
|
|
|
+ item.bidamount_share = item.bidamount_share !== null && !isNaN(item.bidamount_share) ? (item.bidamount_share * 100).fixed(2) + '%' : '--'
|
|
|
+ item.rate_avg = item.rate_avg !== null && !isNaN(item.rate_avg) ? (item.rate_avg * 100).fixed(2) + '%' : '--'
|
|
|
+ arr.push(item.scopeclassName, item.bidamount_share, item.bidamount_count, item.project_count, item.rate_avg)
|
|
|
+ })
|
|
|
+ const normal = ['行业', '采购规模占比', '采购规模', '采购项目数量', '平均节支率']
|
|
|
+ var newArr = this.arrTrans(5, arr)
|
|
|
+ newArr.unshift(normal)
|
|
|
+ this.projectScale.options.tooltip.formatter = (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] + '</span></br>'
|
|
|
+ var scale = '<span style="padding-left:13px;">采购规模:' + moneyUnit(data[2].fixed(2)) + '</span></br>'
|
|
|
+ var count = '<span style="padding-left:13px;">采购项目数量:' + data[3] + '个</span></br>'
|
|
|
+ var rate = data[4] === '--' ? '' : '<span style="padding-left:13px;">平均节支率:' + data[4] + '</span></br>'
|
|
|
+ tip = params.marker + params.name + '<br/>' + percent + scale + count + rate
|
|
|
+ return tip
|
|
|
+ }
|
|
|
+ this.projectScale.flag = true
|
|
|
+ this.projectScale.data = newArr
|
|
|
+ this.projectScale.show = true
|
|
|
+ this.allBool.push(true)
|
|
|
+ } else {
|
|
|
+ this.allBool.push(false)
|
|
|
+ this.projectScale.flag = false
|
|
|
+ this.projectScale.data = []
|
|
|
+ this.projectScale.show = false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 格式化注册资本数据
|
|
|
+ formatCapitalData (data) {
|
|
|
+ if (data && data.length > 0) {
|
|
|
+ const columns = ['注册资本', '企业数量', '累计采购规模']
|
|
|
+ const rows = []
|
|
|
+ const capData = []
|
|
|
+ data.forEach((item) => {
|
|
|
+ /* eslint-disable */
|
|
|
+ rows.push({
|
|
|
+ '注册资本': this.formatMoneyRange(item.key),
|
|
|
+ '企业数量': item.ent_count,
|
|
|
+ '累计采购规模': (item.money_count /10000).fixed(2)
|
|
|
+ })
|
|
|
+ capData.push({
|
|
|
+ '注册资本': this.formatMoneyRange(item.key),
|
|
|
+ '企业数量': item.ent_count,
|
|
|
+ '累计采购规模': (item.money_count /10000).fixed(2),
|
|
|
+ '采购项目数量': item.project_count,
|
|
|
+ '平均节支率': item.rate_avg
|
|
|
+ })
|
|
|
+ /* eslint-enable */
|
|
|
+ })
|
|
|
+ this.capital.data.columns = columns
|
|
|
+ this.capital.data.rows = rows
|
|
|
+ this.capital.data.customData = capData
|
|
|
+ this.capital.show = true
|
|
|
+ this.capital.flag = true
|
|
|
+ this.allBool.push(true)
|
|
|
+ } else {
|
|
|
+ this.allBool.push(false)
|
|
|
+ this.capital.data.columns = []
|
|
|
+ this.capital.data.rows = []
|
|
|
+ this.capital.data.customData = []
|
|
|
+ this.capital.show = false
|
|
|
+ this.capital.flag = false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 格式化企业年龄分布数据
|
|
|
+ formatAgeData (data) {
|
|
|
+ if (data && data.length > 0) {
|
|
|
+ const ageRows = []
|
|
|
+ const customRows = []
|
|
|
+ data.forEach((item) => {
|
|
|
+ if (item.key === '0_1') {
|
|
|
+ item.key = '<1'
|
|
|
+ }
|
|
|
+ if (item.key === '40') {
|
|
|
+ item.key = '≥40'
|
|
|
+ }
|
|
|
+ /* eslint-disable */
|
|
|
+ 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
|
|
|
+ })
|
|
|
+ /* eslint-enable */
|
|
|
+ })
|
|
|
+ this.age.data.rows = ageRows
|
|
|
+ this.age.data.customData = customRows
|
|
|
+ this.age.show = true
|
|
|
+ this.age.flag = true
|
|
|
+ this.allBool.push(true)
|
|
|
+ } else {
|
|
|
+ this.allBool.push(false)
|
|
|
+ this.age.data.rows = []
|
|
|
+ this.age.data.customData = []
|
|
|
+ this.age.show = false
|
|
|
+ this.age.flag = false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 格式化企业注册地分布数据
|
|
|
+ formatAreaData (data) {
|
|
|
+ if (data && data.length > 0) {
|
|
|
+ const rows = []
|
|
|
+ const custom = []
|
|
|
+ data.forEach((item) => {
|
|
|
+ /* eslint-disable */
|
|
|
+ rows.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
|
|
|
+ })
|
|
|
+ /* eslint-enable */
|
|
|
+ })
|
|
|
+ this.area.data.rows = rows
|
|
|
+ this.area.data.customData = custom
|
|
|
+ this.area.show = true
|
|
|
+ this.area.flag = true
|
|
|
+ this.allBool.push(true)
|
|
|
+ } else {
|
|
|
+ this.allBool.push(false)
|
|
|
+ this.area.data.rows = []
|
|
|
+ this.area.data.customData = []
|
|
|
+ this.area.show = false
|
|
|
+ this.area.flag = false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 格式化重点合作企业数据
|
|
|
+ formatClientData (data) {
|
|
|
+ if (data && data.length > 0) {
|
|
|
+ data.forEach((v, i) => {
|
|
|
+ v.topData.forEach((s, j) => {
|
|
|
+ s.parent = s.countMoney / v.topData[0].countMoney * 100 + '%'
|
|
|
+ s.lastTime = new Date(Number(s.lastTime + '000')).pattern('yyyy/MM/dd')
|
|
|
+ })
|
|
|
+ })
|
|
|
+ const newData = data.map((v) => {
|
|
|
+ v.topData = v.topData.filter((s) => {
|
|
|
+ return s.winnerName && s.winnerName.trim().length
|
|
|
+ })
|
|
|
+ return v
|
|
|
+ }).filter(function (v, i) {
|
|
|
+ return v.topData.length
|
|
|
+ })
|
|
|
+ this.client.data = newData
|
|
|
+ this.client.flag = true
|
|
|
+ this.client.show = true
|
|
|
+ this.allBool.push(true)
|
|
|
+ } else {
|
|
|
+ this.allBool.push(false)
|
|
|
+ this.client.data = []
|
|
|
+ this.client.flag = false
|
|
|
+ this.client.show = false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 格式化重点合作代理机构数据
|
|
|
+ formatAgencyData (data) {
|
|
|
+ if (data && data.length > 0) {
|
|
|
+ const arr = []
|
|
|
+ data.forEach((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 + '%'
|
|
|
+ arr.push({
|
|
|
+ name: v.agency_name,
|
|
|
+ count: v.project_count,
|
|
|
+ time: v.last_with_time,
|
|
|
+ parent: v.parent
|
|
|
+ })
|
|
|
+ })
|
|
|
+ this.agency.data = arr
|
|
|
+ this.agency.flag = true
|
|
|
+ this.agency.show = true
|
|
|
+ this.allBool.push(true)
|
|
|
+ } else {
|
|
|
+ this.allBool.push(false)
|
|
|
+ this.agency.data = []
|
|
|
+ this.agency.flag = false
|
|
|
+ this.agency.show = false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /* ******** 公共函数部分 ******* */
|
|
|
+ // 求最大项目数量
|
|
|
+ getMaxProjectCount (analysisArr) {
|
|
|
+ if (!analysisArr || !$.isArray(analysisArr)) return
|
|
|
+ const itemMaxKey = 3 // 每一项中要比较大小的索引
|
|
|
+ const arr = JSON.parse(JSON.stringify(analysisArr))
|
|
|
+ bSort(arr, itemMaxKey)
|
|
|
+ const maxCount = arr[arr.length - 1][itemMaxKey]
|
|
|
+ let maxIndex = -1
|
|
|
+ analysisArr.some((item, index) => {
|
|
|
+ const gotIt = item[itemMaxKey] === maxCount
|
|
|
+ if (gotIt) maxIndex = index
|
|
|
+ return gotIt
|
|
|
+ })
|
|
|
+ return maxIndex
|
|
|
+ },
|
|
|
+ // 一维数组转换为二维数组
|
|
|
+ arrTrans (num, arr) {
|
|
|
+ const newArr = []
|
|
|
+ arr.forEach((item, index) => {
|
|
|
+ // 计算该元素为第几个素组内
|
|
|
+ const page = Math.floor(index / num)
|
|
|
+ // 判断是否存在
|
|
|
+ if (!newArr[page]) {
|
|
|
+ newArr[page] = []
|
|
|
+ }
|
|
|
+ newArr[page].push(item)
|
|
|
+ })
|
|
|
+ return newArr
|
|
|
+ },
|
|
|
+ // 处理金额区间转换
|
|
|
+ formatMoneyRange (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]
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+.unit-chart{
|
|
|
+ padding: 32px 40px;
|
|
|
+ margin: 0 auto;
|
|
|
+ background: #fff;
|
|
|
+ .chart-title{
|
|
|
+ padding: 32px 0 16px;
|
|
|
+ font-size: 18px;
|
|
|
+ color: #1d1d1d;
|
|
|
+ line-height: 28px;
|
|
|
+ font-family: 'Microsoft YaHei, Microsoft YaHei-Regular';
|
|
|
+ }
|
|
|
+ .chart-tips{
|
|
|
+ padding: 0 0 32px 46px;
|
|
|
+ font-size: 12px;
|
|
|
+ color: #999999;
|
|
|
+ line-height: 20px;
|
|
|
+ }
|
|
|
+ .text-center{
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|