Browse Source

工作台修复

wenbobowen 4 years ago
parent
commit
68070fc2dc

+ 26 - 15
src/views/workbench/components/searchSection.vue

@@ -7,7 +7,7 @@
         <el-checkbox v-for="item in memberList" :key="item.idap" :label="item.idap">
           <div class="check-point">
             {{ item.name }}
-            <div v-if="workbench === '团队'" class="point" :style="{'background-color': mapMemberColor.get(item.idap).bgColor}" />
+            <div v-if="workbench === '团队'" class="point" :style="{'background-color': mapMemberColor[item.idap].bgColor}" />
           </div>
         </el-checkbox>
       </el-checkbox-group>
@@ -29,6 +29,7 @@
           <el-checkbox v-for="item in taskScheduleEvent" :key="item.code" :label="item.code">
             <div class="check-point">
               {{ item.msg }}
+              <div class="point" :style="{'background-color': mapTypeColor[item.code].bgColor}" />
             </div>
           </el-checkbox>
         </el-checkbox-group>
@@ -48,6 +49,7 @@
 </template>
 <script>
 import { queryTeamMember, showWorkbenchEnum } from '@/api/workSchedule'
+import { colorList } from '../mixins/utils'
 export default {
   props: {
     value: {
@@ -61,8 +63,13 @@ export default {
       required: false
     },
     memberColor: {
-      type: Map,
-      default: () => new Map(),
+      type: Object,
+      default: () => {},
+      required: false
+    },
+    typeColor: {
+      type: Object,
+      default: () => {},
       required: false
     },
     type: {
@@ -85,13 +92,14 @@ export default {
       isIndeterminate: false,
       isIndeterminate_1: false,
       isIndeterminate_2: false,
-      colorList: [
-        'rgba(64,127,232,1)', 'rgba(11,160,188,1)', 'rgba(28,188,126,1)', 'rgba(235,172,0,1)', 'rgba(132,100,247,1)',
-        'rgba(73,92,197,1)', 'rgba(193,67,96,1)', 'rgba(211,87,35,1)', 'rgba(40,28,149,1)', 'rgba(85,138,43,1)',
-        'rgba(67,17,59,1)', 'rgba(221,57,222,1)', 'rgba(149,114,109,1)', 'rgba(202,50,31,1)', 'rgba(226,119,141,1)',
-        'rgba(240,164,126,1)', 'rgba(59,64,72,1)', 'rgba(115,159,158,1)', 'rgba(122,209,67,1)', 'rgba(152,40,49,1)'
-      ],
+      // colorList: [
+      //   'rgba(64,127,232,1)', 'rgba(11,160,188,1)', 'rgba(28,188,126,1)', 'rgba(235,172,0,1)', 'rgba(132,100,247,1)',
+      //   'rgba(73,92,197,1)', 'rgba(193,67,96,1)', 'rgba(211,87,35,1)', 'rgba(40,28,149,1)', 'rgba(85,138,43,1)',
+      //   'rgba(67,17,59,1)', 'rgba(221,57,222,1)', 'rgba(149,114,109,1)', 'rgba(202,50,31,1)', 'rgba(226,119,141,1)',
+      //   'rgba(240,164,126,1)', 'rgba(59,64,72,1)', 'rgba(115,159,158,1)', 'rgba(122,209,67,1)', 'rgba(152,40,49,1)'
+      // ],
       mapMemberColor: this.memberColor, // 人员对应颜色表
+      mapTypeColor: this.typeColor,
       checkList: [0, 1], // 类型默认全部选择
       ScheduleAndSchedule: [0, 1],
       selfScheduleType: [], // 日程类型
@@ -130,13 +138,14 @@ export default {
           this.memberList = this.handleMember(res.data)
           this.filtrate.checkedMembers = this.memberList.map(item => item.idap)
           this.checkAllMember = true
-          this.colorHandler(this.memberList)
+          this.colorHandler(this.memberList, 'mapMemberColor', 'idap')
         }
       }
       const res_1 = await showWorkbenchEnum()
       if (res_1.code === 200) {
         this.selfScheduleType = res_1.data.selfScheduleType // 日程类型
         this.taskScheduleEvent = res_1.data.taskScheduleEvent // 排期类型
+        this.colorHandler(this.taskScheduleEvent, 'mapTypeColor', 'code')
         this.selfScheduleType.unshift({ code: -1, msg: '未分类' })
         this.schedule = this.selfScheduleType.map(item => item.code)
         this.scheduling = this.taskScheduleEvent.map(item => item.code)
@@ -151,15 +160,17 @@ export default {
         this.$emit('change')
         this.$emit('update:value', this.filtrate)
         this.$emit('update:memberColor', this.mapMemberColor)
+        this.$emit('update:typeColor', this.mapTypeColor)
       })
     },
-    colorHandler(arr) { // 成员对应颜色处理
-      this.mapMemberColor.clear()
+    colorHandler(arr, type, key) { // 成员对应颜色处理
+      // this.mapMemberColor.clear()
+      this[type] = {}
       arr.map((item, index) => {
-        this.mapMemberColor.set(item.idap, {
+        this[type][item[key]] = {
           color: '#FFFFFF',
-          bgColor: this.colorList[index % 20]
-        })
+          bgColor: colorList[index]
+        }
       })
     },
     handleMember(arr) { // 人员和颜色的映射处理

+ 6 - 0
src/views/workbench/mixins/utils.js

@@ -0,0 +1,6 @@
+export const colorList = [
+  'rgba(64,127,232,1)', 'rgba(11,160,188,1)', 'rgba(28,188,126,1)', 'rgba(235,172,0,1)', 'rgba(132,100,247,1)',
+  'rgba(73,92,197,1)', 'rgba(193,67,96,1)', 'rgba(211,87,35,1)', 'rgba(40,28,149,1)', 'rgba(85,138,43,1)',
+  'rgba(67,17,59,1)', 'rgba(221,57,222,1)', 'rgba(149,114,109,1)', 'rgba(202,50,31,1)', 'rgba(226,119,141,1)',
+  'rgba(240,164,126,1)', 'rgba(59,64,72,1)', 'rgba(115,159,158,1)', 'rgba(122,209,67,1)', 'rgba(152,40,49,1)'
+]

+ 10 - 1
src/views/workbench/person/components/myFullCalendar.vue

@@ -153,6 +153,15 @@ export default {
       calendarTitle: ''
     }
   },
+  watch: {
+    events: {
+      handler(newV) {
+        setTimeout(() => { this.setIcon() }, 0)
+      },
+      immediate: true,
+      deep: true
+    }
+  },
   mounted() {
     this.settingGetCalendar()
     this.callCalendarApi()
@@ -194,7 +203,7 @@ export default {
         }
       }
       this.$nextTick(() => {
-        setTimeout(() => { this.setIcon() }, 2000)
+        setTimeout(() => { this.setIcon() }, 200)
         this.$emit('change', calendarApi.view)
         if (methods === 'today' && this.methods > 1) return false
         this.setDate()

+ 16 - 15
src/views/workbench/person/index.vue

@@ -149,6 +149,7 @@
             :value.sync="filtrate"
             :type="'个人'"
             style="margin: 0 30px;"
+            :type-color.sync="mapTypeColor"
             @change="queryWorkListByTime(calendarView)"
             @loading="loading = false"
           />
@@ -266,6 +267,7 @@ import websocket from '@/views/workbench/mixins/websocket'
 import listView from '@/views/workbench/components/listView.vue'
 import { getAllTime } from '@/utils/global.js'
 import { settingGetBizList } from '@/api/defectManage'
+// import { colorList } from '../mixins/utils'
 import '@/styles/PublicStyle/index.scss'
 
 export default {
@@ -337,12 +339,8 @@ export default {
       showDetail: false,
       visibleSchedule: false, // 排期任务弹框
       detailXY: [0, 0], // 详情弹框位置
-      colorList: [
-        'rgba(64,127,232,1)', 'rgba(11,160,188,1)', 'rgba(28,188,126,1)', 'rgba(235,172,0,1)', 'rgba(132,100,247,1)',
-        'rgba(73,92,197,1)', 'rgba(193,67,96,1)', 'rgba(211,87,35,1)', 'rgba(40,28,149,1)', 'rgba(85,138,43,1)',
-        'rgba(67,17,59,1)', 'rgba(221,57,222,1)', 'rgba(149,114,109,1)', 'rgba(202,50,31,1)', 'rgba(226,119,141,1)',
-        'rgba(240,164,126,1)', 'rgba(59,64,72,1)', 'rgba(115,159,158,1)', 'rgba(122,209,67,1)', 'rgba(152,40,49,1)'
-      ],
+      mapTypeColor: {}, // 状态对应色表
+      // colorList: ,
       tabTips: { // 顶部tab红点提示
         require: false,
         task: false,
@@ -536,26 +534,29 @@ export default {
       const res = await queryWorkListByTime(params)
       if (res.code === 200) {
         res.data = res.data.sort((a, b) => a.id - b.id)
-        let num = 0
+        // let num = 0
         this.calendarEvents = res.data.map((item, index) => {
           const title = item.origin ? '日程:' : '排期:'
           let require = ''
-          if (item.requireList && item.requireList.length > 0) {
-            require = `所属需求:${item.requireList.map(item => item.name).join(',')}`
-          } else if (item.taskList && item.taskList.length > 0) {
+          const name = item.origin ? item.name : `【${item.name}】`
+          // if (item.requireList && item.requireList.length > 0) {
+          //   require = `所属需求:${item.requireList.map(item => item.name).join(',')}`
+          // } else
+          if (item.taskList && item.taskList.length > 0) {
             require = `所属任务:${item.taskList.map(item => item.name).join(',')}`
           }
-          if (index >= 1 && item.id === res.data[index - 1].id) {
-            num = num + 1
-          }
+          // if (index >= 1 && item.id === res.data[index - 1].id) {
+          //   num = num + 1
+          // }
+          // const bgColor = params.peoples.length < 2 ? this.mapTypeColor[item.type].bgColor : colorObj.bgColor
           return {
             id: item.id,
-            title: `${title}【${item.peopleObject.name}】 ${item.name} ${item.desc ? ':' + item.desc : ''}; ${item.origin ? '' : require}`,
+            title: `${title}【${item.peopleObject.name}】${name}${item.desc ? ':' + item.desc + ';' : ''} ${item.origin ? '' : require}`,
             start: moment(item.startTime).toDate(),
             end: moment(item.endTime).add(1, 'day').toDate(),
             detailData: item,
             className: item.origin ? 'schedule1' : 'schedule2',
-            backgroundColor: this.colorList[(index - num) % 20],
+            backgroundColor: this.mapTypeColor[item.type].bgColor,
             textColor: '#FFFFFF'
           }
         })

+ 12 - 8
src/views/workbench/team/index.vue

@@ -50,6 +50,7 @@
           :search-form="searchForm"
           :type="'团队'"
           style="margin: 0 30px;"
+          :type-color.sync="mapTypeColor"
           :member-color.sync="mapMemberColor"
           @change="queryTeamWorkListByTime(calendarView)"
           @loading="loading = false"
@@ -270,7 +271,8 @@ export default {
       filtrate: {// 筛选区域
         checkedMembers: [] // 被选中的成员列表
       },
-      mapMemberColor: new Map(), // 人员对应颜色表
+      mapMemberColor: {}, // 人员对应颜色表
+      mapTypeColor: {}, // 状态对应色表
       calendarEvents: [// 日程图标数据
         {
           title: 'Event Now',
@@ -550,24 +552,26 @@ export default {
       const res = await queryTeamWorkListByTime(params)
       if (res.code === 200) {
         this.calendarEvents = res.data.map((item, index) => {
-          const colorObj = this.mapMemberColor.get(item.peopleObject.idap)
+          const colorObj = this.mapMemberColor[item.peopleObject.idap]
+          const bgColor = params.peoples.length < 2 ? this.mapTypeColor[item.type].bgColor : colorObj.bgColor
           const title = item.origin ? '日程:' : '排期:'
-          let require = ''
+          // let require = ''
           let task = ''
-          if (item.requireList && item.requireList.length > 0) {
-            require = `所属需求:${item.requireList.map(item => item.name).join(',')}`
-          }
+          const name = item.origin ? item.name : `【${item.name}】`
+          // if (item.requireList && item.requireList.length > 0) {
+          //   require = `所属需求:${item.requireList.map(item => item.name).join(',')}`
+          // }
           if (item.taskList && item.taskList.length > 0) {
             task = `所属任务:${item.taskList.map(item => item.name).join(',')}`
           }
           return {
             id: item.id,
-            title: `${title}【${item.peopleObject.name}】${item.name} ${item.desc ? ':' + item.desc : ''}; ${item.origin ? '' : require + ';'} ${task}`,
+            title: `${title}【${item.peopleObject.name}】${name} ${item.desc ? ':' + item.desc + ';' : ''} ${task}`,
             start: moment(item.startTime).toDate(),
             end: moment(item.endTime).add(1, 'day').toDate(),
             detailData: item,
             className: item.origin ? 'schedule1' : 'schedule2',
-            backgroundColor: colorObj && colorObj.bgColor || null,
+            backgroundColor: bgColor || null,
             textColor: colorObj && colorObj.color || null
           }
         })