82a19101a8
- 创建 rui-frontend 前端仓库 - 迁移 admin-ui 管理后台 - 创建 cashier-mobile 和 customer-mobile 占位项目 - 配置 pnpm workspace
35 lines
798 B
TypeScript
35 lines
798 B
TypeScript
import { request } from '@/utils/request'
|
|
|
|
/**
|
|
* 用户岗位关联服务
|
|
*/
|
|
class UserPostService {
|
|
private baseUrl = '/user/admin/user-post'
|
|
|
|
/**
|
|
* 查询用户已分配的岗位ID列表
|
|
*/
|
|
async listPostIdsByUserId(userId: number | string): Promise<number[]> {
|
|
const res: any = await request({
|
|
url: `${this.baseUrl}/user/${userId}`,
|
|
method: 'get',
|
|
})
|
|
return res.data || []
|
|
}
|
|
|
|
/**
|
|
* 分配用户岗位
|
|
*/
|
|
async assignPosts(userId: number | string, postIds: number[]): Promise<boolean> {
|
|
const res: any = await request({
|
|
url: `${this.baseUrl}/user/${userId}`,
|
|
method: 'post',
|
|
data: postIds,
|
|
})
|
|
return res.data === true
|
|
}
|
|
}
|
|
|
|
/** 用户岗位关联服务单例 */
|
|
export const userPostService = new UserPostService()
|