Files
inquiry_robot/inquiry-backend/src/views/inquiry/staffRole/staffRole.api.ts
T

36 lines
1.8 KiB
TypeScript

/**
* 员工岗位 API:对接主账 /inquiry/staffRole。
* 与 Jeecg /sys/user 分离——本页管企微岗位绑定;同步走主账 /syncWecom,浏览器不直连企微。
* 部门下拉对齐旧项目:GET /inquiry/staffRole/departments → string[]。
*/
import { defHttp } from '/@/utils/http/axios';
enum Api {
list = '/inquiry/staffRole/list',
counts = '/inquiry/staffRole/counts',
add = '/inquiry/staffRole/add',
edit = '/inquiry/staffRole/edit',
disable = '/inquiry/staffRole/disable',
queryById = '/inquiry/staffRole/queryById',
syncWecom = '/inquiry/staffRole/syncWecom',
/** 旧项目同名接口:部门短名全量 */
departments = '/inquiry/staffRole/departments',
wecomDepartments = '/inquiry/staffRole/wecomDepartments',
}
export const getStaffList = (params) => defHttp.get({ url: Api.list, params });
export const getStaffCounts = () => defHttp.get({ url: Api.counts });
export const saveStaff = (data, isUpdate: boolean) =>
isUpdate ? defHttp.put({ url: Api.edit, data }) : defHttp.post({ url: Api.add, data });
export const disableStaff = (id: string) => defHttp.post({ url: Api.disable, params: { id } });
export const getStaffById = (id: string) => defHttp.get({ url: Api.queryById, params: { id } });
/** 主账拉企微通讯录 upsert;返回 { fetched, created, updated, skipped, message } */
export const syncWecomStaff = () => defHttp.post({ url: Api.syncWecom });
/**
* 部门下拉(对齐旧项目):返回 string[] 短名全量,可搜索可滚动。
* 失败时勿挡手工填部门。
*/
export const getStaffDepartments = () => defHttp.get({ url: Api.departments });
/** @deprecated 结构列表;员工下拉请用 getStaffDepartments */
export const getWecomDepartments = () => defHttp.get({ url: Api.wecomDepartments });