You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
676 B
31 lines
676 B
export const QC_DEFAULT_BU_NO = '*'
|
|
|
|
export function buildQcBu (site) {
|
|
if (!site) {
|
|
return ''
|
|
}
|
|
const siteOnly = String(site).includes('_') ? String(site).split('_')[0] : site
|
|
return `${siteOnly}_${QC_DEFAULT_BU_NO}`
|
|
}
|
|
|
|
export function parseQcBu (bu) {
|
|
if (!bu) {
|
|
return { site: '', buNo: QC_DEFAULT_BU_NO }
|
|
}
|
|
const site = String(bu).includes('_') ? String(bu).split('_')[0] : bu
|
|
return { site, buNo: QC_DEFAULT_BU_NO }
|
|
}
|
|
|
|
export function normalizeBuList (list) {
|
|
if (!list || !list.length) {
|
|
return list || []
|
|
}
|
|
return list.map(item => {
|
|
const bu = buildQcBu(item.site)
|
|
return {
|
|
...item,
|
|
buNo: bu,
|
|
bu
|
|
}
|
|
})
|
|
}
|