湖里大屏(进度计划):完成甘特图进度条左偏移设置

This commit is contained in:
Jack 2022-08-09 18:34:00 +08:00
parent 6cd08a5982
commit 08ef44cf8b

View File

@ -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) {