用户、组织机构API路由

This commit is contained in:
huxin02 2025-02-14 16:52:28 +08:00
parent 813ed14076
commit bb2a4a1525
3 changed files with 87 additions and 0 deletions

View File

@ -0,0 +1,24 @@
import crud from '../BaseApi'
import { api } from '../../utils/Request'
import { REQUEST_METHOD_TYPES } from '@/utils/Constants'
const url = '/api/lawenforcement/agencies'
export const agencies = {
tree: () => api({
url: `${url}/tree`,
method: REQUEST_METHOD_TYPES.GET
}),
findOneByCode: (code) => api({
url: `${url}/code/${code}`,
method: REQUEST_METHOD_TYPES.GET
}),
getNextOrderNum: (parentId) => api({
url: `${url}/nextOrderNum`,
method: REQUEST_METHOD_TYPES.GET,
params: { parentId: parentId || '0' }
}),
...crud(url)
}
export default agencies

View File

@ -0,0 +1,22 @@
import crud from '../BaseApi'
import api from '@/utils/Request.js'
import {REQUEST_METHOD_TYPES} from '@/utils/Constants.js'
const url = '/api/lawenforcement/officers'
export const officers = Object.assign({
getOfficersByAgency(agencyId) {
return api({
url: `${url}/agency/${agencyId}`,
method: REQUEST_METHOD_TYPES.GET
})
},
count() {
return api({
url: `${url}/count`,
method: REQUEST_METHOD_TYPES.GET
})
}
}, crud(url))
export default officers

View File

@ -0,0 +1,41 @@
import { api } from '../../utils/Request'
const url = '/lawenforcement/v1/auth'
const baseURL = `${import.meta.env.VITE_BASE_URL}/ht`
export const getUserInfo = () => {
return api.get(`${url}/getSysUser`)
}
export const login = (params) => {
return api.post(`${url}/login`, undefined, {params: params})
}
export const logout = (params) => {
return api.post(`${url}/logout`, undefined, {params: params})
}
export const getLoginUrl = () => {
return api.get(`${url}/getLoginUrl`)
}
// 刷新访问令牌
export const refreshToken = (refreshToken) => {
return api.post(`${url}/refreshToken`, undefined, { params: { refreshToken } })
}
// 新增:客户端退出登录接口
export const sysLogout = () => {
return api.post(`${baseURL}/uaa/clients/sysLogout`)
}
export const users = {
getUserInfo,
login,
logout,
getLoginUrl,
refreshToken,
sysLogout
}
export default users