| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- /**
- * api/credit.js — 学时账户域接口
- * 契约见《健康服务人员助手_后端服务设计_v1.0》§7.1 培训线
- * ⚠ 单位红线:total/theory/practice/gap/hours 一律为【分钟整数】,
- * 展示层统一走 utils/format.js 的 creditHours() 做 /60 换算,后端不做小时转换。
- * 复用 utils/api.js 的统一 request 封装。
- */
- import { request } from '@/utils/api.js'
- /**
- * 我的学时账户
- * 入参:{year?: int = 当前年}(历史年走后端台账聚合,明细 status='settled')
- * 出参(后端实际实现):{year, totalHours, theoryHours, practiceHours, effectiveHours, pendingHours,
- * detail:[{id,sourceType,sourceId,hours,theory,practice,status,effectiveAt}]}
- * 兼容键(设计文档 §7.1 旧表述):total / theory / practice / gap / list
- * status: pending | effective | objected | rejected | settled
- * ⚠ 所有学时数值字段一律为【分钟整数】(含字段名带 Hours 的),展示层统一 creditHours() /60。
- * 错误:401
- */
- export function getCreditMine(year) {
- var data = {}
- if (year) data.year = year
- return request('/api/credit/mine', 'POST', data, { silent: true })
- }
- /**
- * 待生效明细(T+3 待入账)
- * 入参:{page, size}
- * 出参:{list:[pending 明细], total}
- * 错误:401
- */
- export function getCreditPending(page, size) {
- return request('/api/credit/pending', 'POST', {
- page: page || 1,
- size: size || 20
- }, { silent: true })
- }
- /**
- * 学时异议 ★幂等
- * 入参:{creditId: Long 必填, reason: String 必填}
- * 出参:Boolean
- * 错误:404「学时记录不存在或不属于您」/ 500「该学时状态不允许异议」
- */
- export function creditObject(creditId, reason) {
- return request('/api/credit/object', 'POST', {
- creditId: creditId,
- reason: reason
- }, { silent: true })
- }
|