refactor: vue3 axios api ...

This commit is contained in:
xingyu
2022-07-19 22:33:54 +08:00
parent ba96eef51a
commit 9e2e220b69
121 changed files with 1022 additions and 9700 deletions

View File

@ -1,36 +1,38 @@
import { defHttp } from '@/config/axios'
import { useAxios } from '@/hooks/web/useAxios'
import type { PostVO } from './types'
const request = useAxios()
// 查询岗位列表
export const getPostPageApi = ({ params }) => {
return defHttp.get<PageResult<PostVO>>({ url: '/system/post/page', params })
export const getPostPageApi = async (params) => {
return await request.get({ url: '/system/post/page', params })
}
// 获取岗位精简信息列表
export const listSimplePostsApi = () => {
return defHttp.get<PostVO[]>({ url: '/system/post/list-all-simple' })
export const listSimplePostsApi = async () => {
return await request.get({ url: '/system/post/list-all-simple' })
}
// 查询岗位详情
export const getPostApi = (id: number) => {
return defHttp.get<PostVO>({ url: '/system/post/get?id=' + id })
export const getPostApi = async (id: number) => {
return await request.get({ url: '/system/post/get?id=' + id })
}
// 新增岗位
export const createPostApi = (params: PostVO) => {
return defHttp.post({ url: '/system/post/create', params })
export const createPostApi = async (data: PostVO) => {
return await request.post({ url: '/system/post/create', data })
}
// 修改岗位
export const updatePostApi = (params: PostVO) => {
return defHttp.put({ url: '/system/post/update', params })
export const updatePostApi = async (data: PostVO) => {
return await request.put({ url: '/system/post/update', data })
}
// 删除岗位
export const deletePostApi = (id: number) => {
return defHttp.delete({ url: '/system/post/delete?id=' + id })
export const deletePostApi = async (id: number) => {
return await request.delete({ url: '/system/post/delete?id=' + id })
}
// 导出岗位
export const exportPostApi = (params) => {
return defHttp.get({ url: '/system/post/export', params, responseType: 'blob' })
export const exportPostApi = async (params) => {
return await request.get({ url: '/system/post/export', params, responseType: 'blob' })
}