提交
This commit is contained in:
@@ -48,6 +48,7 @@
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import SkillWeightPopup from './SkillWeightPopup.vue';
|
||||
import { getSkillNum, getSkillsHeatAnalysisList } from '@/apiRc/jobSkill.js';
|
||||
|
||||
// 技能列表(后续从接口获取)
|
||||
const skillList = ref([
|
||||
@@ -77,6 +78,14 @@ const skillList = ref([
|
||||
}
|
||||
]);
|
||||
|
||||
// 技能数量
|
||||
const skillCount = ref(0);
|
||||
const isLoadingSkillCount = ref(false);
|
||||
|
||||
// 技能热度分析列表
|
||||
const heatAnalysisList = ref([]);
|
||||
const isLoadingHeatAnalysis = ref(false);
|
||||
|
||||
// 弹出层引用
|
||||
const skillWeightPopup = ref(null);
|
||||
|
||||
@@ -85,6 +94,43 @@ const selectedSkillName = ref('');
|
||||
const selectedSkillWeight = ref('');
|
||||
const selectedSkillLevel = ref(0);
|
||||
|
||||
// 获取技能数量
|
||||
async function fetchSkillNum(skillType = null) {
|
||||
isLoadingSkillCount.value = true;
|
||||
try {
|
||||
const response = await getSkillNum({
|
||||
skillType: skillType
|
||||
});
|
||||
skillCount.value = response?.data ?? 0;
|
||||
} catch (error) {
|
||||
console.error('获取技能数量失败:', error);
|
||||
skillCount.value = 0;
|
||||
} finally {
|
||||
isLoadingSkillCount.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
// 获取技能热度分析列表
|
||||
async function fetchSkillsHeatAnalysis(startDate, endDate) {
|
||||
isLoadingHeatAnalysis.value = true;
|
||||
try {
|
||||
const params = {};
|
||||
if (startDate) {
|
||||
params.startDate = startDate;
|
||||
}
|
||||
if (endDate) {
|
||||
params.endDate = endDate;
|
||||
}
|
||||
const response = await getSkillsHeatAnalysisList(params);
|
||||
heatAnalysisList.value = Array.isArray(response?.data) ? response.data : [];
|
||||
} catch (error) {
|
||||
console.error('获取技能热度分析失败:', error);
|
||||
heatAnalysisList.value = [];
|
||||
} finally {
|
||||
isLoadingHeatAnalysis.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
// 获取技能发展数据(从接口获取)
|
||||
async function getSkillDevelopmentData() {
|
||||
// TODO: 调用接口获取技能发展数据
|
||||
@@ -109,6 +155,23 @@ function handlePopupClose() {
|
||||
|
||||
onMounted(() => {
|
||||
getSkillDevelopmentData();
|
||||
// 获取技能数量(不传skillType获取全部)
|
||||
fetchSkillNum();
|
||||
|
||||
// 获取技能热度分析(默认查询最近7天)
|
||||
const endDate = new Date();
|
||||
const startDate = new Date();
|
||||
startDate.setDate(startDate.getDate() - 7);
|
||||
const formatDate = (date) => {
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
const hours = String(date.getHours()).padStart(2, '0');
|
||||
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||
const seconds = String(date.getSeconds()).padStart(2, '0');
|
||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||
};
|
||||
fetchSkillsHeatAnalysis(formatDate(startDate), formatDate(endDate));
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user