|
@@ -23,9 +23,9 @@
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="item in searchEnum.businesslines"
|
|
|
- :key="item.id"
|
|
|
- :label="item.bizName"
|
|
|
- :value="item.id"
|
|
|
+ :key="item.code"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.code"
|
|
|
/>
|
|
|
</el-select>
|
|
|
</div>
|
|
@@ -75,10 +75,12 @@
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<gantt-elastic
|
|
|
+ v-if="ganttShow"
|
|
|
+ ref="ganttElastic"
|
|
|
:tasks="tasks"
|
|
|
:options="options"
|
|
|
>
|
|
|
- <gantt-elastic-header v-show="false" slot="header" ref="ganttHeader" />
|
|
|
+ <gantt-elastic-header v-show="true" slot="header" ref="ganttHeader" />
|
|
|
</gantt-elastic>
|
|
|
</el-main>
|
|
|
</el-container>
|
|
@@ -86,7 +88,7 @@
|
|
|
|
|
|
<script>
|
|
|
import workbenchApi from '@/api/workbench.js'
|
|
|
-import { queryBizTypeList } from '@/api/defectManage'
|
|
|
+import { settingGetBizList } from '@/api/defectManage'
|
|
|
import GanttElastic from 'gantt-elastic'
|
|
|
import GanttHeader from 'gantt-elastic-header'
|
|
|
import dayjs from 'dayjs'
|
|
@@ -156,7 +158,7 @@ export default {
|
|
|
{
|
|
|
id: 2,
|
|
|
label: '任务名称',
|
|
|
- value: 'label',
|
|
|
+ value: 'labelName',
|
|
|
width: 180,
|
|
|
expander: true,
|
|
|
style: {
|
|
@@ -169,7 +171,7 @@ export default {
|
|
|
{
|
|
|
id: 3,
|
|
|
label: '开始时间',
|
|
|
- value: task => dayjs(task.start).format('YYYY-MM-DD'),
|
|
|
+ value: 'startDate',
|
|
|
width: 90,
|
|
|
style: {
|
|
|
'task-list-header-label': {
|
|
@@ -185,7 +187,7 @@ export default {
|
|
|
{
|
|
|
id: 4,
|
|
|
label: '结束时间',
|
|
|
- value: task => dayjs(task.start + task.duration).format('YYYY-MM-DD'),
|
|
|
+ value: 'endDate',
|
|
|
width: 90,
|
|
|
style: {
|
|
|
'task-list-header-label': {
|
|
@@ -219,6 +221,7 @@ export default {
|
|
|
}, // 甘特图配置
|
|
|
ganttHeaderStyle: {
|
|
|
},
|
|
|
+ colorList: ['rgba(255,82,0,0.5)', 'rgba(227,131,247,0.5)', 'rgba(68,190,255,0.5)', 'rgba(122,221,13,0.5)', 'rgba(245,108,108,0.5)'],
|
|
|
radio1: '忙碌',
|
|
|
radio2: '今天',
|
|
|
radio2TF: true,
|
|
@@ -236,12 +239,13 @@ export default {
|
|
|
businesslines: []
|
|
|
},
|
|
|
username: localStorage.getItem('username'),
|
|
|
- teamWorkList: []
|
|
|
+ teamWorkList: [],
|
|
|
+ ganttShow: false
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
this.queryTeamInfoList(this.username)
|
|
|
- this.queryBizTypeList()
|
|
|
+ this.settingGetBizList()
|
|
|
this.queryTeamWorkList()
|
|
|
},
|
|
|
methods: {
|
|
@@ -268,13 +272,13 @@ export default {
|
|
|
// this.radio2TF = !this.radio2TF
|
|
|
}
|
|
|
if (val === '月') {
|
|
|
- this.$refs.ganttHeader.setScale(22)
|
|
|
+ this.$refs.ganttHeader.scale = 24
|
|
|
}
|
|
|
if (val === '周') {
|
|
|
- this.$refs.ganttHeader.setScale(20)
|
|
|
+ this.$refs.ganttHeader.scale = 20
|
|
|
}
|
|
|
if (val === '日') {
|
|
|
- this.$refs.ganttHeader.setScale(10)
|
|
|
+ this.$refs.ganttHeader.scale = 17
|
|
|
}
|
|
|
},
|
|
|
queryTeamInfoList(username) {
|
|
@@ -289,13 +293,13 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- queryBizTypeList() {
|
|
|
- queryBizTypeList({}).then(res => {
|
|
|
+ settingGetBizList() {
|
|
|
+ settingGetBizList({}).then(res => {
|
|
|
if (res.data) {
|
|
|
- this.searchEnum.businesslines = res.data.list
|
|
|
+ this.searchEnum.businesslines = res.data
|
|
|
this.searchEnum.businesslines.unshift({
|
|
|
- id: null,
|
|
|
- bizName: '全部'
|
|
|
+ code: null,
|
|
|
+ name: '全部'
|
|
|
})
|
|
|
}
|
|
|
})
|
|
@@ -321,6 +325,9 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
createTasks(res, mode) {
|
|
|
+ const today = new Date()
|
|
|
+ const colorlist = ['#A1DEFF', '#FAB5B5', '#BCED86', '#FFA87F', '#8E44AD', '#1EBC61', '#0287D0']
|
|
|
+ this.ganttShow = false
|
|
|
this.tasks = []
|
|
|
let count = 0
|
|
|
for (const i in res.data) {
|
|
@@ -330,29 +337,49 @@ export default {
|
|
|
} else {
|
|
|
label = res.data[i].workNum.taskWorkNum + '个空闲时段'
|
|
|
}
|
|
|
+ const color = colorlist[count % colorlist.length]
|
|
|
const parentItem = {
|
|
|
id: count++,
|
|
|
- label: label,
|
|
|
+ labelName: label,
|
|
|
+ label: res.data[i].workNum.startTime && res.data[i].workNum.endTime ? label : '',
|
|
|
user: res.data[i].userInfo.ldapName,
|
|
|
collapsed: true,
|
|
|
+ progress: 0,
|
|
|
needLegalAllDays: res.data[i].workNum.needDays + '/' + res.data[i].workNum.legalDays + '/' + res.data[i].workNum.allDays,
|
|
|
- start: dayjs(res.data[i].workNum.startTime).toDate().getTime(),
|
|
|
- duration: dayjs(res.data[i].workNum.endTime).toDate().getTime() - dayjs(res.data[i].workNum.startTime).toDate().getTime(),
|
|
|
- type: 'task'
|
|
|
+ start: res.data[i].workNum.startTime ? dayjs(res.data[i].workNum.startTime).toDate().getTime() : today.getTime(),
|
|
|
+ duration: res.data[i].workNum.endTime ? dayjs(res.data[i].workNum.endTime).toDate().getTime() - dayjs(res.data[i].workNum.startTime).toDate().getTime() : 0,
|
|
|
+ startDate: res.data[i].workNum.startTime ? dayjs(res.data[i].workNum.startTime).format('YYYY-MM-DD') : '',
|
|
|
+ endDate: res.data[i].workNum.endTime ? dayjs(res.data[i].workNum.endTime).format('YYYY-MM-DD') : '',
|
|
|
+ type: 'task',
|
|
|
+ style: {
|
|
|
+ base: {
|
|
|
+ fill: color
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
this.tasks.push(parentItem)
|
|
|
for (const j in res.data[i].workData) {
|
|
|
const item = {
|
|
|
id: count++,
|
|
|
parentId: parentItem.id,
|
|
|
+ labelName: res.data[i].workData[j].name,
|
|
|
label: res.data[i].workData[j].name,
|
|
|
user: parentItem.user,
|
|
|
+ progress: 0,
|
|
|
needLegalAllDays: res.data[i].workData[j].needDays + '/' + res.data[i].workData[j].legalDays + '/' + res.data[i].workData[j].allDays,
|
|
|
start: dayjs(res.data[i].workData[j].startTime).toDate().getTime(),
|
|
|
duration: dayjs(res.data[i].workData[j].endTime).toDate().getTime() - dayjs(res.data[i].workData[j].startTime).toDate().getTime(),
|
|
|
- type: 'task'
|
|
|
+ startDate: dayjs(res.data[i].workData[j].startTime).format('YYYY-MM-DD'),
|
|
|
+ endDate: dayjs(res.data[i].workData[j].endTime).format('YYYY-MM-DD'),
|
|
|
+ type: 'task',
|
|
|
+ style: {
|
|
|
+ base: {
|
|
|
+ fill: color
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
this.tasks.push(item)
|
|
|
+ this.ganttShow = true
|
|
|
}
|
|
|
}
|
|
|
}
|