wuzhen update
This commit is contained in:
1 parent
76fada3a51
commit
44042c5381
12 files changed
+3264
-26
No files matched your search
@@ -114,3 +114,11 @@ export function getApplicationStatistics(positionId) {
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
|
||||
// 获取学生申请状态列表
|
||||
export function getStudentApplicationStatusList() {
|
||||
return request({
|
||||
url: '/jcbt/workStudyApplication/student/applicationStatus',
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
@@ -447,3 +447,13 @@ export function getCurrentStudentInfo(): AxiosPromise<any> {
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取学生已申请岗位状态列表
|
||||
*/
|
||||
export function getStudentApplicationStatusList(): AxiosPromise<any[]> {
|
||||
return request({
|
||||
url: '/jcbt/workStudyApplication/student/applicationStatus',
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
@@ -112,12 +112,27 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作" width="160" align="center" fixed="right">
|
||||
<el-table-column label="申请状态" width="120" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="getApplicationStatusType(row)" size="small">
|
||||
{{ getApplicationStatusText(row) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作" width="180" align="center" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<div class="action-buttons">
|
||||
<el-button type="primary" icon="View" size="small" @click="handleViewDetail(row)" title="查看详情"> 查看 </el-button>
|
||||
<el-button type="success" icon="Plus" size="small" @click="handleApply(row)" :disabled="!canApply(row)" title="申请岗位">
|
||||
申请
|
||||
<el-button
|
||||
:type="getApplyButtonType(row)"
|
||||
:icon="getApplyButtonIcon(row)"
|
||||
size="small"
|
||||
@click="handleApply(row)"
|
||||
:disabled="!canApply(row)"
|
||||
:title="getApplyButtonTitle(row)"
|
||||
>
|
||||
{{ getApplyButtonText(row) }}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
@@ -141,7 +156,8 @@
|
||||
|
||||
<!-- 岗位详情对话框 -->
|
||||
<el-dialog v-model="detailDialogVisible" title="岗位详情" width="80%" :close-on-click-modal="false" class="position-detail-dialog">
|
||||
<PositionDetail v-if="detailDialogVisible && selectedPositionId" :position-id="selectedPositionId" @apply="handleApplyFromDetail" />
|
||||
<!-- <PositionDetail v-if="detailDialogVisible && selectedPositionId" :position-id="selectedPositionId" @apply="handleApplyFromDetail" /> -->
|
||||
<div style="padding: 20px; text-align: center;">岗位详情页面开发中...</div>
|
||||
<template #footer>
|
||||
<el-button @click="detailDialogVisible = false">关闭</el-button>
|
||||
</template>
|
||||
@@ -149,12 +165,17 @@
|
||||
|
||||
<!-- 申请表单对话框 -->
|
||||
<el-dialog v-model="applyDialogVisible" title="申请岗位" width="70%" :close-on-click-modal="false" class="apply-dialog">
|
||||
<ApplicationForm
|
||||
<!-- <ApplicationForm
|
||||
v-if="applyDialogVisible && selectedPosition"
|
||||
:position="selectedPosition"
|
||||
@success="handleApplySuccess"
|
||||
@cancel="applyDialogVisible = false"
|
||||
/>
|
||||
/> -->
|
||||
<div style="padding: 20px; text-align: center;">申请表单页面开发中...</div>
|
||||
<template #footer>
|
||||
<el-button @click="applyDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="handleApplySuccess">确认申请</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
@@ -162,10 +183,14 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, computed } from 'vue';
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { listVisiblePositions } from '@/api/jcbt/workStudyPosition';
|
||||
import type { WorkStudyPositionVO } from '@/api/jcbt/workStudyPosition';
|
||||
import PositionDetail from './detail.vue';
|
||||
import ApplicationForm from './form.vue';
|
||||
import { getStudentApplicationStatusList } from '@/api/jcbt/workStudyApplication';
|
||||
// import PositionDetail from './detail.vue';
|
||||
// import ApplicationForm from './form.vue';
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
// 组件引用
|
||||
const queryFormRef = ref();
|
||||
@@ -179,6 +204,7 @@ const detailDialogVisible = ref(false);
|
||||
const applyDialogVisible = ref(false);
|
||||
const selectedPositionId = ref<number>();
|
||||
const selectedPosition = ref<WorkStudyPositionVO>();
|
||||
const studentApplications = ref<any[]>([]);
|
||||
|
||||
// 查询参数
|
||||
const queryParams = reactive({
|
||||
@@ -210,6 +236,13 @@ const getStatusType = (status: string) => {
|
||||
|
||||
/** 判断是否可以申请 */
|
||||
const canApply = (position: WorkStudyPositionVO) => {
|
||||
const application = studentApplications.value.find((app) => app.positionId === position.id);
|
||||
|
||||
// 如果已录用,禁用按钮
|
||||
if (application && application.status === 'approved') {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 检查岗位状态
|
||||
if (!['PUBLISHED', 'RECRUITING'].includes(position.status || '')) {
|
||||
return false;
|
||||
@@ -282,6 +315,20 @@ const handleViewDetail = (position: WorkStudyPositionVO) => {
|
||||
|
||||
/** 申请岗位 */
|
||||
const handleApply = (position: WorkStudyPositionVO) => {
|
||||
const application = studentApplications.value.find((app) => app.positionId === position.id);
|
||||
|
||||
// 如果已有申请且状态为已提交或审核中,跳转到申请管理页面
|
||||
if (application && ['submitted', 'college_reviewing', 'final_reviewing'].includes(application.status)) {
|
||||
router.push('/jcbt/workstudy/my-applications');
|
||||
return;
|
||||
}
|
||||
|
||||
// 如果已录用,不允许操作
|
||||
if (application && application.status === 'approved') {
|
||||
ElMessage.info('您已被该岗位录用');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!canApply(position)) {
|
||||
ElMessage.warning('该岗位当前不可申请');
|
||||
return;
|
||||
@@ -298,17 +345,150 @@ const handleApplyFromDetail = (position: WorkStudyPositionVO) => {
|
||||
applyDialogVisible.value = true;
|
||||
};
|
||||
|
||||
/** 加载学生申请状态列表 */
|
||||
const loadStudentApplications = async () => {
|
||||
try {
|
||||
const response = await getStudentApplicationStatusList();
|
||||
if (response.code === 200) {
|
||||
studentApplications.value = response.data || [];
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取申请状态失败:', error);
|
||||
}
|
||||
};
|
||||
|
||||
/** 获取申请状态文本 */
|
||||
const getApplicationStatusText = (row: WorkStudyPositionVO) => {
|
||||
const application = studentApplications.value.find((app) => app.positionId === row.id);
|
||||
if (!application) return '未申请';
|
||||
|
||||
switch (application.status) {
|
||||
case 'submitted':
|
||||
return '已提交';
|
||||
case 'college_reviewing':
|
||||
return '学院审核中';
|
||||
case 'final_reviewing':
|
||||
return '学生处审核中';
|
||||
case 'approved':
|
||||
return '审核通过';
|
||||
case 'rejected':
|
||||
return '审核不通过';
|
||||
default:
|
||||
return '未知状态';
|
||||
}
|
||||
};
|
||||
|
||||
/** 获取申请状态标签类型 */
|
||||
const getApplicationStatusType = (row: WorkStudyPositionVO) => {
|
||||
const application = studentApplications.value.find((app) => app.positionId === row.id);
|
||||
if (!application) return 'info';
|
||||
|
||||
switch (application.status) {
|
||||
case 'submitted':
|
||||
return 'primary';
|
||||
case 'college_reviewing':
|
||||
case 'final_reviewing':
|
||||
return 'warning';
|
||||
case 'approved':
|
||||
return 'success';
|
||||
case 'rejected':
|
||||
return 'danger';
|
||||
default:
|
||||
return 'info';
|
||||
}
|
||||
};
|
||||
|
||||
/** 获取申请按钮文本 */
|
||||
const getApplyButtonText = (row: WorkStudyPositionVO) => {
|
||||
const application = studentApplications.value.find((app) => app.positionId === row.id);
|
||||
if (!application) return '申请';
|
||||
|
||||
switch (application.status) {
|
||||
case 'submitted':
|
||||
case 'college_reviewing':
|
||||
case 'final_reviewing':
|
||||
return '查看申请';
|
||||
case 'approved':
|
||||
return '已录用';
|
||||
case 'rejected':
|
||||
return '重新申请';
|
||||
default:
|
||||
return '申请';
|
||||
}
|
||||
};
|
||||
|
||||
/** 获取申请按钮类型 */
|
||||
const getApplyButtonType = (row: WorkStudyPositionVO) => {
|
||||
const application = studentApplications.value.find((app) => app.positionId === row.id);
|
||||
if (!application) return 'success';
|
||||
|
||||
switch (application.status) {
|
||||
case 'submitted':
|
||||
case 'college_reviewing':
|
||||
case 'final_reviewing':
|
||||
return 'primary';
|
||||
case 'approved':
|
||||
return 'info';
|
||||
case 'rejected':
|
||||
return 'warning';
|
||||
default:
|
||||
return 'success';
|
||||
}
|
||||
};
|
||||
|
||||
/** 获取申请按钮图标 */
|
||||
const getApplyButtonIcon = (row: WorkStudyPositionVO) => {
|
||||
const application = studentApplications.value.find((app) => app.positionId === row.id);
|
||||
if (!application) return 'Plus';
|
||||
|
||||
switch (application.status) {
|
||||
case 'submitted':
|
||||
case 'college_reviewing':
|
||||
case 'final_reviewing':
|
||||
return 'View';
|
||||
case 'approved':
|
||||
return 'Check';
|
||||
case 'rejected':
|
||||
return 'RefreshRight';
|
||||
default:
|
||||
return 'Plus';
|
||||
}
|
||||
};
|
||||
|
||||
/** 获取申请按钮提示文本 */
|
||||
const getApplyButtonTitle = (row: WorkStudyPositionVO) => {
|
||||
const application = studentApplications.value.find((app) => app.positionId === row.id);
|
||||
if (!application) return '申请岗位';
|
||||
|
||||
switch (application.status) {
|
||||
case 'submitted':
|
||||
return '查看申请详情';
|
||||
case 'college_reviewing':
|
||||
return '学院审核中,查看申请详情';
|
||||
case 'final_reviewing':
|
||||
return '学生处审核中,查看申请详情';
|
||||
case 'approved':
|
||||
return '已被录用';
|
||||
case 'rejected':
|
||||
return '重新申请该岗位';
|
||||
default:
|
||||
return '申请岗位';
|
||||
}
|
||||
};
|
||||
|
||||
/** 申请成功回调 */
|
||||
const handleApplySuccess = () => {
|
||||
applyDialogVisible.value = false;
|
||||
ElMessage.success('申请提交成功!');
|
||||
// 刷新列表
|
||||
// 刷新列表和申请状态
|
||||
getPositionList();
|
||||
loadStudentApplications();
|
||||
};
|
||||
|
||||
// 生命周期
|
||||
onMounted(() => {
|
||||
getPositionList();
|
||||
loadStudentApplications();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Reference in new issue
Block a user