qinzhipeng_v@didiglobal.com 4 жил өмнө
parent
commit
67eef19e2f

+ 22 - 29
src/views/workbench/components/statisticsSection.vue

@@ -36,9 +36,9 @@
           </el-radio-group>
           <div v-if="itemType === '1'" class="spaceBetween">
             <div class="date-select">
-              <span :class="[dateType==='week'?'date-active':'']" class="date-item" @click.stop="dateType='week';setDate('week')">本周</span>
-              <span :class="[dateType==='month'?'date-active':'']" class="date-item" @click.stop="dateType='month';setDate('month')">本月</span>
-              <span :class="[dateType==='year'?'date-active':'']" class="date-item" @click.stop="dateType='year';setDate('year')">本年</span>
+              <span :class="[dateType==='WEEK'?'date-active':'']" class="date-item" @click.stop="dateType='WEEK';setDate('WEEK')">本周</span>
+              <span :class="[dateType==='MONTH'?'date-active':'']" class="date-item" @click.stop="dateType='MONTH';setDate('MONTH')">本月</span>
+              <span :class="[dateType==='YEAR'?'date-active':'']" class="date-item" @click.stop="dateType='YEAR';setDate('YEAR')">本年</span>
             </div>
             <el-date-picker
               v-model="stratAndEnd"
@@ -50,7 +50,7 @@
               size="small"
               value-format="yyyy.MM.dd"
               :default-time="['00:00:00','23:59:59']"
-              @change="dateType = ''"
+              @change="setDateList()"
             />
             <h3 class="mt5" @click="getAll()">总数:<span>{{ totalTask }}</span></h3>
           </div>
@@ -88,6 +88,7 @@
 <script>
 import moment from 'moment'
 moment.locale('zh-cn')
+// import { getPersonalRequireDisData } from '@/api/workSchedule.js'
 import normalEchart from '@/components/chart/normalEchart'
 import statusStayChart from '@/components/chart/statusStayChart'
 export default {
@@ -130,7 +131,7 @@ export default {
       echartsOption: null,
       echartsOption2: null,
       stratAndEnd: [], // 开始结束日期
-      dateType: 'week', // 时间选择类型
+      dateType: 'WEEK', // 时间选择类型
       bugCountTimeType: 1, // 获取趋缺陷势图数据接口入参:1本周 2本月 3本年
       timeTypeList: [ // 日期选择
         { code: 1, label: '周' },
@@ -188,37 +189,24 @@ export default {
           this.getChart(requestChart, '3')
           this.getChart(requestChart, '5')
         } else {
+          this.itemType = '0'
           this.getChart(requestChart, this.itemType)
         }
       }
     },
     setDate(type) { // 日期筛选
-      let startDate = null
-      let endDate = null
-      switch (type) {
-        case 'week':
-          startDate = moment().startOf('week').format('YYYY.MM.DD')
-          endDate = moment().endOf('week').format('YYYY.MM.DD')
-          this.bugCountTimeType = this.timeTypeList[0].code
-          break
-        case 'month':
-          startDate = moment().startOf('month').format('YYYY.MM.DD')
-          endDate = moment().endOf('month').format('YYYY.MM.DD')
-          this.bugCountTimeType = this.timeTypeList[1].code
-          break
-        case 'year':
-          startDate = moment().startOf('year').format('YYYY.MM.DD')
-          endDate = moment().endOf('year').format('YYYY.MM.DD')
-          this.bugCountTimeType = this.timeTypeList[2].code
-          break
-      }
-      this.stratAndEnd = [startDate, endDate]
-      // this.onSubmit()
-      console.log(this.stratAndEnd, this.bugCountTimeType)
+      this.stratAndEnd = []
+      const { requestChart } = this.requestObj
+      this.getChart(requestChart, this.itemType, { dateType: this.dateType })
+    },
+    setDateList() { // 日期筛选
+      this.dateType = ''
+      const { requestChart } = this.requestObj
+      this.getChart(requestChart, this.itemType, { dayTime: this.stratAndEnd })
     },
     onChangeTagRadio(e) {
       const { requestChart } = this.requestObj
-      this.getChart(requestChart, this.itemType)
+      this.getChart(requestChart, this.itemType, { dateType: this.dateType })
     },
     async getData(requestUrl) { // 获取顶部数据
       const res = await requestUrl({ teamSearchInfo: this.searchForm })
@@ -237,12 +225,17 @@ export default {
         }
       }
     },
-    async getChart(requestUrl, type) { // 获取图表数据
+    async getChart(requestUrl, type, data) { // 获取图表数据
       const res = await requestUrl({ teamSearchInfo: this.searchForm, type: type })
       if (type === '3') {
         this.echartsOption = this.setChart(res.data)
       } else if (type === '5') {
         this.echartsOption2 = this.setChart(res.data)
+      } else if (type === '1') {
+        const res = await requestUrl({ teamSearchInfo: this.searchForm, type, ...data })
+        this.totalTask = res.data.total
+        this.totalIdList = res.data.idList
+        this.echartsOption = { ...res.data, type: this.itemType }
       } else {
         const res = await requestUrl({ teamSearchInfo: this.searchForm, type })
         this.totalTask = res.data.total