From eb40272594d10879cb80da21f557ca85754f54b8 Mon Sep 17 00:00:00 2001 From: biss Date: Sat, 31 Oct 2026 19:36:20 +0800 Subject: [PATCH] feat: localize classroom reservation workflows --- web/scripts/check-i18n.mjs | 2 +- web/src/i18n/messages/en-US.ts | 1 + web/src/i18n/messages/zh-CN.ts | 1 + web/src/views/ClassroomReservationsView.vue | 152 ++++++++++---------- 4 files changed, 79 insertions(+), 77 deletions(-) diff --git a/web/scripts/check-i18n.mjs b/web/scripts/check-i18n.mjs index b34a9d3..980151e 100644 --- a/web/scripts/check-i18n.mjs +++ b/web/scripts/check-i18n.mjs @@ -16,7 +16,7 @@ const missing = [...reference].filter((key) => !candidate.has(key)) const extra = [...candidate].filter((key) => !reference.has(key)) // Fully migrated pages must not silently reintroduce hardcoded Chinese UI copy. -const completedViews = ['CoursesView.vue', 'OtherExamsView.vue', 'BaseDataView.vue', 'OfficialDocumentsView.vue', 'CampusRegistrationsView.vue'] +const completedViews = ['CoursesView.vue', 'OtherExamsView.vue', 'BaseDataView.vue', 'OfficialDocumentsView.vue', 'CampusRegistrationsView.vue', 'ClassroomReservationsView.vue'] const hardcoded = completedViews.filter((name) => { const file = fileURLToPath(new URL(`../src/views/${name}`, import.meta.url)) let source = readFileSync(file, 'utf8') diff --git a/web/src/i18n/messages/en-US.ts b/web/src/i18n/messages/en-US.ts index acd281a..567a09d 100644 --- a/web/src/i18n/messages/en-US.ts +++ b/web/src/i18n/messages/en-US.ts @@ -1,4 +1,5 @@ export default { + classroomReservation: {"submitted":"Awaiting college review","approved":"Approved","rejected":"Rejected","cancelled":"Cancelled","unknown":"Unknown status","selectTermDate":"Select a term and reservation date first.","noRooms":"No rooms are available. Adjust the date, periods, or attendee count.","noCollege":"This account has no available college affiliation.","selectRoom":"Search for available rooms and select one first.","requiredFields":"Enter the purpose and contact phone.","submittedMessage":"Your application was submitted for review by your college.","cancelApproved":"This reservation is approved. Cancelling releases the room immediately. Continue?","cancelPending":"Withdraw this pending application?","cancelTitle":"Cancel classroom reservation","confirmCancel":"Confirm cancellation","keep":"Keep reservation","cancelledMessage":"Reservation cancelled.","approveTitle":"Approve classroom reservation","approve":"Approve","back":"Back","approvedMessage":"Application approved.","rejectPrompt":"Enter the rejection reason. The applicant will receive it in the notification center.","rejectTitle":"Reject classroom reservation","reasonPlaceholder":"Enter a specific reason","reasonRequired":"A rejection reason is required","confirmReject":"Confirm rejection","kicker":"Teaching facilities","title":"Classroom reservations","description":"Request an available time outside the published timetable for review by your college.","applyTitle":"Submit a reservation","conflictHint":"Published classes and exams and approved reservations are excluded.","selectTerm":"Select term","date":"Reservation date","selectDate":"Select date","attendees":"Expected attendees","allBuildings":"All teaching buildings","availableRooms":"Available classrooms","chooseRoom":"Select an available classroom","searchFirst":"Search for available classrooms first","searchRooms":"Search available classrooms","purpose":"Purpose","purposePlaceholder":"For example, a college lecture or class event","contactHint":"For the reviewer to contact you","notes":"Additional notes","notesPlaceholder":"Enter equipment, layout, or other requirements","searchAgain":"Search again after changing the date, periods, or attendee count.","submit":"Submit for college review","mine":"My applications","datePeriods":"Date and periods","purposeShort":"Purpose","cancel":"Cancel","cancelReservation":"Cancel reservation","emptyMine":"No classroom reservation applications yet","collegeReview":"College review","reviewHint":"Only applications from members of your college are shown.","applicant":"Applicant","dateRoom":"Date and classroom","purposeAttendees":"Purpose and attendees","submittedAt":"Submitted at","emptyReview":"No applications match the current filters","approveConfirm":"Approve {name}’s request for {building} {room}? Conflicts will be checked again.","singlePeriod":"Period {start}","periodRange":"Periods {start}–{end}","roomLabel":"{campus} · {building} · {room} ({capacity} people)","reviewCollege":"Reviewing college: {college}","unpublishedTerm":"{term} (timetable not published)","periodCount":"{count} periods","roomsFound":"Found {count} available classrooms","campusAttendees":"{campus} · {count} people","attendeesPhone":"{count} people · {phone}","reviewQueue":"{college} review queue"}, campusRegistration: {"pendingReview":"Pending review","pendingPayment":"Awaiting payment","confirmed":"Confirmed","waitlisted":"Waitlisted","rejected":"Rejected","cancelled":"Cancelled","draft":"Draft","published":"Published","closed":"Closed","free":"Free","unknown":"Unknown status","projectSaved":"Project saved","noteOptional":"Optional: enter an application note","note":"Application note","applicationSubmitted":"Application submitted","approvePrompt":"Approval creates a payment order or confirms a free registration.","rejectPrompt":"Enter the rejection reason","approveTitle":"Approve registration","rejectTitle":"Reject registration","optionalComment":"Optional review comment","rejectReason":"Rejection reason","processed":"Processing complete","offlinePrompt":"Enter the offline payment reference (optional)","offlineTitle":"Confirm offline payment","paymentConfirmed":"Payment and registration confirmed","cancelPrompt":"This cannot be undone. Continue?","cancelTitle":"Cancel registration","applicationCancelled":"Registration cancelled","balanceTitle":"Pay with balance","balancePaid":"Balance payment succeeded and registration was confirmed","exportFile":"Campus registrations and payments.xlsx","title":"Campus payments and registrations","description":"Manage registration, review, offline payment confirmation, and roster export in one workflow.","newProject":"New registration project","projects":"Registration projects","noDescription":"No project description.","registrationPeriod":"Registration period","capacityConfirmed":"Capacity / Confirmed","fee":"Fee","requiresReview":"· Requires review","automatic":"· Automatic acceptance","applyNow":"Register now","unavailable":"Registration unavailable","editProject":"Edit project","noProjects":"No visible registration projects","myOrders":"My registrations and orders","balance":"Campus balance","balanceHint":"Administrators manage the balance, which can be used to pay pending registration fees.","project":"Project","order":"Order","offline":"Offline payment","awaitingConfirmation":"Awaiting confirmation","noApplications":"No registrations submitted","reviewPayments":"Review and payments","scopeNote":"All actions are limited to the data scope of the project’s college.","allProjects":"All projects","projectStudent":"Project and student","registrationStatus":"Registration status","submittedAt":"Submitted at","confirmPayment":"Confirm payment","noHistory":"No pending or historical registrations","editProjectTitle":"Edit registration project","projectCode":"Project code","codePlaceholder":"For example CAMPUS-2026-001","projectName":"Project name","registrationStarts":"Registration starts","registrationEnds":"Registration ends","capacity":"Capacity","feeAmount":"Fee (CNY)","projectDescription":"Project description","acceptance":"Acceptance method","manualReview":"Accept after manual review","directAcceptance":"Accept directly","publishStatus":"Publication status","contact":"Contact","adminNotes":"Administrative notes","applyTitle":"Register: {name}","balanceConfirm":"Deduct {amount} from your campus balance?","dateRange":"{start} to {end}","capacityCount":"{capacity} / {confirmed} people"}, warningsPage: {"failed":"Failed-course credits","lowGpa":"Low GPA","absence":"Absence","delay":"Delayed graduation risk","active":"Active","acknowledged":"Acknowledged","processed":"Processed","ignored":"Ignored","failedUnit":" failed courses","gpaThreshold":"Minimum GPA","absenceUnit":" absences / late arrivals","cumulativeUnit":" cumulative failed courses","daily":"Every day","monday":"Monday","tuesday":"Tuesday","wednesday":"Wednesday","thursday":"Thursday","friday":"Friday","saturday":"Saturday","sunday":"Sunday","exportFile":"Academic warnings.xlsx","rulesSaved":"Warning rules saved","detectConfirm":"The system will scan all currently enrolled students in the current term and notify students and counselors of generated warnings.","detectTitle":"Run academic warning detection","detectStart":"Start detection","acknowledgePrompt":"Acknowledge this warning? You can optionally add a comment.","acknowledgeTitle":"Acknowledge warning","confirm":"Confirm","confirmed":"Acknowledged","taskUpdated":"Follow-up task updated","contentRequired":"Enter the record content","entrySaved":"Intervention record saved","studentTitle":"My warnings","managerTitle":"Academic warnings","managerDescription":"Configure warning rules, run detection, and review warnings.","counselorDescription":"View academic warnings for assigned students.","studentDescription":"View and acknowledge your academic warning notifications.","rulesTitle":"Warning rules","saveRules":"Save rules","runDetection":"Run detection","threshold":"Threshold","toggle":"Enabled","student":"Student","autoDetection":"Automatic detection","every":"Every","hour":"hour","minute":"minute","recordsTitle":"Warning records","studentSearch":"Name / Student number","organization":"Organization","details":"Threshold / Details","emptyRecords":"No warning records. Run detection first.","riskTitle":"Risk intervention follow-up","privacyHint":"Interview and support records are sensitive and visible only to assigned counselors and academic administrators.","warningType":"Warning type","followUpDue":"Follow-up deadline","reviewDate":"Review date","unset":"Not set","pendingFollowUp":"Pending follow-up","inProgress":"In progress","pendingReview":"Pending review","closed":"Closed","intervene":"Manage","emptyTasks":"No risk tasks require follow-up","emptyWarnings":"No academic warnings","mySupport":"My support and review progress","mySupportHint":"View your counselor’s interview, support, and review records.","unscheduled":"Not scheduled","interview":"Interview","support":"Support measure","reviewEntry":"Review","emptyEntries":"Your counselor has not entered intervention records","riskDialog":"Academic risk intervention (sensitive)","followUpStatus":"Follow-up status","saveTask":"Save task","addEntry":"Add intervention record","entryType":"Record type","occurredAt":"Date and time","content":"Content","entryPlaceholder":"Record interview points, support measures, or review conclusions","history":"Intervention history","detected":"Detection complete: {count} warnings generated","grade":"Enrolled {year}","page":"Batch {page}","pendingCount":"Pending {count}","lastRun":"Last run: {date}","followUpValue":"Follow-up deadline: {date}","reviewValue":"Review date: {date}","recordedBy":"Recorded by: {name}"}, officialDocuments: {"transcript":"Official electronic transcript","certificate":"Student status certificate","valid":"Valid","invalidated":"Invalidated","superseded":"Reissued","selectStudent":"Select a student.","reused":"Your recently requested valid document has been retained.","issued":"Official document issued.","generated":"The electronic document is ready to download from the list.","invalidatePrompt":"After invalidation, students cannot download the document; verification of downloaded copies will show it as invalid. Enter a reason.","confirmInvalidate":"Confirm invalidation","reasonLength":"The reason must contain 2–500 characters","invalidateSuccess":"Document invalidated.","reissuePrompt":"The original will be frozen and a new number and QR code generated using current official data. Enter the reason for reissue.","reissueTitle":"Reissue document","confirmReissue":"Confirm reissue","reissueSuccess":"A new document was issued and the original marked as superseded.","managerTitle":"Official document issuance","studentTitle":"Electronic transcripts and certificates","managerDescription":"The server preserves an issuance snapshot and PDF. Each document has a unique number and a publicly verifiable QR code.","studentDescription":"Request a PDF online and use its QR code for public verification.","issueNew":"Issue new document","request":"Request electronic document","uniqueNumber":"Unique number","uniqueHint":"Each issuance has a unique number","qr":"QR verification","qrHint":"Shows current validity","downloadTracking":"Download audit","downloadHint":"Time, account and source are recorded","lifecycle":"Invalidation and reissue","lifecycleHint":"The original document history is retained","allTypes":"All document types","missingReason":"No reason provided","downloadPdf":"Download PDF","invalidate":"Invalidate","reissue":"Reissue","emptyManager":"No official documents match the filters","emptyStudent":"No electronic documents yet. Use the button above to request one.","issueTitle":"Issue official document","managerNotice":"Issuance preserves the current official data. Subsequent changes do not alter issued documents.","studentNotice":"The document is generated from your student record. Transcripts include only officially published grades. Identical requests within five minutes reuse the existing file.","student":"Student","searchStudent":"Search by name or student number","documentType":"Document type","purpose":"Purpose (optional)","purposeHint":"For example, further study or internship applications","confirmIssue":"Confirm issuance","submitRequest":"Submit request","history":"Document download history","downloadedBy":"Downloaded by","downloadTime":"Download time","sourceIp":"Source IP","emptyHistory":"No download history","total":"{count} documents","issuedBy":"Issued {date} · {name}","purposeValue":"Purpose: {purpose}","downloadCount":"Download history ({count})","statusReason":"{status}: {reason}"}, diff --git a/web/src/i18n/messages/zh-CN.ts b/web/src/i18n/messages/zh-CN.ts index 09ded60..7f58a90 100644 --- a/web/src/i18n/messages/zh-CN.ts +++ b/web/src/i18n/messages/zh-CN.ts @@ -1,4 +1,5 @@ export default { + classroomReservation: {"submitted":"待学院审核","approved":"已批准","rejected":"已驳回","cancelled":"已取消","unknown":"未知状态","selectTermDate":"请先选择学期和预约日期。","noRooms":"当前条件下没有可预约教室,请调整日期、节次或人数。","noCollege":"当前账号没有可用的学院归属。","selectRoom":"请先查询可用教室并选择教室。","requiredFields":"请填写借用用途和联系电话。","submittedMessage":"申请已提交,将由您所在学院审核。","cancelApproved":"该预约已经批准,取消后教室将立即释放。确认取消吗?","cancelPending":"确认撤回这条待审核申请吗?","cancelTitle":"取消教室预约","confirmCancel":"确认取消","keep":"暂不取消","cancelledMessage":"预约已取消。","approveTitle":"批准教室借用","approve":"批准","back":"返回","approvedMessage":"申请已批准。","rejectPrompt":"请填写驳回原因,申请人将在消息中心收到该意见。","rejectTitle":"驳回教室借用","reasonPlaceholder":"请输入具体原因","reasonRequired":"驳回原因不能为空","confirmReject":"确认驳回","kicker":"教学场地","title":"教室借用与预约","description":"选择正式课表之外的空闲时段提交申请,由申请人所在学院审核。","applyTitle":"提交借用申请","conflictHint":"系统会避让正式课程、已发布考试及已批准的教室预约。","selectTerm":"选择学期","date":"预约日期","selectDate":"选择日期","attendees":"预计人数","allBuildings":"全部教学楼","availableRooms":"可用教室","chooseRoom":"选择可用教室","searchFirst":"请先查询可用教室","searchRooms":"查询可用教室","purpose":"借用用途","purposePlaceholder":"例如:学院学术讲座、班级主题活动","contactHint":"便于审核人联系","notes":"补充说明","notesPlaceholder":"可填写设备、布置或其他需求","searchAgain":"日期、节次、人数变化后需重新查询可用教室。","submit":"提交学院审核","mine":"我的申请","datePeriods":"日期与节次","purposeShort":"用途","cancel":"取消","cancelReservation":"取消预约","emptyMine":"还没有教室借用申请","collegeReview":"本院审核","reviewHint":"这里只显示申请人归属本学院的教室借用申请。","applicant":"申请人","dateRoom":"日期与教室","purposeAttendees":"用途与人数","submittedAt":"提交时间","emptyReview":"当前筛选下没有申请","approveConfirm":"确认批准 {name} 对 {building} {room} 的借用申请吗?系统会再次检查占用冲突。","singlePeriod":"第 {start} 节","periodRange":"第 {start}—{end} 节","roomLabel":"{campus} · {building} · {room}({capacity} 人)","reviewCollege":"审核学院:{college}","unpublishedTerm":"{term}(课表未发布)","periodCount":"{count} 节","roomsFound":"已找到 {count} 间符合条件的空闲教室","campusAttendees":"{campus} · {count} 人","attendeesPhone":"{count} 人 · {phone}","reviewQueue":"{college}审核队列"}, campusRegistration: {"pendingReview":"待审核","pendingPayment":"待缴费","confirmed":"已确认","waitlisted":"候补中","rejected":"已驳回","cancelled":"已取消","draft":"草稿","published":"已发布","closed":"已关闭","free":"免费","unknown":"未知状态","projectSaved":"项目已保存","noteOptional":"可选:填写报名说明","note":"报名说明","applicationSubmitted":"报名已提交","approvePrompt":"审核通过后将生成缴费订单或直接确认免费报名。","rejectPrompt":"请填写驳回原因","approveTitle":"通过报名","rejectTitle":"驳回报名","optionalComment":"可选审核意见","rejectReason":"驳回原因","processed":"处理完成","offlinePrompt":"填写线下收款凭据编号(可选)","offlineTitle":"确认线下缴费","paymentConfirmed":"已确认收款和报名","cancelPrompt":"撤销后不可恢复,确定继续吗?","cancelTitle":"撤销报名","applicationCancelled":"报名已撤销","balanceTitle":"余额支付","balancePaid":"余额支付成功,报名已确认","exportFile":"校园报名与缴费.xlsx","title":"校园支付与报名","description":"报名、审核、线下缴费确认和名单导出在同一闭环内完成。","newProject":"新建报名项目","projects":"报名项目","noDescription":"暂无项目说明。","registrationPeriod":"报名时间","capacityConfirmed":"名额 / 已确认","fee":"费用","requiresReview":"· 需审核","automatic":"· 自动受理","applyNow":"立即报名","unavailable":"当前不可报名","editProject":"编辑项目","noProjects":"暂无可见报名项目","myOrders":"我的报名与订单","balance":"校园余额","balanceHint":"余额由管理员调整,可用于支付待缴费报名。","project":"项目","order":"订单","offline":"线下缴费","awaitingConfirmation":"待确认","noApplications":"尚未提交报名","reviewPayments":"审核与收款","scopeNote":"所有操作均按项目所属学院的数据范围限制。","allProjects":"全部项目","projectStudent":"项目与学生","registrationStatus":"报名状态","submittedAt":"提交时间","confirmPayment":"确认收款","noHistory":"暂无待处理或历史报名","editProjectTitle":"编辑报名项目","projectCode":"项目编码","codePlaceholder":"如 CAMPUS-2026-001","projectName":"项目名称","registrationStarts":"报名开始","registrationEnds":"报名结束","capacity":"名额","feeAmount":"收费金额(元)","projectDescription":"项目说明","acceptance":"受理方式","manualReview":"人工审核后受理","directAcceptance":"直接受理","publishStatus":"发布状态","contact":"联系人","adminNotes":"管理备注","applyTitle":"报名:{name}","balanceConfirm":"将从校园余额扣除 {amount},确定支付吗?","dateRange":"{start} 至 {end}","capacityCount":"{capacity} / {confirmed} 人"}, warningsPage: {"failed":"不及格学分","lowGpa":"低绩点","absence":"缺勤","delay":"延毕风险","active":"生效中","acknowledged":"已确认","processed":"已处理","ignored":"已忽略","failedUnit":"门 不及格","gpaThreshold":"GPA 下限","absenceUnit":"次 缺勤/迟到","cumulativeUnit":"门 累计不及格","daily":"每天","monday":"周一","tuesday":"周二","wednesday":"周三","thursday":"周四","friday":"周五","saturday":"周六","sunday":"周日","exportFile":"学业预警记录.xlsx","rulesSaved":"预警规则已保存","detectConfirm":"系统将扫描当前学期全部在籍学生,产生的预警将自动通知学生及辅导员。","detectTitle":"执行学业预警检测","detectStart":"开始检测","acknowledgePrompt":"确认已知晓此预警?(可选填备注)","acknowledgeTitle":"确认预警","confirm":"确认","confirmed":"已确认","taskUpdated":"跟进任务已更新","contentRequired":"请填写记录内容","entrySaved":"处置记录已保存","studentTitle":"我的预警","managerTitle":"学业预警","managerDescription":"配置预警规则,执行检测,查看预警记录。","counselorDescription":"查看所管学生的学业预警情况。","studentDescription":"查看并确认您的学业预警通知。","rulesTitle":"预警规则配置","saveRules":"保存规则","runDetection":"执行检测","threshold":"阈值","toggle":"开关","student":"学生","autoDetection":"自动检测","every":"每","hour":"时","minute":"分","recordsTitle":"预警记录","studentSearch":"姓名 / 学号","organization":"组织信息","details":"阈值/详情","emptyRecords":"暂无预警记录,请先执行检测。","riskTitle":"风险处置跟进","privacyHint":"谈话和帮扶记录为敏感信息,仅被指派辅导员和学业管理人员可见。","warningType":"预警类型","followUpDue":"跟进截止","reviewDate":"复核日期","unset":"待设置","pendingFollowUp":"待跟进","inProgress":"跟进中","pendingReview":"待复核","closed":"已结案","intervene":"处置","emptyTasks":"暂无需要跟进的风险任务","emptyWarnings":"暂无学业预警","mySupport":"我的帮扶与复核进度","mySupportHint":"这里展示辅导员针对本人的谈话、帮扶和复核记录。","unscheduled":"待安排","interview":"谈话记录","support":"帮扶措施","reviewEntry":"复核记录","emptyEntries":"辅导员暂未填写处置记录","riskDialog":"学业风险处置(敏感)","followUpStatus":"跟进状态","saveTask":"保存任务","addEntry":"新增处置记录","entryType":"记录类别","occurredAt":"发生时间","content":"内容","entryPlaceholder":"记录谈话要点、帮扶措施或复核结论","history":"处置历史","detected":"检测完成,生成 {count} 条预警","grade":"{year}级","page":"第 {page} 批","pendingCount":"待办 {count}","lastRun":"上次: {date}","followUpValue":"跟进截止:{date}","reviewValue":"复核日期:{date}","recordedBy":"记录人:{name}"}, officialDocuments: {"transcript":"官方电子成绩单","certificate":"学籍状态证明","valid":"有效","invalidated":"已失效","superseded":"已重签","selectStudent":"请选择学生。","reused":"已为你保留刚申请的同类有效凭证。","issued":"官方凭证已签发。","generated":"电子凭证已生成,可在列表中下载。","invalidatePrompt":"失效后学生不能再下载,但已下载文件仍可扫码看到“已失效”。请输入原因。","confirmInvalidate":"确认失效","reasonLength":"原因需为 2-500 个字符","invalidateSuccess":"凭证已失效。","reissuePrompt":"系统会冻结原凭证并按当前正式数据生成新编号和新二维码。请输入重签原因。","reissueTitle":"重签凭证","confirmReissue":"确认重签","reissueSuccess":"新凭证已签发,原凭证已标记为被替代。","managerTitle":"官方凭证签发中心","studentTitle":"电子成绩单与证明","managerDescription":"服务端固化签发快照和 PDF,凭证编号唯一,二维码可公开验真。","studentDescription":"在线申请后即时生成,可下载 PDF,并通过二维码公开验真。","issueNew":"签发新凭证","request":"申请电子凭证","uniqueNumber":"唯一编号","uniqueHint":"每次签发独立编号","qr":"二维码验真","qrHint":"实时显示有效状态","downloadTracking":"下载留痕","downloadHint":"时间、账号与来源可追溯","lifecycle":"失效与重签","lifecycleHint":"旧凭证保留完整链路","allTypes":"全部凭证类型","missingReason":"未填写原因","downloadPdf":"下载 PDF","invalidate":"设为失效","reissue":"重签","emptyManager":"暂无符合条件的官方凭证","emptyStudent":"暂无电子凭证,可点击上方按钮在线申请","issueTitle":"签发官方凭证","managerNotice":"签发后将固化当前正式数据;后续数据修改不会悄悄改变已签发文件。","studentNotice":"系统将按你的学籍档案即时生成;成绩单仅包含已正式发布的成绩,5 分钟内重复申请同类型、同用途凭证将复用已有文件。","student":"学生","searchStudent":"按姓名或学号搜索","documentType":"凭证类型","purpose":"用途(可选)","purposeHint":"例如:升学申请、实习材料","confirmIssue":"确认签发","submitRequest":"提交申请","history":"凭证下载记录","downloadedBy":"下载人","downloadTime":"下载时间","sourceIp":"来源 IP","emptyHistory":"尚无下载记录","total":"共 {count} 份凭证","issuedBy":"签发于 {date} · {name}","purposeValue":"用途:{purpose}","downloadCount":"下载记录({count})","statusReason":"{status}:{reason}"}, diff --git a/web/src/views/ClassroomReservationsView.vue b/web/src/views/ClassroomReservationsView.vue index 2352615..0839827 100644 --- a/web/src/views/ClassroomReservationsView.vue +++ b/web/src/views/ClassroomReservationsView.vue @@ -150,16 +150,16 @@ const availablePeriodCounts = computed(() => { return counts }) -const statusMeta: Record = { - Submitted: { label: '待学院审核', type: 'warning' }, - Approved: { label: '已批准', type: 'success' }, - Rejected: { label: '已驳回', type: 'danger' }, - Cancelled: { label: '已取消', type: 'info' }, -} +const statusMeta = computed>(() => ({ + Submitted: { label: t('classroomReservation.submitted'), type: 'warning' }, + Approved: { label: t('classroomReservation.approved'), type: 'success' }, + Rejected: { label: t('classroomReservation.rejected'), type: 'danger' }, + Cancelled: { label: t('classroomReservation.cancelled'), type: 'info' }, +})) function statusInfo(status: unknown) { - return statusMeta[status as Reservation['status']] - ?? { label: '未知状态', type: 'info' as const } + return statusMeta.value[status as Reservation['status']] + ?? { label: t('classroomReservation.unknown'), type: 'info' as const } } function todayText() { @@ -242,7 +242,7 @@ function isDateDisabled(value: Date) { async function queryAvailability() { if (!form.academicTermId || !form.reservationDate) { - ElMessage.warning('请先选择学期和预约日期。') + ElMessage.warning(t('classroomReservation.selectTermDate')) return } availabilityLoading.value = true @@ -264,7 +264,7 @@ async function queryAvailability() { form.classroomId = '' } if (availableRooms.value.length === 0) { - ElMessage.warning('当前条件下没有可预约教室,请调整日期、节次或人数。') + ElMessage.warning(t('classroomReservation.noRooms')) } } catch (error) { availabilityChecked.value = false @@ -276,15 +276,15 @@ async function queryAvailability() { async function submitReservation() { if (!applicant.value) { - ElMessage.error(applicantProblem.value || '当前账号没有可用的学院归属。') + ElMessage.error(applicantProblem.value || t('classroomReservation.noCollege')) return } if (!availabilityChecked.value || !form.classroomId) { - ElMessage.warning('请先查询可用教室并选择教室。') + ElMessage.warning(t('classroomReservation.selectRoom')) return } if (!form.purpose.trim() || !form.contactPhone.trim()) { - ElMessage.warning('请填写借用用途和联系电话。') + ElMessage.warning(t('classroomReservation.requiredFields')) return } submitting.value = true @@ -300,7 +300,7 @@ async function submitReservation() { contactPhone: form.contactPhone.trim(), notes: form.notes.trim() || null, }) - ElMessage.success('申请已提交,将由您所在学院审核。') + ElMessage.success(t('classroomReservation.submittedMessage')) form.purpose = '' form.notes = '' invalidateAvailability() @@ -358,13 +358,13 @@ async function cancelReservation(item: Reservation | Record) { try { await ElMessageBox.confirm( item.status === 'Approved' - ? '该预约已经批准,取消后教室将立即释放。确认取消吗?' - : '确认撤回这条待审核申请吗?', - '取消教室预约', - { type: 'warning', confirmButtonText: '确认取消', cancelButtonText: '暂不取消' }, + ? t('classroomReservation.cancelApproved') + : t('classroomReservation.cancelPending'), + t('classroomReservation.cancelTitle'), + { type: 'warning', confirmButtonText: t('classroomReservation.confirmCancel'), cancelButtonText: t('classroomReservation.keep') }, ) await http.post(`/classroom-reservations/${item.id}/cancel`) - ElMessage.success('预约已取消。') + ElMessage.success(t('classroomReservation.cancelledMessage')) await loadMine() } catch (error) { if (error === 'cancel' || error === 'close') return @@ -375,12 +375,12 @@ async function cancelReservation(item: Reservation | Record) { async function approveReservation(item: Reservation | Record) { try { await ElMessageBox.confirm( - `确认批准 ${item.applicantName} 对 ${item.buildingName} ${item.classroomName} 的借用申请吗?系统会再次检查占用冲突。`, - '批准教室借用', - { type: 'success', confirmButtonText: '批准', cancelButtonText: '返回' }, + t('classroomReservation.approveConfirm', { name: item.applicantName, building: item.buildingName, room: item.classroomName }), + t('classroomReservation.approveTitle'), + { type: 'success', confirmButtonText: t('classroomReservation.approve'), cancelButtonText: t('classroomReservation.back') }, ) await http.post(`/classroom-reservations/${item.id}/approve`, { comment: null }) - ElMessage.success('申请已批准。') + ElMessage.success(t('classroomReservation.approvedMessage')) await loadReview() } catch (error) { if (error === 'cancel' || error === 'close') return @@ -391,14 +391,14 @@ async function approveReservation(item: Reservation | Record) { async function rejectReservation(item: Reservation | Record) { try { const result = await ElMessageBox.prompt( - '请填写驳回原因,申请人将在消息中心收到该意见。', - '驳回教室借用', + t('classroomReservation.rejectPrompt'), + t('classroomReservation.rejectTitle'), { inputType: 'textarea', - inputPlaceholder: '请输入具体原因', - inputValidator: (value) => value.trim().length > 0 || '驳回原因不能为空', - confirmButtonText: '确认驳回', - cancelButtonText: '返回', + inputPlaceholder: t('classroomReservation.reasonPlaceholder'), + inputValidator: (value) => value.trim().length > 0 || t('classroomReservation.reasonRequired'), + confirmButtonText: t('classroomReservation.confirmReject'), + cancelButtonText: t('classroomReservation.back'), type: 'warning', }, ) @@ -416,12 +416,12 @@ async function rejectReservation(item: Reservation | Record) { function periodText(item: Reservation | Record) { const end = item.startPeriod + item.periodCount - 1 return item.periodCount === 1 - ? `第 ${item.startPeriod} 节` - : `第 ${item.startPeriod}—${end} 节` + ? t('classroomReservation.singlePeriod', { start: item.startPeriod }) + : t('classroomReservation.periodRange', { start: item.startPeriod, end }) } function roomLabel(room: AvailableClassroom) { - return `${room.campusName} · ${room.buildingName} · ${room.name}(${room.capacity} 人)` + return t('classroomReservation.roomLabel', { campus: room.campusName, building: room.buildingName, room: room.name, capacity: room.capacity }) } function formatDateTime(value?: string) { @@ -441,12 +441,12 @@ onMounted(async () => {
-

教学场地

-

教室借用与预约

-

选择正式课表之外的空闲时段提交申请,由申请人所在学院审核。

+

{{ t('classroomReservation.kicker') }}

+

{{ t('classroomReservation.title') }}

+

{{ t('classroomReservation.description') }}

- 审核学院:{{ applicant.collegeName }} + {{ t('classroomReservation.reviewCollege', { college: applicant.collegeName }) }}
@@ -463,8 +463,8 @@ onMounted(async () => {