OpenHarmony KMP员工薪资评估 | 科学制定方案

目录
概述
员工薪资是企业人力资源管理中最重要的内容之一。合理的薪资体系能够激励员工、提升企业竞争力、促进企业发展。然而,面对复杂的薪资评估标准和众多的评估维度,企业HR往往难以制定科学、公平的薪资方案。员工薪资评估系统是帮助企业了解薪资特点、评估薪资合理性、制定科学薪资方案的重要工具。本文档介绍如何在 Kotlin Multiplatform (KMP) 框架下,结合 OpenHarmony 鸿蒙操作系统,实现一个功能完整的员工薪资评估系统。
员工薪资评估系统是一个综合性的薪资管理平台,它不仅能够对员工薪资进行多维度评估,还能够进行薪资对比、生成薪资建议、提供个性化的薪资调整方案。通过KMP框架的跨端能力,这个工具可以在Android、iOS、Web和OpenHarmony等多个平台上运行,为企业提供了一个强大的薪资决策辅助工具。
员工薪资评估的重要性
员工薪资评估在现代企业管理中的重要性日益凸显:
- 公平性保证:科学的评估能够确保薪资分配的公平性。
- 员工满意度:合理的薪资能够提升员工满意度。
- 人才吸引:竞争力的薪资能够吸引优秀人才。
- 成本控制:科学的评估能够控制企业薪资成本。
- 企业发展:合理的薪资体系能够促进企业发展。
工具的核心价值
员工薪资评估系统提供以下价值:
- 多维度评估:从岗位等级、工作经验、绩效评分、学历背景等多个维度进行评估
- 薪资对比:支持多个员工的薪资对比分析
- 个性化建议:根据员工情况提供个性化的薪资调整建议
- 市场对标:提供行业薪资水平参考
- 薪资建议:根据评估结果提供科学的薪资建议
- 跨平台支持:一份代码可在多个平台运行,提高管理效率
薪资评估基础
核心概念
薪资评分(Salary Rating):对员工薪资合理性的综合评价,通常用0-100的分数表示。
岗位等级(Position Level):员工所在岗位的等级划分。
工作经验(Work Experience):员工的工作年限和经验积累。
绩效评分(Performance Score):员工的工作绩效评分。
学历背景(Education Background):员工的学历和专业背景。
薪资竞争力(Salary Competitiveness):员工薪资与市场水平的比较。
常见的薪资评估维度
岗位维度:岗位等级、岗位职责、岗位复杂度等。
人员维度:工作经验、学历背景、技能水平等。
绩效维度:工作绩效、工作质量、工作效率等。
市场维度:行业薪资水平、地区薪资水平、企业规模等。
成本维度:企业薪资成本、薪资预算等。
发展维度:职业发展潜力、晋升空间等。
影响薪资评分的关键因素
岗位等级:岗位等级是薪资的重要决定因素。
工作经验:工作经验越丰富,薪资通常越高。
绩效表现:优秀的绩效应该获得更高的薪资。
学历背景:高学历通常对应更高的薪资。
市场水平:市场薪资水平影响企业薪资制定。
企业能力:企业的经济能力影响薪资水平。
核心评估方法
1. 岗位等级评估
评估员工岗位等级是否合理。
2. 经验评估
评估员工工作经验是否与薪资相匹配。
3. 绩效评估
评估员工绩效是否与薪资相匹配。
4. 学历评估
评估员工学历背景是否与薪资相匹配。
5. 市场对标评估
评估员工薪资与市场水平的对比。
6. 个性化建议
根据评估结果提供个性化的薪资调整建议。
Kotlin 源代码
// SalaryAssessmentSystem.kt
import java.time.LocalDateTime
import kotlin.math.pow
data class Employee(
val employeeId: String,
val name: String,
val position: String,
val department: String,
val joinDate: String
)
data class SalaryInfo(
val salaryId: String,
val employeeId: String,
val baseSalary: Double,
val bonus: Double,
val benefits: Double,
val totalSalary: Double
)
data class SalaryRating(
val salaryId: String,
val employeeName: String,
val positionScore: Double,
val experienceScore: Double,
val performanceScore: Double,
val educationScore: Double,
val marketScore: Double,
val overallScore: Double,
val ratingLevel: String,
val recommendations: List<String>,
val timestamp: String
)
data class AssessmentMetrics(
val totalEmployees: Long,
val averageScore: Double,
val highestSalaryEmployee: String,
val lowestSalaryEmployee: String,
val averageSalary: Double,
val salaryRange: String
)
data class SalaryComparison(
val salaries: List<SalaryRating>,
val bestPosition: String,
val bestExperience: String,
val bestPerformance: String,
val bestEducation: String,
val recommendation: String
)
class SalaryAssessmentSystem {
private val employees = mutableListOf<Employee>()
private val salaryInfos = mutableListOf<SalaryInfo>()
private val ratings = mutableListOf<SalaryRating>()
private var employeeIdCounter = 0
private var salaryIdCounter = 0
// 添加员工
fun addEmployee(
name: String,
position: String,
department: String,
joinDate: String
): Employee {
val id = "EMP${++employeeIdCounter}"
val employee = Employee(id, name, position, department, joinDate)
employees.add(employee)
return employee
}
// 添加薪资信息
fun addSalaryInfo(
employeeId: String,
baseSalary: Double,
bonus: Double,
benefits: Double
): SalaryInfo {
val id = "SAL${++salaryIdCounter}"
val totalSalary = baseSalary + bonus + benefits
val salaryInfo = SalaryInfo(id, employeeId, baseSalary, bonus, benefits, totalSalary)
salaryInfos.add(salaryInfo)
return salaryInfo
}
// 评估薪资
fun assessSalary(
salaryId: String,
positionScore: Double,
experienceScore: Double,
performanceScore: Double,
educationScore: Double,
marketScore: Double
): SalaryRating {
val salaryInfo = salaryInfos.find { it.salaryId == salaryId }
?: return SalaryRating("", "", 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, "", emptyList(), "")
val employee = employees.find { it.employeeId == salaryInfo.employeeId }
?: return SalaryRating("", "", 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, "", emptyList(), "")
// 确保分数在0-100范围内
val position = minOf(maxOf(positionScore, 0.0), 100.0)
val experience = minOf(maxOf(experienceScore, 0.0), 100.0)
val performance = minOf(maxOf(performanceScore, 0.0), 100.0)
val education = minOf(maxOf(educationScore, 0.0), 100.0)
val market = minOf(maxOf(marketScore, 0.0), 100.0)
// 计算综合评分(加权平均)
val overallScore = position * 0.25 + experience * 0.20 + performance * 0.20 + education * 0.15 + market * 0.20
// 判断评分等级
val ratingLevel = when {
overallScore >= 90 -> "薪资优秀"
overallScore >= 80 -> "薪资良好"
overallScore >= 70 -> "薪资合理"
overallScore >= 60 -> "薪资基本合理"
else -> "薪资需要调整"
}
// 生成建议
val recommendations = generateRecommendations(
position, experience, performance, education, market, employee, salaryInfo
)
val rating = SalaryRating(
salaryId, employee.name, position, experience, performance, education, market,
overallScore, ratingLevel, recommendations, LocalDateTime.now().toString()
)
ratings.add(rating)
return rating
}
// 生成建议
private fun generateRecommendations(
position: Double,
experience: Double,
performance: Double,
education: Double,
market: Double,
employee: Employee,
salaryInfo: SalaryInfo
): List<String> {
val recommendations = mutableListOf<String>()
if (position >= 80) {
recommendations.add("📊 岗位等级匹配,薪资定位准确")
} else if (position < 60) {
recommendations.add("📊 岗位等级不匹配,建议重新评估岗位")
}
if (experience >= 80) {
recommendations.add("📅 工作经验充足,薪资水平合理")
} else if (experience < 60) {
recommendations.add("📅 工作经验不足,建议根据经验调整薪资")
}
if (performance >= 80) {
recommendations.add("⭐ 绩效优秀,建议提高薪资激励")
} else if (performance < 60) {
recommendations.add("⭐ 绩效一般,建议关注员工发展")
}
if (education >= 75) {
recommendations.add("🎓 学历背景优秀,薪资水平合理")
} else if (education < 65) {
recommendations.add("🎓 学历背景一般,薪资水平可调整")
}
if (market >= 80) {
recommendations.add("💰 市场竞争力强,薪资具有吸引力")
} else if (market < 60) {
recommendations.add("💰 市场竞争力弱,建议提高薪资水平")
}
if (salaryInfo.totalSalary > 20000) {
recommendations.add("💵 薪资水平较高,建议定期评估")
}
return recommendations
}
// 获取评估指标
fun getAssessmentMetrics(): AssessmentMetrics {
if (ratings.isEmpty()) {
return AssessmentMetrics(0, 0.0, "", "", 0.0, "")
}
val totalEmployees = employees.size.toLong()
val averageScore = ratings.map { it.overallScore }.average()
val highestSalaryEmployee = ratings.maxByOrNull { it.overallScore }?.employeeName ?: ""
val lowestSalaryEmployee = ratings.minByOrNull { it.overallScore }?.employeeName ?: ""
val averageSalary = salaryInfos.map { it.totalSalary }.average()
val maxSalary = salaryInfos.maxOf { it.totalSalary }
val minSalary = salaryInfos.minOf { it.totalSalary }
val salaryRange = "¥${String.format("%.0f", minSalary)} - ¥${String.format("%.0f", maxSalary)}"
return AssessmentMetrics(
totalEmployees, averageScore, highestSalaryEmployee, lowestSalaryEmployee,
averageSalary, salaryRange
)
}
// 获取所有评估
fun getAllRatings(): List<SalaryRating> {
return ratings.toList()
}
// 薪资对比
fun compareSalaries(salaryIds: List<String>): SalaryComparison {
val comparisonRatings = ratings.filter { it.salaryId in salaryIds }
val bestPosition = comparisonRatings.maxByOrNull { it.positionScore }?.employeeName ?: ""
val bestExperience = comparisonRatings.maxByOrNull { it.experienceScore }?.employeeName ?: ""
val bestPerformance = comparisonRatings.maxByOrNull { it.performanceScore }?.employeeName ?: ""
val bestEducation = comparisonRatings.maxByOrNull { it.educationScore }?.employeeName ?: ""
val avgScore = comparisonRatings.map { it.overallScore }.average()
val recommendation = when {
avgScore >= 85 -> "这些员工薪资水平很好,薪资体系合理"
avgScore >= 75 -> "这些员工薪资水平良好,可根据具体情况调整"
else -> "这些员工薪资水平一般,建议进行薪资调整"
}
return SalaryComparison(
comparisonRatings, bestPosition, bestExperience, bestPerformance, bestEducation, recommendation
)
}
// 生成薪资报告
fun generateSalaryReport(): Map<String, Any> {
val metrics = getAssessmentMetrics()
return mapOf(
"timestamp" to LocalDateTime.now().toString(),
"metrics" to metrics,
"ratings" to ratings.toList(),
"topSalaries" to ratings.sortedByDescending { it.overallScore }.take(5),
"recommendations" to generateGeneralRecommendations(metrics)
)
}
// 生成通用建议
private fun generateGeneralRecommendations(metrics: AssessmentMetrics): List<String> {
val recommendations = mutableListOf<String>()
if (metrics.averageScore >= 80) {
recommendations.add("📊 整体薪资水平高,薪资体系合理")
} else if (metrics.averageScore < 70) {
recommendations.add("📊 整体薪资水平一般,建议进行薪资调整")
}
recommendations.add("💼 定期进行薪资评估,确保薪资体系的公平性")
recommendations.add("✅ 根据市场变化和员工表现,适时调整薪资")
return recommendations
}
// 清空数据
fun clearData() {
employees.clear()
salaryInfos.clear()
ratings.clear()
}
}
fun main() {
val system = SalaryAssessmentSystem()
// 添加员工
system.addEmployee("李明", "高级工程师", "技术部", "2020-01-15")
system.addEmployee("王芳", "产品经理", "产品部", "2019-06-20")
// 添加薪资信息
system.addSalaryInfo("EMP1", 15000.0, 3000.0, 2000.0)
system.addSalaryInfo("EMP2", 12000.0, 2000.0, 1500.0)
// 评估薪资
val rating1 = system.assessSalary("SAL1", 85.0, 82.0, 88.0, 80.0, 85.0)
val rating2 = system.assessSalary("SAL2", 80.0, 78.0, 82.0, 85.0, 80.0)
println("薪资评估结果:")
println("${rating1.employeeName}: ${String.format("%.2f", rating1.overallScore)} (${rating1.ratingLevel})")
println("${rating2.employeeName}: ${String.format("%.2f", rating2.overallScore)} (${rating2.ratingLevel})")
// 生成报告
val report = system.generateSalaryReport()
println("\n薪资报告已生成")
}
Kotlin代码说明:这个Kotlin实现提供了完整的员工薪资评估功能。SalaryAssessmentSystem 类能够管理员工信息和薪资数据、进行薪资评估、进行薪资对比、生成薪资报告。通过使用数据类和科学的计算方法,代码既简洁又准确。系统支持多维度的薪资分析,从单个员工的详细评分到整个企业的薪资趋势分析,为企业提供了全面的薪资决策支持。
JavaScript 编译代码
// SalaryAssessmentSystem.js
class Employee {
constructor(employeeId, name, position, department, joinDate) {
this.employeeId = employeeId;
this.name = name;
this.position = position;
this.department = department;
this.joinDate = joinDate;
}
}
class SalaryInfo {
constructor(salaryId, employeeId, baseSalary, bonus, benefits, totalSalary) {
this.salaryId = salaryId;
this.employeeId = employeeId;
this.baseSalary = baseSalary;
this.bonus = bonus;
this.benefits = benefits;
this.totalSalary = totalSalary;
}
}
class SalaryRating {
constructor(salaryId, employeeName, positionScore, experienceScore, performanceScore, educationScore, marketScore, overallScore, ratingLevel, recommendations, timestamp) {
this.salaryId = salaryId;
this.employeeName = employeeName;
this.positionScore = positionScore;
this.experienceScore = experienceScore;
this.performanceScore = performanceScore;
this.educationScore = educationScore;
this.marketScore = marketScore;
this.overallScore = overallScore;
this.ratingLevel = ratingLevel;
this.recommendations = recommendations;
this.timestamp = timestamp;
}
}
class AssessmentMetrics {
constructor(totalEmployees, averageScore, highestSalaryEmployee, lowestSalaryEmployee, averageSalary, salaryRange) {
this.totalEmployees = totalEmployees;
this.averageScore = averageScore;
this.highestSalaryEmployee = highestSalaryEmployee;
this.lowestSalaryEmployee = lowestSalaryEmployee;
this.averageSalary = averageSalary;
this.salaryRange = salaryRange;
}
}
class SalaryAssessmentSystem {
constructor() {
this.employees = [];
this.salaryInfos = [];
this.ratings = [];
this.employeeIdCounter = 0;
this.salaryIdCounter = 0;
}
addEmployee(name, position, department, joinDate) {
const id = `EMP${++this.employeeIdCounter}`;
const employee = new Employee(id, name, position, department, joinDate);
this.employees.push(employee);
return employee;
}
addSalaryInfo(employeeId, baseSalary, bonus, benefits) {
const id = `SAL${++this.salaryIdCounter}`;
const totalSalary = baseSalary + bonus + benefits;
const salaryInfo = new SalaryInfo(id, employeeId, baseSalary, bonus, benefits, totalSalary);
this.salaryInfos.push(salaryInfo);
return salaryInfo;
}
assessSalary(salaryId, positionScore, experienceScore, performanceScore, educationScore, marketScore) {
const salaryInfo = this.salaryInfos.find(s => s.salaryId === salaryId);
if (!salaryInfo) return null;
const employee = this.employees.find(e => e.employeeId === salaryInfo.employeeId);
if (!employee) return null;
const position = Math.min(Math.max(positionScore, 0), 100);
const experience = Math.min(Math.max(experienceScore, 0), 100);
const performance = Math.min(Math.max(performanceScore, 0), 100);
const education = Math.min(Math.max(educationScore, 0), 100);
const market = Math.min(Math.max(marketScore, 0), 100);
const overallScore = position * 0.25 + experience * 0.20 + performance * 0.20 + education * 0.15 + market * 0.20;
let ratingLevel;
if (overallScore >= 90) ratingLevel = "薪资优秀";
else if (overallScore >= 80) ratingLevel = "薪资良好";
else if (overallScore >= 70) ratingLevel = "薪资合理";
else if (overallScore >= 60) ratingLevel = "薪资基本合理";
else ratingLevel = "薪资需要调整";
const recommendations = this.generateRecommendations(position, experience, performance, education, market, employee, salaryInfo);
const rating = new SalaryRating(salaryId, employee.name, position, experience, performance, education, market, overallScore, ratingLevel, recommendations, new Date().toISOString());
this.ratings.push(rating);
return rating;
}
generateRecommendations(position, experience, performance, education, market, employee, salaryInfo) {
const recommendations = [];
if (position >= 80) {
recommendations.push("📊 岗位等级匹配,薪资定位准确");
} else if (position < 60) {
recommendations.push("📊 岗位等级不匹配,建议重新评估岗位");
}
if (experience >= 80) {
recommendations.push("📅 工作经验充足,薪资水平合理");
} else if (experience < 60) {
recommendations.push("📅 工作经验不足,建议根据经验调整薪资");
}
if (performance >= 80) {
recommendations.push("⭐ 绩效优秀,建议提高薪资激励");
} else if (performance < 60) {
recommendations.push("⭐ 绩效一般,建议关注员工发展");
}
if (education >= 75) {
recommendations.push("🎓 学历背景优秀,薪资水平合理");
} else if (education < 65) {
recommendations.push("🎓 学历背景一般,薪资水平可调整");
}
if (market >= 80) {
recommendations.push("💰 市场竞争力强,薪资具有吸引力");
} else if (market < 60) {
recommendations.push("💰 市场竞争力弱,建议提高薪资水平");
}
if (salaryInfo.totalSalary > 20000) {
recommendations.push("💵 薪资水平较高,建议定期评估");
}
return recommendations;
}
getAssessmentMetrics() {
if (this.ratings.length === 0) {
return new AssessmentMetrics(0, 0, "", "", 0, "");
}
const totalEmployees = this.employees.length;
const averageScore = this.ratings.reduce((sum, r) => sum + r.overallScore, 0) / this.ratings.length;
const highestSalaryEmployee = this.ratings.reduce((max, r) => r.overallScore > max.overallScore ? r : max).employeeName;
const lowestSalaryEmployee = this.ratings.reduce((min, r) => r.overallScore < min.overallScore ? r : min).employeeName;
const averageSalary = this.salaryInfos.reduce((sum, s) => sum + s.totalSalary, 0) / this.salaryInfos.length;
const maxSalary = Math.max(...this.salaryInfos.map(s => s.totalSalary));
const minSalary = Math.min(...this.salaryInfos.map(s => s.totalSalary));
const salaryRange = `¥${Math.round(minSalary)} - ¥${Math.round(maxSalary)}`;
return new AssessmentMetrics(totalEmployees, averageScore, highestSalaryEmployee, lowestSalaryEmployee, averageSalary, salaryRange);
}
getAllRatings() {
return this.ratings;
}
compareSalaries(salaryIds) {
const comparisonRatings = this.ratings.filter(r => salaryIds.includes(r.salaryId));
const bestPosition = comparisonRatings.reduce((max, r) => r.positionScore > max.positionScore ? r : max).employeeName;
const bestExperience = comparisonRatings.reduce((max, r) => r.experienceScore > max.experienceScore ? r : max).employeeName;
const bestPerformance = comparisonRatings.reduce((max, r) => r.performanceScore > max.performanceScore ? r : max).employeeName;
const bestEducation = comparisonRatings.reduce((max, r) => r.educationScore > max.educationScore ? r : max).employeeName;
const avgScore = comparisonRatings.reduce((sum, r) => sum + r.overallScore, 0) / comparisonRatings.length;
let recommendation;
if (avgScore >= 85) recommendation = "这些员工薪资水平很好,薪资体系合理";
else if (avgScore >= 75) recommendation = "这些员工薪资水平良好,可根据具体情况调整";
else recommendation = "这些员工薪资水平一般,建议进行薪资调整";
return {
salaries: comparisonRatings,
bestPosition: bestPosition,
bestExperience: bestExperience,
bestPerformance: bestPerformance,
bestEducation: bestEducation,
recommendation: recommendation
};
}
generateSalaryReport() {
const metrics = this.getAssessmentMetrics();
return {
timestamp: new Date().toISOString(),
metrics: metrics,
ratings: this.ratings,
topSalaries: this.ratings.sort((a, b) => b.overallScore - a.overallScore).slice(0, 5),
recommendations: this.generateGeneralRecommendations(metrics)
};
}
generateGeneralRecommendations(metrics) {
const recommendations = [];
if (metrics.averageScore >= 80) {
recommendations.push("📊 整体薪资水平高,薪资体系合理");
} else if (metrics.averageScore < 70) {
recommendations.push("📊 整体薪资水平一般,建议进行薪资调整");
}
recommendations.push("💼 定期进行薪资评估,确保薪资体系的公平性");
recommendations.push("✅ 根据市场变化和员工表现,适时调整薪资");
return recommendations;
}
clearData() {
this.employees = [];
this.salaryInfos = [];
this.ratings = [];
}
}
// 使用示例
const system = new SalaryAssessmentSystem();
system.addEmployee("李明", "高级工程师", "技术部", "2020-01-15");
system.addEmployee("王芳", "产品经理", "产品部", "2019-06-20");
system.addSalaryInfo("EMP1", 15000, 3000, 2000);
system.addSalaryInfo("EMP2", 12000, 2000, 1500);
const rating1 = system.assessSalary("SAL1", 85, 82, 88, 80, 85);
const rating2 = system.assessSalary("SAL2", 80, 78, 82, 85, 80);
console.log("薪资评估结果:");
console.log(`${rating1.employeeName}: ${rating1.overallScore.toFixed(2)} (${rating1.ratingLevel})`);
console.log(`${rating2.employeeName}: ${rating2.overallScore.toFixed(2)} (${rating2.ratingLevel})`);
const report = system.generateSalaryReport();
console.log("\n薪资报告已生成");
JavaScript代码说明:JavaScript版本是Kotlin代码的直接转译。我们使用ES6的class语法定义各个类,使用数学函数进行计算。整体逻辑和算法与Kotlin版本保持一致,确保跨平台的一致性。JavaScript的灵活性使得代码更加简洁,同时保持了清晰的结构和完整的功能。
ArkTS 调用代码
// SalaryAssessmentPage.ets
import { SalaryAssessmentSystem } from './SalaryAssessmentSystem';
@Entry
@Component
struct SalaryAssessmentPage {
@State employeeName: string = '李明';
@State position: string = '高级工程师';
@State baseSalary: number = 15000;
@State bonus: number = 3000;
@State benefits: number = 2000;
@State positionScore: number = 85;
@State experienceScore: number = 80;
@State performanceScore: number = 85;
@State educationScore: number = 80;
@State marketScore: number = 85;
@State selectedTab: number = 0;
@State ratings: Array<any> = [];
@State metrics: any = null;
@State isLoading: boolean = false;
@State errorMessage: string = '';
@State report: any = null;
private system: SalaryAssessmentSystem = new SalaryAssessmentSystem();
addAndAssessSalary() {
if (!this.employeeName.trim()) {
this.errorMessage = '请输入员工姓名';
return;
}
this.isLoading = true;
this.errorMessage = '';
try {
this.system.addEmployee(this.employeeName, this.position, "部门", "2020-01-15");
this.system.addSalaryInfo(
"EMP1",
this.baseSalary,
this.bonus,
this.benefits
);
this.system.assessSalary(
"SAL1",
this.positionScore,
this.experienceScore,
this.performanceScore,
this.educationScore,
this.marketScore
);
this.ratings = this.system.getAllRatings();
this.metrics = this.system.getAssessmentMetrics();
AlertDialog.show({ message: '薪资已添加并评估' });
// 重置表单
this.employeeName = '';
this.positionScore = 80;
this.experienceScore = 80;
this.performanceScore = 80;
this.educationScore = 80;
this.marketScore = 80;
} catch (error) {
this.errorMessage = '操作失败: ' + error.message;
} finally {
this.isLoading = false;
}
}
generateReport() {
this.isLoading = true;
try {
this.report = this.system.generateSalaryReport();
} catch (error) {
this.errorMessage = '生成报告失败: ' + error.message;
} finally {
this.isLoading = false;
}
}
getRatingLevelColor(level: string): string {
switch (level) {
case '薪资优秀': return '#FFD700';
case '薪资良好': return '#4CAF50';
case '薪资合理': return '#FF9800';
case '薪资基本合理': return '#F44336';
case '薪资需要调整': return '#D32F2F';
default: return '#999999';
}
}
build() {
Column() {
Text('员工薪资评估系统')
.fontSize(24)
.fontWeight(FontWeight.Bold)
.margin({ top: 20, bottom: 20 })
Tabs({ barPosition: BarPosition.Start }) {
TabContent() {
Column() {
Text('添加薪资').fontSize(14).fontWeight(FontWeight.Bold).margin({ bottom: 15 })
Text('员工姓名:').fontSize(12).margin({ bottom: 5 })
TextInput({ placeholder: '李明' })
.value(this.employeeName)
.onChange((value: string) => { this.employeeName = value; })
.height(40).padding(10).border({ width: 1, color: '#cccccc' }).margin({ bottom: 15 })
Row() {
Column() {
Text('岗位:').fontSize(12).margin({ bottom: 5 })
TextInput({ placeholder: '高级工程师' })
.value(this.position)
.onChange((value: string) => { this.position = value; })
.height(40).padding(10).border({ width: 1, color: '#cccccc' })
}
.flex(1)
Column() {
Text('基本薪资:').fontSize(12).margin({ bottom: 5 })
TextInput({ placeholder: '15000' })
.type(InputType.Number)
.value(this.baseSalary.toString())
.onChange((value: string) => { this.baseSalary = parseInt(value) || 0; })
.height(40).padding(10).border({ width: 1, color: '#cccccc' })
}
.flex(1)
.margin({ left: 10 })
}
.margin({ bottom: 15 })
Row() {
Column() {
Text('奖金:').fontSize(12).margin({ bottom: 5 })
TextInput({ placeholder: '3000' })
.type(InputType.Number)
.value(this.bonus.toString())
.onChange((value: string) => { this.bonus = parseInt(value) || 0; })
.height(40).padding(10).border({ width: 1, color: '#cccccc' })
}
.flex(1)
Column() {
Text('福利:').fontSize(12).margin({ bottom: 5 })
TextInput({ placeholder: '2000' })
.type(InputType.Number)
.value(this.benefits.toString())
.onChange((value: string) => { this.benefits = parseInt(value) || 0; })
.height(40).padding(10).border({ width: 1, color: '#cccccc' })
}
.flex(1)
.margin({ left: 10 })
}
.margin({ bottom: 15 })
Text('岗位等级评分:').fontSize(12).margin({ bottom: 5 })
Slider({ value: this.positionScore, min: 0, max: 100, step: 5 })
.onChange((value: number) => { this.positionScore = value; })
.margin({ bottom: 15 })
Row() {
Column() {
Text('工作经验:').fontSize(12).margin({ bottom: 5 })
Slider({ value: this.experienceScore, min: 0, max: 100, step: 5 })
.onChange((value: number) => { this.experienceScore = value; })
}
.flex(1)
Column() {
Text('绩效评分:').fontSize(12).margin({ bottom: 5 })
Slider({ value: this.performanceScore, min: 0, max: 100, step: 5 })
.onChange((value: number) => { this.performanceScore = value; })
}
.flex(1)
.margin({ left: 10 })
}
.margin({ bottom: 15 })
Row() {
Column() {
Text('学历背景:').fontSize(12).margin({ bottom: 5 })
Slider({ value: this.educationScore, min: 0, max: 100, step: 5 })
.onChange((value: number) => { this.educationScore = value; })
}
.flex(1)
Column() {
Text('市场竞争力:').fontSize(12).margin({ bottom: 5 })
Slider({ value: this.marketScore, min: 0, max: 100, step: 5 })
.onChange((value: number) => { this.marketScore = value; })
}
.flex(1)
.margin({ left: 10 })
}
.margin({ bottom: 15 })
Button('添加并评估').width('100%').height(40).margin({ bottom: 15 })
.onClick(() => { this.addAndAssessSalary(); }).enabled(!this.isLoading)
if (this.errorMessage) {
Text(this.errorMessage).fontSize(12).fontColor('#F44336').margin({ bottom: 15 })
}
}
.padding(15)
}
.tabBar('➕ 添加薪资')
TabContent() {
Column() {
if (this.ratings.length > 0) {
Text('薪资评估').fontSize(16).fontWeight(FontWeight.Bold).margin({ bottom: 15 })
List() {
ForEach(this.ratings, (rating: any) => {
ListItem() {
Column() {
Row() {
Text(rating.employeeName).fontSize(14).fontWeight(FontWeight.Bold).flex(1)
Text(rating.ratingLevel).fontSize(12).fontColor(this.getRatingLevelColor(rating.ratingLevel))
.fontWeight(FontWeight.Bold)
}
.margin({ bottom: 10 })
Row() {
Text('综合评分:').fontSize(11)
Text(rating.overallScore.toFixed(1)).fontSize(11).fontWeight(FontWeight.Bold)
.fontColor('#2196F3')
}
.margin({ bottom: 5 })
Row() {
Column() {
Text('岗位:').fontSize(10).fontColor('#999999')
Text(rating.positionScore.toFixed(0)).fontSize(10).fontWeight(FontWeight.Bold)
}
.flex(1)
Column() {
Text('经验:').fontSize(10).fontColor('#999999')
Text(rating.experienceScore.toFixed(0)).fontSize(10).fontWeight(FontWeight.Bold)
}
.flex(1)
Column() {
Text('绩效:').fontSize(10).fontColor('#999999')
Text(rating.performanceScore.toFixed(0)).fontSize(10).fontWeight(FontWeight.Bold)
}
.flex(1)
Column() {
Text('学历:').fontSize(10).fontColor('#999999')
Text(rating.educationScore.toFixed(0)).fontSize(10).fontWeight(FontWeight.Bold)
}
.flex(1)
}
}
.padding(10).border({ width: 1, color: '#eeeeee' }).borderRadius(5)
}
}, (rating: any) => rating.salaryId)
}
} else {
Text('请先添加薪资').fontSize(12).fontColor('#999999')
}
}
.padding(15)
}
.tabBar('⭐ 评估列表')
TabContent() {
Column() {
if (this.metrics) {
Text('评估指标').fontSize(16).fontWeight(FontWeight.Bold).margin({ bottom: 15 })
Row() {
Column() {
Text('平均评分').fontSize(11).fontColor('#999999')
Text(this.metrics.averageScore.toFixed(1)).fontSize(18)
.fontWeight(FontWeight.Bold).fontColor('#2196F3').margin({ top: 5 })
}
.flex(1).alignItems(HorizontalAlign.Center).padding(15).backgroundColor('#F5F5F5').borderRadius(5)
Column() {
Text('员工总数').fontSize(11).fontColor('#999999')
Text(this.metrics.totalEmployees.toString()).fontSize(18)
.fontWeight(FontWeight.Bold).fontColor('#4CAF50').margin({ top: 5 })
}
.flex(1).alignItems(HorizontalAlign.Center).padding(15).backgroundColor('#F5F5F5').borderRadius(5)
.margin({ left: 10 })
}
.margin({ bottom: 15 })
Column() {
Row() {
Text('最高薪资员工:').fontSize(12)
Text(this.metrics.highestSalaryEmployee).fontSize(12).fontWeight(FontWeight.Bold)
}
.margin({ bottom: 10 })
Row() {
Text('最低薪资员工:').fontSize(12)
Text(this.metrics.lowestSalaryEmployee).fontSize(12).fontWeight(FontWeight.Bold)
}
.margin({ bottom: 10 })
Row() {
Text('平均薪资:').fontSize(12)
Text('¥' + this.metrics.averageSalary.toFixed(0)).fontSize(12).fontWeight(FontWeight.Bold)
}
.margin({ bottom: 10 })
Row() {
Text('薪资范围:').fontSize(12)
Text(this.metrics.salaryRange).fontSize(12).fontWeight(FontWeight.Bold)
}
}
.padding(10).backgroundColor('#F5F5F5').borderRadius(5)
} else {
Text('请先添加薪资').fontSize(12).fontColor('#999999')
}
}
.padding(15)
}
.tabBar('📊 指标')
TabContent() {
Column() {
Button('生成报告').width('100%').height(40).margin({ bottom: 15 })
.onClick(() => { this.generateReport(); })
if (this.report) {
Text('薪资报告').fontSize(16).fontWeight(FontWeight.Bold).margin({ bottom: 15 })
if (this.report.recommendations && this.report.recommendations.length > 0) {
Text('建议:').fontSize(14).fontWeight(FontWeight.Bold).margin({ bottom: 10 })
Column() {
ForEach(this.report.recommendations, (rec: string, index: number) => {
Row() {
Text('•').fontSize(14).fontWeight(FontWeight.Bold).margin({ right: 10 })
Text(rec).fontSize(11).flex(1)
}
.padding(10).margin({ bottom: 8 }).backgroundColor('#E3F2FD').borderRadius(5)
}, (rec: string, index: number) => index.toString())
}
}
}
}
.padding(15)
}
.tabBar('📈 报告')
}
.width('100%')
.flex(1)
}
.padding(10)
.width('100%')
.height('100%')
}
}
ArkTS代码说明:这个ArkTS实现展示了如何在OpenHarmony应用中集成员工薪资评估系统。通过使用标签页组件,用户可以在添加薪资、查看评估列表、查看评估指标和生成报告之间切换。UI设计直观,提供了良好的用户体验。每个标签页都有不同的功能,用户可以全面地进行薪资评估和薪资管理。
评估指标详解
薪资评分维度
岗位等级评分:员工岗位等级是否与薪资相匹配,范围0-100。
工作经验评分:员工工作经验是否与薪资相匹配,范围0-100。
绩效评分:员工绩效表现是否与薪资相匹配,范围0-100。
学历背景评分:员工学历背景是否与薪资相匹配,范围0-100。
市场竞争力评分:员工薪资与市场水平的对比,范围0-100。
综合评分:五个维度的加权平均,权重分别为25%、20%、20%、15%、20%。
评分等级
薪资优秀:综合评分90-100分,薪资水平优秀。
薪资良好:综合评分80-89分,薪资水平良好。
薪资合理:综合评分70-79分,薪资水平合理。
薪资基本合理:综合评分60-69分,薪资水平基本合理。
薪资需要调整:综合评分0-59分,薪资需要调整。
实战应用
应用场景1:薪资体系设计
企业可以使用这个系统设计科学合理的薪资体系,确保薪资的公平性。
应用场景2:员工薪资调整
HR可以使用这个系统评估员工薪资是否合理,制定薪资调整方案。
应用场景3:薪资预算管理
企业可以使用这个系统进行薪资预算管理和成本控制。
应用场景4:薪资分析研究
企业可以使用这个系统进行薪资数据分析和研究。
总结
员工薪资评估系统是现代企业人力资源管理中的重要工具。通过KMP框架和OpenHarmony操作系统的结合,我们可以实现一个功能完整、高效可靠的薪资评估系统。
这个工具不仅能够对员工薪资进行多维度评分,还能够进行薪资对比、生成薪资建议、提供个性化的薪资调整方案。通过本文介绍的Kotlin实现、JavaScript编译和ArkTS调用,企业可以快速构建自己的薪资评估系统。
在实际应用中,薪资评估的价值远不止于此。从提升员工满意度到吸引优秀人才,从控制企业成本到促进企业发展,薪资评估都发挥着重要的作用。通过持续改进和优化,可以构建更加科学和高效的薪资体系。
掌握好薪资评估的方法和工具,对于提升企业竞争力和实现企业目标都有重要的帮助。通过这个系统的学习和使用,希望能够帮助企业更好地进行薪资管理,制定科学的薪资方案,最终实现企业和员工的共同发展。
欢迎加入开源鸿蒙跨平台社区:https://openharmonycrossplatform.csdn.net
AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。
更多推荐


所有评论(0)