- 包含4个产业方向的前端项目:智能开发、智能制造、大健康、财经商贸 - 已清理node_modules、.yoyo等大文件,项目大小从2.6GB优化至631MB - 配置完善的.gitignore文件 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
114 lines
4.0 KiB
JavaScript
114 lines
4.0 KiB
JavaScript
import fs from 'fs';
|
||
|
||
// 读取生成的项目库Mock数据
|
||
const mockContent = fs.readFileSync('src/mocks/projectLibraryMock.js', 'utf8');
|
||
|
||
// 提取projectDetails对象
|
||
const detailsMatch = mockContent.match(/const projectDetails = ({[\s\S]*?});[\s\S]*?const detail = projectDetails/);
|
||
if (!detailsMatch) {
|
||
console.error('无法提取projectDetails数据');
|
||
process.exit(1);
|
||
}
|
||
|
||
// 使用eval来解析JavaScript对象(注意:这只在受控环境中使用)
|
||
let projectDetails;
|
||
try {
|
||
eval(`projectDetails = ${detailsMatch[1]}`);
|
||
} catch (e) {
|
||
console.error('解析projectDetails失败:', e);
|
||
process.exit(1);
|
||
}
|
||
|
||
// 统计不同等级的岗位
|
||
const levelStats = {
|
||
'普通岗': [],
|
||
'技术骨干岗': [],
|
||
'储备干部岗': []
|
||
};
|
||
|
||
// 收集所有岗位信息
|
||
Object.values(projectDetails).forEach(project => {
|
||
project.applicablePositions.forEach(pos => {
|
||
if (levelStats[pos.level]) {
|
||
// 检查是否已存在该岗位
|
||
const existing = levelStats[pos.level].find(p => p.name === pos.position);
|
||
if (existing) {
|
||
existing.projects.push(project.title);
|
||
} else {
|
||
levelStats[pos.level].push({
|
||
name: pos.position,
|
||
projects: [project.title]
|
||
});
|
||
}
|
||
}
|
||
});
|
||
});
|
||
|
||
// 输出统计结果
|
||
console.log('=====================================');
|
||
console.log('财经商贸项目库 - 岗位等级详细分析');
|
||
console.log('=====================================\n');
|
||
|
||
console.log('【总体统计】');
|
||
console.log(`- 普通岗:${levelStats['普通岗'].length} 种岗位`);
|
||
console.log(`- 技术骨干岗:${levelStats['技术骨干岗'].length} 种岗位`);
|
||
console.log(`- 储备干部岗:${levelStats['储备干部岗'].length} 种岗位`);
|
||
console.log(`- 岗位总计:${levelStats['普通岗'].length + levelStats['技术骨干岗'].length + levelStats['储备干部岗'].length} 种岗位`);
|
||
|
||
console.log('\n=====================================');
|
||
console.log('【普通岗位列表】(绿色标签)');
|
||
console.log('=====================================');
|
||
levelStats['普通岗'].forEach((pos, index) => {
|
||
console.log(`${index + 1}. ${pos.name}`);
|
||
console.log(` 适用项目:`);
|
||
pos.projects.forEach(proj => {
|
||
console.log(` - ${proj}`);
|
||
});
|
||
});
|
||
|
||
console.log('\n=====================================');
|
||
console.log('【技术骨干岗位列表】(紫色标签)');
|
||
console.log('=====================================');
|
||
levelStats['技术骨干岗'].forEach((pos, index) => {
|
||
console.log(`${index + 1}. ${pos.name}`);
|
||
console.log(` 适用项目:`);
|
||
pos.projects.forEach(proj => {
|
||
console.log(` - ${proj}`);
|
||
});
|
||
});
|
||
|
||
console.log('\n=====================================');
|
||
console.log('【储备干部岗位列表】(蓝色标签)');
|
||
console.log('=====================================');
|
||
levelStats['储备干部岗'].forEach((pos, index) => {
|
||
console.log(`${index + 1}. ${pos.name}`);
|
||
console.log(` 适用项目:`);
|
||
pos.projects.forEach(proj => {
|
||
console.log(` - ${proj}`);
|
||
});
|
||
});
|
||
|
||
// 输出项目与岗位的对应关系
|
||
console.log('\n=====================================');
|
||
console.log('【项目-岗位等级分布】');
|
||
console.log('=====================================');
|
||
Object.entries(projectDetails).forEach(([id, project]) => {
|
||
const levelCount = {
|
||
'普通岗': 0,
|
||
'技术骨干岗': 0,
|
||
'储备干部岗': 0
|
||
};
|
||
|
||
project.applicablePositions.forEach(pos => {
|
||
if (levelCount[pos.level] !== undefined) {
|
||
levelCount[pos.level]++;
|
||
}
|
||
});
|
||
|
||
console.log(`\n${id}. ${project.title}`);
|
||
console.log(` 普通岗: ${levelCount['普通岗']}个 | 技术骨干岗: ${levelCount['技术骨干岗']}个 | 储备干部岗: ${levelCount['储备干部岗']}个`);
|
||
});
|
||
|
||
console.log('\n=====================================');
|
||
console.log('分析完成!');
|
||
console.log('====================================='); |