湖里大屏(进度计划):抽离获取进度条参数代码

This commit is contained in:
Jack 2022-08-10 17:18:03 +08:00
parent 4dde2afbf0
commit 923aad5fef

View File

@ -75,6 +75,7 @@ export default {
pName: '地基与基础工程', pName: '地基与基础工程',
startTime: '2020/04/06', startTime: '2020/04/06',
endTime: '2020/05/09', endTime: '2020/05/09',
delay: 5,
status: 0, status: 0,
gantts: [], gantts: [],
// gantts: [{ left: '420px', width: '100px', status: '' }], // gantts: [{ left: '420px', width: '100px', status: '' }],
@ -91,10 +92,8 @@ export default {
} }
}, },
methods: { methods: {
setGantts() { getGanttStyle(project) {
const configGantts = projects => { let { startTime, endTime, pName } = project
projects.map(project => {
let { startTime, endTime, pName, gantts } = project
const startArr = startTime.split('/') const startArr = startTime.split('/')
const endArr = endTime.split('/') const endArr = endTime.split('/')
let startRef = null let startRef = null
@ -121,15 +120,20 @@ export default {
const endLeft = endRef.offsetLeft const endLeft = endRef.offsetLeft
const ganttWidth = endLeft - startLeft + endWidth const ganttWidth = endLeft - startLeft + endWidth
const gantt = { left: startLeft + 'px', width: ganttWidth + 'px', background: this.colors[project.status] } return { left: startLeft + 'px', width: ganttWidth + 'px' }
},
setGantts() {
const configGantts = projects => {
projects.map(project => {
let { gantts } = project
const gantt = this.getGanttStyle(project)
gantt.background = this.colors[project.status]
if (gantts) { if (gantts) {
gantts.push(gantt) gantts.push(gantt)
} else { } else {
project.gantts = [gantt] project.gantts = [gantt]
} }
console.log(startLeft, ganttWidth, '丢雷', `${pName}-${endTime}`)
// debugger // debugger
project.children && configGantts(project.children) project.children && configGantts(project.children)
}) })