feat(xg): 落实教师反馈中的留宿、点名、卫生和处分规则
留宿按次日早上8点结束,点名按校区分日共用批次,处分计入现有班级月扣分,开除学籍只登记不计分。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
51abfca40f
commit
f75c8a6834
49 files changed
+2163
-276
No files matched your search
@@ -46,10 +46,11 @@ export const delDormRollCall = (id: string | number | Array<string | number>) =>
|
||||
});
|
||||
};
|
||||
|
||||
export const generateBatchNo = (): AxiosPromise<string> => {
|
||||
export const generateBatchNo = (campusId?: string | number): AxiosPromise<string> => {
|
||||
return request({
|
||||
url: '/dormRollCall/dormRollCall/generateBatchNo',
|
||||
method: 'get'
|
||||
method: 'get',
|
||||
params: campusId ? { campusId } : undefined
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -74,11 +74,36 @@ export const getStudentOptions = (keyword?: string): AxiosPromise<XskhStudentOpt
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 查询当前登录学生的违纪处分记录列表
|
||||
* @param query
|
||||
* @returns {*}
|
||||
*/
|
||||
/** 学生处分种类,分值由服务端固定 */
|
||||
export const getPunishmentOptions = () => {
|
||||
return request({
|
||||
url: '/disciplineRecord/disciplineRecord/punishment/options',
|
||||
method: 'get'
|
||||
});
|
||||
};
|
||||
|
||||
export const addPunishment = (data: {
|
||||
studentId: string | number;
|
||||
punishmentCode: string;
|
||||
disciplineReason: string;
|
||||
disciplineContent?: string;
|
||||
disciplineDate?: string;
|
||||
}) => {
|
||||
return request({
|
||||
url: '/disciplineRecord/disciplineRecord/punishment',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
};
|
||||
|
||||
export const getPunishmentSummary = (query?: DisciplineRecordQuery) => {
|
||||
return request({
|
||||
url: '/disciplineRecord/disciplineRecord/punishment/summary',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
|
||||
export const listMyDisciplineRecord = (query?: DisciplineRecordQuery): AxiosPromise<DisciplineRecordVO[]> => {
|
||||
return request({
|
||||
url: '/disciplineRecord/disciplineRecord/my',
|
||||
|
||||
@@ -96,6 +96,19 @@ export const constantRoutes: RouteRecordRaw[] = [
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/xskh/studentPunishment',
|
||||
component: Layout,
|
||||
hidden: true,
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
component: () => import('@/views/xskh/studentPunishment/index.vue'),
|
||||
name: 'StudentPunishmentPage',
|
||||
meta: { title: '学生处分', icon: 'form' }
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/user',
|
||||
component: Layout,
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<el-input v-model="queryParams.nodeName" placeholder="请输入任务名称" @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="流程定义名称" label-width="100" prop="flowName">
|
||||
<el-input v-model="queryParams.flowName" placeholder="请输入流程定义名称" @keyup.enter="handleQuery" />
|
||||
<el-input v-model="queryParams.flowName" placeholder="流程名称 / 学生姓名 / 学号" @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="流程定义编码" label-width="100" prop="flowCode">
|
||||
<el-input v-model="queryParams.flowCode" placeholder="请输入流程定义编码" @keyup.enter="handleQuery" />
|
||||
|
||||
+73
-26
@@ -253,32 +253,22 @@
|
||||
</el-row>
|
||||
</div>
|
||||
|
||||
<!-- 请假信息区域 -->
|
||||
<div class="leave-section" v-if="getStudentLeave(student.studentId)">
|
||||
<div class="leave-section" v-if="getStudentLeaves(student.studentId).length">
|
||||
<div class="leave-header">
|
||||
<span>请假信息</span>
|
||||
<div class="leave-header-actions">
|
||||
<el-button size="small" plain @click="viewLeaveProcess(student, getStudentLeave(student.studentId))" title="查看请假流程">
|
||||
查看流程
|
||||
</el-button>
|
||||
<el-tag type="warning" size="small">请假中</el-tag>
|
||||
</div>
|
||||
<span>今日请假</span>
|
||||
</div>
|
||||
<div class="leave-info">
|
||||
<div class="leave-item">
|
||||
<span class="leave-label">发起时间:</span>
|
||||
<span class="leave-value">{{ formatDateTime(getStudentLeave(student.studentId)?.createTime) }}</span>
|
||||
</div>
|
||||
<div class="leave-item">
|
||||
<span class="leave-label">请假时间:</span>
|
||||
<span class="leave-value"
|
||||
>{{ formatDateTime(getStudentLeave(student.studentId)?.startTime) }} 至
|
||||
{{ formatDateTime(getStudentLeave(student.studentId)?.endTime) }}</span
|
||||
>
|
||||
<div v-for="(leave, leaveIndex) in getStudentLeaves(student.studentId)" :key="leave.id || leaveIndex" class="leave-info">
|
||||
<div class="leave-header-actions">
|
||||
<el-button size="small" plain @click="viewLeaveProcess(student, leave)" title="查看请假流程">查看流程</el-button>
|
||||
<el-tag :type="leaveTagType(leave)" size="small">{{ leaveTagText(leave) }}</el-tag>
|
||||
</div>
|
||||
<div class="leave-item">
|
||||
<span class="leave-label">请假类型:</span>
|
||||
<span class="leave-value">{{ getStudentLeave(student.studentId)?.leaveTypeName }}</span>
|
||||
<span class="leave-value">{{ leave.leaveTypeName || '-' }}</span>
|
||||
</div>
|
||||
<div class="leave-item">
|
||||
<span class="leave-label">请假时间:</span>
|
||||
<span class="leave-value">{{ formatDateTime(leave.startTime) }} 至 {{ formatDateTime(leave.endTime) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -772,14 +762,62 @@ const loadViolationRecords = async (prefetched?: any[] | null) => {
|
||||
}
|
||||
};
|
||||
|
||||
// 加载学生请假信息
|
||||
const parseLeaveTime = (value?: string) => {
|
||||
if (!value) return null;
|
||||
const date = new Date(String(value).replace('T', ' ').replace(/-/g, '/'));
|
||||
return Number.isNaN(date.getTime()) ? null : date;
|
||||
};
|
||||
|
||||
const resolveCheckMoment = (checkDate?: string) => {
|
||||
const text = String(checkDate || '').replace('T', ' ').trim();
|
||||
const now = new Date();
|
||||
if (!text || text.length <= 10) {
|
||||
const ymd = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')}`;
|
||||
if (!text || text === ymd) return now;
|
||||
return parseLeaveTime(`${text} 12:00:00`) || now;
|
||||
}
|
||||
return parseLeaveTime(text) || now;
|
||||
};
|
||||
|
||||
const leaveCoversMoment = (leave: any, moment: Date) => {
|
||||
const start = parseLeaveTime(leave?.startTime);
|
||||
const end = parseLeaveTime(leave?.endTime);
|
||||
if (!start || !end) return false;
|
||||
return start.getTime() <= moment.getTime() && end.getTime() >= moment.getTime();
|
||||
};
|
||||
|
||||
const isLateReturnLeave = (leave: any) => {
|
||||
const end = parseLeaveTime(leave?.endTime);
|
||||
if (!end) return false;
|
||||
const minutes = end.getHours() * 60 + end.getMinutes();
|
||||
return minutes >= 20 * 60 + 30 || minutes <= 5 * 60;
|
||||
};
|
||||
|
||||
const leaveTagText = (leave: any) => {
|
||||
const moment = resolveCheckMoment(hygieneForm.checkDate);
|
||||
if (leaveCoversMoment(leave, moment)) {
|
||||
return isLateReturnLeave(leave) ? '晚归待返' : '进行中';
|
||||
}
|
||||
const end = parseLeaveTime(leave?.endTime);
|
||||
if (end && end.getTime() < moment.getTime()) return '今日已结束';
|
||||
return '今日请假';
|
||||
};
|
||||
|
||||
const leaveTagType = (leave: any) => {
|
||||
const text = leaveTagText(leave);
|
||||
if (text === '晚归待返') return 'warning';
|
||||
if (text === '进行中') return 'danger';
|
||||
if (text === '今日已结束') return 'info';
|
||||
return 'primary';
|
||||
};
|
||||
|
||||
const loadStudentLeaves = async () => {
|
||||
if (!hygieneForm.checkDate || studentScores.value.length === 0) return;
|
||||
|
||||
try {
|
||||
const studentIds = studentScores.value.map((student) => student.studentId).join(',');
|
||||
const res = await request({
|
||||
url: '/studentLeave/studentLeave/queryByCheckDate',
|
||||
url: '/studentLeave/studentLeave/queryByCheckDay',
|
||||
method: 'get',
|
||||
params: {
|
||||
studentIds,
|
||||
@@ -788,12 +826,15 @@ const loadStudentLeaves = async () => {
|
||||
});
|
||||
|
||||
if (res.code === 200 && res.data) {
|
||||
const moment = resolveCheckMoment(hygieneForm.checkDate);
|
||||
studentLeaves.value.clear();
|
||||
Object.keys(res.data).forEach((studentId) => {
|
||||
const normalizedId = normalizeStudentId(studentId);
|
||||
studentLeaves.value.set(normalizedId, res.data[studentId]);
|
||||
const raw = res.data[studentId];
|
||||
const list = Array.isArray(raw) ? raw : raw ? [raw] : [];
|
||||
studentLeaves.value.set(normalizedId, list);
|
||||
const student = studentScores.value.find((s) => normalizeStudentId(s.studentId) === normalizedId);
|
||||
if (student) {
|
||||
if (student && list.some((leave) => leaveCoversMoment(leave, moment))) {
|
||||
student.attendanceStatus = '3';
|
||||
}
|
||||
});
|
||||
@@ -829,8 +870,14 @@ const syncStudentScoreFromViolations = (studentId?: string | number) => {
|
||||
};
|
||||
|
||||
// 获取学生的请假信息
|
||||
const getStudentLeaves = (studentId: string | number) => {
|
||||
const value = studentLeaves.value.get(normalizeStudentId(studentId));
|
||||
if (!value) return [];
|
||||
return Array.isArray(value) ? value : [value];
|
||||
};
|
||||
|
||||
const getStudentLeave = (studentId: string | number) => {
|
||||
return studentLeaves.value.get(normalizeStudentId(studentId)) || null;
|
||||
return getStudentLeaves(studentId)[0] || null;
|
||||
};
|
||||
|
||||
// 处理附件数据
|
||||
|
||||
+75
-27
@@ -211,32 +211,23 @@
|
||||
</el-row>
|
||||
</div>
|
||||
|
||||
<!-- 请假信息区域 -->
|
||||
<div class="leave-section" v-if="getStudentLeave(student.studentId)">
|
||||
<!-- 请假信息区域:当天全部已结束请假,进行中才标记出勤为请假 -->
|
||||
<div class="leave-section" v-if="getStudentLeaves(student.studentId).length">
|
||||
<div class="leave-header">
|
||||
<span>请假信息</span>
|
||||
<div class="leave-header-actions">
|
||||
<el-button size="small" @click="viewLeaveProcess(student, getStudentLeave(student.studentId))" title="查看请假流程">
|
||||
查看流程
|
||||
</el-button>
|
||||
<el-tag type="warning" size="small">请假中</el-tag>
|
||||
</div>
|
||||
<span>今日请假</span>
|
||||
</div>
|
||||
<div class="leave-info">
|
||||
<div class="leave-item">
|
||||
<span class="leave-label">发起时间:</span>
|
||||
<span class="leave-value">{{ formatDateTime(getStudentLeave(student.studentId)?.createTime) }}</span>
|
||||
</div>
|
||||
<div class="leave-item">
|
||||
<span class="leave-label">请假时间:</span>
|
||||
<span class="leave-value"
|
||||
>{{ formatDateTime(getStudentLeave(student.studentId)?.startTime) }} 至
|
||||
{{ formatDateTime(getStudentLeave(student.studentId)?.endTime) }}</span
|
||||
>
|
||||
<div v-for="(leave, leaveIndex) in getStudentLeaves(student.studentId)" :key="leave.id || leaveIndex" class="leave-info">
|
||||
<div class="leave-header-actions">
|
||||
<el-button size="small" @click="viewLeaveProcess(student, leave)" title="查看请假流程">查看流程</el-button>
|
||||
<el-tag :type="leaveTagType(leave)" size="small">{{ leaveTagText(leave) }}</el-tag>
|
||||
</div>
|
||||
<div class="leave-item">
|
||||
<span class="leave-label">请假类型:</span>
|
||||
<span class="leave-value">{{ getStudentLeave(student.studentId)?.leaveTypeName }}</span>
|
||||
<span class="leave-value">{{ leave.leaveTypeName || '-' }}</span>
|
||||
</div>
|
||||
<div class="leave-item">
|
||||
<span class="leave-label">请假时间:</span>
|
||||
<span class="leave-value">{{ formatDateTime(leave.startTime) }} 至 {{ formatDateTime(leave.endTime) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -547,14 +538,63 @@ const loadRoomStudents = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
// 加载学生请假信息
|
||||
const parseLeaveTime = (value?: string) => {
|
||||
if (!value) return null;
|
||||
const date = new Date(String(value).replace('T', ' ').replace(/-/g, '/'));
|
||||
return Number.isNaN(date.getTime()) ? null : date;
|
||||
};
|
||||
|
||||
const resolveCheckMoment = (checkDate?: string) => {
|
||||
const text = String(checkDate || '').replace('T', ' ').trim();
|
||||
const now = new Date();
|
||||
if (!text || text.length <= 10) {
|
||||
const ymd = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')}`;
|
||||
if (!text || text === ymd) return now;
|
||||
return parseLeaveTime(`${text} 12:00:00`) || now;
|
||||
}
|
||||
return parseLeaveTime(text) || now;
|
||||
};
|
||||
|
||||
const leaveCoversMoment = (leave: any, moment: Date) => {
|
||||
const start = parseLeaveTime(leave?.startTime);
|
||||
const end = parseLeaveTime(leave?.endTime);
|
||||
if (!start || !end) return false;
|
||||
return start.getTime() <= moment.getTime() && end.getTime() >= moment.getTime();
|
||||
};
|
||||
|
||||
const isLateReturnLeave = (leave: any) => {
|
||||
const end = parseLeaveTime(leave?.endTime);
|
||||
if (!end) return false;
|
||||
const minutes = end.getHours() * 60 + end.getMinutes();
|
||||
return minutes >= 20 * 60 + 30 || minutes <= 5 * 60;
|
||||
};
|
||||
|
||||
const leaveTagText = (leave: any) => {
|
||||
const moment = resolveCheckMoment(props.checkInfo?.checkDate);
|
||||
if (leaveCoversMoment(leave, moment)) {
|
||||
return isLateReturnLeave(leave) ? '晚归待返' : '进行中';
|
||||
}
|
||||
const end = parseLeaveTime(leave?.endTime);
|
||||
if (end && end.getTime() < moment.getTime()) return '今日已结束';
|
||||
return '今日请假';
|
||||
};
|
||||
|
||||
const leaveTagType = (leave: any) => {
|
||||
const text = leaveTagText(leave);
|
||||
if (text === '晚归待返') return 'warning';
|
||||
if (text === '进行中') return 'danger';
|
||||
if (text === '今日已结束') return 'info';
|
||||
return 'primary';
|
||||
};
|
||||
|
||||
// 加载学生当天请假,供教官查看;只有检查时刻仍在假期内才锁定出勤为请假
|
||||
const loadStudentLeaves = async () => {
|
||||
if (!props.checkInfo?.checkDate || roomStudents.value.length === 0) return;
|
||||
|
||||
try {
|
||||
const studentIds = roomStudents.value.map((student) => student.studentId).join(',');
|
||||
const res = await request({
|
||||
url: '/studentLeave/studentLeave/queryByCheckDate',
|
||||
url: '/studentLeave/studentLeave/queryByCheckDay',
|
||||
method: 'get',
|
||||
params: {
|
||||
studentIds,
|
||||
@@ -563,12 +603,15 @@ const loadStudentLeaves = async () => {
|
||||
});
|
||||
|
||||
if (res.code === 200 && res.data) {
|
||||
const moment = resolveCheckMoment(props.checkInfo.checkDate);
|
||||
studentLeaves.value.clear();
|
||||
Object.keys(res.data).forEach((studentId) => {
|
||||
const normalizedId = normalizeStudentId(studentId);
|
||||
studentLeaves.value.set(normalizedId, res.data[studentId]);
|
||||
const raw = res.data[studentId];
|
||||
const list = Array.isArray(raw) ? raw : raw ? [raw] : [];
|
||||
studentLeaves.value.set(normalizedId, list);
|
||||
const student = roomStudents.value.find((s) => normalizeStudentId(s.studentId) === normalizedId);
|
||||
if (student) {
|
||||
if (student && list.some((leave) => leaveCoversMoment(leave, moment))) {
|
||||
student.attendance_status = '3';
|
||||
}
|
||||
});
|
||||
@@ -602,9 +645,14 @@ const syncStudentScoreFromViolations = (studentId?: string | number) => {
|
||||
});
|
||||
};
|
||||
|
||||
// 获取学生的请假信息
|
||||
const getStudentLeaves = (studentId: string | number) => {
|
||||
const value = studentLeaves.value.get(normalizeStudentId(studentId));
|
||||
if (!value) return [];
|
||||
return Array.isArray(value) ? value : [value];
|
||||
};
|
||||
|
||||
const getStudentLeave = (studentId: string | number) => {
|
||||
return studentLeaves.value.get(normalizeStudentId(studentId)) || null;
|
||||
return getStudentLeaves(studentId)[0] || null;
|
||||
};
|
||||
|
||||
// 格式化日期时间
|
||||
|
||||
+60
-10
@@ -13,7 +13,9 @@
|
||||
style="width: 100%"
|
||||
@change="handleTypeSelectionChange"
|
||||
>
|
||||
<el-option v-for="item in options" :key="item.id" :label="formatOptionLabel(item)" :value="item.id" />
|
||||
<el-option-group v-for="group in groupedOptions" :key="group.label" :label="group.label">
|
||||
<el-option v-for="item in group.options" :key="item.id" :label="formatOptionLabel(item)" :value="item.id" />
|
||||
</el-option-group>
|
||||
</el-select>
|
||||
<div v-else-if="!items.length" class="empty-text">无扣分项</div>
|
||||
</el-form-item>
|
||||
@@ -26,19 +28,25 @@
|
||||
v-model="item.score"
|
||||
:min="getMinScore(item)"
|
||||
:max="getMaxScore(item)"
|
||||
:precision="2"
|
||||
:step="0.5"
|
||||
:precision="1"
|
||||
:disabled="disabled"
|
||||
controls-position="right"
|
||||
size="small"
|
||||
@change="handleScoreChange"
|
||||
@change="(value) => snapItemScore(item, value)"
|
||||
/>
|
||||
<span class="deduction-range">({{ getMinScore(item) }}-{{ getMaxScore(item) }}分)</span>
|
||||
<span class="deduction-range">({{ getMinScore(item) }}-{{ getMaxScore(item) }}分,0.5分一档)</span>
|
||||
<el-button v-if="getTypeRemark(item.disciplineTypeId)" link type="warning" @click="showTypeRemark(item)">提醒</el-button>
|
||||
<el-button v-if="!disabled" link type="danger" @click="removeItem(index)">删除</el-button>
|
||||
</div>
|
||||
<div v-if="getTypeRemark(item.disciplineTypeId)" class="deduction-remark">
|
||||
<el-icon class="remark-icon"><InfoFilled /></el-icon>
|
||||
<span>{{ getTypeRemark(item.disciplineTypeId) }}</span>
|
||||
</div>
|
||||
<el-input
|
||||
v-model="item.remark"
|
||||
:disabled="disabled"
|
||||
size="small"
|
||||
maxlength="200"
|
||||
placeholder="本项扣分说明(选填)"
|
||||
style="margin-top: 8px"
|
||||
/>
|
||||
</div>
|
||||
<div class="deduction-total">
|
||||
合计扣分:<strong>{{ totalScore }}</strong> 分
|
||||
@@ -50,8 +58,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { InfoFilled } from '@element-plus/icons-vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
import type { HygieneDeductionItem } from '@/api/xg/xgss/dormHygieneCheck/dormHygieneCheck/types';
|
||||
|
||||
interface DisciplineTypeOption {
|
||||
@@ -101,6 +108,37 @@ watch(
|
||||
{ deep: true, immediate: true }
|
||||
);
|
||||
|
||||
const GROUP_ORDER = ['卫生', '纪律', '重大违纪', '其他'];
|
||||
|
||||
const groupOf = (remark?: string) => {
|
||||
const text = remark || '';
|
||||
if (text.startsWith('重大违纪')) return '重大违纪';
|
||||
if (text.startsWith('卫生')) return '卫生';
|
||||
if (text.startsWith('纪律')) return '纪律';
|
||||
return '其他';
|
||||
};
|
||||
|
||||
const groupedOptions = computed(() => {
|
||||
const buckets = new Map<string, DisciplineTypeOption[]>(GROUP_ORDER.map((label) => [label, []]));
|
||||
(props.options || []).forEach((item) => {
|
||||
buckets.get(groupOf(item.remark))?.push(item);
|
||||
});
|
||||
return GROUP_ORDER.filter((label) => (buckets.get(label) || []).length > 0).map((label) => ({
|
||||
label,
|
||||
options: buckets.get(label) || []
|
||||
}));
|
||||
});
|
||||
|
||||
const snapHalf = (score: number | undefined, min: number, max: number) => {
|
||||
let value = Math.round(Number(score) * 2) / 2;
|
||||
if (Number.isNaN(value)) value = min;
|
||||
if (value < min) value = Math.ceil(min * 2) / 2;
|
||||
if (value > max) value = Math.floor(max * 2) / 2;
|
||||
if (value < min) value = min;
|
||||
if (value > max) value = max;
|
||||
return Number(value.toFixed(1));
|
||||
};
|
||||
|
||||
const formatOptionLabel = (item: DisciplineTypeOption) => {
|
||||
const min = item.minScore ?? 0;
|
||||
return `${item.typeName}(${min}分起)`;
|
||||
@@ -141,6 +179,7 @@ const handleTypeSelectionChange = (typeIds: Array<number | string>) => {
|
||||
score: existing?.score ?? Number(option.minScore ?? 0),
|
||||
minScore: Number(option.minScore ?? 0),
|
||||
maxScore: Number(option.maxScore ?? 100),
|
||||
remark: existing?.remark || '',
|
||||
sortOrder: index + 1
|
||||
});
|
||||
});
|
||||
@@ -151,6 +190,17 @@ const handleTypeSelectionChange = (typeIds: Array<number | string>) => {
|
||||
}
|
||||
};
|
||||
|
||||
const snapItemScore = (item: HygieneDeductionItem, value?: number) => {
|
||||
item.score = snapHalf(value, getMinScore(item), getMaxScore(item));
|
||||
handleScoreChange();
|
||||
};
|
||||
|
||||
const showTypeRemark = (item: HygieneDeductionItem) => {
|
||||
ElMessageBox.alert(getTypeRemark(item.disciplineTypeId) || '暂无说明', item.disciplineTypeName || '扣分说明', {
|
||||
confirmButtonText: '知道了'
|
||||
});
|
||||
};
|
||||
|
||||
const handleScoreChange = () => {
|
||||
if (totalScore.value > 100) {
|
||||
ElMessage.warning('合计扣分不能超过100分');
|
||||
|
||||
+99
-39
@@ -14,21 +14,23 @@
|
||||
<!-- 违纪类型选择:编辑模式单选 -->
|
||||
<el-form-item v-if="isEditMode" label="违纪类型" prop="disciplineTypeId" class="discipline-form-item">
|
||||
<el-select v-model="form.disciplineTypeId" placeholder="请选择违纪类型" style="width: 100%" @change="handleDisciplineTypeChange" filterable>
|
||||
<el-option
|
||||
v-for="item in allViolationTypes"
|
||||
:key="item.id"
|
||||
:label="getViolationTypeLabel(item)"
|
||||
:value="item.id"
|
||||
:disabled="item.status !== '0'"
|
||||
>
|
||||
<div class="violation-type-option">
|
||||
<span class="violation-type-name" :title="getViolationTypeLabel(item)">
|
||||
<span class="area-tag" :class="getAreaTypeClass(item.areaType)">{{ getAreaTypeText(item.areaType) }}</span>
|
||||
{{ getShortTypeName(item.typeName) }}
|
||||
</span>
|
||||
<span class="score-range">{{ item.minScore }}-{{ item.maxScore }}分</span>
|
||||
</div>
|
||||
</el-option>
|
||||
<el-option-group v-for="group in groupedViolationTypes" :key="'edit-' + group.label" :label="group.label">
|
||||
<el-option
|
||||
v-for="item in group.options"
|
||||
:key="item.id"
|
||||
:label="getViolationTypeLabel(item)"
|
||||
:value="item.id"
|
||||
:disabled="item.status !== '0'"
|
||||
>
|
||||
<div class="violation-type-option">
|
||||
<span class="violation-type-name" :title="getViolationTypeLabel(item)">
|
||||
<span class="area-tag" :class="getAreaTypeClass(item.areaType)">{{ getAreaTypeText(item.areaType) }}</span>
|
||||
{{ getShortTypeName(item.typeName) }}
|
||||
</span>
|
||||
<span class="score-range">{{ item.minScore }}-{{ item.maxScore }}分</span>
|
||||
</div>
|
||||
</el-option>
|
||||
</el-option-group>
|
||||
</el-select>
|
||||
|
||||
<div v-if="form.disciplineTypeId && selectedDisciplineTypeRemark" class="discipline-type-remark">
|
||||
@@ -51,21 +53,23 @@
|
||||
style="width: 100%"
|
||||
@change="handleTypeSelectionChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in allViolationTypes"
|
||||
:key="item.id"
|
||||
:label="getViolationTypeLabel(item)"
|
||||
:value="item.id"
|
||||
:disabled="item.status !== '0'"
|
||||
>
|
||||
<div class="violation-type-option">
|
||||
<span class="violation-type-name" :title="getViolationTypeLabel(item)">
|
||||
<span class="area-tag" :class="getAreaTypeClass(item.areaType)">{{ getAreaTypeText(item.areaType) }}</span>
|
||||
{{ getShortTypeName(item.typeName) }}
|
||||
</span>
|
||||
<span class="score-range">{{ item.minScore }}-{{ item.maxScore }}分</span>
|
||||
</div>
|
||||
</el-option>
|
||||
<el-option-group v-for="group in groupedViolationTypes" :key="'add-' + group.label" :label="group.label">
|
||||
<el-option
|
||||
v-for="item in group.options"
|
||||
:key="item.id"
|
||||
:label="getViolationTypeLabel(item)"
|
||||
:value="item.id"
|
||||
:disabled="item.status !== '0'"
|
||||
>
|
||||
<div class="violation-type-option">
|
||||
<span class="violation-type-name" :title="getViolationTypeLabel(item)">
|
||||
<span class="area-tag" :class="getAreaTypeClass(item.areaType)">{{ getAreaTypeText(item.areaType) }}</span>
|
||||
{{ getShortTypeName(item.typeName) }}
|
||||
</span>
|
||||
<span class="score-range">{{ item.minScore }}-{{ item.maxScore }}分</span>
|
||||
</div>
|
||||
</el-option>
|
||||
</el-option-group>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
@@ -77,17 +81,17 @@
|
||||
v-model="item.scoreDeduction"
|
||||
:min="getItemMinScore(item)"
|
||||
:max="getItemMaxScore(item)"
|
||||
:precision="2"
|
||||
:step="0.5"
|
||||
:precision="1"
|
||||
controls-position="right"
|
||||
size="small"
|
||||
@change="(value) => snapViolationScore(item, value)"
|
||||
/>
|
||||
<span class="score-range">({{ getItemMinScore(item) }}-{{ getItemMaxScore(item) }}分)</span>
|
||||
<el-button v-if="getItemRemark(item.disciplineTypeId)" link type="warning" @click="showViolationRemark(item)">提醒</el-button>
|
||||
<el-button link type="danger" @click="removeViolationItem(index)">删除</el-button>
|
||||
</div>
|
||||
<div v-if="getItemRemark(item.disciplineTypeId)" class="discipline-type-remark inline-remark">
|
||||
<el-icon class="remark-icon"><InfoFilled /></el-icon>
|
||||
<span class="remark-text">类型说明:{{ getItemRemark(item.disciplineTypeId) }}</span>
|
||||
</div>
|
||||
<el-input v-model="item.remark" size="small" maxlength="200" placeholder="本项说明(选填)" style="margin-top: 6px" />
|
||||
</div>
|
||||
<div class="violation-item-total">
|
||||
合计扣分:<strong>{{ violationItemsTotalScore }}</strong> 分
|
||||
@@ -111,7 +115,16 @@
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item v-if="isEditMode" label="扣分分值" prop="scoreDeduction">
|
||||
<el-input-number v-model="form.scoreDeduction" :precision="2" placeholder="请输入扣分" style="width: 100%" />
|
||||
<el-input-number
|
||||
v-model="form.scoreDeduction"
|
||||
:step="0.5"
|
||||
:precision="1"
|
||||
:min="currentTypeMinScore"
|
||||
:max="currentTypeMaxScore"
|
||||
placeholder="请输入扣分"
|
||||
style="width: 100%"
|
||||
@change="snapFormScore"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -221,7 +234,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, computed, watch, onMounted, nextTick } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
import { Plus, InfoFilled, UploadFilled, Document, Loading, Download, Delete } from '@element-plus/icons-vue';
|
||||
// import ImagePreview from '@/components/ImagePreview/index.vue';
|
||||
import ImagePreview from '@/components/ImagePreview/index.vue';
|
||||
@@ -264,6 +277,7 @@ interface ViolationItem {
|
||||
disciplineTypeId: string | number;
|
||||
disciplineTypeName: string;
|
||||
scoreDeduction: number;
|
||||
remark?: string;
|
||||
}
|
||||
|
||||
const selectedTypeIds = ref<Array<string | number>>([]);
|
||||
@@ -396,6 +410,50 @@ const getItemMaxScore = (item: ViolationItem) => parseScore(getTypeOption(item.d
|
||||
|
||||
const getItemRemark = (typeId?: string | number) => getTypeOption(typeId)?.remark || '';
|
||||
|
||||
const violationGroupOf = (remark?: string) => {
|
||||
const text = remark || '';
|
||||
if (text.startsWith('重大违纪')) return '重大违纪';
|
||||
if (text.startsWith('卫生')) return '卫生';
|
||||
if (text.startsWith('纪律')) return '纪律';
|
||||
return '其他';
|
||||
};
|
||||
|
||||
const groupedViolationTypes = computed(() => {
|
||||
const order = ['卫生', '纪律', '重大违纪', '其他'];
|
||||
const buckets = new Map<string, any[]>(order.map((label) => [label, []]));
|
||||
allViolationTypes.value.forEach((item) => {
|
||||
buckets.get(violationGroupOf(item.remark))?.push(item);
|
||||
});
|
||||
return order.filter((label) => (buckets.get(label) || []).length > 0).map((label) => ({
|
||||
label,
|
||||
options: buckets.get(label) || []
|
||||
}));
|
||||
});
|
||||
|
||||
const snapHalfScore = (score: number | undefined, min: number, max: number) => {
|
||||
let value = Math.round(Number(score) * 2) / 2;
|
||||
if (Number.isNaN(value)) value = min;
|
||||
if (value < min) value = Math.ceil(min * 2) / 2;
|
||||
if (value > max) value = Math.floor(max * 2) / 2;
|
||||
if (value < min) value = min;
|
||||
if (value > max) value = max;
|
||||
return Number(value.toFixed(1));
|
||||
};
|
||||
|
||||
const snapViolationScore = (item: ViolationItem, value?: number) => {
|
||||
item.scoreDeduction = snapHalfScore(value, getItemMinScore(item), getItemMaxScore(item));
|
||||
};
|
||||
|
||||
const snapFormScore = (value?: number) => {
|
||||
form.scoreDeduction = snapHalfScore(value, currentTypeMinScore.value, currentTypeMaxScore.value);
|
||||
};
|
||||
|
||||
const showViolationRemark = (item: ViolationItem) => {
|
||||
ElMessageBox.alert(getItemRemark(item.disciplineTypeId) || '暂无说明', item.disciplineTypeName || '扣分说明', {
|
||||
confirmButtonText: '知道了'
|
||||
});
|
||||
};
|
||||
|
||||
const handleTypeSelectionChange = (typeIds: Array<string | number>) => {
|
||||
const currentMap = new Map(violationItems.value.map((item) => [String(item.disciplineTypeId), item]));
|
||||
const nextItems: ViolationItem[] = [];
|
||||
@@ -407,7 +465,8 @@ const handleTypeSelectionChange = (typeIds: Array<string | number>) => {
|
||||
nextItems.push({
|
||||
disciplineTypeId: option.id,
|
||||
disciplineTypeName: option.typeName,
|
||||
scoreDeduction: existing?.scoreDeduction ?? parseScore(option.minScore, 0)
|
||||
scoreDeduction: existing?.scoreDeduction ?? parseScore(option.minScore, 0),
|
||||
remark: existing?.remark || ''
|
||||
});
|
||||
});
|
||||
|
||||
@@ -865,7 +924,8 @@ const handleConfirm = async () => {
|
||||
...sharedFields,
|
||||
disciplineTypeId: item.disciplineTypeId,
|
||||
disciplineTypeName: item.disciplineTypeName,
|
||||
scoreDeduction: item.scoreDeduction
|
||||
scoreDeduction: item.scoreDeduction,
|
||||
disciplineContent: [sharedFields.disciplineContent, item.remark].filter((text) => text && String(text).trim()).join(';')
|
||||
}));
|
||||
emit('confirm', records);
|
||||
} catch (error) {
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
<!-- 只展示状态名,不展示请假类型(如「其他假」) -->
|
||||
<el-tag v-if="bed.leaveId" type="warning" size="small">请假</el-tag>
|
||||
<el-tag v-if="bed.holidayStayId" type="primary" size="small" style="margin-left: 4px">假期留宿</el-tag>
|
||||
<div v-if="isLateReturn(bed)" class="late-return-text">{{ formatHm(bed.leaveEndTime) }}返寝</div>
|
||||
</div>
|
||||
<div v-if="!bed.leaveId && !bed.holidayStayId" class="status-label">
|
||||
{{ getStatusLabel(bed) }}
|
||||
@@ -46,6 +47,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch, getCurrentInstance, ComponentInternalInstance, onMounted } from 'vue';
|
||||
import ElMessage from 'element-plus/es/components/message/index';
|
||||
import { ElMessageBox } from 'element-plus';
|
||||
import { submitRollCall } from '@/api/xg/xgss/dormRollCall/dormRollCall/index';
|
||||
import { DormRollCallDetailForm, DormRollCallForm } from '@/api/xg/xgss/dormRollCall/dormRollCall/types';
|
||||
import { getRoomStudents } from '@/api/xg/xgss/dormBedStudent/dormBedStudent/index';
|
||||
@@ -105,11 +107,33 @@ const summary = computed(() => {
|
||||
return { present, leave, holidayStay, absent, empty };
|
||||
});
|
||||
|
||||
const isLateReturn = (bed: BedItem) => {
|
||||
if (!bed?.leaveEndTime) return false;
|
||||
const date = new Date(String(bed.leaveEndTime).replace(/-/g, '/'));
|
||||
if (Number.isNaN(date.getTime())) return false;
|
||||
const minutes = date.getHours() * 60 + date.getMinutes();
|
||||
return minutes >= 20 * 60 + 30 || minutes <= 5 * 60;
|
||||
};
|
||||
|
||||
const formatHm = (value?: string) => {
|
||||
if (!value) return '';
|
||||
const date = new Date(String(value).replace(/-/g, '/'));
|
||||
if (Number.isNaN(date.getTime())) return '';
|
||||
const pad = (n: number) => String(n).padStart(2, '0');
|
||||
return `${pad(date.getHours())}:${pad(date.getMinutes())}`;
|
||||
};
|
||||
|
||||
const formatDetailTime = (value?: string) => {
|
||||
if (!value) return '-';
|
||||
return String(value).replace('T', ' ').slice(0, 16);
|
||||
};
|
||||
|
||||
const getBedCardClass = (bed: BedItem) => {
|
||||
if (bed.isLeaveAuto && bed.isHolidayStayAuto) return 'bed-leave';
|
||||
const late = bed.isLeaveAuto && isLateReturn(bed) ? ' bed-late-return' : '';
|
||||
if (bed.isLeaveAuto && bed.isHolidayStayAuto) return 'bed-leave bed-holiday-stay' + late;
|
||||
const status = bed.rollCallStatus;
|
||||
if (status === '0') return 'bed-present';
|
||||
if (status === '1') return 'bed-leave';
|
||||
if (status === '1') return 'bed-leave' + late;
|
||||
if (status === '4') return 'bed-holiday-stay';
|
||||
if (status === '2') return 'bed-absent';
|
||||
if (status === '3') return 'bed-empty';
|
||||
@@ -131,13 +155,20 @@ const getStatusLabel = (bed: BedItem | string) => {
|
||||
|
||||
const handleBedClick = (bed: BedItem) => {
|
||||
if (bed.isLeaveAuto || bed.isHolidayStayAuto) {
|
||||
ElMessage.info(
|
||||
bed.isLeaveAuto && bed.isHolidayStayAuto
|
||||
? '该学生同时处于请假与假期留宿,不可修改'
|
||||
: bed.isLeaveAuto
|
||||
? '该学生处于请假状态,不可修改'
|
||||
: '该学生处于假期留宿状态,不可修改'
|
||||
);
|
||||
const lines: string[] = [];
|
||||
if (bed.isLeaveAuto) {
|
||||
lines.push(`请假:${formatDetailTime(bed.leaveStartTime)} 至 ${formatDetailTime(bed.leaveEndTime)}`);
|
||||
if (isLateReturn(bed)) {
|
||||
lines.push(`预计 ${formatHm(bed.leaveEndTime)} 返寝`);
|
||||
}
|
||||
}
|
||||
if (bed.isHolidayStayAuto) {
|
||||
lines.push(`假期留宿:${formatDetailTime(bed.holidayStartDate)} 至 ${formatDetailTime(bed.holidayEndDate)}`);
|
||||
}
|
||||
ElMessageBox.alert(lines.join('<br/>'), bed.studentName || '点名明细', {
|
||||
confirmButtonText: '知道了',
|
||||
dangerouslyUseHTMLString: true
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!bed.studentId) {
|
||||
@@ -364,6 +395,18 @@ watch(() => props.visible, (val) => {
|
||||
border-color: #67c23a;
|
||||
}
|
||||
|
||||
.late-return-text {
|
||||
margin-top: 4px;
|
||||
color: #fa8c16;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.bed-card.bed-late-return {
|
||||
background: #fff7e6;
|
||||
border-color: #fa8c16;
|
||||
}
|
||||
|
||||
.bed-leave {
|
||||
background: #fff8e1;
|
||||
border-color: #e6a23c;
|
||||
|
||||
@@ -106,11 +106,22 @@ const loadCampusOptions = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
const refreshBatchNo = async () => {
|
||||
if (!filterForm.campusId) {
|
||||
batchNo.value = '';
|
||||
return;
|
||||
}
|
||||
const batchRes = await generateBatchNo(filterForm.campusId);
|
||||
batchNo.value = batchRes.data;
|
||||
};
|
||||
|
||||
const handleCampusChange = async (val: string | number) => {
|
||||
filterForm.buildingId = undefined;
|
||||
buildingOptions.value = [];
|
||||
rooms.value = [];
|
||||
batchNo.value = '';
|
||||
if (val) {
|
||||
await refreshBatchNo();
|
||||
try {
|
||||
dormLoading.value = true;
|
||||
const res = await request({
|
||||
@@ -137,8 +148,11 @@ const loadRooms = async () => {
|
||||
loading.value = true;
|
||||
try {
|
||||
if (!batchNo.value) {
|
||||
const batchRes = await generateBatchNo();
|
||||
batchNo.value = batchRes.data;
|
||||
await refreshBatchNo();
|
||||
}
|
||||
if (!batchNo.value) {
|
||||
ElMessage.warning('请先选择校区');
|
||||
return;
|
||||
}
|
||||
const res = await getBuildingRoomsStatus(filterForm.buildingId, batchNo.value);
|
||||
rooms.value = res.data || [];
|
||||
|
||||
@@ -632,9 +632,9 @@
|
||||
<el-date-picker
|
||||
clearable
|
||||
v-model="form.applyStartDate"
|
||||
type="datetime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="请选择留宿开始日期"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="开始日早上8点"
|
||||
style="width: 100%"
|
||||
>
|
||||
</el-date-picker>
|
||||
@@ -645,9 +645,9 @@
|
||||
<el-date-picker
|
||||
clearable
|
||||
v-model="form.applyEndDate"
|
||||
type="datetime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="请选择留宿结束日期"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="最后一晚,次日早上8点结束"
|
||||
style="width: 100%"
|
||||
>
|
||||
</el-date-picker>
|
||||
@@ -880,7 +880,7 @@ const initFormData: HolidayStayForm = {
|
||||
bedId: undefined,
|
||||
bedName: undefined,
|
||||
holidayType: undefined,
|
||||
applyStartDate: new Date().toISOString().slice(0, 19).replace('T', ' '), // 默认当前日期时间
|
||||
applyStartDate: undefined,
|
||||
applyEndDate: undefined,
|
||||
stayReason: undefined,
|
||||
stayReasonType: 'other', // 默认其他原因
|
||||
@@ -1144,6 +1144,8 @@ const handleUpdate = async (row?: HolidayStayVO) => {
|
||||
const _id = row?.id || ids.value[0];
|
||||
const res = await getHolidayStay(_id);
|
||||
Object.assign(form.value, res.data);
|
||||
form.value.applyStartDate = toStayInputDate(form.value.applyStartDate, false);
|
||||
form.value.applyEndDate = toStayInputDate(form.value.applyEndDate, true);
|
||||
|
||||
// 确保当前学生信息在选项中(修复学生选择器显示问题)
|
||||
if (form.value.studentId && form.value.studentName && form.value.studentNo) {
|
||||
@@ -1192,6 +1194,22 @@ const handleUpdate = async (row?: HolidayStayVO) => {
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const toStayInputDate = (value?: string, isEnd = false) => {
|
||||
if (!value) return undefined;
|
||||
const date = new Date(String(value).replace(/-/g, '/'));
|
||||
if (Number.isNaN(date.getTime())) return String(value).slice(0, 10);
|
||||
if (isEnd && date.getHours() === 8 && date.getMinutes() === 0 && date.getSeconds() === 0) {
|
||||
date.setDate(date.getDate() - 1);
|
||||
}
|
||||
const pad = (n: number) => String(n).padStart(2, '0');
|
||||
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
|
||||
};
|
||||
|
||||
const toStayPayloadDate = (value?: string) => {
|
||||
if (!value) return value;
|
||||
return `${String(value).slice(0, 10)} 00:00:00`;
|
||||
};
|
||||
|
||||
const submitForm = () => {
|
||||
holidayStayFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
@@ -1202,6 +1220,8 @@ const submitForm = () => {
|
||||
|
||||
// 将附件ID添加到表单数据中,处理成逗号分隔的字符串
|
||||
form.value.attachmentOssIds = attachmentOssIds.join(',');
|
||||
form.value.applyStartDate = toStayPayloadDate(form.value.applyStartDate);
|
||||
form.value.applyEndDate = toStayPayloadDate(form.value.applyEndDate);
|
||||
|
||||
if (form.value.id) {
|
||||
await updateHolidayStay(form.value).finally(() => (buttonLoading.value = false));
|
||||
|
||||
@@ -454,9 +454,9 @@
|
||||
<el-date-picker
|
||||
clearable
|
||||
v-model="form.applyStartDate"
|
||||
type="datetime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="请选择留宿开始日期"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="开始日早上8点"
|
||||
style="width: 100%"
|
||||
>
|
||||
</el-date-picker>
|
||||
@@ -467,9 +467,9 @@
|
||||
<el-date-picker
|
||||
clearable
|
||||
v-model="form.applyEndDate"
|
||||
type="datetime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="请选择留宿结束日期"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="最后一晚,次日早上8点结束"
|
||||
style="width: 100%"
|
||||
>
|
||||
</el-date-picker>
|
||||
@@ -711,7 +711,7 @@ const initFormData: HolidayStayForm = {
|
||||
bedId: undefined,
|
||||
bedName: undefined,
|
||||
holidayType: undefined,
|
||||
applyStartDate: new Date().toISOString().slice(0, 19).replace('T', ' '), // 默认当前日期时间
|
||||
applyStartDate: undefined,
|
||||
applyEndDate: undefined,
|
||||
stayReason: undefined,
|
||||
stayReasonType: 'other', // 默认其他原因
|
||||
@@ -883,6 +883,8 @@ const handleUpdate = async (row?: HolidayStayVO) => {
|
||||
const _id = row?.id || ids.value[0];
|
||||
const res = await getHolidayStay(_id);
|
||||
Object.assign(form.value, res.data);
|
||||
form.value.applyStartDate = toStayInputDate(form.value.applyStartDate, false);
|
||||
form.value.applyEndDate = toStayInputDate(form.value.applyEndDate, true);
|
||||
|
||||
// 确保当前学生信息在选项中(修复学生选择器显示问题)
|
||||
if (form.value.studentId && form.value.studentName && form.value.studentNo) {
|
||||
@@ -930,6 +932,22 @@ const handleUpdate = async (row?: HolidayStayVO) => {
|
||||
dialog.title = '修改假期留宿管理';
|
||||
};
|
||||
|
||||
const toStayInputDate = (value?: string, isEnd = false) => {
|
||||
if (!value) return undefined;
|
||||
const date = new Date(String(value).replace(/-/g, '/'));
|
||||
if (Number.isNaN(date.getTime())) return String(value).slice(0, 10);
|
||||
if (isEnd && date.getHours() === 8 && date.getMinutes() === 0 && date.getSeconds() === 0) {
|
||||
date.setDate(date.getDate() - 1);
|
||||
}
|
||||
const pad = (n: number) => String(n).padStart(2, '0');
|
||||
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
|
||||
};
|
||||
|
||||
const toStayPayloadDate = (value?: string) => {
|
||||
if (!value) return value;
|
||||
return `${String(value).slice(0, 10)} 00:00:00`;
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
holidayStayFormRef.value?.validate(async (valid: boolean) => {
|
||||
@@ -941,6 +959,8 @@ const submitForm = () => {
|
||||
|
||||
// 将附件ID添加到表单数据中,处理成逗号分隔的字符串
|
||||
form.value.attachmentOssIds = attachmentOssIds.join(',');
|
||||
form.value.applyStartDate = toStayPayloadDate(form.value.applyStartDate);
|
||||
form.value.applyEndDate = toStayPayloadDate(form.value.applyEndDate);
|
||||
|
||||
if (form.value.id) {
|
||||
await updateHolidayStay(form.value).finally(() => (buttonLoading.value = false));
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['disciplineRecord:disciplineRecord:add']">新增</el-button>
|
||||
<el-button type="warning" plain icon="Document" @click="goPunishment" v-hasPermi="['disciplineRecord:disciplineRecord:list']">学生处分</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
@@ -147,6 +148,7 @@
|
||||
|
||||
<script setup name="DisciplineRecord" lang="ts">
|
||||
import { ref, reactive, toRefs, onMounted, getCurrentInstance, ComponentInternalInstance } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { listDisciplineRecord, delDisciplineRecord } from '@/api/xskh/disciplineRecord/disciplineRecord';
|
||||
import {
|
||||
DisciplineRecordVO,
|
||||
@@ -156,6 +158,7 @@ import {
|
||||
import DisciplineRecordForm from './DisciplineRecordForm.vue';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const router = useRouter();
|
||||
const { student_discipline_status, xskh_violation_source } = toRefs<any>(proxy?.useDict('student_discipline_status', 'xskh_violation_source'));
|
||||
|
||||
const disciplineRecordList = ref<DisciplineRecordVO[]>([]);
|
||||
@@ -255,6 +258,10 @@ const handleSelectionChange = (selection: DisciplineRecordVO[]) => {
|
||||
};
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const goPunishment = () => {
|
||||
router.push({ name: 'StudentPunishmentPage' });
|
||||
};
|
||||
|
||||
const handleAdd = () => {
|
||||
disciplineRecordFormRef.value?.openDialog(undefined, '新增');
|
||||
};
|
||||
|
||||
@@ -0,0 +1,316 @@
|
||||
<template>
|
||||
<div class="p-2 page-container">
|
||||
<el-card shadow="hover" class="mb-[10px]">
|
||||
<el-form :model="queryParams" label-width="80px">
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="6">
|
||||
<el-form-item label="学号">
|
||||
<el-input v-model="queryParams.studentNo" clearable placeholder="学号" @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="姓名">
|
||||
<el-input v-model="queryParams.studentName" clearable placeholder="姓名" @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="学院">
|
||||
<el-input v-model="queryParams.collegeName" clearable placeholder="学院" @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="班级">
|
||||
<el-input v-model="queryParams.className" clearable placeholder="班级" @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="处分种类">
|
||||
<el-select v-model="queryParams.disciplineTypeName" clearable placeholder="全部" style="width: 100%">
|
||||
<el-option v-for="item in punishmentOptions" :key="item.code" :label="optionLabel(item)" :value="item.name" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="处分日期">
|
||||
<el-date-picker
|
||||
v-model="dateRange"
|
||||
type="daterange"
|
||||
value-format="YYYY-MM-DD"
|
||||
range-separator="至"
|
||||
start-placeholder="开始"
|
||||
end-placeholder="结束"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
<el-button type="primary" plain icon="Plus" v-hasPermi="['disciplineRecord:disciplineRecord:add']" @click="openCreate">登记处分</el-button>
|
||||
<el-button type="warning" plain icon="Download" v-hasPermi="['disciplineRecord:disciplineRecord:export']" @click="handleExport">导出登记表</el-button>
|
||||
<el-button type="warning" plain icon="Download" v-hasPermi="['disciplineRecord:disciplineRecord:export']" @click="handleExportSummary">导出汇总表</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-row :gutter="12" class="mb-[10px]">
|
||||
<el-col :span="12">
|
||||
<el-card shadow="never" header="按处分种类">
|
||||
<el-table :data="summary.byType" border size="small">
|
||||
<el-table-column prop="name" label="种类" />
|
||||
<el-table-column prop="count" label="人次" width="90" />
|
||||
<el-table-column prop="score" label="班级扣分" width="110" />
|
||||
</el-table>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-card shadow="never" header="按班级">
|
||||
<el-table :data="summary.byClass" border size="small" max-height="280">
|
||||
<el-table-column prop="name" label="学院/班级" />
|
||||
<el-table-column prop="count" label="人次" width="90" />
|
||||
<el-table-column prop="score" label="班级扣分" width="110" />
|
||||
</el-table>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-card shadow="never">
|
||||
<el-table v-loading="loading" :data="recordList" border>
|
||||
<el-table-column prop="studentNo" label="学号" width="130" />
|
||||
<el-table-column prop="studentName" label="姓名" width="100" />
|
||||
<el-table-column prop="collegeName" label="学院" min-width="140" />
|
||||
<el-table-column prop="className" label="班级" min-width="140" />
|
||||
<el-table-column prop="disciplineTypeName" label="处分种类" width="120" />
|
||||
<el-table-column prop="scoreDeduction" label="班级扣分" width="100" />
|
||||
<el-table-column prop="disciplineDate" label="处分日期" width="120" />
|
||||
<el-table-column prop="disciplineReason" label="原因" min-width="180" show-overflow-tooltip />
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</el-card>
|
||||
|
||||
<el-dialog v-model="dialogVisible" title="登记学生处分" width="560px" append-to-body>
|
||||
<el-form ref="formRef" :model="form" :rules="rules" label-width="90px">
|
||||
<el-form-item label="学生" prop="studentId">
|
||||
<el-select
|
||||
v-model="form.studentId"
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
placeholder="输入姓名或学号"
|
||||
:remote-method="searchStudents"
|
||||
:loading="studentLoading"
|
||||
style="width: 100%"
|
||||
@change="handleStudentChange"
|
||||
>
|
||||
<el-option v-for="item in studentOptions" :key="item.id" :label="studentLabel(item)" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="班级">
|
||||
<el-input :model-value="selectedStudent ? `${selectedStudent.collegeName || ''} ${selectedStudent.className || ''}` : ''" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="处分种类" prop="punishmentCode">
|
||||
<el-select v-model="form.punishmentCode" placeholder="请选择" style="width: 100%">
|
||||
<el-option v-for="item in punishmentOptions" :key="item.code" :label="optionLabel(item)" :value="item.code" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="处分日期" prop="disciplineDate">
|
||||
<el-date-picker v-model="form.disciplineDate" type="date" value-format="YYYY-MM-DD" style="width: 100%" />
|
||||
</el-form-item>
|
||||
<el-form-item label="处分原因" prop="disciplineReason">
|
||||
<el-input v-model="form.disciplineReason" type="textarea" :rows="3" maxlength="500" show-word-limit />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="form.disciplineContent" type="textarea" :rows="2" maxlength="500" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="submitting" @click="submitForm">确定</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="StudentPunishmentPage" lang="ts">
|
||||
import { computed, getCurrentInstance, onMounted, reactive, ref } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { addPunishment, getPunishmentOptions, getPunishmentSummary, getStudentOptions, listDisciplineRecord } from '@/api/xskh/disciplineRecord/disciplineRecord';
|
||||
import type { DisciplineRecordVO, XskhStudentOptionVO } from '@/api/xskh/disciplineRecord/disciplineRecord/types';
|
||||
|
||||
interface PunishmentOption {
|
||||
code: string;
|
||||
name: string;
|
||||
score: number;
|
||||
countInClass: boolean;
|
||||
}
|
||||
|
||||
const { proxy } = getCurrentInstance() as any;
|
||||
|
||||
const loading = ref(false);
|
||||
const submitting = ref(false);
|
||||
const studentLoading = ref(false);
|
||||
const dialogVisible = ref(false);
|
||||
const total = ref(0);
|
||||
const recordList = ref<DisciplineRecordVO[]>([]);
|
||||
const punishmentOptions = ref<PunishmentOption[]>([]);
|
||||
const studentOptions = ref<XskhStudentOptionVO[]>([]);
|
||||
const dateRange = ref<string[]>([]);
|
||||
const formRef = ref();
|
||||
|
||||
const queryParams = reactive({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
studentNo: '',
|
||||
studentName: '',
|
||||
collegeName: '',
|
||||
className: '',
|
||||
disciplineTypeName: '',
|
||||
violationSource: '3',
|
||||
beginDisciplineDate: undefined as string | undefined,
|
||||
endDisciplineDate: undefined as string | undefined
|
||||
});
|
||||
|
||||
const summary = reactive<{ byType: any[]; byClass: any[] }>({
|
||||
byType: [],
|
||||
byClass: []
|
||||
});
|
||||
|
||||
const form = reactive({
|
||||
studentId: undefined as string | number | undefined,
|
||||
punishmentCode: '',
|
||||
disciplineDate: '',
|
||||
disciplineReason: '',
|
||||
disciplineContent: ''
|
||||
});
|
||||
|
||||
const rules = {
|
||||
studentId: [{ required: true, message: '请选择学生', trigger: 'change' }],
|
||||
punishmentCode: [{ required: true, message: '请选择处分种类', trigger: 'change' }],
|
||||
disciplineDate: [{ required: true, message: '请选择处分日期', trigger: 'change' }],
|
||||
disciplineReason: [{ required: true, message: '请填写处分原因', trigger: 'blur' }]
|
||||
};
|
||||
|
||||
const selectedStudent = computed(() => studentOptions.value.find((item) => String(item.id) === String(form.studentId)));
|
||||
|
||||
const optionLabel = (item: PunishmentOption) => {
|
||||
if (!item.countInClass) return `${item.name}(不计班级扣分)`;
|
||||
return `${item.name}(${item.score}分)`;
|
||||
};
|
||||
|
||||
const studentLabel = (item: XskhStudentOptionVO) => `${item.name} ${item.studentNo} ${item.className || ''}`;
|
||||
|
||||
const buildQuery = () => {
|
||||
queryParams.beginDisciplineDate = dateRange.value?.[0];
|
||||
queryParams.endDisciplineDate = dateRange.value?.[1];
|
||||
return { ...queryParams };
|
||||
};
|
||||
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
try {
|
||||
const res: any = await listDisciplineRecord(buildQuery());
|
||||
recordList.value = res.rows || [];
|
||||
total.value = res.total || 0;
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const loadSummary = async () => {
|
||||
const res: any = await getPunishmentSummary(buildQuery());
|
||||
summary.byType = res.data?.byType || [];
|
||||
summary.byClass = res.data?.byClass || [];
|
||||
};
|
||||
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNum = 1;
|
||||
getList();
|
||||
loadSummary();
|
||||
};
|
||||
|
||||
const resetQuery = () => {
|
||||
queryParams.studentNo = '';
|
||||
queryParams.studentName = '';
|
||||
queryParams.collegeName = '';
|
||||
queryParams.className = '';
|
||||
queryParams.disciplineTypeName = '';
|
||||
dateRange.value = [];
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
const searchStudents = async (keyword: string) => {
|
||||
if (!keyword) {
|
||||
studentOptions.value = [];
|
||||
return;
|
||||
}
|
||||
studentLoading.value = true;
|
||||
try {
|
||||
const res: any = await getStudentOptions(keyword);
|
||||
studentOptions.value = res.data || [];
|
||||
} finally {
|
||||
studentLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const handleStudentChange = () => {
|
||||
if (selectedStudent.value && !selectedStudent.value.classId) {
|
||||
ElMessage.warning('该学生未分配班级,无法登记处分');
|
||||
}
|
||||
};
|
||||
|
||||
const openCreate = () => {
|
||||
form.studentId = undefined;
|
||||
form.punishmentCode = punishmentOptions.value[0]?.code || '';
|
||||
const now = new Date();
|
||||
const pad = (n: number) => String(n).padStart(2, '0');
|
||||
form.disciplineDate = `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}`;
|
||||
form.disciplineReason = '';
|
||||
form.disciplineContent = '';
|
||||
studentOptions.value = [];
|
||||
dialogVisible.value = true;
|
||||
};
|
||||
|
||||
const submitForm = async () => {
|
||||
await formRef.value?.validate();
|
||||
if (selectedStudent.value && !selectedStudent.value.classId) {
|
||||
ElMessage.warning('该学生未分配班级,无法登记处分');
|
||||
return;
|
||||
}
|
||||
submitting.value = true;
|
||||
try {
|
||||
await addPunishment({
|
||||
studentId: form.studentId as string | number,
|
||||
punishmentCode: form.punishmentCode,
|
||||
disciplineDate: form.disciplineDate,
|
||||
disciplineReason: form.disciplineReason,
|
||||
disciplineContent: form.disciplineContent
|
||||
});
|
||||
ElMessage.success('处分已登记,分值会计入班级月扣分');
|
||||
dialogVisible.value = false;
|
||||
handleQuery();
|
||||
} finally {
|
||||
submitting.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const handleExport = () => {
|
||||
proxy?.download('disciplineRecord/disciplineRecord/punishment/export', buildQuery(), `学生处分登记表_${Date.now()}.xlsx`);
|
||||
};
|
||||
|
||||
const handleExportSummary = () => {
|
||||
proxy?.download('disciplineRecord/disciplineRecord/punishment/exportSummary', buildQuery(), `学生处分汇总表_${Date.now()}.xlsx`);
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
const res: any = await getPunishmentOptions();
|
||||
punishmentOptions.value = res.data || [];
|
||||
handleQuery();
|
||||
});
|
||||
</script>
|
||||
Reference in new issue
Block a user