diff --git a/src/main/resources/static/employee-management.html b/src/main/resources/static/employee-management.html deleted file mode 100644 index 3867133..0000000 --- a/src/main/resources/static/employee-management.html +++ /dev/null @@ -1,293 +0,0 @@ - - - - - - 员工管理 - - - - -
-
-

员工管理

- -
- - - - - - - - - - - - - - - - -
ID姓名电话角色OpenID操作
-
- - - - - - - - - - - \ No newline at end of file diff --git a/src/main/resources/static/js/employee-api.js b/src/main/resources/static/js/employee-api.js deleted file mode 100644 index e9e4498..0000000 --- a/src/main/resources/static/js/employee-api.js +++ /dev/null @@ -1,125 +0,0 @@ -/** - * 员工管理API服务 - */ -class EmployeeApiService { - constructor(baseURL) { - this.baseURL = baseURL; - } - - /** - * 获取所有员工列表 - * @returns 员工信息数组 - */ - async getEmployees() { - try { - const response = await fetch(`${this.baseURL}/employees`, { - method: 'GET', - headers: { - 'Content-Type': 'application/json', - 'Authorization': `Bearer ${this.getToken()}` - } - }); - - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - - return await response.json(); - } catch (error) { - console.error('获取员工列表失败:', error); - throw error; - } - } - - /** - * 添加新员工 - * @param employeeInfo 员工信息 - * @returns 添加结果 - */ - async addEmployee(employeeInfo) { - try { - const response = await fetch(`${this.baseURL}/employees`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'Authorization': `Bearer ${this.getToken()}` - }, - body: JSON.stringify(employeeInfo) - }); - - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - - return await response.json(); - } catch (error) { - console.error('添加员工失败:', error); - throw error; - } - } - - /** - * 删除员工 - * @param employeeId 员工ID - * @returns 删除结果 - */ - async deleteEmployee(employeeId) { - try { - const response = await fetch(`${this.baseURL}/employees/${employeeId}`, { - method: 'DELETE', - headers: { - 'Content-Type': 'application/json', - 'Authorization': `Bearer ${this.getToken()}` - } - }); - - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - - return await response.text(); - } catch (error) { - console.error('删除员工失败:', error); - throw error; - } - } - - /** - * 更新员工信息 - * @param employeeId 员工ID - * @param employeeInfo 员工信息 - * @returns 更新结果 - */ - async updateEmployee(employeeId, employeeInfo) { - try { - const response = await fetch(`${this.baseURL}/employees/${employeeId}`, { - method: 'PUT', - headers: { - 'Content-Type': 'application/json', - 'Authorization': `Bearer ${this.getToken()}` - }, - body: JSON.stringify(employeeInfo) - }); - - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - - return await response.json(); - } catch (error) { - console.error('更新员工信息失败:', error); - throw error; - } - } - - /** - * 从localStorage获取token - * @returns JWT token - */ - getToken() { - return localStorage.getItem('token'); - } -} - -// 导出员工API服务实例 -const employeeApiService = new EmployeeApiService('/api'); \ No newline at end of file