Require receiving college review for major transfers

This commit is contained in:
biss committed 2026-11-08 15:50:58 +08:00
1 parent 31c25ed19e
commit 3f8ca29430
14 files changed
+12324 -22

No files matched your search

+1 -1
View File
@@ -368,7 +368,7 @@ function progressLabel(kind: string) {
const labels: Record<string, string> = {
submitted: 'submitted', started: 'started', created: 'created', approved: 'approved', rejected: 'rejected', returned: 'returned', published: 'published', cancelled: 'cancelled',
counselorApproved: 'counselorApproved', counselorRejected: 'counselorRejected', legacyReviewed: 'legacyReviewed',
collegeApproved: 'collegeApproved', collegeRejected: 'collegeRejected',
collegeApproved: 'collegeApproved', collegeRejected: 'collegeRejected', receivingCollegeApproved: 'receivingCollegeApproved', receivingCollegeRejected: 'receivingCollegeRejected',
finalApproved: 'finalApproved', finalRejected: 'finalRejected', dormitoryApproved: 'dormitoryApproved', dormitoryRejected: 'dormitoryRejected',
}
return t(`approvalProgress.${labels[kind] ?? 'submitted'}`)
+18 -4
View File
@@ -23,6 +23,7 @@ const applyDialog = ref(false)
const reviewDialog = ref(false)
const selected = ref<any | null>(null)
const reviewApproved = ref(true)
const receivingReview = ref(false)
const applyForm = reactive({ type: '', reason: '', affectedTermId: '', targetClassId: '', serviceStartDate: '', dischargeDate: '' })
const terms = ref<any[]>([])
const classes = ref<any[]>([])
@@ -40,7 +41,7 @@ watch(() => applyForm.type, type => {
})
const targetClasses = computed(() => classes.value.filter(item => {
if (!item.isEnabled) return false
if (applyForm.type === 'MajorTransfer') return item.collegeId === options.value?.collegeId && item.majorId !== options.value?.majorId
if (applyForm.type === 'MajorTransfer') return item.majorId !== options.value?.majorId
if (item.majorId !== options.value?.majorId) return false
if (applyForm.type === 'Demotion') return item.grade > options.value?.currentGrade
if (applyForm.type === 'ClassTransfer') return item.grade === options.value?.currentGrade && item.id !== options.value?.currentClassId
@@ -82,6 +83,13 @@ function canReview(change: any) {
roles.some((role) => ['AcademicAdmin', 'SuperAdmin'].includes(role)))
)
}
function canReviewReceivingCollege(change: any) {
const user = auth.user
return Boolean(user?.roles.includes('CollegeAdmin') && change.type === 'MajorTransfer' &&
change.state === 'CollegeApproved' && !change.receivingCollegeReviewedAt &&
change.originalCollegeId !== change.targetCollegeId &&
(user.effectiveDataScope === 'All' || user.collegeId === change.targetCollegeId))
}
function stateTagType(state: ChangeState) {
if (state === 'Approved') return 'success'
if (state === 'Rejected') return 'danger'
@@ -164,9 +172,10 @@ async function cancel(change: any) {
if (error !== 'cancel' && error !== 'close') ElMessage.error(apiErrorMessage(error))
}
}
async function openReview(change: any, approved: boolean) {
async function openReview(change: any, approved: boolean, receiving = false) {
selected.value = change
reviewApproved.value = approved
receivingReview.value = receiving
reviewForm.comment = ''
reviewDialog.value = true
courseImpact.value = []
@@ -190,7 +199,7 @@ async function submitReview() {
return
}
try {
await http.post(`/student-status-changes/${selected.value.id}/review`, {
await http.post(`/student-status-changes/${selected.value.id}/${receivingReview.value ? 'receiving-college-review' : 'review'}`, {
approved: reviewApproved.value,
comment: reviewForm.comment,
})
@@ -266,6 +275,7 @@ onMounted(async () => {
<p v-if="change.targetClassName">{{ t('statusChangeImpact.classTransition') }}: {{ change.originalClassName }} → {{ change.targetClassName }}</p>
<p v-if="change.serviceStartDate">{{ t('statusChangeImpact.serviceDate') }}: {{ change.serviceStartDate }}</p>
<p v-if="change.dischargeDate">{{ t('statusChangeImpact.dischargeDate') }}: {{ change.dischargeDate }}</p>
<p v-if="change.type === 'MajorTransfer' && change.originalCollegeId !== change.targetCollegeId">{{ t(change.receivingCollegeReviewedAt ? 'statusChangeImpact.receivingReviewed' : 'statusChangeImpact.receivingPending') }}<span v-if="change.receivingCollegeReviewComment"> · {{ change.receivingCollegeReviewComment }}</span></p>
</div>
<div class="approval-track">
@@ -287,6 +297,10 @@ onMounted(async () => {
<template v-if="canReview(change)">
<el-button :icon="Close" type="danger" plain @click="openReview(change, false)">{{ t('statusChanges.reject') }}</el-button><el-button :icon="Stamp" type="primary" @click="openReview(change, true)">{{ t('statusChanges.approve') }}</el-button>
</template>
<template v-if="canReviewReceivingCollege(change)">
<el-button type="danger" plain @click="openReview(change, false, true)">{{ t('statusChangeImpact.receivingReject') }}</el-button>
<el-button type="primary" @click="openReview(change, true, true)">{{ t('statusChangeImpact.receivingApprove') }}</el-button>
</template>
</div>
</footer>
</article>
@@ -335,7 +349,7 @@ onMounted(async () => {
</template>
</el-dialog>
<el-dialog v-model="reviewDialog" :title="t(reviewApproved ? 'statusChanges.approveTitle' : 'statusChanges.rejectTitle')" width="600px">
<el-dialog v-model="reviewDialog" :title="t(receivingReview ? (reviewApproved ? 'statusChangeImpact.receivingApprove' : 'statusChangeImpact.receivingReject') : (reviewApproved ? 'statusChanges.approveTitle' : 'statusChanges.rejectTitle'))" width="600px">
<div v-if="selected" class="review-target">
<span>{{ selected.studentNumber }}</span>
<b>{{ t('statusChanges.applicationTitle', { name: selected.name, type: typeLabel(selected.type) }) }}</b>