From 08ef44cf8bbe509e34e01208edba47ec9ba1aab6 Mon Sep 17 00:00:00 2001 From: Jack <1638169491@qq.com> Date: Tue, 9 Aug 2022 18:34:00 +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=E8=BF=9B=E5=BA=A6=E6=9D=A1=E5=B7=A6?= =?UTF-8?q?=E5=81=8F=E7=A7=BB=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jlw/planProgress/centerTop.vue | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/views/projectAdmin/jlw/planProgress/centerTop.vue b/src/views/projectAdmin/jlw/planProgress/centerTop.vue index b10a1b4c..972328d7 100644 --- a/src/views/projectAdmin/jlw/planProgress/centerTop.vue +++ b/src/views/projectAdmin/jlw/planProgress/centerTop.vue @@ -66,12 +66,11 @@ export default { console.log(this.getDays('2022/09'), '到') }, mounted() { - console.log(this.projects) - console.log(this.$refs, 'sdfsf') + this.getGantts() }, data() { return { - dates: ['2020/04', '2020/05', '2020/07', '2020/08'], + dates: ['2020/03', '2020/04', '2020/05', '2020/07', '2020/08'], projects: [ { pName: '地基与基础工程', @@ -90,6 +89,26 @@ export default { } }, methods: { + getGantts() { + this.projects.map(project => { + let { startTime, pName, gantts } = project + const dateArr = startTime.split('/') + let startRef = null + + if (!(dateArr[2] % 2)) { + const day = dateArr[2] - 1 + dateArr[2] = day < 10 ? '0' + day : day + startTime = dateArr.join('/') + console.log(startTime, 'xxx') + } + + startRef = this.$refs[`${pName}-${startTime}`][0] + const left = startRef.offsetLeft + gantts[0].left = left + 'px' + console.log(startRef.offsetLeft, '丢雷', startTime) + // 设置 left + }) + }, getDays(date) { const year = date.split('/')[0] const month = +date.split('/')[1] @@ -225,6 +244,7 @@ export default { height: 100%; display: flex; .grid { + position: relative; flex: 1; height: 100%; &:not(:last-child) {