This commit is contained in:
zlwu committed 2025-08-13 22:16:46 +08:00
commit 14d53f60b0
23 files changed
+4260 -72

No files matched your search

+46
View File
@@ -0,0 +1,46 @@
import request from '@/utils/request'
// 查询实习日常记录列表
export function listInternshipDaily(query) {
return request({
url: '/zsjy/internship/daily/list',
method: 'get',
params: query
})
}
// 学生签到打卡
export function checkIn(data) {
return request({
url: '/zsjy/internship/daily/checkin',
method: 'post',
data: data
})
}
// 新增实习日常记录
export function addInternshipDaily(data) {
return request({
url: '/zsjy/internship/daily',
method: 'post',
data: data
})
}
// 获取学生考勤日历
export function getCalendar(studentId, params) {
return request({
url: `/zsjy/internship/daily/calendar/${studentId}`,
method: 'get',
params: params
})
}
// 获取考勤统计数据
export function getStatistics(query) {
return request({
url: '/zsjy/internship/daily/statistics',
method: 'get',
params: query
})
}
+115 -45
View File
@@ -841,6 +841,31 @@ export interface InternshipInfoVO {
*/
companyAddress?: string;
/**
* 实习津贴
*/
internshipAllowance?: number;
/**
* 单位联系人
*/
contactPersonName?: string;
/**
* 联系人电话
*/
contactPersonPhone?: string;
/**
* 协议状态
*/
agreementStatus?: string;
/**
* 备注信息
*/
remark?: string;
/**
* 创建时间
*/
@@ -871,6 +896,16 @@ export interface InternshipInfoAddBO {
*/
studentId: string | number;
/**
* 学生姓名(前端显示用)
*/
studentName?: string;
/**
* 学生学号(前端显示用)
*/
studentNo?: string;
/**
* 实习状态(1进行中 2已完成 3中断)
*/
@@ -886,6 +921,16 @@ export interface InternshipInfoAddBO {
*/
companyAddress: string;
/**
* 单位联系人
*/
companyContact?: string;
/**
* 联系人电话
*/
companyPhone?: string;
/**
* 行业类型
*/
@@ -897,30 +942,40 @@ export interface InternshipInfoAddBO {
companyScale?: string;
/**
* 单位联系人
* 实习岗位
*/
companyContact: string;
internshipPosition: string;
/**
* 实习薪资
*/
internshipAllowance?: number;
/**
* 实习开始时间
*/
internshipStartDate: string;
/**
* 实习结束时间
*/
internshipEndDate: string;
/**
* 联系人姓名
*/
contactPersonName: string;
/**
* 联系人电话
*/
companyPhone: string;
/**
* 岗位名称
*/
positionName: string;
contactPersonPhone: string;
/**
* 岗位职责
*/
positionDuties?: string;
/**
* 实习津贴
*/
internshipAllowance?: number;
/**
* 工作时长
*/
@@ -942,19 +997,9 @@ export interface InternshipInfoAddBO {
accommodationCost?: number;
/**
* 实习开始日期
* 实习协议状态(1已签署 2未签署)
*/
startDate: string;
/**
* 实习结束日期
*/
endDate: string;
/**
* 实际结束日期
*/
actualEndDate?: string;
agreementStatus: string;
/**
* 备注
@@ -976,6 +1021,16 @@ export interface InternshipInfoEditBO {
*/
studentId: string | number;
/**
* 学生姓名(前端显示用)
*/
studentName?: string;
/**
* 学生学号(前端显示用)
*/
studentNo?: string;
/**
* 实习状态(1进行中 2已完成 3中断)
*/
@@ -991,6 +1046,16 @@ export interface InternshipInfoEditBO {
*/
companyAddress: string;
/**
* 单位联系人
*/
companyContact?: string;
/**
* 联系人电话
*/
companyPhone?: string;
/**
* 行业类型
*/
@@ -1002,30 +1067,40 @@ export interface InternshipInfoEditBO {
companyScale?: string;
/**
* 单位联系人
* 实习岗位
*/
companyContact: string;
internshipPosition: string;
/**
* 实习薪资
*/
internshipAllowance?: number;
/**
* 实习开始时间
*/
internshipStartDate: string;
/**
* 实习结束时间
*/
internshipEndDate: string;
/**
* 联系人姓名
*/
contactPersonName: string;
/**
* 联系人电话
*/
companyPhone: string;
/**
* 岗位名称
*/
positionName: string;
contactPersonPhone: string;
/**
* 岗位职责
*/
positionDuties?: string;
/**
* 实习津贴
*/
internshipAllowance?: number;
/**
* 工作时长
*/
@@ -1047,14 +1122,9 @@ export interface InternshipInfoEditBO {
accommodationCost?: number;
/**
* 实习开始日期
* 实习协议状态(1已签署 2未签署)
*/
startDate: string;
/**
* 实习结束日期
*/
endDate: string;
agreementStatus: string;
/**
* 实际结束日期
@@ -0,0 +1,695 @@
<template>
<div class="checkin-container">
<!-- 顶部状态卡片 -->
<el-card class="status-card" shadow="hover">
<div class="status-header">
<div class="user-info">
<el-avatar :size="60" :src="userInfo.avatar" icon="UserFilled" />
<div class="info-text">
<h3>{{ userInfo.studentName || userInfo.nickName }}</h3>
<p>学号:{{ userInfo.studentNumber || '未设置' }}</p>
<p>班级:{{ userInfo.className || '未设置' }}</p>
</div>
</div>
<div class="time-info">
<div class="current-time">{{ currentTime }}</div>
<div class="current-date">{{ currentDate }}</div>
</div>
</div>
</el-card>
<!-- 签到区域 -->
<el-row :gutter="20">
<el-col :span="12">
<el-card class="checkin-card" shadow="hover">
<template #header>
<div class="card-header">
<el-icon class="header-icon"><Clock /></el-icon>
<span>签到打卡</span>
</div>
</template>
<div class="checkin-content">
<!-- 签到状态显示 -->
<div class="status-display">
<div v-if="todayRecord.checkInTime" class="checked-in">
<el-icon class="status-icon success"><SuccessFilled /></el-icon>
<div class="status-text">
<h4>已签到</h4>
<p>{{ parseTime(todayRecord.checkInTime, '{h}:{i}') }}</p>
</div>
</div>
<div v-else class="not-checked-in">
<el-icon class="status-icon waiting"><Clock /></el-icon>
<div class="status-text">
<h4>未签到</h4>
<p>请点击下方按钮进行签到</p>
</div>
</div>
</div>
<!-- 签到按钮 -->
<div class="checkin-actions">
<el-button
type="primary"
size="large"
:disabled="todayRecord.checkInTime || loading"
:loading="loading"
@click="handleCheckIn"
class="checkin-btn"
>
<el-icon><Location /></el-icon>
{{ todayRecord.checkInTime ? '已签到' : '立即签到' }}
</el-button>
</div>
<!-- 位置信息 -->
<div class="location-info" v-if="locationInfo.address">
<el-icon><MapPin /></el-icon>
<span>{{ locationInfo.address }}</span>
</div>
</div>
</el-card>
</el-col>
<el-col :span="12">
<el-card class="checkout-card" shadow="hover">
<template #header>
<div class="card-header">
<el-icon class="header-icon"><Clock /></el-icon>
<span>签退打卡</span>
</div>
</template>
<div class="checkout-content">
<!-- 签退状态显示 -->
<div class="status-display">
<div v-if="todayRecord.checkOutTime" class="checked-out">
<el-icon class="status-icon success"><SuccessFilled /></el-icon>
<div class="status-text">
<h4>已签退</h4>
<p>{{ parseTime(todayRecord.checkOutTime, '{h}:{i}') }}</p>
</div>
</div>
<div v-else class="not-checked-out">
<el-icon class="status-icon waiting"><Clock /></el-icon>
<div class="status-text">
<h4>未签退</h4>
<p>{{ todayRecord.checkInTime ? '可以进行签退' : '请先签到' }}</p>
</div>
</div>
</div>
<!-- 签退按钮 -->
<div class="checkout-actions">
<el-button
type="success"
size="large"
:disabled="!todayRecord.checkInTime || todayRecord.checkOutTime || loading"
:loading="loading"
@click="handleCheckOut"
class="checkout-btn"
>
<el-icon><Location /></el-icon>
{{ todayRecord.checkOutTime ? '已签退' : '立即签退' }}
</el-button>
</div>
<!-- 工作时长 -->
<div class="duration-info" v-if="todayRecord.workDuration">
<el-icon><Timer /></el-icon>
<span>工作时长:{{ todayRecord.workDuration }}小时</span>
</div>
</div>
</el-card>
</el-col>
</el-row>
<!-- 工作内容填写 -->
<el-card class="work-content-card" shadow="hover" v-if="todayRecord.checkInTime">
<template #header>
<div class="card-header">
<el-icon class="header-icon"><Edit /></el-icon>
<span>今日工作内容</span>
</div>
</template>
<div class="work-content">
<el-form ref="workFormRef" :model="workForm" label-width="100px">
<el-form-item label="工作内容" prop="workContent">
<el-input
v-model="workForm.workContent"
type="textarea"
:rows="4"
placeholder="请详细描述今日的工作内容..."
maxlength="500"
show-word-limit
/>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input
v-model="workForm.remark"
type="textarea"
:rows="2"
placeholder="可填写工作心得、遇到的问题等..."
maxlength="200"
show-word-limit
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="saveWorkContent" :loading="saving">
<el-icon><DocumentAdd /></el-icon>
保存工作内容
</el-button>
</el-form-item>
</el-form>
</div>
</el-card>
<!-- 最近记录 -->
<el-card class="recent-records-card" shadow="hover">
<template #header>
<div class="card-header">
<el-icon class="header-icon"><List /></el-icon>
<span>最近考勤记录</span>
</div>
</template>
<div class="recent-records">
<el-table :data="recentRecords" style="width: 100%">
<el-table-column label="日期" width="120">
<template #default="scope">
{{ parseTime(scope.row.checkDate, '{m}-{d}') }}
</template>
</el-table-column>
<el-table-column label="签到时间" width="100">
<template #default="scope">
{{ scope.row.checkInTime ? parseTime(scope.row.checkInTime, '{h}:{i}') : '-' }}
</template>
</el-table-column>
<el-table-column label="签退时间" width="100">
<template #default="scope">
{{ scope.row.checkOutTime ? parseTime(scope.row.checkOutTime, '{h}:{i}') : '-' }}
</template>
</el-table-column>
<el-table-column label="工作时长" width="100">
<template #default="scope">
{{ scope.row.workDuration ? scope.row.workDuration + 'h' : '-' }}
</template>
</el-table-column>
<el-table-column label="状态" width="80">
<template #default="scope">
<el-tag :type="getStatusType(scope.row.status)" size="small">
{{ getStatusText(scope.row.status) }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="工作内容" show-overflow-tooltip>
<template #default="scope">
{{ scope.row.workContent || '-' }}
</template>
</el-table-column>
</el-table>
</div>
</el-card>
</div>
</template>
<script setup name="InternshipCheckin">
import { checkIn } from "@/api/zsjy/internshipDaily";
import { parseTime } from "@/utils/ruoyi";
const { proxy } = getCurrentInstance();
// 响应式数据
const loading = ref(false);
const saving = ref(false);
const currentTime = ref('');
const currentDate = ref('');
const userInfo = ref({});
const todayRecord = ref({});
const recentRecords = ref([]);
const locationInfo = ref({});
// 工作内容表单
const workForm = ref({
workContent: '',
remark: ''
});
// 获取用户信息
const getUserInfo = () => {
// 从store或接口获取用户信息
userInfo.value = {
studentName: '张三',
studentNumber: '20230001',
className: '计算机科学与技术2023-1班',
avatar: ''
};
};
// 获取今日考勤记录
const getTodayRecord = () => {
// 调用接口获取今日考勤记录
const today = new Date().toISOString().slice(0, 10);
// 这里应该调用实际的API
todayRecord.value = {
checkDate: today,
checkInTime: null,
checkOutTime: null,
workDuration: null,
status: '0'
};
};
// 获取最近考勤记录
const getRecentRecords = () => {
// 调用接口获取最近7天的考勤记录
recentRecords.value = [
{
checkDate: '2024-01-15',
checkInTime: '2024-01-15 09:00:00',
checkOutTime: '2024-01-15 18:00:00',
workDuration: 8,
status: '1',
workContent: '参与项目开发,完成用户模块设计'
},
// 更多记录...
];
};
// 获取地理位置
const getLocation = () => {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(
(position) => {
const { latitude, longitude } = position.coords;
locationInfo.value = {
latitude,
longitude,
address: '获取位置中...'
};
// 调用地图API获取详细地址
getAddressFromCoords(latitude, longitude);
},
(error) => {
console.error('获取位置失败:', error);
proxy.$modal.msgError('获取位置失败,请检查浏览器权限设置');
}
);
} else {
proxy.$modal.msgError('浏览器不支持地理位置功能');
}
};
// 根据坐标获取地址
const getAddressFromCoords = (lat, lng) => {
// 这里可以调用高德地图、百度地图等API
// 模拟地址信息
setTimeout(() => {
locationInfo.value.address = '浙江省杭州市西湖区某某大厦';
}, 1000);
};
// 处理签到
const handleCheckIn = async () => {
if (!locationInfo.value.latitude) {
proxy.$modal.msgError('请先获取位置信息');
getLocation();
return;
}
loading.value = true;
try {
const checkInData = {
checkInLocation: locationInfo.value.address,
latitude: locationInfo.value.latitude,
longitude: locationInfo.value.longitude,
checkInTime: new Date().toISOString()
};
await checkIn(checkInData);
proxy.$modal.msgSuccess('签到成功');
getTodayRecord(); // 刷新今日记录
getRecentRecords(); // 刷新最近记录
} catch (error) {
console.error('签到失败:', error);
proxy.$modal.msgError('签到失败,请重试');
} finally {
loading.value = false;
}
};
// 处理签退
const handleCheckOut = async () => {
if (!locationInfo.value.latitude) {
proxy.$modal.msgError('请先获取位置信息');
getLocation();
return;
}
loading.value = true;
try {
const checkOutData = {
checkOutLocation: locationInfo.value.address,
latitude: locationInfo.value.latitude,
longitude: locationInfo.value.longitude,
checkOutTime: new Date().toISOString()
};
// 调用签退接口
// await checkOut(checkOutData);
proxy.$modal.msgSuccess('签退成功');
getTodayRecord(); // 刷新今日记录
getRecentRecords(); // 刷新最近记录
} catch (error) {
console.error('签退失败:', error);
proxy.$modal.msgError('签退失败,请重试');
} finally {
loading.value = false;
}
};
// 保存工作内容
const saveWorkContent = async () => {
if (!workForm.value.workContent.trim()) {
proxy.$modal.msgError('请填写工作内容');
return;
}
saving.value = true;
try {
// 调用保存工作内容的接口
// await updateWorkContent(workForm.value);
proxy.$modal.msgSuccess('工作内容保存成功');
getTodayRecord(); // 刷新今日记录
} catch (error) {
console.error('保存失败:', error);
proxy.$modal.msgError('保存失败,请重试');
} finally {
saving.value = false;
}
};
// 获取状态类型
const getStatusType = (status) => {
const statusMap = {
'0': 'info',
'1': 'success',
'2': 'warning',
'3': 'danger'
};
return statusMap[status] || 'info';
};
// 获取状态文本
const getStatusText = (status) => {
const statusMap = {
'0': '未签到',
'1': '正常',
'2': '迟到',
'3': '早退'
};
return statusMap[status] || '';
};
// 更新时间
const updateTime = () => {
const now = new Date();
currentTime.value = now.toLocaleTimeString('zh-CN', {
hour12: false,
hour: '2-digit',
minute: '2-digit',
second: '2-digit'
});
currentDate.value = now.toLocaleDateString('zh-CN', {
year: 'numeric',
month: 'long',
day: 'numeric',
weekday: 'long'
});
};
// 初始化
onMounted(() => {
getUserInfo();
getTodayRecord();
getRecentRecords();
getLocation();
updateTime();
// 每秒更新时间
setInterval(updateTime, 1000);
});
</script>
<style scoped lang="scss">
.checkin-container {
padding: 20px;
max-width: 1200px;
margin: 0 auto;
.status-card {
margin-bottom: 20px;
border-radius: 12px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
:deep(.el-card__body) {
padding: 24px;
}
.status-header {
display: flex;
justify-content: space-between;
align-items: center;
.user-info {
display: flex;
align-items: center;
gap: 16px;
.info-text {
h3 {
margin: 0 0 8px 0;
font-size: 24px;
font-weight: 600;
}
p {
margin: 2px 0;
opacity: 0.9;
font-size: 14px;
}
}
}
.time-info {
text-align: right;
.current-time {
font-size: 32px;
font-weight: bold;
line-height: 1;
margin-bottom: 4px;
}
.current-date {
font-size: 16px;
opacity: 0.9;
}
}
}
}
.checkin-card,
.checkout-card {
border-radius: 12px;
margin-bottom: 20px;
.card-header {
display: flex;
align-items: center;
gap: 8px;
font-weight: 600;
font-size: 16px;
.header-icon {
font-size: 18px;
color: #409eff;
}
}
.checkin-content,
.checkout-content {
text-align: center;
padding: 20px 0;
.status-display {
margin-bottom: 24px;
.checked-in,
.checked-out,
.not-checked-in,
.not-checked-out {
display: flex;
flex-direction: column;
align-items: center;
gap: 12px;
.status-icon {
font-size: 48px;
&.success {
color: #67c23a;
}
&.waiting {
color: #909399;
}
}
.status-text {
h4 {
margin: 0 0 4px 0;
font-size: 18px;
font-weight: 600;
}
p {
margin: 0;
color: #909399;
font-size: 14px;
}
}
}
}
.checkin-actions,
.checkout-actions {
margin-bottom: 16px;
.checkin-btn,
.checkout-btn {
width: 200px;
height: 48px;
font-size: 16px;
border-radius: 24px;
font-weight: 600;
}
}
.location-info,
.duration-info {
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
color: #606266;
font-size: 14px;
}
}
}
.work-content-card,
.recent-records-card {
border-radius: 12px;
margin-bottom: 20px;
.card-header {
display: flex;
align-items: center;
gap: 8px;
font-weight: 600;
font-size: 16px;
.header-icon {
font-size: 18px;
color: #409eff;
}
}
.work-content {
padding: 16px 0;
}
.recent-records {
:deep(.el-table) {
.el-table__header-wrapper {
th {
background-color: #f8f9fa;
color: #333;
font-weight: 600;
}
}
.el-table__row {
&:hover {
background-color: #f5f7fa;
}
}
}
}
}
}
/* 响应式设计 */
@media (max-width: 768px) {
.checkin-container {
padding: 12px;
.status-header {
flex-direction: column;
text-align: center;
gap: 16px;
.user-info {
flex-direction: column;
text-align: center;
}
.time-info {
text-align: center;
.current-time {
font-size: 24px;
}
}
}
.checkin-btn,
.checkout-btn {
width: 100% !important;
}
}
}
/* 动画效果 */
.checkin-card,
.checkout-card,
.work-content-card,
.recent-records-card {
transition: all 0.3s ease;
&:hover {
transform: translateY(-2px);
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}
}
.checkin-btn,
.checkout-btn {
transition: all 0.3s ease;
&:hover:not(:disabled) {
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(64, 158, 255, 0.3);
}
}
</style>
@@ -0,0 +1,899 @@
<template>
<div class="p-2 page-container">
<!-- 搜索区域 -->
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :model="queryParams" label-width="100px">
<!-- 第一行:4个搜索条件 -->
<el-row :gutter="20">
<el-col :span="6">
<el-form-item label="学生姓名" prop="studentName">
<el-input v-model="queryParams.studentName" placeholder="请输入学生姓名" clearable @keyup.enter="handleQuery" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="学号" prop="studentNumber">
<el-input v-model="queryParams.studentNumber" placeholder="请输入学号" clearable @keyup.enter="handleQuery" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="实习单位" prop="companyName">
<el-input v-model="queryParams.companyName" placeholder="请输入实习单位" clearable @keyup.enter="handleQuery" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="签到状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择签到状态" clearable style="width: 100%">
<el-option label="已签到" value="1" />
<el-option label="未签到" value="0" />
<el-option label="迟到" value="2" />
<el-option label="早退" value="3" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<!-- 第二行:日期筛选 + 操作按钮 -->
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="签到日期">
<el-date-picker
v-model="daterangeCheckTime"
value-format="YYYY-MM-DD"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="handleQuery"
style="width: 100%"
></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12" class="search-btn-container">
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
</div>
</transition>
<!-- 统计卡片区域 -->
<div class="mb-[10px]">
<el-row :gutter="16">
<el-col :span="6">
<el-card shadow="hover" class="stat-card stat-card-primary">
<div class="stat-content">
<div class="stat-icon">
<el-icon><User /></el-icon>
</div>
<div class="stat-info">
<div class="stat-value">{{ statistics.totalStudents || 0 }}</div>
<div class="stat-label">实习学生总数</div>
</div>
</div>
</el-card>
</el-col>
<el-col :span="6">
<el-card shadow="hover" class="stat-card stat-card-success">
<div class="stat-content">
<div class="stat-icon">
<el-icon><SuccessFilled /></el-icon>
</div>
<div class="stat-info">
<div class="stat-value">{{ statistics.todayCheckedIn || 0 }}</div>
<div class="stat-label">今日已签到</div>
</div>
</div>
</el-card>
</el-col>
<el-col :span="6">
<el-card shadow="hover" class="stat-card stat-card-warning">
<div class="stat-content">
<div class="stat-icon">
<el-icon><WarningFilled /></el-icon>
</div>
<div class="stat-info">
<div class="stat-value">{{ statistics.todayLate || 0 }}</div>
<div class="stat-label">今日迟到</div>
</div>
</div>
</el-card>
</el-col>
<el-col :span="6">
<el-card shadow="hover" class="stat-card stat-card-info">
<div class="stat-content">
<div class="stat-icon">
<el-icon><Clock /></el-icon>
</div>
<div class="stat-info">
<div class="stat-value">{{ statistics.attendanceRate || '0%' }}</div>
<div class="stat-label">本月出勤率</div>
</div>
</div>
</el-card>
</el-col>
</el-row>
</div>
<!-- 操作工具栏 -->
<el-card shadow="never" class="button-card">
<div class="card-header-vertical">
<div class="toolbar-title">实习日常管理</div>
<div class="button-group">
<el-button type="primary" icon="Plus" @click="handleAdd" v-hasPermi="['zsjy:internship:daily:add']">新增签到</el-button>
<el-button plain icon="Search" @click="showSearch = !showSearch">搜索</el-button>
<el-button type="primary" plain icon="Download" @click="handleExport" v-hasPermi="['zsjy:internship:daily:export']">导出</el-button>
</div>
</div>
</el-card>
<!-- 数据表格 -->
<el-card shadow="never" class="table-card">
<div class="table-container">
<el-table
ref="internshipDailyTableRef"
v-loading="loading"
:data="internshipDailyList"
row-key="id"
class="scroll-table"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="序号" type="index" width="60" align="center" />
<el-table-column label="学生信息" min-width="180" align="left">
<template #default="scope">
<div class="student-info">
<div class="student-name">{{ scope.row.studentName }}</div>
<div class="student-number">学号:{{ scope.row.studentNumber }}</div>
<div class="student-class">班级:{{ scope.row.className }}</div>
</div>
</template>
</el-table-column>
<el-table-column label="实习单位" prop="companyName" min-width="150" align="left" show-overflow-tooltip />
<el-table-column label="签到时间" min-width="120" align="center">
<template #default="scope">
<div v-if="scope.row.checkInTime">
<div>{{ parseTime(scope.row.checkInTime, '{y}-{m}-{d}') }}</div>
<div class="time-detail">{{ parseTime(scope.row.checkInTime, '{h}:{i}') }}</div>
</div>
<span v-else class="text-danger">未签到</span>
</template>
</el-table-column>
<el-table-column label="签退时间" min-width="120" align="center">
<template #default="scope">
<div v-if="scope.row.checkOutTime">
<div>{{ parseTime(scope.row.checkOutTime, '{y}-{m}-{d}') }}</div>
<div class="time-detail">{{ parseTime(scope.row.checkOutTime, '{h}:{i}') }}</div>
</div>
<span v-else class="text-muted">未签退</span>
</template>
</el-table-column>
<el-table-column label="工作时长" min-width="100" align="center">
<template #default="scope">
<span v-if="scope.row.workDuration">{{ scope.row.workDuration }}小时</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="签到状态" min-width="100" align="center">
<template #default="scope">
<dict-tag :options="attendanceStatusOptions" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column label="签到地点" prop="checkInLocation" min-width="150" align="left" show-overflow-tooltip />
<el-table-column label="工作内容" prop="workContent" min-width="200" align="left" show-overflow-tooltip />
<el-table-column label="操作" width="120" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<div class="action-buttons">
<el-tooltip content="查看详情" placement="top">
<el-button link type="primary" icon="View" @click="handleView(scope.row)" />
</el-tooltip>
<el-tooltip content="查看日历" placement="top">
<el-button link type="success" icon="Calendar" @click="handleCalendar(scope.row)" />
</el-tooltip>
</div>
</template>
</el-table-column>
</el-table>
</div>
<!-- 分页组件 -->
<div class="pagination-container">
<pagination
v-show="total > 0"
:total="total"
:page="queryParams.pageNum"
:limit="queryParams.pageSize"
@pagination="getList"
/>
</div>
</el-card>
<!-- 详情对话框 -->
<el-dialog title="考勤详情" v-model="viewDialogVisible" width="600px" append-to-body>
<div v-if="currentRecord" class="detail-container">
<el-descriptions :column="2" border>
<el-descriptions-item label="学生姓名">{{ currentRecord.studentName }}</el-descriptions-item>
<el-descriptions-item label="学号">{{ currentRecord.studentNumber }}</el-descriptions-item>
<el-descriptions-item label="班级">{{ currentRecord.className }}</el-descriptions-item>
<el-descriptions-item label="实习单位">{{ currentRecord.companyName }}</el-descriptions-item>
<el-descriptions-item label="签到时间">
{{ currentRecord.checkInTime ? parseTime(currentRecord.checkInTime) : '未签到' }}
</el-descriptions-item>
<el-descriptions-item label="签退时间">
{{ currentRecord.checkOutTime ? parseTime(currentRecord.checkOutTime) : '未签退' }}
</el-descriptions-item>
<el-descriptions-item label="工作时长">
{{ currentRecord.workDuration ? currentRecord.workDuration + '小时' : '-' }}
</el-descriptions-item>
<el-descriptions-item label="签到状态">
<dict-tag :options="attendanceStatusOptions" :value="currentRecord.status" />
</el-descriptions-item>
<el-descriptions-item label="签到地点" :span="2">{{ currentRecord.checkInLocation || '-' }}</el-descriptions-item>
<el-descriptions-item label="工作内容" :span="2">
<div style="white-space: pre-wrap;">{{ currentRecord.workContent || '-' }}</div>
</el-descriptions-item>
<el-descriptions-item label="备注" :span="2">
<div style="white-space: pre-wrap;">{{ currentRecord.remark || '-' }}</div>
</el-descriptions-item>
</el-descriptions>
</div>
<template #footer>
<div class="dialog-footer-right">
<el-button @click="viewDialogVisible = false">关闭</el-button>
</div>
</template>
</el-dialog>
<!-- 考勤日历对话框 -->
<el-dialog title="考勤日历" v-model="calendarDialogVisible" width="800px" append-to-body>
<div v-if="currentStudent" class="calendar-container">
<div class="calendar-header">
<h4>{{ currentStudent.studentName }}({{ currentStudent.studentNumber }})的考勤记录</h4>
<el-date-picker
v-model="calendarMonth"
type="month"
placeholder="选择月份"
format="YYYY年MM月"
value-format="YYYY-MM"
@change="handleMonthChange"
/>
</div>
<el-calendar v-model="calendarDate">
<template #date-cell="{ data }">
<div class="calendar-day">
<div class="day-number">{{ data.day.split('-').slice(2).join('') }}</div>
<div v-if="getAttendanceStatus(data.day)" class="attendance-status">
<el-tag
:type="getStatusTagType(getAttendanceStatus(data.day))"
size="small"
>
{{ getStatusText(getAttendanceStatus(data.day)) }}
</el-tag>
</div>
</div>
</template>
</el-calendar>
</div>
<template #footer>
<div class="dialog-footer-right">
<el-button @click="calendarDialogVisible = false">关闭</el-button>
</div>
</template>
</el-dialog>
<!-- 新增签到对话框 -->
<el-dialog title="新增签到记录" v-model="addDialogVisible" width="600px" append-to-body>
<el-form ref="addFormRef" :model="addForm" :rules="addFormRules" label-width="100px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="学生姓名" prop="studentName">
<el-input v-model="addForm.studentName" placeholder="请输入学生姓名" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="学号" prop="studentNumber">
<el-input v-model="addForm.studentNumber" placeholder="请输入学号" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="班级" prop="className">
<el-input v-model="addForm.className" placeholder="请输入班级" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="实习单位" prop="companyName">
<el-input v-model="addForm.companyName" placeholder="请输入实习单位" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="签到时间" prop="checkInTime">
<el-date-picker
v-model="addForm.checkInTime"
type="datetime"
placeholder="选择签到时间"
value-format="YYYY-MM-DD HH:mm:ss"
style="width: 100%"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="签退时间" prop="checkOutTime">
<el-date-picker
v-model="addForm.checkOutTime"
type="datetime"
placeholder="选择签退时间"
value-format="YYYY-MM-DD HH:mm:ss"
style="width: 100%"
/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="签到状态" prop="status">
<el-select v-model="addForm.status" placeholder="请选择签到状态" style="width: 100%">
<el-option
v-for="item in attendanceStatusOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工作时长" prop="workDuration">
<el-input-number
v-model="addForm.workDuration"
:min="0"
:max="24"
:precision="1"
placeholder="工作时长(小时)"
style="width: 100%"
/>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="签到地点" prop="checkInLocation">
<el-input v-model="addForm.checkInLocation" placeholder="请输入签到地点" />
</el-form-item>
<el-form-item label="工作内容" prop="workContent">
<el-input
v-model="addForm.workContent"
type="textarea"
:rows="3"
placeholder="请输入工作内容"
maxlength="500"
show-word-limit
/>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input
v-model="addForm.remark"
type="textarea"
:rows="2"
placeholder="请输入备注"
maxlength="200"
show-word-limit
/>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer-right">
<el-button @click="cancelAdd">取消</el-button>
<el-button type="primary" @click="submitAdd" :loading="addLoading">确定</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup name="InternshipDaily">
import { listInternshipDaily, getCalendar, getStatistics, addInternshipDaily } from "@/api/zsjy/internshipDaily";
import { parseTime } from "@/utils/ruoyi";
const { proxy } = getCurrentInstance();
// 响应式数据
const internshipDailyList = ref([]);
const loading = ref(true);
const showSearch = ref(true);
const total = ref(0);
const daterangeCheckTime = ref([]);
const viewDialogVisible = ref(false);
const calendarDialogVisible = ref(false);
const currentRecord = ref(null);
const currentStudent = ref(null);
const calendarMonth = ref('');
const calendarDate = ref(new Date());
const calendarData = ref([]);
const statistics = ref({});
const addDialogVisible = ref(false);
const addLoading = ref(false);
// 新增表单数据
const addForm = ref({
studentName: '',
studentNumber: '',
className: '',
companyName: '',
checkInTime: '',
checkOutTime: '',
workDuration: null,
status: '1',
checkInLocation: '',
workContent: '',
remark: ''
});
// 新增表单验证规则
const addFormRules = ref({
studentName: [
{ required: true, message: '请输入学生姓名', trigger: 'blur' }
],
studentNumber: [
{ required: true, message: '请输入学号', trigger: 'blur' }
],
className: [
{ required: true, message: '请输入班级', trigger: 'blur' }
],
companyName: [
{ required: true, message: '请输入实习单位', trigger: 'blur' }
],
checkInTime: [
{ required: true, message: '请选择签到时间', trigger: 'change' }
],
status: [
{ required: true, message: '请选择签到状态', trigger: 'change' }
]
});
// 查询参数
const queryParams = ref({
pageNum: 1,
pageSize: 10,
studentName: '',
studentNumber: '',
companyName: '',
status: '',
checkTimeStart: '',
checkTimeEnd: ''
});
// 字典数据
const attendanceStatusOptions = ref([
{ label: '未签到', value: '0', elTagType: 'info' },
{ label: '已签到', value: '1', elTagType: 'success' },
{ label: '迟到', value: '2', elTagType: 'warning' },
{ label: '早退', value: '3', elTagType: 'danger' }
]);
// 查询列表
const getList = () => {
loading.value = true;
// 处理日期范围
if (daterangeCheckTime.value && daterangeCheckTime.value.length === 2) {
queryParams.value.checkTimeStart = daterangeCheckTime.value[0];
queryParams.value.checkTimeEnd = daterangeCheckTime.value[1];
} else {
queryParams.value.checkTimeStart = '';
queryParams.value.checkTimeEnd = '';
}
listInternshipDaily(queryParams.value).then(response => {
internshipDailyList.value = response.rows;
total.value = response.total;
loading.value = false;
});
};
// 获取统计数据
const getStatisticsData = () => {
getStatistics().then(response => {
statistics.value = response.data || {};
});
};
// 搜索按钮操作
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
// 重置按钮操作
const resetQuery = () => {
daterangeCheckTime.value = [];
proxy.resetForm("queryFormRef");
queryParams.value = {
pageNum: 1,
pageSize: 10,
studentName: '',
studentNumber: '',
companyName: '',
status: '',
checkTimeStart: '',
checkTimeEnd: ''
};
handleQuery();
};
// 多选框选中数据
const handleSelectionChange = (selection) => {
// 多选处理逻辑
};
// 新增按钮操作
const handleAdd = () => {
resetAddForm();
addDialogVisible.value = true;
};
// 重置新增表单
const resetAddForm = () => {
addForm.value = {
studentName: '',
studentNumber: '',
className: '',
companyName: '',
checkInTime: '',
checkOutTime: '',
workDuration: null,
status: '1',
checkInLocation: '',
workContent: '',
remark: ''
};
if (proxy.$refs.addFormRef) {
proxy.$refs.addFormRef.resetFields();
}
};
// 取消新增
const cancelAdd = () => {
addDialogVisible.value = false;
resetAddForm();
};
// 提交新增
const submitAdd = () => {
proxy.$refs.addFormRef.validate(valid => {
if (valid) {
addLoading.value = true;
addInternshipDaily(addForm.value).then(response => {
proxy.$modal.msgSuccess("新增签到记录成功");
addDialogVisible.value = false;
getList();
}).finally(() => {
addLoading.value = false;
});
}
});
};
// 查看详情
const handleView = (row) => {
currentRecord.value = { ...row };
viewDialogVisible.value = true;
};
// 查看考勤日历
const handleCalendar = (row) => {
currentStudent.value = { ...row };
calendarMonth.value = new Date().toISOString().slice(0, 7); // 当前月份
calendarDate.value = new Date();
calendarDialogVisible.value = true;
loadCalendarData();
};
// 月份变化处理
const handleMonthChange = (month) => {
calendarMonth.value = month;
loadCalendarData();
};
// 加载日历数据
const loadCalendarData = () => {
if (!currentStudent.value || !calendarMonth.value) return;
const params = {
month: calendarMonth.value
};
getCalendar(currentStudent.value.studentId, params).then(response => {
calendarData.value = response.data || [];
});
};
// 获取考勤状态
const getAttendanceStatus = (date) => {
const record = calendarData.value.find(item =>
item.checkDate === date
);
return record ? record.status : null;
};
// 获取状态标签类型
const getStatusTagType = (status) => {
const statusMap = {
'0': 'info',
'1': 'success',
'2': 'warning',
'3': 'danger'
};
return statusMap[status] || 'info';
};
// 获取状态文本
const getStatusText = (status) => {
const statusMap = {
'0': '未签到',
'1': '正常',
'2': '迟到',
'3': '早退'
};
return statusMap[status] || '';
};
// 导出按钮操作
const handleExport = () => {
proxy.download('zsjy/internship/daily/export', {
...queryParams.value
}, `实习日常记录_${new Date().getTime()}.xlsx`);
};
// 初始化
onMounted(() => {
getList();
getStatisticsData();
});
</script>
<style scoped lang="scss">
// 继承后勤管理的样式
.page-container {
.search-btn-container {
text-align: right;
}
.button-card {
margin-bottom: 20px;
.card-header-vertical {
display: flex;
justify-content: space-between;
align-items: center;
}
.toolbar-title {
font-size: 18px;
font-weight: bold;
color: #303133;
}
.button-group {
display: flex;
align-items: center;
gap: 10px;
}
}
.table-card {
.table-container {
overflow-x: auto;
}
.pagination-container {
display: flex;
justify-content: flex-end;
padding: 16px 20px 0 0 !important;
background-color: #fff;
margin-top: 0px !important;
}
}
}
/* 统计卡片样式 */
.stat-card {
border-radius: 8px;
transition: all 0.3s ease;
height: 90px;
&:hover {
transform: translateY(-2px);
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}
.stat-content {
display: flex;
align-items: center;
padding: 5px 12px;
height: 100%;
box-sizing: border-box;
.stat-icon {
font-size: 24px;
margin-right: 12px;
opacity: 0.8;
}
.stat-info {
flex: 1;
.stat-value {
font-size: 20px;
font-weight: bold;
line-height: 1;
margin-bottom: 3px;
}
.stat-label {
font-size: 13px;
opacity: 0.7;
line-height: 1;
}
}
}
&.stat-card-primary {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
}
&.stat-card-success {
background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
color: white;
}
&.stat-card-warning {
background: linear-gradient(135deg, #ff9a56 0%, #ffad56 100%);
color: white;
}
&.stat-card-info {
background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
color: #333;
}
}
/* 表格样式 */
.scroll-table {
:deep(.el-table__header-wrapper) {
.el-table__header {
th {
background-color: #f8f9fa;
color: #333;
font-weight: 600;
}
}
}
:deep(.el-table__body-wrapper) {
.el-table__row {
&:hover {
background-color: #f5f7fa;
}
}
}
}
/* 学生信息样式 */
.student-info {
.student-name {
font-weight: 600;
color: #303133;
margin-bottom: 2px;
}
.student-number,
.student-class {
font-size: 12px;
color: #909399;
line-height: 1.2;
}
}
/* 时间详情样式 */
.time-detail {
font-size: 12px;
color: #909399;
}
.text-danger {
color: #f56c6c;
}
.text-muted {
color: #909399;
}
/* 操作按钮样式 */
.action-buttons {
display: flex;
gap: 8px;
justify-content: center;
align-items: center;
}
/* 对话框样式 */
.dialog-footer-right {
display: flex;
justify-content: flex-end;
gap: 10px;
}
/* 详情容器样式 */
.detail-container {
padding: 8px 0;
}
/* 日历相关样式 */
.calendar-container {
.calendar-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
h4 {
margin: 0;
color: #303133;
}
}
.calendar-day {
height: 60px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
position: relative;
.day-number {
font-size: 14px;
font-weight: 500;
margin-bottom: 4px;
}
.attendance-status {
.el-tag {
font-size: 10px;
padding: 0 4px;
height: 16px;
line-height: 16px;
}
}
}
}
/* 响应式设计 */
@media (max-width: 768px) {
.stat-card {
margin-bottom: 10px;
}
.action-buttons {
flex-direction: column;
gap: 4px;
}
}
</style>
@@ -0,0 +1,366 @@
<template>
<el-dialog
v-model="visible"
title="新增实习信息"
width="80%"
:before-close="handleClose"
draggable
destroy-on-close
>
<el-form ref="formRef" :model="form" :rules="rules" label-width="120px" class="form-container">
<el-row :gutter="24">
<!-- 基本信息 -->
<el-col :span="24">
<div class="form-section-title">基本信息</div>
</el-col>
<el-col :span="12">
<el-form-item label="学生姓名" prop="studentName">
<el-input v-model="form.studentName" placeholder="学生姓名" disabled />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="学号" prop="studentNo">
<el-input v-model="form.studentNo" placeholder="学号" disabled />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="实习状态" prop="internshipStatus">
<el-select v-model="form.internshipStatus" placeholder="请选择实习状态" style="width: 100%">
<el-option v-for="dict in internship_status" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="实习津贴" prop="internshipAllowance">
<el-input-number v-model="form.internshipAllowance" :min="0" :precision="2" controls-position="right" placeholder="实习津贴" style="width: 100%" />
</el-form-item>
</el-col>
<!-- 实习单位信息 -->
<el-col :span="24">
<div class="form-section-title">实习单位信息</div>
</el-col>
<el-col :span="12">
<el-form-item label="实习单位名称" prop="companyName">
<el-input v-model="form.companyName" placeholder="请输入实习单位名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单位联系人" prop="companyContact">
<el-input v-model="form.companyContact" placeholder="请输入单位联系人" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="单位地址" prop="companyAddress">
<el-input v-model="form.companyAddress" placeholder="请输入单位地址" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="联系人电话" prop="companyPhone">
<el-input v-model="form.companyPhone" placeholder="请输入联系人电话" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="行业类型" prop="companyIndustry">
<el-input v-model="form.companyIndustry" placeholder="请输入行业类型" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单位规模" prop="companyScale">
<el-select v-model="form.companyScale" placeholder="请选择单位规模" clearable style="width: 100%">
<el-option label="20人以下" value="1" />
<el-option label="20-99人" value="2" />
<el-option label="100-499人" value="3" />
<el-option label="500-999人" value="4" />
<el-option label="1000人以上" value="5" />
</el-select>
</el-form-item>
</el-col>
<!-- 岗位信息 -->
<el-col :span="24">
<div class="form-section-title">岗位信息</div>
</el-col>
<el-col :span="12">
<el-form-item label="岗位名称" prop="internshipPosition">
<el-input v-model="form.internshipPosition" placeholder="请输入岗位名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工作时长" prop="workHours">
<el-input v-model="form.workHours" placeholder="请输入工作时长" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="岗位职责" prop="positionDuties">
<el-input v-model="form.positionDuties" placeholder="请输入岗位职责" />
</el-form-item>
</el-col>
<!-- 实习周期 -->
<el-col :span="24">
<div class="form-section-title">实习周期</div>
</el-col>
<el-col :span="12">
<el-form-item label="实习开始日期" prop="internshipStartDate">
<el-date-picker
v-model="form.internshipStartDate"
type="date"
placeholder="请选择实习开始日期"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
style="width: 100%"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="实习结束日期" prop="internshipEndDate">
<el-date-picker
v-model="form.internshipEndDate"
type="date"
placeholder="请选择实习结束日期"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
style="width: 100%"
/>
</el-form-item>
</el-col>
<!-- 联系方式和其他信息 -->
<el-col :span="24">
<div class="form-section-title">联系方式和其他信息</div>
</el-col>
<el-col :span="12">
<el-form-item label="单位联系人" prop="contactPersonName">
<el-input v-model="form.contactPersonName" placeholder="请输入单位联系人" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="联系人电话" prop="contactPersonPhone">
<el-input v-model="form.contactPersonPhone" placeholder="请输入联系人电话" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="实习协议状态" prop="agreementStatus">
<el-select v-model="form.agreementStatus" placeholder="请选择实习协议状态" style="width: 100%">
<el-option label="已签署" value="1" />
<el-option label="未签署" value="2" />
</el-select>
</el-form-item>
</el-col>
<!-- 备注 -->
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" :rows="3" placeholder="请输入备注信息" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="handleClose">取消</el-button>
<el-button type="primary" :loading="submitLoading" @click="handleSubmit">保存</el-button>
</span>
</template>
</el-dialog>
</template>
<script setup name="AddDialog" lang="ts">
import { ref, reactive, watch, getCurrentInstance, ComponentInternalInstance, toRefs } from 'vue';
import { ElMessage } from 'element-plus';
import { addInternshipInfo } from '@/api/zsjy/internship';
import { InternshipInfoAddBO } from '@/api/zsjy/types';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { internship_status } = toRefs<any>(proxy?.useDict('internship_status'));
// Props定义
interface Props {
modelValue: boolean;
studentInfo?: {
studentId: string;
studentName: string;
studentNo: string;
};
}
const props = withDefaults(defineProps<Props>(), {
modelValue: false,
studentInfo: () => ({
studentId: '',
studentName: '',
studentNo: ''
})
});
// Emits定义
const emit = defineEmits<{
'update:modelValue': [value: boolean];
'success': [];
}>();
const visible = ref(false);
const formRef = ref();
const submitLoading = ref(false);
// 表单数据
const form = reactive<InternshipInfoAddBO>({
studentId: '',
studentName: '',
studentNo: '',
internshipStatus: '1',
companyName: '',
companyAddress: '',
companyIndustry: '',
companyScale: '',
internshipPosition: '',
positionDuties: '',
internshipAllowance: 0,
workHours: '',
accommodationAddress: '',
accommodationType: '',
accommodationCost: 0,
internshipStartDate: '',
internshipEndDate: '',
contactPersonName: '',
contactPersonPhone: '',
agreementStatus: '1',
remark: ''
});
// 表单验证规则
const rules = reactive({
internshipStatus: [{ required: true, message: '请选择实习状态', trigger: 'change' }],
companyName: [{ required: true, message: '请输入实习单位名称', trigger: 'blur' }],
companyAddress: [{ required: true, message: '请输入单位地址', trigger: 'blur' }],
internshipPosition: [{ required: true, message: '请输入岗位名称', trigger: 'blur' }],
contactPersonName: [{ required: true, message: '请输入单位联系人', trigger: 'blur' }],
contactPersonPhone: [
{ required: true, message: '请输入联系人电话', trigger: 'blur' },
{ pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号码', trigger: 'blur' }
],
internshipStartDate: [{ required: true, message: '请选择实习开始日期', trigger: 'change' }],
internshipEndDate: [{ required: true, message: '请选择实习结束日期', trigger: 'change' }],
agreementStatus: [{ required: true, message: '请选择实习协议状态', trigger: 'change' }]
});
// 监听弹窗显示状态
watch(
() => props.modelValue,
(newVal) => {
visible.value = newVal;
if (newVal && props.studentInfo) {
form.studentId = props.studentInfo.studentId;
form.studentName = props.studentInfo.studentName;
form.studentNo = props.studentInfo.studentNo;
}
}
);
// 监听visible变化,同步到父组件
watch(
() => visible.value,
(newVal) => {
emit('update:modelValue', newVal);
}
);
// 重置表单
const resetForm = () => {
Object.assign(form, {
studentId: '',
studentName: '',
studentNo: '',
internshipStatus: '1',
companyName: '',
companyAddress: '',
companyIndustry: '',
companyScale: '',
internshipPosition: '',
positionDuties: '',
internshipAllowance: 0,
workHours: '',
accommodationAddress: '',
accommodationType: '',
accommodationCost: 0,
internshipStartDate: '',
internshipEndDate: '',
contactPersonName: '',
contactPersonPhone: '',
agreementStatus: '1',
remark: ''
});
formRef.value?.clearValidate();
};
// 关闭弹窗
const handleClose = () => {
visible.value = false;
resetForm();
};
// 提交表单
const handleSubmit = async () => {
try {
await formRef.value.validate();
submitLoading.value = true;
console.log('=== 前端提交实习信息 ===');
console.log('1. 表单验证通过');
console.log('2. 提交的数据:', JSON.stringify(form, null, 2));
const response = await addInternshipInfo(form);
console.log('3. 后端响应:', response);
console.log('4. 响应状态码:', response.code);
console.log('5. 响应消息:', response.msg);
if (response.code === 200) {
console.log('6. 新增成功');
ElMessage.success('新增实习信息成功');
handleClose();
emit('success');
} else {
console.error('7. 新增失败,后端返回错误:', response.msg);
ElMessage.error(response.msg || '新增实习信息失败');
}
} catch (error) {
console.error('=== 前端提交失败 ===');
console.error('错误对象:', error);
console.error('错误信息:', error.message);
console.error('错误响应:', error.response);
ElMessage.error('新增实习信息失败');
} finally {
submitLoading.value = false;
console.log('=== 前端提交流程结束 ===');
}
};
</script>
<style lang="scss" scoped>
.form-container {
max-height: 60vh;
overflow-y: auto;
padding: 20px 0;
}
.form-section-title {
font-size: 16px;
font-weight: bold;
color: #303133;
margin-bottom: 20px;
padding-bottom: 10px;
border-bottom: 2px solid #409eff;
}
.dialog-footer {
text-align: right;
}
:deep(.el-dialog__body) {
padding-top: 10px;
padding-bottom: 10px;
}
</style>
@@ -0,0 +1,437 @@
<template>
<el-dialog
v-model="visible"
title="编辑实习信息"
width="80%"
:before-close="handleClose"
draggable
destroy-on-close
>
<el-form ref="formRef" :model="form" :rules="rules" label-width="120px" class="form-container" v-loading="loading">
<el-row :gutter="24">
<!-- 基本信息 -->
<el-col :span="24">
<div class="form-section-title">基本信息</div>
</el-col>
<el-col :span="12">
<el-form-item label="学生姓名" prop="studentName">
<el-input v-model="form.studentName" placeholder="学生姓名" disabled />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="学号" prop="studentNo">
<el-input v-model="form.studentNo" placeholder="学号" disabled />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="实习状态" prop="internshipStatus">
<el-select v-model="form.internshipStatus" placeholder="请选择实习状态" style="width: 100%">
<el-option v-for="dict in internship_status" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="实习津贴" prop="internshipAllowance">
<el-input-number v-model="form.internshipAllowance" :min="0" :precision="2" controls-position="right" placeholder="实习津贴" style="width: 100%" />
</el-form-item>
</el-col>
<!-- 实习单位信息 -->
<el-col :span="24">
<div class="form-section-title">实习单位信息</div>
</el-col>
<el-col :span="12">
<el-form-item label="实习单位名称" prop="companyName">
<el-input v-model="form.companyName" placeholder="请输入实习单位名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单位联系人" prop="companyContact">
<el-input v-model="form.companyContact" placeholder="请输入单位联系人" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="单位地址" prop="companyAddress">
<el-input v-model="form.companyAddress" placeholder="请输入单位地址" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="联系人电话" prop="companyPhone">
<el-input v-model="form.companyPhone" placeholder="请输入联系人电话" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="行业类型" prop="companyIndustry">
<el-input v-model="form.companyIndustry" placeholder="请输入行业类型" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单位规模" prop="companyScale">
<el-select v-model="form.companyScale" placeholder="请选择单位规模" clearable style="width: 100%">
<el-option label="20人以下" value="1" />
<el-option label="20-99人" value="2" />
<el-option label="100-499人" value="3" />
<el-option label="500-999人" value="4" />
<el-option label="1000人以上" value="5" />
</el-select>
</el-form-item>
</el-col>
<!-- 岗位信息 -->
<el-col :span="24">
<div class="form-section-title">岗位信息</div>
</el-col>
<!-- 岗位名称 -->
<el-col :span="12">
<el-form-item label="岗位名称" prop="internshipPosition">
<el-input v-model="form.internshipPosition" placeholder="请输入岗位名称" />
</el-form-item>
</el-col>
<!-- 岗位职责 -->
<el-col :span="12">
<el-form-item label="岗位职责" prop="positionDuties">
<el-input v-model="form.positionDuties" placeholder="请输入岗位职责" />
</el-form-item>
</el-col>
<!-- 实习津贴 -->
<el-col :span="12">
<el-form-item label="实习津贴" prop="internshipAllowance">
<el-input-number v-model="form.internshipAllowance" :min="0" :precision="2" placeholder="请输入实习津贴" style="width: 100%" />
</el-form-item>
</el-col>
<!-- 工作时长 -->
<el-col :span="12">
<el-form-item label="工作时长" prop="workHours">
<el-input v-model="form.workHours" placeholder="请输入工作时长" />
</el-form-item>
</el-col>
</el-row>
<!-- 第四分区:实习时间信息 -->
<el-divider content-position="left">实习时间信息</el-divider>
<el-row :gutter="20">
<!-- 实习开始日期 -->
<el-col :span="12">
<el-form-item label="实习开始日期" prop="internshipStartDate">
<el-date-picker
v-model="form.internshipStartDate"
type="date"
placeholder="请选择实习开始日期"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
style="width: 100%"
/>
</el-form-item>
</el-col>
<!-- 实习结束日期 -->
<el-col :span="12">
<el-form-item label="实习结束日期" prop="internshipEndDate">
<el-date-picker
v-model="form.internshipEndDate"
type="date"
placeholder="请选择实习结束日期"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
style="width: 100%"
/>
</el-form-item>
</el-col>
<!-- 实际结束日期 -->
<el-col :span="12">
<el-form-item label="实际结束日期" prop="actualEndDate">
<el-date-picker
v-model="form.actualEndDate"
type="date"
placeholder="请选择实际结束日期"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
style="width: 100%"
/>
</el-form-item>
</el-col>
</el-row>
<!-- 第五分区:联系方式和其他信息 -->
<el-divider content-position="left">联系方式和其他信息</el-divider>
<el-row :gutter="20">
<!-- 单位联系人 -->
<el-col :span="12">
<el-form-item label="单位联系人" prop="contactPersonName">
<el-input v-model="form.contactPersonName" placeholder="请输入单位联系人" />
</el-form-item>
</el-col>
<!-- 联系人电话 -->
<el-col :span="12">
<el-form-item label="联系人电话" prop="contactPersonPhone">
<el-input v-model="form.contactPersonPhone" placeholder="请输入联系人电话" />
</el-form-item>
</el-col>
<!-- 实习协议状态 -->
<el-col :span="12">
<el-form-item label="实习协议状态" prop="agreementStatus">
<el-select v-model="form.agreementStatus" placeholder="请选择实习协议状态" style="width: 100%">
<el-option label="已签署" value="1" />
<el-option label="未签署" value="2" />
</el-select>
</el-form-item>
</el-col>
<!-- 备注 -->
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" :rows="3" placeholder="请输入备注信息" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="handleClose">取消</el-button>
<el-button type="primary" :loading="submitLoading" @click="handleSubmit">保存</el-button>
<el-button type="danger" @click="handleDelete">删除</el-button>
</span>
</template>
</el-dialog>
</template>
<script setup name="EditDialog" lang="ts">
import { ref, reactive, watch, getCurrentInstance, ComponentInternalInstance, toRefs } from 'vue';
import { ElMessage, ElMessageBox } from 'element-plus';
import { getInternshipInfo, updateInternshipInfo, delInternshipInfo } from '@/api/zsjy/internship';
import { InternshipInfoEditBO } from '@/api/zsjy/types';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { internship_status } = toRefs<any>(proxy?.useDict('internship_status'));
// Props定义
interface Props {
modelValue: boolean;
studentId?: string;
}
const props = withDefaults(defineProps<Props>(), {
modelValue: false,
studentId: ''
});
// Emits定义
const emit = defineEmits<{
'update:modelValue': [value: boolean];
'success': [];
}>();
const visible = ref(false);
const formRef = ref();
const loading = ref(false);
const submitLoading = ref(false);
// 表单数据
const form = reactive<InternshipInfoEditBO>({
internshipId: '',
studentId: '',
studentName: '',
studentNo: '',
internshipStatus: '1',
companyName: '',
companyAddress: '',
companyIndustry: '',
companyScale: '',
internshipPosition: '',
positionDuties: '',
internshipAllowance: 0,
workHours: '',
accommodationAddress: '',
accommodationType: '',
accommodationCost: 0,
internshipStartDate: '',
internshipEndDate: '',
contactPersonName: '',
contactPersonPhone: '',
agreementStatus: '1',
actualEndDate: '',
remark: ''
});
// 表单验证规则
const rules = reactive({
internshipStatus: [{ required: true, message: '请选择实习状态', trigger: 'change' }],
companyName: [{ required: true, message: '请输入实习单位名称', trigger: 'blur' }],
companyAddress: [{ required: true, message: '请输入单位地址', trigger: 'blur' }],
internshipPosition: [{ required: true, message: '请输入岗位名称', trigger: 'blur' }],
contactPersonName: [{ required: true, message: '请输入单位联系人', trigger: 'blur' }],
contactPersonPhone: [
{ required: true, message: '请输入联系人电话', trigger: 'blur' },
{ pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号码', trigger: 'blur' }
],
internshipStartDate: [{ required: true, message: '请选择实习开始日期', trigger: 'change' }],
internshipEndDate: [{ required: true, message: '请选择实习结束日期', trigger: 'change' }],
agreementStatus: [{ required: true, message: '请选择实习协议状态', trigger: 'change' }]
});
// 监听弹窗显示状态
watch(() => props.modelValue, (newVal) => {
visible.value = newVal;
if (newVal && props.studentId) {
getInternshipDetail();
}
});
watch(visible, (newVal) => {
emit('update:modelValue', newVal);
});
// 获取实习信息详情
const getInternshipDetail = async () => {
if (!props.studentId) {
ElMessage.error('参数错误');
return;
}
loading.value = true;
try {
const res = await getInternshipInfo(props.studentId);
const data = res.data;
// 填充表单数据
Object.assign(form, {
internshipId: data.internshipId,
studentId: data.studentId,
studentName: data.studentName,
studentNo: data.studentNo,
internshipStatus: data.internshipStatus,
companyName: data.companyName,
companyAddress: data.companyAddress,
companyIndustry: data.companyIndustry,
companyScale: data.companyScale,
internshipPosition: data.internshipPosition || data.positionName,
positionDuties: data.positionDuties,
internshipAllowance: data.internshipAllowance,
workHours: data.workHours,
accommodationAddress: data.accommodationAddress,
accommodationType: data.accommodationType,
accommodationCost: data.accommodationCost,
internshipStartDate: data.internshipStartDate || data.startDate,
internshipEndDate: data.internshipEndDate || data.endDate,
contactPersonName: data.contactPersonName || data.companyContact,
contactPersonPhone: data.contactPersonPhone || data.companyPhone,
agreementStatus: data.agreementStatus || '1',
actualEndDate: data.actualEndDate,
remark: data.remark
});
} catch (error) {
console.error('获取实习信息失败:', error);
ElMessage.error('获取实习信息失败');
handleClose();
} finally {
loading.value = false;
}
};
// 重置表单
const resetForm = () => {
Object.assign(form, {
internshipId: '',
studentId: '',
studentName: '',
studentNo: '',
internshipStatus: '1',
companyName: '',
companyAddress: '',
companyIndustry: '',
companyScale: '',
companyContact: '',
companyPhone: '',
positionName: '',
positionDuties: '',
internshipAllowance: 0,
workHours: '',
accommodationAddress: '',
accommodationType: '',
accommodationCost: 0,
startDate: '',
endDate: '',
actualEndDate: '',
remark: ''
});
formRef.value?.clearValidate();
};
// 关闭弹窗
const handleClose = () => {
visible.value = false;
resetForm();
};
// 提交表单
const handleSubmit = async () => {
try {
await formRef.value.validate();
submitLoading.value = true;
await updateInternshipInfo(form);
ElMessage.success('修改实习信息成功');
handleClose();
emit('success');
} catch (error) {
console.error('修改实习信息失败:', error);
ElMessage.error('修改实习信息失败');
} finally {
submitLoading.value = false;
}
};
// 删除实习信息
const handleDelete = async () => {
try {
await ElMessageBox.confirm('确认删除该实习信息?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
});
await delInternshipInfo(form.internshipId);
ElMessage.success('删除实习信息成功');
handleClose();
emit('success');
} catch (error) {
if (error === 'cancel') return;
console.error('删除实习信息失败:', error);
ElMessage.error('删除实习信息失败');
}
};
</script>
<style lang="scss" scoped>
.form-container {
max-height: 60vh;
overflow-y: auto;
padding: 20px 0;
}
.form-section-title {
font-size: 16px;
font-weight: bold;
color: #303133;
margin-bottom: 20px;
padding-bottom: 10px;
border-bottom: 2px solid #409eff;
}
.dialog-footer {
text-align: right;
}
:deep(.el-dialog__body) {
padding-top: 10px;
padding-bottom: 10px;
}
</style>
@@ -93,7 +93,7 @@
<div class="statistics-card internshiping">
<div class="statistics-content">
<div class="statistics-number">{{ statisticsData.internshipCount || 0 }}</div>
<div class="statistics-label">实习中</div>
<div class="statistics-label">已实习</div>
</div>
<div class="statistics-icon">
<el-icon><Loading /></el-icon>
@@ -103,9 +103,9 @@
<el-col :span="6">
<div class="statistics-card completed">
<div class="statistics-content">
<div class="statistics-number">{{ statisticsData.internshipCount || 0 }}</div>
<div class="statistics-label">已完成</div>
<div class="statistics-rate">实习率:{{ statisticsData.internshipRate || '0.00%' }}</div>
<div class="statistics-number">{{ statisticsData.internshipRate || '0.00%' }}</div>
<div class="statistics-label">实习率</div>
<div class="statistics-description">已实习学生占比</div>
</div>
<div class="statistics-icon">
<el-icon><CircleCheck /></el-icon>
@@ -194,17 +194,17 @@
<!-- 学生实习详情对话框 -->
<el-dialog title="学生实习详情" v-model="dialog.visible" width="800px" append-to-body>
<el-dialog title="学生实习详情" v-model="dialog.visible" width="900px" append-to-body>
<div v-if="studentDetail" class="student-detail">
<el-descriptions title="基本信息" :column="2" border>
<el-descriptions-item label="学号">{{ studentDetail.studentNo }}</el-descriptions-item>
<el-descriptions-item label="姓名">{{ studentDetail.studentName }}</el-descriptions-item>
<el-descriptions-item label="性别">{{ studentDetail.gender }}</el-descriptions-item>
<el-descriptions-item label="手机号">{{ studentDetail.mobile }}</el-descriptions-item>
<el-descriptions-item label="手机号">{{ studentDetail.phone }}</el-descriptions-item>
<el-descriptions-item label="学院">{{ studentDetail.collegeName }}</el-descriptions-item>
<el-descriptions-item label="专业">{{ studentDetail.majorName }}</el-descriptions-item>
<el-descriptions-item label="班级">{{ studentDetail.className }}</el-descriptions-item>
<el-descriptions-item label="班主任">{{ studentDetail.classMasterName }}</el-descriptions-item>
<el-descriptions-item label="班主任">{{ studentDetail.classTeacherName }}</el-descriptions-item>
</el-descriptions>
<el-descriptions title="实习信息" :column="2" border class="mt-4">
@@ -212,17 +212,29 @@
<span v-if="studentDetail.internshipStatus === 'null' || !studentDetail.internshipStatus" class="status-tag not-started">未实习</span>
<dict-tag v-else :options="internship_status" :value="studentDetail.internshipStatus" />
</el-descriptions-item>
<el-descriptions-item label="实习公司">{{ studentDetail.internshipCompany || '-' }}</el-descriptions-item>
<el-descriptions-item label="实习公司">{{ studentDetail.companyName || '-' }}</el-descriptions-item>
<el-descriptions-item label="实习岗位">{{ studentDetail.internshipPosition || '-' }}</el-descriptions-item>
<el-descriptions-item label="实习地点">{{ studentDetail.internshipLocation || '-' }}</el-descriptions-item>
<el-descriptions-item label="实习地点">{{ studentDetail.companyAddress || '-' }}</el-descriptions-item>
<el-descriptions-item label="实习开始时间">
<span v-if="studentDetail.internshipStartTime">{{ parseTime(studentDetail.internshipStartTime, '{y}-{m}-{d}') }}</span>
<span v-if="studentDetail.internshipStartDate">{{ parseTime(studentDetail.internshipStartDate, '{y}-{m}-{d}') }}</span>
<span v-else>-</span>
</el-descriptions-item>
<el-descriptions-item label="实习结束时间">
<span v-if="studentDetail.internshipEndTime">{{ parseTime(studentDetail.internshipEndTime, '{y}-{m}-{d}') }}</span>
<span v-if="studentDetail.internshipEndDate">{{ parseTime(studentDetail.internshipEndDate, '{y}-{m}-{d}') }}</span>
<span v-else>-</span>
</el-descriptions-item>
<el-descriptions-item label="单位联系人">{{ studentDetail.contactPersonName || '-' }}</el-descriptions-item>
<el-descriptions-item label="联系人电话">{{ studentDetail.contactPersonPhone || '-' }}</el-descriptions-item>
<el-descriptions-item label="实习津贴">
<span v-if="studentDetail.internshipAllowance && studentDetail.internshipAllowance > 0">{{ studentDetail.internshipAllowance }}元/月</span>
<span v-else>-</span>
</el-descriptions-item>
<el-descriptions-item label="协议状态">
<el-tag v-if="studentDetail.agreementStatus === '1'" type="success">已签署</el-tag>
<el-tag v-else-if="studentDetail.agreementStatus === '2'" type="warning">未签署</el-tag>
<span v-else>-</span>
</el-descriptions-item>
<el-descriptions-item label="备注" :span="2">{{ studentDetail.remark || '-' }}</el-descriptions-item>
</el-descriptions>
</div>
<template #footer>
@@ -498,6 +510,12 @@ const cancel = () => {
opacity: 0.8;
margin-top: 2px;
}
.statistics-description {
font-size: 12px;
opacity: 0.8;
margin-top: 2px;
}
}
.statistics-icon {