From 812821f1060d5806804ac66ccac51935a47ddb69 Mon Sep 17 00:00:00 2001 From: Jack <1638169491@qq.com> Date: Wed, 10 Aug 2022 18:31:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B9=96=E9=87=8C=E5=A4=A7=E5=B1=8F(=E8=BF=9B?= =?UTF-8?q?=E5=BA=A6=E8=AE=A1=E5=88=92)=EF=BC=9A=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E7=94=98=E7=89=B9=E5=9B=BE=E5=BB=B6=E6=97=B6=E8=BF=9B=E5=BA=A6?= =?UTF-8?q?=E6=9D=A1=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jlw/planProgress/centerTop.vue | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) 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]