oms/frontend/src/api/principal.ts
liufumingren a51cb4df15 feat(frontend): 初始化 Vue3 + Vite 前端工程与业务页面
- 工程脚手架:Vite、TypeScript 配置、路由、Pinia store(auth/principal/menu)、请求封装
- 布局与通用组件:BasicLayout、SideMenu、DataTable/VirtualTable、VirtualSelect、ProductSelect、ImageUploader 等
- 业务页面:登录、首页、商品、店铺、店铺商品、组合商品、仓库/接口配置、库存、入库单、出库单、发货单(列表 + 创建)、外部接口、主体/主体用户、个人资料
- API 层:api/*.ts 与后端接口一一对应
2026-09-13 02:23:51 +08:00

34 lines
768 B
TypeScript

import { post, get } from '@/utils/request'
export interface PrincipalPayload {
name: string
type?: number
contact_name?: string
contact_phone?: string
remark?: string
}
export interface PrincipalItem {
id: number
name: string
type: number
contact_name: string | null
contact_phone: string | null
status: number
remark: string | null
created_at?: string
}
/** 创建主体(同时会将当前用户关联为默认主体用户) */
export function createPrincipal(data: PrincipalPayload) {
return post<{ id: number }>('/principals', data)
}
/** 主体列表 */
export function getPrincipals(params?: object) {
return get<{ list: PrincipalItem[]; total: number; page: number; pageSize: number }>(
'/principals',
params,
)
}