49 lines
2.2 KiB
TypeScript
49 lines
2.2 KiB
TypeScript
import * as dotenv from 'dotenv';
|
|
dotenv.config();
|
|
import pool from './src/config/database';
|
|
|
|
const defaults: [string, string, string][] = [
|
|
['business_completion_weight', '15', '工作完成度权重'],
|
|
['business_quality_weight', '10', '工作质量权重'],
|
|
['business_efficiency_weight', '10', '工作效率权重'],
|
|
['business_skill_weight', '10', '专业技能权重'],
|
|
['business_innovation_weight', '5', '创新能力权重'],
|
|
['business_problem_solving_weight', '5', '问题解决权重'],
|
|
['business_customer_satisfaction_weight', '5', '客户满意度权重'],
|
|
['business_teamwork_weight', '5', '团队协作权重'],
|
|
['business_goal_achievement_weight', '5', '目标达成权重'],
|
|
['comprehensive_responsibility_weight', '5', '责任心权重'],
|
|
['comprehensive_initiative_weight', '4', '主动性权重'],
|
|
['comprehensive_learning_weight', '4', '学习能力权重'],
|
|
['comprehensive_communication_weight', '4', '沟通能力权重'],
|
|
['comprehensive_execution_weight', '4', '执行力权重'],
|
|
['comprehensive_discipline_weight', '4', '纪律性权重'],
|
|
['comprehensive_team_spirit_weight', '5', '团队精神权重'],
|
|
['comprehensive_attendance_weight', '10', '考勤权重'],
|
|
['reward_excellent', '500', '优秀奖励金额'],
|
|
['punish_qualified_high', '0', '合格(80-89)扣款'],
|
|
['punish_qualified_low', '100', '合格(70-79)扣款'],
|
|
['punish_need_motivation', '200', '需激励扣款'],
|
|
['punish_unqualified', '500', '不合格扣款'],
|
|
['attendance_leave_deduct', '5', '事假每天扣分'],
|
|
['attendance_late_deduct', '2', '迟到每次扣分'],
|
|
['attendance_lack_card_deduct', '2', '缺卡每次扣分'],
|
|
['attendance_base_score', '10', '考勤基础分'],
|
|
];
|
|
|
|
async function run() {
|
|
for (const [key, value, desc] of defaults) {
|
|
await pool.query(
|
|
`INSERT INTO performance_rules (rule_key, rule_value, description)
|
|
VALUES (?, ?, ?)
|
|
ON DUPLICATE KEY UPDATE description = VALUES(description)`,
|
|
[key, value, desc]
|
|
);
|
|
}
|
|
const [rows] = await pool.query<any[]>('SELECT COUNT(*) as cnt FROM performance_rules');
|
|
console.log('规则总数:', rows[0].cnt);
|
|
await pool.end();
|
|
console.log('完成');
|
|
}
|
|
run().catch(console.error);
|