diff --git a/src/views/projectAdmin/jlw/planProgress/centerTop.vue b/src/views/projectAdmin/jlw/planProgress/centerTop.vue index acdf0164..3beee7ff 100644 --- a/src/views/projectAdmin/jlw/planProgress/centerTop.vue +++ b/src/views/projectAdmin/jlw/planProgress/centerTop.vue @@ -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]