120 lines
3.6 KiB
JavaScript
120 lines
3.6 KiB
JavaScript
/**
|
|
* 四层战略地图泳道配置常量
|
|
* 管理会计OS — BSC四层因果链
|
|
*
|
|
* 颜色规范:
|
|
* 财务层 #F56C6C (红) — 滞后指标(结果)
|
|
* 客户层 #409EFF (蓝) — 领先指标(驱动)
|
|
* 流程层 #67C23A (绿) — 领先指标(驱动)
|
|
* 学习层 #E6A23C (橙) — 领先指标(根本驱动)
|
|
*/
|
|
|
|
export const LAYER_KEYS = ['financial', 'customer', 'process', 'learning']
|
|
|
|
/** 每层默认的颜色/图标/预设节点 */
|
|
export const LAYER_CONFIG = {
|
|
financial: {
|
|
key: 'financial',
|
|
label: '财务层',
|
|
enLabel: 'Financial',
|
|
icon: '💰',
|
|
iconComponent: 'Money',
|
|
color: '#F56C6C',
|
|
bgColor: '#FEF0F0',
|
|
lightColor: '#FDE2E2',
|
|
order: 1,
|
|
description: '股东价值目标 — 滞后指标(结果)',
|
|
defaultNodes: [
|
|
{ name: '营收目标', targetValue: null, unit: '万元', isLeading: false },
|
|
{ name: '净利润率', targetValue: null, unit: '%', isLeading: false },
|
|
{ name: '现金流', targetValue: null, unit: '万元', isLeading: false },
|
|
],
|
|
},
|
|
customer: {
|
|
key: 'customer',
|
|
label: '客户层',
|
|
enLabel: 'Customer',
|
|
icon: '👥',
|
|
iconComponent: 'User',
|
|
color: '#409EFF',
|
|
bgColor: '#ECF5FF',
|
|
lightColor: '#D9ECFF',
|
|
order: 2,
|
|
description: '客户价值主张 — 领先指标(驱动)',
|
|
defaultNodes: [
|
|
{ name: '客户满意度', targetValue: null, unit: '%', isLeading: true },
|
|
{ name: '市场份额', targetValue: null, unit: '%', isLeading: true },
|
|
{ name: '客户保留率', targetValue: null, unit: '%', isLeading: true },
|
|
],
|
|
},
|
|
process: {
|
|
key: 'process',
|
|
label: '内部流程层',
|
|
enLabel: 'Internal Process',
|
|
icon: '⚙️',
|
|
iconComponent: 'Setting',
|
|
color: '#67C23A',
|
|
bgColor: '#F0F9EB',
|
|
lightColor: '#E1F3D8',
|
|
order: 3,
|
|
description: '流程卓越 — 领先指标(驱动)',
|
|
defaultNodes: [
|
|
{ name: '运营效率', targetValue: null, unit: '%', isLeading: true },
|
|
{ name: '质量合格率', targetValue: null, unit: '%', isLeading: true },
|
|
],
|
|
},
|
|
learning: {
|
|
key: 'learning',
|
|
label: '学习成长层',
|
|
enLabel: 'Learning & Growth',
|
|
icon: '📚',
|
|
iconComponent: 'Reading',
|
|
color: '#E6A23C',
|
|
bgColor: '#FDF6EC',
|
|
lightColor: '#FAECD8',
|
|
order: 4,
|
|
description: '无形资产 — 领先指标(根本驱动)',
|
|
defaultNodes: [
|
|
{ name: '关键岗位胜任度', targetValue: null, unit: '%', isLeading: true },
|
|
{ name: '培训完成率', targetValue: null, unit: '%', isLeading: true },
|
|
],
|
|
},
|
|
}
|
|
|
|
/** 根据层KEY获取颜色 */
|
|
export function getLayerColor(layerKey) {
|
|
return LAYER_CONFIG[layerKey]?.color || '#909399'
|
|
}
|
|
|
|
/** 根据层KEY获取中文标签 */
|
|
export function getLayerLabel(layerKey) {
|
|
return LAYER_CONFIG[layerKey]?.label || layerKey
|
|
}
|
|
|
|
/** 根据层KEY获取英文标签 */
|
|
export function getLayerEnLabel(layerKey) {
|
|
return LAYER_CONFIG[layerKey]?.enLabel || layerKey
|
|
}
|
|
|
|
/** 获取所有层的配置数组(按order排序) */
|
|
export function getLayerList() {
|
|
return LAYER_KEYS.map((k) => LAYER_CONFIG[k]).sort(
|
|
(a, b) => a.order - b.order
|
|
)
|
|
}
|
|
|
|
/**
|
|
* 计算节点状态
|
|
* @param {number|null} currentValue
|
|
* @param {number|null} targetValue
|
|
* @param {boolean} isLeading - 领先指标
|
|
* @returns {'success'|'warning'|'danger'|'info'}
|
|
*/
|
|
export function computeNodeStatus(currentValue, targetValue) {
|
|
if (currentValue == null || targetValue == null) return 'info'
|
|
const ratio = targetValue === 0 ? 0 : currentValue / targetValue
|
|
if (ratio >= 1.0) return 'success'
|
|
if (ratio >= 0.8) return 'warning'
|
|
return 'danger'
|
|
}
|