减少冗余代码
This commit is contained in:
@@ -1,78 +1,80 @@
|
||||
import request from '@/utils/request'
|
||||
import { adminRequest, indexRequest } from '@/utils/request'
|
||||
|
||||
// ==================== 前台接口(/api/index) ====================
|
||||
|
||||
export const userApi = {
|
||||
// 登录接口
|
||||
login(username, password) {
|
||||
// 这里的 data 会被 axios 放在请求体 (Body) 中发送
|
||||
return request.post('/login', {
|
||||
username,
|
||||
password
|
||||
})
|
||||
return indexRequest.post('/login', { username, password })
|
||||
},
|
||||
|
||||
// 退出登录
|
||||
logout() {
|
||||
return request.post('/logout')
|
||||
return indexRequest.post('/logout')
|
||||
}
|
||||
}
|
||||
|
||||
// ==================== 后台接口(/api/admin) ====================
|
||||
|
||||
export const ticketApi = {
|
||||
//获取工单各个完成状态的统计数量
|
||||
getticketsstatuscount(){
|
||||
return request.get('/getticketstatuscount')
|
||||
// 获取工单各完成状态的统计数量
|
||||
getticketdashboardstats() {
|
||||
return adminRequest.get('/getticketdashboardstats')
|
||||
},
|
||||
|
||||
// 获取工单列表
|
||||
getTickets(params) {
|
||||
return request.get('/ticketsfind', { params })
|
||||
return adminRequest.get('/ticketsfind', { params })
|
||||
},
|
||||
|
||||
// 新增工单
|
||||
addTicket(data) {
|
||||
return request.post('/addticket', data)
|
||||
return adminRequest.post('/addticket', data)
|
||||
},
|
||||
|
||||
// 更新工单
|
||||
updateTicket(id, data) {
|
||||
return request.put(`/ticket/${id}`, data)
|
||||
return adminRequest.put(`/ticket/${id}`, data)
|
||||
},
|
||||
|
||||
// 删除工单
|
||||
deleteTicket(id) {
|
||||
return request.delete(`/ticket/${id}`)
|
||||
return adminRequest.delete(`/ticket/${id}`)
|
||||
},
|
||||
|
||||
// 获取运营人员列表
|
||||
getOperators() {
|
||||
return request.get('/operators')
|
||||
// 获取运营人员列表(按公司分组)
|
||||
getOperatorsNew() {
|
||||
return adminRequest.get('/getOperatorList')
|
||||
},
|
||||
|
||||
// 获取员工列表
|
||||
getStaffs(params) {
|
||||
return request.get('/getStaffList', { params })
|
||||
}
|
||||
getUserStaffs() {
|
||||
return adminRequest.get('/getUserStaffList')
|
||||
},
|
||||
|
||||
// 批量更新工单
|
||||
batchUpdateTicket(data) {
|
||||
return adminRequest.put('/tickets/batch-update', data)
|
||||
},
|
||||
}
|
||||
|
||||
export const customerApi = {
|
||||
getCustomers() {
|
||||
return request.get('/customers')
|
||||
return adminRequest.get('/customers')
|
||||
},
|
||||
|
||||
|
||||
// 添加客户,data 结构应为 { company_name: 'xxx' }
|
||||
addCustomerName(data) {
|
||||
return request.post('/addcustomername', data)
|
||||
return adminRequest.post('/addcustomername', data)
|
||||
},
|
||||
|
||||
addEmployee(data) {
|
||||
return request.post('/addemployee', data) // 对应后端新增员工
|
||||
return adminRequest.post('/addemployee', data)
|
||||
},
|
||||
deleteEmployee(empId) {
|
||||
return request.delete(`/deleteemployee/${empId}`) // 对应后端删除员工
|
||||
},
|
||||
deleteCustomer(customerId) {
|
||||
return request.delete(`/deletecustomer/${customerId}`) // 删除客户单位
|
||||
}
|
||||
|
||||
deleteEmployee(empId) {
|
||||
return adminRequest.delete(`/deleteemployee/${empId}`)
|
||||
},
|
||||
|
||||
deleteCustomer(customerId) {
|
||||
return adminRequest.delete(`/deletecustomer/${customerId}`)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user