From 375c18a6d2713ff19b22093eec57315992d8333f Mon Sep 17 00:00:00 2001
From: Codex Assistant <codex@example.com>
Date: 星期四, 06 十一月 2025 13:33:52 +0800
Subject: [PATCH] 增加评审下载
---
web/src/api/employee.ts | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/web/src/api/employee.ts b/web/src/api/employee.ts
index 75c9dac..6cb318e 100644
--- a/web/src/api/employee.ts
+++ b/web/src/api/employee.ts
@@ -19,7 +19,7 @@
}
`,
- // 鏍规嵁濮撳悕鎼滅储鍛樺伐
+ // 鎼滅储鍛樺伐
SEARCH_EMPLOYEES: `
query SearchEmployees($name: String) {
employeesByName(name: $name) {
@@ -99,18 +99,18 @@
// 鑾峰彇鍛樺伐鍒楄〃
async getEmployees(): Promise<Employee[]> {
try {
- const data = await graphqlRequest(EMPLOYEE_QUERIES.GET_EMPLOYEES)
- return data?.employees || []
+ const result = await graphqlRequest(EMPLOYEE_QUERIES.GET_EMPLOYEES)
+ return result?.data?.employees || []
} catch (error: any) {
throw new Error(error.message || '鑾峰彇鍛樺伐鍒楄〃澶辫触')
}
},
// 鎼滅储鍛樺伐
- async searchEmployees(keyword: string): Promise<Employee[]> {
+ async searchEmployees(name: string): Promise<Employee[]> {
try {
- const data = await graphqlRequest(EMPLOYEE_QUERIES.SEARCH_EMPLOYEES, { keyword })
- return data?.searchEmployees || []
+ const result = await graphqlRequest(EMPLOYEE_QUERIES.SEARCH_EMPLOYEES, { name })
+ return result?.data?.employeesByName || []
} catch (error: any) {
throw new Error(error.message || '鎼滅储鍛樺伐澶辫触')
}
@@ -119,8 +119,8 @@
// 鏍规嵁ID鑾峰彇鍛樺伐璇︽儏
async getEmployee(id: string): Promise<Employee | null> {
try {
- const data = await graphqlRequest(EMPLOYEE_QUERIES.GET_EMPLOYEE, { id })
- return data?.employee || null
+ const result = await graphqlRequest(EMPLOYEE_QUERIES.GET_EMPLOYEE, { id })
+ return result?.data?.employee || null
} catch (error: any) {
throw new Error(error.message || '鑾峰彇鍛樺伐璇︽儏澶辫触')
}
@@ -129,8 +129,8 @@
// 淇濆瓨鍛樺伐锛堟柊澧炴垨鏇存柊锛�
async saveEmployee(employee: EmployeeInput): Promise<Employee> {
try {
- const data = await graphqlRequest(EMPLOYEE_MUTATIONS.SAVE_EMPLOYEE, { input: employee })
- return data?.saveEmployee
+ const result = await graphqlRequest(EMPLOYEE_MUTATIONS.SAVE_EMPLOYEE, { input: employee })
+ return result?.data?.saveEmployee
} catch (error: any) {
throw new Error(error.message || '淇濆瓨鍛樺伐澶辫触')
}
@@ -139,8 +139,8 @@
// 鍒犻櫎鍛樺伐
async deleteEmployee(id: string): Promise<boolean> {
try {
- const data = await graphqlRequest(EMPLOYEE_MUTATIONS.DELETE_EMPLOYEE, { id })
- return data?.deleteEmployee || false
+ const result = await graphqlRequest(EMPLOYEE_MUTATIONS.DELETE_EMPLOYEE, { id })
+ return result?.data?.deleteEmployee || false
} catch (error: any) {
throw new Error(error.message || '鍒犻櫎鍛樺伐澶辫触')
}
--
Gitblit v1.8.0