|
|
@ -10,14 +10,20 @@ async function busCarLevelList (ctx) { |
|
|
|
attributes: ['id', 'company', 'fleet', 'vehicleLicensePlateNumber', 'line'], |
|
|
|
}) |
|
|
|
for (let c of busCarRes) { |
|
|
|
const { company, fleet, line } = c |
|
|
|
const { company, fleet, vehicleLicensePlateNumber, line } = c |
|
|
|
const corCompany = data.find(d => d.name === company) |
|
|
|
if (!corCompany) { |
|
|
|
data.push({ |
|
|
|
name: company, |
|
|
|
child: [{ |
|
|
|
name: fleet, |
|
|
|
child: [{ ...c.dataValues }] |
|
|
|
child: [{ |
|
|
|
name: line, |
|
|
|
child: [{ |
|
|
|
id: c.id, |
|
|
|
name: vehicleLicensePlateNumber, |
|
|
|
}] |
|
|
|
}] |
|
|
|
}] |
|
|
|
}) |
|
|
|
} else { |
|
|
@ -25,10 +31,30 @@ async function busCarLevelList (ctx) { |
|
|
|
if (!corFleet) { |
|
|
|
corCompany.child.push({ |
|
|
|
name: fleet, |
|
|
|
child: [{ ...c.dataValues }] |
|
|
|
child: [{ |
|
|
|
name: line, |
|
|
|
child: [{ |
|
|
|
id: c.id, |
|
|
|
name: vehicleLicensePlateNumber, |
|
|
|
}] |
|
|
|
}] |
|
|
|
}) |
|
|
|
} else { |
|
|
|
corFleet.child.push({ ...c.dataValues }) |
|
|
|
const corLine = corFleet.child.find(d => d.name === line) |
|
|
|
if (!corLine) { |
|
|
|
corFleet.child.push({ |
|
|
|
name: line, |
|
|
|
child: [{ |
|
|
|
id: c.id, |
|
|
|
name: vehicleLicensePlateNumber, |
|
|
|
}] |
|
|
|
}) |
|
|
|
} else { |
|
|
|
corLine.child.push({ |
|
|
|
id: c.id, |
|
|
|
name: vehicleLicensePlateNumber, |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|