hfxc226 3 years ago
parent
commit
5d6d7dbe67
1 changed files with 22 additions and 16 deletions
  1. 22 16
      src/views/dashboard/CheckJobReportWeek.vue

+ 22 - 16
src/views/dashboard/CheckJobReportWeek.vue

@@ -4,7 +4,8 @@
       <div class="salesCard">
         <a-tabs default-active-key="1" size="large" :tab-bar-style="{marginBottom: '24px', paddingLeft: '16px'}">
           <div class="extra-wrapper" slot="tabBarExtraContent">
-            <a-button type="primary" icon="printer" @click="handlePrint()">打印</a-button>
+            <a-button type="primary" icon="printer" @click="getData()">刷新</a-button>
+            <a-button style="margin-left: 8px" type="primary" icon="printer" @click="handlePrint()">打印</a-button>
             <a-button style="margin-left: 8px" type="primary" @click="doExport()">导出</a-button>
             <a-select style="margin-left: 8px" @change="changeYear" v-model="queryParam.year" placeholder="请选择">
               <a-select-option
@@ -78,7 +79,6 @@ import { getWeekReport, exportWeekReport, saveWorkHour } from '@/api/report/chec
 import { Chart } from '@antv/g2'
 import PrintInCheckJobReportWeek from '@/views/dashboard/modules/PrintInCheckJobReportWeek'
 import DetailCheckJobReport from '@/views/dashboard/modules/DetailCheckJobReport'
-import { addSbType } from '@/api/sb/type'
 
 export default {
   name: 'Analysis',
@@ -89,6 +89,7 @@ export default {
   },
   data () {
     return {
+      confirmLoading: false,
       loading: false,
       serverData: [],
       queryParam: {
@@ -157,25 +158,24 @@ export default {
     },
     changeYear (value) {
       this.queryParam.year = value
-      getWeekReport(this.queryParam)
-        .then(res => {
-          this.chartsData = res.data
-
-          // 需要将数据分组:总数,完成数
-          /* const groupData = []
-          this.chartsData.forEach(function (data) {
-            groupData.push({ name: '总数', month: data.month, num: data.totalNum })
-            groupData.push({ name: '完成数', month: data.month, num: data.totalFinishNum })
-          }) */
-          this.getCharts('container', this.chartsData)// 调用统计图
-        })
+      this.getData()
     },
     changeLevel (value) {
       this.queryParam.standardLevel = value
+      this.getData()
+    },
+    getData () {
       getWeekReport(this.queryParam)
         .then(res => {
           this.chartsData = res.data
-          this.getCharts('container', this.chartsData)// 调用统计图
+
+          // 需要将数据分组:总数,完成数
+          const groupData = []
+          this.chartsData.forEach(function (data) {
+            groupData.push({ name: '标准工时', week: data.week, totalHours: data.totalHours })
+            groupData.push({ name: '可用工时', week: data.week, totalHours: data.useHours })
+          })
+          this.getCharts('container', groupData)// 调用统计图
         })
     },
     getCharts (id, data) {
@@ -193,7 +193,12 @@ export default {
         showMarkers: false,
         shared: true
       })
-      this.chart.interval().position('week*totalHours')
+      this.chart.interval().position('week*totalHours').color('name').adjust([
+        {
+          type: 'dodge',
+          marginRatio: 0
+        }
+      ])
       this.chart.interaction('active-region')
       this.chart.legend({
         position: 'bottom'
@@ -218,6 +223,7 @@ export default {
       modal.base(record)
     },
     handleAdd (record) {
+      this.confirmLoading = true
       saveWorkHour(record)
         .then((res) => {
           this.$message.info(res.data)