|
|
|
@ -75,6 +75,25 @@ import echarts from 'echarts' |
|
|
|
import { getFactoryOverviewBoardData } from '@/api/longchuang/productionPlan' |
|
|
|
|
|
|
|
const STATUS_ALLOW_LIST = ['已排产', '进行中', '已完成'] |
|
|
|
const KEY_NODE_NAME_ORDER = ['仓库配料', 'VL2.5组装', '检验', '打包', '线缆/COP', '机加工生产', '机加工检验'] |
|
|
|
const NODE_NAME_BY_CODE = { |
|
|
|
stocking: '仓库配料', |
|
|
|
assy: 'VL2.5组装', |
|
|
|
inspect: '检验', |
|
|
|
pack: '打包', |
|
|
|
lineProduction: '线缆/COP', |
|
|
|
copProduction: '线缆/COP', |
|
|
|
machiningProduction: '机加工生产', |
|
|
|
machiningInspection: '机加工检验', |
|
|
|
platformDebug: '平台组装/调试', |
|
|
|
bgCeiling: '背景墙/吊顶组装', |
|
|
|
doorAssy: '门组装' |
|
|
|
} |
|
|
|
const NODE_DISPLAY_NAME_ALIAS = { |
|
|
|
组装: 'VL2.5组装', |
|
|
|
线缆生产: '线缆/COP', |
|
|
|
COP生产: '线缆/COP' |
|
|
|
} |
|
|
|
|
|
|
|
export default { |
|
|
|
name: 'ScreenFactoryOverview', |
|
|
|
@ -158,6 +177,7 @@ export default { |
|
|
|
}, |
|
|
|
normalizeNodeList(sourceList) { |
|
|
|
return (sourceList || []).map(node => ({ |
|
|
|
nodeCode: node && node.nodeCode ? node.nodeCode : '', |
|
|
|
nodeName: node && node.nodeName ? node.nodeName : '', |
|
|
|
status: node && node.status ? node.status : '' |
|
|
|
})) |
|
|
|
@ -239,21 +259,49 @@ export default { |
|
|
|
all.forEach(item => { |
|
|
|
const list = item.nodeList || [] |
|
|
|
list.forEach(node => { |
|
|
|
if (!nodeMap[node.nodeName]) nodeMap[node.nodeName] = { total: 0, done: 0 } |
|
|
|
nodeMap[node.nodeName].total += 1 |
|
|
|
if (node.status === '已完成') nodeMap[node.nodeName].done += 1 |
|
|
|
const nodeName = this.resolveNodeName(node) |
|
|
|
if (!nodeName) return |
|
|
|
if (!nodeMap[nodeName]) nodeMap[nodeName] = { total: 0, done: 0 } |
|
|
|
nodeMap[nodeName].total += 1 |
|
|
|
if (node.status === '已完成') nodeMap[nodeName].done += 1 |
|
|
|
}) |
|
|
|
}) |
|
|
|
return Object.keys(nodeMap).map((name) => { |
|
|
|
KEY_NODE_NAME_ORDER.forEach(name => { |
|
|
|
if (!nodeMap[name]) { |
|
|
|
nodeMap[name] = { total: 0, done: 0 } |
|
|
|
} |
|
|
|
}) |
|
|
|
const keyNodeRateList = KEY_NODE_NAME_ORDER.map((name) => { |
|
|
|
const total = nodeMap[name].total |
|
|
|
const done = nodeMap[name].done |
|
|
|
return { |
|
|
|
name, |
|
|
|
total, |
|
|
|
done, |
|
|
|
rate: total ? Math.round((done / total) * 100) : 0, |
|
|
|
rate: total ? Math.round((done / total) * 100) : 0 |
|
|
|
} |
|
|
|
}).sort((a, b) => b.rate - a.rate) |
|
|
|
}) |
|
|
|
const extraNodeRateList = Object.keys(nodeMap) |
|
|
|
.filter(name => !KEY_NODE_NAME_ORDER.includes(name)) |
|
|
|
.map((name) => { |
|
|
|
const total = nodeMap[name].total |
|
|
|
const done = nodeMap[name].done |
|
|
|
return { |
|
|
|
name, |
|
|
|
total, |
|
|
|
done, |
|
|
|
rate: total ? Math.round((done / total) * 100) : 0 |
|
|
|
} |
|
|
|
}) |
|
|
|
.sort((a, b) => b.rate - a.rate) |
|
|
|
return keyNodeRateList.concat(extraNodeRateList) |
|
|
|
}, |
|
|
|
resolveNodeName(node) { |
|
|
|
if (!node) return '' |
|
|
|
const nodeName = String(node.nodeName || '').trim() |
|
|
|
if (nodeName) return NODE_DISPLAY_NAME_ALIAS[nodeName] || nodeName |
|
|
|
const nodeCode = String(node.nodeCode || '').trim() |
|
|
|
return NODE_NAME_BY_CODE[nodeCode] || '' |
|
|
|
}, |
|
|
|
getNodeRateClass(rate) { |
|
|
|
if (rate >= 85) return 'is-high' |
|
|
|
|