347617796@qq.com 3 년 전
부모
커밋
c94b1e9c8e
2개의 변경된 파일14개의 추가작업 그리고 12개의 파일을 삭제
  1. 1 1
      config/index.js
  2. 13 11
      src/components/integral/statistics_personal_b.vue

+ 1 - 1
config/index.js

@@ -14,7 +14,7 @@ module.exports = {
 
     // Various Dev Server settings
     host: 'localhost', // can be overwritten by process.env.HOST
-    port: 8090, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
+    port: 6682, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
     autoOpenBrowser: false,
     errorOverlay: true,
     notifyOnErrors: true,

+ 13 - 11
src/components/integral/statistics_personal_b.vue

@@ -93,7 +93,6 @@
 
 <script>
 import request from '@/utils/request'
-import echarts from 'echarts'
 import Vue from 'vue'
 import {Empty, Panel, Image, Button, Icon } from 'vant'
 import YearMonthPicker from '@/components/common/YearMonthPicker'
@@ -147,7 +146,7 @@ export default {
   methods: {
     event_list () {
       let employee_id = ''
-      this.$route.query.employee_id ? employee_id = this.$route.query.employee_id : employee_id = this.$store.getters.user_info.id
+      this.$route.query.employee_id ? employee_id = this.$route.query.employee_id : employee_id = this.$userInfo().id
       this.$router.push({name: 'event_list', query: {employee_id: employee_id}})
     },
     viewRanking () {
@@ -240,10 +239,10 @@ export default {
       if (this.employee_id) {
         params = {employee_id: this.employee_id, month: this.date_value}
       } else {
-        params = {employee_id: this.$store.getters.user_info.id, month: this.date_value}
+        params = {employee_id: this.$userInfo().id, month: this.date_value}
       }
       const mainRequest = request('get','/api/integral/statistics/b', params)
-      const pieRequest = request('get','/api/integral/statistics/pie/b', params)
+      const pieRequest = request('get','/api/integral/statistics/pie/b', params,'v2')
 
       Promise.all([mainRequest, pieRequest]).then(resArr => {
         if (resArr[0].data.code == 1) {
@@ -276,12 +275,15 @@ export default {
           this.statisticsData[2].value = b.total_point || '0'
           this.setEChartOption(xAxisData, points)
         }
-
         if (resArr[1].data.code == 1) {
           let totalPoint = 0
           const pieData = resArr[1].data.data.list.map((item, index) => {
             totalPoint += item.point
-            return {name: item.name, value: item.point, itemStyle: this.pieChartItemsStyle[index]}
+            if (item.ratio < 0) {
+              return {name: item.name, value:0,value2: item.deduction,ratio:item.ratio,itemStyle: this.pieChartItemsStyle[index]}
+            } else {
+              return {name: item.name, value: item.reward,value2: item.deduction,ratio:item.ratio,itemStyle: this.pieChartItemsStyle[index]}
+            }
           })
           this.setEchartPieOption(pieData, totalPoint)
         }
@@ -298,8 +300,8 @@ export default {
       this.pieData = pieData
       legend.formatter = (name) => {
         const item = pieData.find(o => o.name === name)
-        const ratio = (item.value / totalPoint * 100).toFixed(2)
-        return `${name} ${item.value}分 ${ratio}%`
+
+        return `${name} ${item.value}分 ${item.value2}分 ${item.ratio}%`
       }
       series.data = pieData
       this.chartPie.setOption(this.pieOption)
@@ -308,7 +310,7 @@ export default {
     get_integral_list () {
       let self = this
       let employee_id = ''
-      this.$route.query.employee_id ? employee_id = this.$route.query.employee_id : employee_id = this.$store.getters.user_info.id
+      this.$route.query.employee_id ? employee_id = this.$route.query.employee_id : employee_id = this.$userInfo().id
       let data = {page_size: 5, page: 1, employee_ids: employee_id, pt_id: '3'}
       this.$route.query.employee_id ? data['employee_ids'] = this.$route.query.employee_id : ''
       request('get','/api/integral/statistics/integral', data).then(res => {
@@ -333,8 +335,8 @@ export default {
       setTimeout(() => {
         this.get_data()
         this.initEChartOption()
-        this.chartLine = echarts.init(document.getElementById('chartLineBox'))
-        this.chartPie = echarts.init(document.getElementById('chartPieBox'))
+        this.chartLine = this.$echarts.init(document.getElementById('chartLineBox'))
+        this.chartPie = this.$echarts.init(document.getElementById('chartPieBox'))
       }, 200)
       document.querySelector('.body_com').scrollTop = 100
     })