湖里大屏(进度计划):完成甘特图延时进度条显示

This commit is contained in:
Jack 2022-08-10 18:31:48 +08:00
parent 923aad5fef
commit 812821f106

View File

@ -75,7 +75,7 @@ export default {
pName: '地基与基础工程',
startTime: '2020/04/06',
endTime: '2020/05/09',
delay: 5,
delay: 10,
status: 0,
gantts: [],
// gantts: [{ left: '420px', width: '100px', status: '' }],
@ -125,21 +125,38 @@ export default {
setGantts() {
const configGantts = projects => {
projects.map(project => {
let { gantts } = project
let { endTime, pName, gantts } = project
const gantt = this.getGanttStyle(project)
gantt.background = this.colors[project.status]
if (gantts) {
gantts.push(gantt)
} else {
project.gantts = [gantt]
}
if (project.delay) {
const delayStartTime = this.increaseDate(endTime, 1)
const delayEndTime = this.increaseDate(endTime, project.delay)
const gantt = this.getGanttStyle({ startTime: delayStartTime, endTime: delayEndTime, pName })
gantt.background = this.colors[3]
gantts.push(gantt)
console.log(gantt, '是的发生的范范')
}
// debugger
project.children && configGantts(project.children)
})
}
configGantts(this.projects)
},
increaseDate(date, delay) {
const timestamp = new Date(date).getTime() + (delay + 1) * 1000 * 60 * 60 * 24
return new Date(timestamp)
.toISOString()
.replace(/-/g, '/')
.slice(0, 10)
},
getDays(date) {
const year = date.split('/')[0]
const month = +date.split('/')[1]