Browse Source

fix(frontend): 修正 API 调用与后端路由匹配

wangkangyjy 1 week ago
parent
commit
3f5499c38c
2 changed files with 34 additions and 18 deletions
  1. 20 12
      frontend/src/api/okr.js
  2. 14 6
      frontend/src/api/scoring.js

+ 20 - 12
frontend/src/api/okr.js

@@ -1,29 +1,37 @@
 import client from './client'
 
-export function getWorkbench(periodId) {
-  return client.get('/okr/workbench', { params: { periodId } })
-}
-
-export function saveDraft(data) {
-  return client.post('/okr/draft', data)
-}
-
 export function submitOkr(data) {
   return client.post('/okr/submit', data)
 }
 
-export function reviewOkr(data) {
-  return client.post('/okr/review', data)
+export function updateOkr(id, data) {
+  return client.put(`/okr/${id}/update`, data)
+}
+
+export function reviewOkr(id, data) {
+  return client.put(`/okr/${id}/review`, data)
 }
 
 export function updateProgress(krId, data) {
   return client.put(`/okr/kr/${krId}/progress`, data)
 }
 
+export function getKrHistory(krId) {
+  return client.get(`/okr/kr/${krId}/history`)
+}
+
 export function getMyOkr(periodId) {
-  return client.get('/okr/my', { params: { periodId } })
+  return client.get(`/okr/period/${periodId}/my`)
 }
 
 export function getTeamOkr(periodId) {
-  return client.get('/okr/team', { params: { periodId } })
+  return client.get(`/okr/period/${periodId}/subordinates`)
+}
+
+export function getOkrTree(periodId) {
+  return client.get(`/okr/period/${periodId}/tree`)
+}
+
+export function getSuperiorOkr(periodId) {
+  return client.get(`/okr/period/${periodId}/superior`)
 }

+ 14 - 6
frontend/src/api/scoring.js

@@ -1,25 +1,33 @@
 import client from './client'
 
-export function getReviewQueue(periodId) {
-  return client.get('/scores/review-queue', { params: { periodId } })
+export function getScoringPage(periodId, userId) {
+  return client.get('/scores/page', { params: { periodId, userId } })
 }
 
 export function getMyResult(periodId) {
   return client.get('/scores/my', { params: { periodId } })
 }
 
-export function getHistory() {
-  return client.get('/scores/history')
+export function getSubordinates(periodId) {
+  return client.get('/scores/subordinates', { params: { periodId } })
 }
 
 export function submitSelfScore(data) {
   return client.post('/scores/self', data)
 }
 
-export function submitFinalScore(data) {
-  return client.post('/scores/final', data)
+export function submitSuperiorScore(data) {
+  return client.post('/scores/superior', data)
+}
+
+export function confirmResult(periodId) {
+  return client.post('/scores/confirm', { periodId })
 }
 
 export function publishResult(periodId) {
   return client.post('/scores/publish', { periodId })
 }
+
+export function correctScore(id, data) {
+  return client.post(`/scores/${id}/correction`, data)
+}