فهرست منبع

fix: 图表组件等配置相关

yangfeng 4 سال پیش
والد
کامیت
388552003d

+ 6 - 0
src/components/chart/BarLineChart.vue

@@ -66,6 +66,12 @@ export default {
             show: false,
             fontSize: 12
           }
+          item[0].axisLabel.formatter = (value, index) => {
+            return value.toString().replace(/,/, '')
+          }
+          item[1].axisLabel.formatter = (value, index) => {
+            return value.toString().replace(/,/, '')
+          }
           return item
         },
         tooltip: {

+ 2 - 2
src/components/chart/DuoToneChart.vue

@@ -8,7 +8,7 @@
             <span class="item-count text-right">{{item.value}}</span>
           </div>
           <div class="item-progress">
-            <span class="item-progress-count" :class="index > 2 ? 'blue-progress' : 'yellow-progress'" :style="{width: item.parent}"></span>
+            <span class="item-progress-count" :class="index > 2 || single ? 'blue-progress' : 'yellow-progress'" :style="{width: item.parent}"></span>
           </div>
         </div>
       </div>
@@ -18,7 +18,7 @@
 <script>
 export default {
   name: 'progess-chart',
-  props: ['datas'],
+  props: ['datas', 'single'],
   data () {
     return {}
   },

+ 0 - 3
src/views/portrayal/components/EntChart.vue

@@ -396,9 +396,6 @@ export default {
       options.tooltip.axisPointer.shadowStyle.color = 'rgba(42, 190, 209,0.1)' // 修改点击柱条后背景颜色
       options.legend.show = true // 显示底部数量、金额、圆点
       options.yAxis[1].axisLabel.show = true // 显示右侧y轴刻度
-      options.yAxis[1].axisLabel.formatter = (value, index) => {
-        return value.toString().replace(/,/, '')
-      }
       const maxCountList = this.annual.data.rows.map((v) => {
         return v['项目数量']
       })

+ 0 - 3
src/views/portrayal/components/UnitChart.vue

@@ -349,9 +349,6 @@ export default {
     },
     /* ******** 配置项部分 ******* */
     configYears (options) {
-      options.yAxis[1].axisLabel.formatter = (value, index) => {
-        return value.toString().replace(/,/, '')
-      }
       options.legend.show = true
       options.yAxis[1].axisLabel.show = true // 显示右侧y轴刻度
       var maxCountList = this.years.data.rows.map((v) => {

+ 43 - 13
src/views/reportData/pageMonth.vue

@@ -78,7 +78,7 @@
         <!-- 本月中标企业注册资本分布 11-->
         <div class="chart" v-if="capitalTop.show">
           <div class="chart_title">本月中标企业注册资本分布</div>
-          <DuoToneChart :datas="capitalTop.data"></DuoToneChart>
+          <DuoToneChart :datas="capitalTop.data" :single="true"></DuoToneChart>
         </div>
         <!-- 本月中标企业中标项目数量分布 12-->
         <div class="chart" v-if="curMonthBidCount.show">
@@ -526,8 +526,8 @@ export default {
           v.value = v.count + '个'
           v.name = v.range
         })
-        this.CapitalTop.show = true
-        this.CapitalTop.data = data
+        this.capitalTop.show = true
+        this.capitalTop.data = data
       }
     },
     // 
@@ -582,9 +582,6 @@ export default {
     pScaleConfig (options) {
       options.tooltip.axisPointer.shadowStyle.color = 'rgba(5,166,243,0.1)'
       options.yAxis[1].axisLabel.show = true
-      options.yAxis[0].axisLabel.formatter = (value, index) => {
-        return value.toString().replace(/,/, '')
-      }
       const maxCountList = this.pScale.data.rows.map((v) => {
         return v['项目规模']
       })
@@ -625,6 +622,43 @@ export default {
     },
     // 本月项目规模配置
     curMonthScaleConfig (options) {
+      options.yAxis[1].axisLabel.show = true
+      const maxCountList = this.curMonthScale.data.rows.map((v) => {
+        return v['项目规模']
+      })
+      const maxPriceList = this.curMonthScale.data.rows.map((v) => {
+        return v['环比增长率(%)-右纵轴']
+      })
+      let maxLeft = Math.ceil(Math.max.apply(null, maxCountList)).toString()
+      let maxRight = Math.ceil(Math.max.apply(null, maxPriceList)).toString()
+      let minRight = Math.ceil(Math.min.apply(null, maxPriceList)).toString()
+      maxLeft = Math.ceil(maxLeft / (Math.pow(10, maxLeft.length - 1))) * Math.pow(10, maxLeft.length - 1)
+      maxRight = Math.ceil(maxRight / (Math.pow(10, maxRight.length - 1))) * Math.pow(10, maxRight.length - 1)
+      if (minRight.indexOf('-') > -1) {
+        minRight = '-' + Math.ceil(minRight.replace('-', '') / (Math.pow(10, minRight.replace('-', '').length - 1))) * Math.pow(10, minRight.replace('-', '').length - 1)
+      } else {
+        minRight = 0
+      }
+      const item = options.yAxis
+      item[0].min = 0
+      item[1].min = minRight
+      item[0].max = maxLeft
+      item[0].interval = Math.ceil(maxLeft / 5)
+      item[1].max = maxRight
+      item[1].interval = Math.ceil((maxRight - minRight) / 5)
+      if (maxRight !== minRight) {
+        item[0].min = 0
+        item[1].min = minRight
+        item[0].max = maxLeft
+        item[0].interval = Math.ceil(maxLeft / 5)
+        item[1].max = maxRight
+        item[1].interval = Math.ceil((maxRight - minRight) / 5)
+      } else {
+        options.yAxis[1].axisLabel.show = false
+      }
+      options.tooltip.formatter = (params) => {
+        return this.formatTooltip(params)
+      }
       return options
     },
     mapCountConfig (options) {
@@ -666,6 +700,9 @@ export default {
     },
     // 本月中标企业中标项目数量分布配置
     curMonthBidCountConfig (options) {
+      options.tooltip.formatter = (params) => {
+        return this.formatTooltip(params)
+      }
       return options
     },
     /* 公共函数 */
@@ -716,19 +753,12 @@ export default {
 <style lang="scss" scoped>
   .page_week{
     margin: 32px auto;
-    display: flex;
-    justify-content: space-between;
-    width: 1200px;
-    height: auto;
     .page_week_main{
-      width: 920px;
-      height: auto;
       ::v-deep .getlastmonth{
         display: none;
       }
       .week_time{
         // padding-bottom: 24px;
-        width: 920px;
         opacity: 1;
         background: #ffffff;
         border-radius: 4px;

+ 0 - 6
src/views/reportData/pageWeek.vue

@@ -339,9 +339,6 @@ export default {
     newBudgetConfig (options) {
       options.tooltip.axisPointer.shadowStyle.color = 'rgba(5,166,243,0.1)'
       options.yAxis[1].axisLabel.show = true
-      options.yAxis[0].axisLabel.formatter = (value, index) => {
-        return value.toString().replace(/,/, '')
-      }
       const maxCountList = this.newBudget.data.rows.map((v) => {
         return v['项目总预算']
       })
@@ -374,9 +371,6 @@ export default {
     newScaleConfig (options) {
       options.tooltip.axisPointer.shadowStyle.color = 'rgba(5,166,243,0.1)'
       options.yAxis[1].axisLabel.show = true
-      options.yAxis[0].axisLabel.formatter = (value, index) => {
-        return value.toString().replace(/,/, '')
-      }
       const maxCountList = this.newScale.data.rows.map((v) => {
         return v['项目总规模']
       })