docs: 完善项目说明和协作规则
This commit is contained in:
@@ -1,10 +1,18 @@
|
||||
import { http } from "@/utils/http";
|
||||
|
||||
/**
|
||||
* 门店权限后台的业务接口层。
|
||||
*
|
||||
* 页面只依赖这里导出的类型和方法,避免在视图组件中散落接口路径、
|
||||
* 响应结构和状态枚举。后端统一挂在 `/api` 前缀下,由 Vite 代理转发。
|
||||
*/
|
||||
const API_PREFIX = "/api";
|
||||
|
||||
/** 后端员工与门店共用的启停状态枚举。 */
|
||||
export type EmployeeStatus = "ACTIVE" | "INACTIVE";
|
||||
export type StoreStatus = "ACTIVE" | "INACTIVE";
|
||||
|
||||
/** 员工列表中展示的角色摘要。 */
|
||||
export interface RoleSummary {
|
||||
id: number;
|
||||
code: string;
|
||||
@@ -49,6 +57,7 @@ export interface Role extends RoleOption {
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
/** 员工列表是服务端分页,门店和角色当前由前端做轻量筛选。 */
|
||||
export interface EmployeeListParams {
|
||||
storeId?: number;
|
||||
status?: EmployeeStatus;
|
||||
@@ -83,6 +92,7 @@ export interface EmployeePayload {
|
||||
roleIds: number[];
|
||||
}
|
||||
|
||||
/** access-manage 后端普通响应包裹结构。 */
|
||||
export interface ApiResult<T> {
|
||||
success: boolean;
|
||||
data: T;
|
||||
@@ -100,6 +110,7 @@ export interface PaginatedData<T> {
|
||||
pagination: Pagination;
|
||||
}
|
||||
|
||||
/** 门店接口:管理门店基础资料,并给员工下拉选项提供数据源。 */
|
||||
export const listStores = (params?: StoreListParams) => {
|
||||
return http.request<ApiResult<Store[]>>("get", `${API_PREFIX}/stores`, {
|
||||
params
|
||||
@@ -130,6 +141,7 @@ export const deleteStore = (id: number) => {
|
||||
return http.request<void>("delete", `${API_PREFIX}/stores/${id}`);
|
||||
};
|
||||
|
||||
/** 角色接口:维护员工可绑定的权限角色。 */
|
||||
export const getRole = (id: number) => {
|
||||
return http.request<ApiResult<Role>>("get", `${API_PREFIX}/roles/${id}`);
|
||||
};
|
||||
@@ -150,6 +162,7 @@ export const deleteRole = (id: number) => {
|
||||
return http.request<void>("delete", `${API_PREFIX}/roles/${id}`);
|
||||
};
|
||||
|
||||
/** 员工接口:员工列表由后端分页,编辑时按 id 重新拉取完整角色绑定。 */
|
||||
export const listEmployees = (params: EmployeeListParams) => {
|
||||
return http.request<ApiResult<PaginatedData<Employee>>>(
|
||||
"get",
|
||||
|
||||
Reference in New Issue
Block a user