This commit is contained in:
francis_fh
2026-01-14 00:01:29 +08:00
3 changed files with 54 additions and 47 deletions

View File

@@ -16,17 +16,19 @@ export function getJobPathPage(params) {
// 根据职业路径ID获取详情
export function getJobPathDetail(params) {
const {startJobId, endJobId} = params;
const requestParams = {};
if (params?.jobPathId !== undefined && params?.jobPathId !== null && params?.jobPathId !== '') {
requestParams.id = params.jobPathId;
} else if (params?.id !== undefined && params?.id !== null && params?.id !== '') {
requestParams.id = params.id;
if (startJobId !== undefined && startJobId !== null && startJobId !== '') {
requestParams.startJobId = startJobId;
}
if (!requestParams.id) {
return Promise.reject('缺少必需的 id 参数');
if (endJobId !== undefined && endJobId !== null && endJobId !== '') {
requestParams.endJobId = endJobId;
}
if (!startJobId || !endJobId) {
return Promise.reject('缺少必需的 startJobId 和 endJobId 参数');
}
return request({
url: '/jobPath/getJobPathById',
method: 'get',

2
package-lock.json generated
View File

@@ -1,5 +1,5 @@
{
"name": "ks-app",
"name": "ks-app-employment-service",
"lockfileVersion": 3,
"requires": true,
"packages": {

View File

@@ -6,22 +6,22 @@
<uni-icons type="search" size="18" color="#286BFA"></uni-icons>
<text class="title-text">职业路径查询</text>
</view>
<view class="input-group">
<view class="input-item">
<text class="input-label">当前职位</text>
<input
class="input-field"
<input
class="input-field"
:value="currentPosition"
placeholder="市场专员"
placeholder-style="color: #999999"
disabled
/>
</view>
<view class="input-item">
<text class="input-label">目标职业</text>
<picker
<picker
mode="selector"
:range="targetCareerOptions"
range-key="label"
@@ -37,7 +37,7 @@
</picker>
</view>
</view>
<button class="query-btn" @click="handleQuery">
<text>查询职业发展路径</text>
<uni-icons type="search" size="18" color="#FFFFFF"></uni-icons>
@@ -53,7 +53,7 @@
<uni-icons type="person-filled" size="24" color="#000000"></uni-icons>
<text class="title-text">职业发展路径</text>
</view>
<view class="timeline">
<!-- 起点 -->
<view class="timeline-item start">
@@ -61,9 +61,9 @@
<view class="timeline-content">
<view class="step-title">起点: {{ pathData.start.title }}</view>
<view class="skill-tags">
<view
class="skill-tag"
v-for="(skill, index) in pathData.start.skills"
<view
class="skill-tag"
v-for="(skill, index) in pathData.start.skills"
:key="index"
>
{{ skill }}
@@ -73,18 +73,18 @@
</view>
<!-- 步骤 -->
<view
class="timeline-item step"
v-for="(step, index) in pathData.steps"
<view
class="timeline-item step"
v-for="(step, index) in pathData.steps"
:key="index"
>
<view class="timeline-marker step-marker"></view>
<view class="timeline-content">
<view class="step-title">{{ index + 1 }}: {{ step.title }}</view>
<view class="skill-tags">
<view
class="skill-tag"
v-for="(skill, sIndex) in step.skills"
<view
class="skill-tag"
v-for="(skill, sIndex) in step.skills"
:key="sIndex"
>
{{ skill }}
@@ -99,9 +99,9 @@
<view class="timeline-content">
<view class="step-title">终点: {{ pathData.end.title }}</view>
<view class="skill-tags">
<view
class="skill-tag"
v-for="(skill, index) in pathData.end.skills"
<view
class="skill-tag"
v-for="(skill, index) in pathData.end.skills"
:key="index"
>
{{ skill }}
@@ -180,15 +180,17 @@ async function fetchTargetCareerOptions(keyword = '') {
pageNo: 1,
pageSize: 100
});
const list = response?.data?.list || response?.list || [];
targetCareerOptions.value = list.map(item => ({
label: item.endJob || item.startJob || '未知职位',
value: item.id,
startJob: item.startJob,
endJob: item.endJob,
jobOrder: item.jobOrder
jobOrder: item.jobOrder,
startJobId: item.startJobId,
endJobId: item.endJobId
}));
if (targetCareerOptions.value.length === 0) {
@@ -215,8 +217,8 @@ async function fetchPathCount() {
}
}
async function loadPathDetail(jobPathId) {
if (!jobPathId || jobPathId === null || jobPathId === undefined || jobPathId === '') {
async function loadPathDetail(startJobId, endJobId) {
if (startJobId === null || startJobId === undefined || startJobId === '' || endJobId === null || endJobId === undefined || endJobId === '') {
uni.showToast({
title: '职业路径ID无效',
icon: 'none'
@@ -224,16 +226,17 @@ async function loadPathDetail(jobPathId) {
resetPathData();
return;
}
try {
const requestParams = {
jobPathId: jobPathId
startJobId,
endJobId
};
const response = await getJobPathDetail(requestParams);
const details = Array.isArray(response?.data) ? response.data : [];
if (details.length === 0) {
resetPathData();
uni.showToast({
@@ -257,13 +260,14 @@ async function loadPathDetail(jobPathId) {
steps,
end
};
// 通知父组件路径数据已更新
emit('path-data-updated', {
pathData: pathData.value,
targetCareer: targetCareerOptions.value[selectedTargetIndex.value]?.label || ''
});
} catch (error) {
console.warn(error, 22222);
uni.showToast({
title: '获取路径详情失败',
icon: 'none'
@@ -301,16 +305,16 @@ async function handleQuery() {
return;
}
let jobPathId = option.value;
isLoadingPath.value = true;
uni.showLoading({
title: '加载中...',
mask: true
});
console.log(option);
try {
if (!jobPathId) {
let { value: jobPathId, startJobId, endJobId } = option;
/*if (!jobPathId) {
const response = await getJobPathPage({
jobName: option.label,
pageNo: 1,
@@ -326,11 +330,12 @@ async function handleQuery() {
});
resetPathData();
return;
}
}*/
selectedJobPathId.value = jobPathId;
await loadPathDetail(jobPathId);
// selectedJobPathId.value = jobPathId;
await loadPathDetail(startJobId, endJobId);
} catch (error) {
console.warn(error, 11111);
uni.showToast({
title: '查询失败,请重试',
icon: 'none'
@@ -473,11 +478,11 @@ onMounted(async () => {
.timeline-item {
position: relative;
margin-bottom: 32rpx;
&:last-child {
margin-bottom: 0;
}
&:not(:last-child)::before {
content: '';
position: absolute;