- 人员页:编辑抽屉内区域/计划子表编辑;产品页:类别阈值提示条; 客户页:归属变更二次确认含「不回溯历史」+变更记录抽屉 - 评级页:五项评分实时出等级(纯前端判定,不落库 #25)+ 等级映射维护抽屉 - 菜单两组:基础数据(8-10)/业务数据(14);金额字符串直出禁 float Co-Authored-By: Claude Code <noreply@anthropic.com>
151 lines
4.5 KiB
TypeScript
151 lines
4.5 KiB
TypeScript
import { request } from './request'
|
||
import type { PageData } from './types'
|
||
|
||
/** 辐射区域条目(对应后端 `PersonnelRegionOut`) */
|
||
export interface PersonnelRegionItem {
|
||
id: number
|
||
region_name: string
|
||
remark: string | null
|
||
}
|
||
|
||
/** 拓展计划条目(对应后端 `PersonnelPlanOut`) */
|
||
export interface PersonnelPlanItem {
|
||
id: number
|
||
plan_period: string
|
||
plan_content: string
|
||
target_desc: string | null
|
||
}
|
||
|
||
/** 人员列表项(对应后端 `PersonnelOut`) */
|
||
export interface PersonnelItem {
|
||
id: number
|
||
personnel_name: string
|
||
business_role_id: number
|
||
/** 岗位名称由联表带出 */
|
||
role_name: string | null
|
||
manager_id: number | null
|
||
manager_name: string | null
|
||
phone: string | null
|
||
/** 入职日期,ISO 串(YYYY-MM-DD) */
|
||
hire_date: string | null
|
||
/** 1试用期 0正式 */
|
||
is_probation: number
|
||
/** 月工资标准(元),字符串直出 —— 金额红线:不经 float */
|
||
salary_standard: string | null
|
||
/** 1在职 0离职 */
|
||
status: number
|
||
remark: string | null
|
||
}
|
||
|
||
/** 人员详情:附辐射区域与拓展计划,供编辑抽屉一次回显 */
|
||
export interface PersonnelDetail extends PersonnelItem {
|
||
regions: PersonnelRegionItem[]
|
||
plans: PersonnelPlanItem[]
|
||
}
|
||
|
||
export interface PersonnelQueryParams {
|
||
pageNum?: number
|
||
pageSize?: number
|
||
/** 姓名,模糊匹配 */
|
||
keyword?: string
|
||
/** 1在职 0离职 */
|
||
status?: number
|
||
/** 岗位角色ID */
|
||
business_role_id?: number
|
||
}
|
||
|
||
/**
|
||
* 新增/编辑人员(全量提交)。
|
||
*
|
||
* 不含状态 —— 在职/离职是独立操作(PUT /{id}/status),避免编辑表单
|
||
* 误触离职。可空字段传 `null` 表示清空,与后端 `PersonnelCreateIn` 对齐。
|
||
*/
|
||
export interface PersonnelSaveParams {
|
||
personnel_name: string
|
||
business_role_id: number
|
||
/** 直属经理ID,空=无;后端校验不能是自己且须在职 */
|
||
manager_id?: number | null
|
||
phone?: string | null
|
||
/** ISO 串(YYYY-MM-DD) */
|
||
hire_date?: string | null
|
||
/** 1试用期 0正式 */
|
||
is_probation?: number
|
||
/** 月工资标准(元),字符串形式的数字,最多两位小数 */
|
||
salary_standard?: string | null
|
||
remark?: string | null
|
||
}
|
||
|
||
/** 辐射区域条目入参(全量替换用) */
|
||
export interface RegionItemParams {
|
||
region_name: string
|
||
remark?: string | null
|
||
}
|
||
|
||
/** 拓展计划条目入参(全量替换用) */
|
||
export interface PlanItemParams {
|
||
plan_period: string
|
||
plan_content: string
|
||
target_desc?: string | null
|
||
}
|
||
|
||
/** 分页查询人员(含离职),姓名模糊匹配 */
|
||
export function listPersonnel(params: PersonnelQueryParams): Promise<PageData<PersonnelItem>> {
|
||
return request({ url: '/v1/base/personnel', method: 'get', params })
|
||
}
|
||
|
||
/** 新增人员(默认在职;岗位须存在且启用) */
|
||
export function createPersonnel(data: PersonnelSaveParams): Promise<PersonnelItem> {
|
||
return request({ url: '/v1/base/personnel', method: 'post', data })
|
||
}
|
||
|
||
/** 人员详情(附辐射区域与拓展计划) */
|
||
export function getPersonnelDetail(personnelId: number): Promise<PersonnelDetail> {
|
||
return request({ url: `/v1/base/personnel/${personnelId}`, method: 'get' })
|
||
}
|
||
|
||
/** 编辑人员(全量提交,不含状态) */
|
||
export function updatePersonnel(
|
||
personnelId: number,
|
||
data: PersonnelSaveParams,
|
||
): Promise<PersonnelItem> {
|
||
return request({ url: `/v1/base/personnel/${personnelId}`, method: 'put', data })
|
||
}
|
||
|
||
/** 删除人员(被团队成员或客户归属引用时后端拒绝,应改为离职) */
|
||
export function deletePersonnel(personnelId: number): Promise<null> {
|
||
return request({ url: `/v1/base/personnel/${personnelId}`, method: 'delete' })
|
||
}
|
||
|
||
/** 设为在职 / 离职(离职人员不可再被业务与客户归属引用) */
|
||
export function setPersonnelStatus(personnelId: number, status: number): Promise<PersonnelItem> {
|
||
return request({
|
||
url: `/v1/base/personnel/${personnelId}/status`,
|
||
method: 'put',
|
||
data: { status },
|
||
})
|
||
}
|
||
|
||
/** 全量替换辐射区域(空列表即清空该人员的全部区域) */
|
||
export function replacePersonnelRegions(
|
||
personnelId: number,
|
||
items: RegionItemParams[],
|
||
): Promise<null> {
|
||
return request({
|
||
url: `/v1/base/personnel/${personnelId}/regions`,
|
||
method: 'put',
|
||
data: { items },
|
||
})
|
||
}
|
||
|
||
/** 全量替换拓展计划(空列表即清空该人员的全部计划) */
|
||
export function replacePersonnelPlans(
|
||
personnelId: number,
|
||
items: PlanItemParams[],
|
||
): Promise<null> {
|
||
return request({
|
||
url: `/v1/base/personnel/${personnelId}/plans`,
|
||
method: 'put',
|
||
data: { items },
|
||
})
|
||
}
|