ソースを参照

锁定倒计时和增加星期唯独

didi 4 年 前
コミット
2dafdee420

+ 5 - 2
src/api/workSchedule.js

@@ -193,7 +193,8 @@ export function getPersonalRequireSummary(data) {
 export function getPersonalRequireDisData(data) {
   return request({
     url: TeamManagement + `/workbench/personal/getRequireDisDataByStatus`,
-    method: 'get'
+    method: 'post',
+    data
   })
 }
 // 任务头部统计数据,数据里返idList(个人)
@@ -205,9 +206,11 @@ export function getPersonalTaskSummary(data) {
 }
 // 任务按状态统计数据,数据里返idList(个人)
 export function getPersonalTaskDisData(data) {
+  console.log(data)
   return request({
     url: TeamManagement + `/workbench/personal/getTaskDisDataByStatus`,
-    method: 'get'
+    method: 'post',
+    data
   })
 }
 // 缺陷头部统计数据,数据里返(个人)

+ 84 - 0
src/components/chart/statusStayChart.vue

@@ -0,0 +1,84 @@
+<template>
+  <section>
+    <div class="chart-contain">
+      <normal-echart v-if="echartsOption" :chart-id="id" :option="echartsOption" />
+    </div>
+  </section>
+</template>
+<script>
+import normalEchart from '@/components/chart/normalEchart'
+export default {
+  components: { normalEchart },
+  props: {
+    id: {
+      type: String,
+      default: 'status-stay-chart',
+      required: false
+    },
+    chartData: {
+      type: Object,
+      default: () => null,
+      required: false
+    }
+  },
+  data() {
+    return {
+      echartsOption: null
+    }
+  },
+  watch: {
+    chartData: {
+      handler(newV) {
+        this.setChart()
+      },
+      deep: true,
+      immediate: true
+    }
+  },
+  methods: {
+    setChart() {
+      if (!this.chartData) return
+      // console.log(111, this.chartData)
+      // this.chartData.yaxis = [
+      //   {
+      //     data: [1],
+      //     idList: [[1705]],
+      //     name: null
+      //   }
+      // ]
+      const newArr = this.chartData.yaxis.filter(item => { return item.name !== '全部' })
+      const colorArr = ['#409EFF', '#F8CE5C', '#F2904F', '#5EE2BE', '#D873F5', '#7479F5']
+      this.echartsOption = {
+        color: colorArr,
+        tooltip: {
+          trigger: 'axis',
+          axisPointer: { type: 'line' },
+          formatter: params => {
+            let total = 0
+            let backString = ``
+            params.map((item, index) => {
+              total = total + item.value
+              backString = backString + `<span style="color: ${colorArr[index] || ''}">${item.seriesName}</span>:${item.value}个</br>`
+            })
+            return backString + `<span style="color: #F04864">总和</span>:${total}个`
+          }
+        },
+        legend: { data: newArr.map(item => { return item.name }), left: 0, top: 0 },
+        grid: { left: '0', right: '0', top: '8%', bottom: '0', containLabel: true },
+        xAxis: { type: 'category', data: this.chartData.xaxis, axisTick: { alignWithLabel: true }, axisLabel: { interval: 0, rotate: 40 }},
+        yAxis: { type: 'value', axisLine: { show: false }, splitLine: { lineStyle: { type: 'dashed' }}, axisLabel: { formatter: '{value}个' }},
+        series: newArr.map(item => ({ ...item, type: 'bar', stack: '总和', barWidth: '20px' }))
+      }
+    }
+  }
+}
+</script>
+<style lang="scss" scoped>
+.chart-contain {
+  position: relative;
+  height: 320px;
+  width: 84%;
+  margin: 20px auto;
+}
+
+</style>

+ 2 - 3
src/utils/global.js

@@ -43,12 +43,11 @@ export function getAllTime(start, end, noHoliday = true) {
   return NewArr
 }
 
-export function formatHMS() {
-  const data = 60000
+export function formatHMS(data) {
   let time = '--'
   var hours = parseInt((data % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))
   var minutes = parseInt((data % (1000 * 60 * 60)) / (1000 * 60))
-  var seconds = (data % (1000 * 60)) / 1000
+  var seconds = parseInt((data % (1000 * 60)) / 1000)
   time = (hours < 10 ? ('0' + hours) : hours) + ':' + (minutes < 10 ? ('0' + minutes) : minutes) + ':' + (seconds < 10 ? ('0' + seconds) : seconds)
   return time
 }

+ 17 - 4
src/views/projectManage/taskList/taskViewDetail.vue

@@ -190,8 +190,8 @@
                     {{ isScheduleLocked === 1 ? '已锁定' : '未锁定' }}
                   </span>
                 </el-tooltip>
-                <span class="tip">
-                  <i class="el-icon-timer icon" />剩余{{ remainingTime }}
+                <span v-if="isScheduleLocked === 0" class="tip">
+                  <i class="el-icon-timer icon" />剩余{{ autoLockScheduleCountdown }}
                 </span>
               </div>
             </div>
@@ -460,7 +460,8 @@ export default {
   },
   data() {
     return {
-      remainingTime: '23小时23分钟', // 解锁剩余时间
+      autoLockScheduleCountdown: '--', // 解锁剩余时间
+      timer: null, // 定时器
       tabPosition: 'first',
       textarea2: '',
       HoldTask: '',
@@ -528,7 +529,6 @@ export default {
     }
   },
   created() {
-    formatHMS()
     this.analysisBizId_id()
     this.$nextTick(() => {
       this.activeName = this.$route.query.page ? this.$route.query.page : '1'
@@ -536,6 +536,7 @@ export default {
     this.$store.state.data.status = true
   },
   destroyed() {
+    clearInterval(this.timer)
     this.$store.state.data.status = false
   },
   methods: {
@@ -556,6 +557,18 @@ export default {
       this.SchedulingContent = res.data
       const res1 = await listByTask(this.taskId)
       this.isScheduleLocked = res1.data.isScheduleLocked
+      if (res1.data.isScheduleLocked !== 1 && res1.data.autoLockScheduleCountdown > 0) {
+        let totolTime = res1.data.autoLockScheduleCountdown || 6000
+        clearInterval(this.timer)
+        this.timer = setInterval(() => {
+          totolTime = totolTime - 1000
+          this.autoLockScheduleCountdown = formatHMS(totolTime)
+          if (totolTime < 1000) {
+            this.isScheduleLocked = 1
+            clearInterval(this.timer)
+          }
+        }, 1000)
+      }
       this.tips = res1.data.tips
       this.isParentRequireScheduleLocked = res1.data.isParentRequireScheduleLocked
       this.$refs.taskSchedule.listByTask(this.taskId)

+ 1 - 1
src/views/workbench/components/createDialog.vue

@@ -82,7 +82,7 @@ export default {
       const res = await settingGetMyAndOtherBizList()
       if (res.code === 200) {
         this.$nextTick(() => {
-          const biz = res.data[0]
+          const biz = res.data.filter(item => item.length > 0)
           this.bizId = biz[0].code
         })
         this.bizList = [{

+ 21 - 6
src/views/workbench/components/statisticsSection.vue

@@ -24,10 +24,15 @@
           </div>
         </div>
         <div v-if="title !=='缺陷'" class="statistics-chart">
-          <h2>未上线{{ title }}状态分布</h2>
+          <!-- <h2>未上线{{ title }}状态分布</h2> -->
+          <el-radio-group v-model="itemType" @change="onChangeTagRadio">
+            <el-radio-button label="0">未上线{{ title }}状态分布</el-radio-button>
+            <el-radio-button label="1">本周{{ title }}状态流入图</el-radio-button>
+          </el-radio-group>
           <h3 @click="getAll()">总数:<span>{{ totalTask }}</span></h3>
           <div class="chart-contain">
-            <normal-echart v-if="echartsOption" :chart-id="type+title" :option="echartsOption" @onClick="chartChange" />
+            <status-stay-chart :chart-data="echartsOption" @onClick="chartChange" />
+            <!-- <normal-echart v-if="echartsOption" :chart-id="type+title" :option="echartsOption" @onClick="chartChange" /> -->
           </div>
         </div>
         <div v-if="title ==='缺陷'" class="statistics-chart">
@@ -57,9 +62,13 @@
 
 <script>
 import normalEchart from '@/components/chart/normalEchart'
+import statusStayChart from '@/components/chart/statusStayChart'
 export default {
   name: 'StatisticsSectionVue',
-  components: { normalEchart },
+  components: {
+    normalEchart,
+    statusStayChart
+  },
   props: {
     searchForm: { // 搜索项的信息
       type: Object,
@@ -95,6 +104,7 @@ export default {
       echartsOption2: null,
       totalTask: 0, // 所有总数
       totalIdList: 0, // 所有总数的idList
+      itemType: 0, // 0: 未上线的需求分布  1: 本周状态流入图
       tips: {
         '需求': [
           '交付日期为今天,且状态仍未变更为“已上线”的需求数量(不包含当前状态为hold的需求)。',
@@ -143,10 +153,15 @@ export default {
           this.getChart(requestChart, '3')
           this.getChart(requestChart, '5')
         } else {
-          this.getChart(requestChart)
+          this.getChart(requestChart, this.itemType)
         }
       }
     },
+    onChangeTagRadio(e) {
+      console.log(e)
+      const { requestChart } = this.requestObj
+      this.getChart(requestChart, this.itemType)
+    },
     async getData(requestUrl) { // 获取顶部数据
       const res = await requestUrl({ teamSearchInfo: this.searchForm })
       if (res.code === 200) {
@@ -173,10 +188,10 @@ export default {
           this.echartsOption2 = this.setChart(res.data)
         }
       } else {
-        const res = await requestUrl({ teamSearchInfo: this.searchForm })
+        const res = await requestUrl({ teamSearchInfo: this.searchForm, type })
         this.totalTask = res.data.total
         this.totalIdList = res.data.idList
-        this.echartsOption = this.setChart(res.data)
+        this.echartsOption = res.data
       }
     },
     setChart(chartData) { // 设置图表options