import request from "@/router/axios";

/*获取人才列表*/
export const getList = (current, size, params, groupId) => {
  return request({
    url: "/api/jobslink-api/serve/list",
    method: "get",
    params: {...params, current, size, groupId}
  });
};

/*获取人才列表*/
export const getUserList = (current, size, params, groupId) => {
  return request({
    url: "/api/jobslink-api/serve/user/list",
    method: "get",
    params: {...params, current, size, groupId}
  });
};

/*新增人才*/
export const add = row => {
  return request({
    url: "/api/jobslink-api/serve/save",
    method: "post",
    data: row
  });
};

/*编辑人才*/
export const update = row => {
  return request({
    url: "/api/jobslink-api/serve/update",
    method: "post",
    data: row
  });
};

/*删除人才*/
export const remove = ids => {
  return request({
    url: "/api/jobslink-api/serve/remove",
    method: "post",
    params: {ids}
  });
};

/*人才详情*/
export const detail = id => {
  return request({
    url: "/api/jobslink-api/serve/detail",
    method: "get",
    params: {id}
  });
};

/*获取分组*/
export const getDept = () => {
  return request({
    url: "/api/jobslink-api/serve/group/listAll",
    method: "get",
    params: {}
  });
};

export const getDepTree = () => {
  return request({
    url: "/api/jobslink-api/serve/tree",
    method: "get",
    params: {}
  });
};

/*新建分组*/
export const addDept = row => {
  return request({
    url: "/api/jobslink-api/serve/group/save",
    method: "post",
    data: row
  });
};

/*获取分组 - 零工管理*/
export const getServeGroupList = () => {
  return request({
    url: "/api/jobslink-api/serve/user/group/listAll",
    method: "get",
    params: {}
  });
};

/*新建分组 - 零工管理*/
export const addServeGroup = row => {
  return request({
    url: "/api/jobslink-api/serve/user/group/save",
    method: "post",
    data: row
  });
};

/*编辑分组*/
export const updateDept = row => {
  return request({
    url: "/api/jobslink-api/serve/group/update",
    method: "post",
    data: row
  });
};

/*删除分组*/
export const removeDept = ids => {
  return request({
    url: "/api/jobslink-api/serve/group/remove",
    method: "post",
    params: {ids}
  });
};

/*转移分组*/
export const transferDept = (groupIds, ids) => {
  return request({
    url: "/api/jobslink-api/serve/updateAllGroup",
    method: "post",
    params: {groupIds, ids}
  });
};

/*导入人才库*/
export const upload = () => {
  return `/api/jobslink-api/serve/group/import?isCovered=1`;
};

/*转移分组*/
export const getServeListTalents = params => {
  return request({
    url: "/api/jobslink-api/serve/listTalents",
    method: "get",
    params: params
  });
};

/*匹配岗位和任务*/
export const getMatchWorkStation = params => {
  return request({
    url: "/api/jobslink-api/tenant/mainServeUserPost/postPage",
    method: "get",
    params: params
  });
};

/*匹配政策*/
export const getMatchPolicy = params => {
  return request({
    url: "/api/jobslink-api/serve/listPolicy",
    method: "get",
    params: params
  });
};

/*服务日志*/
export const getMatchServeList = params => {
  return request({
    url: "/api/jobslink-api/tenant/mainserveuserlog/pageAll",
    method: "get",
    params: params
  });
};

export const getListAllPolicy = params => {
  return request({
    url: "/api/jobslink-api/serve/listAllPolicy",
    method: "get",
    params: params
  });
};

export const getListAllByLabels = params =>
  request({
    url: "/api/jobslink-api/tenant/talents/listAllByLabels",
    method: "get",
    params: params
  });
export const getListGroupByLabels = params =>
  request({
    url: "/api/jobslink-api/tenant/talents/listGroupByLabels",
    method: "get",
    params: params
  });
export const getListAllByPolicy = params =>
  request({
    url: "/api/jobslink-api/tenant/talents/listAllByPolicy",
    method: "get",
    params: params
  });

export const getServeAllPolicyList = params =>
  request({
    url: "/api/jobslink-api/serve/listAllPolicy",
    method: "get",
    params: params
  });

export const getListByids = params =>
  request({
    url: "/api/jobslink-api/policy/listByids",
    method: "get",
    params: params
  });

export const getSearchAll = params =>
  request({
    url: "/api/jobslink-api/serve/searchAll",
    method: "get",
    params: params
  });
export const getSearchAllByUserId = (params, body) =>
  request({
    url: "/api/jobslink-api/serve/pushSearchList",
    method: "post",
    data: body,
    params: params,
  });

export const pushPolicyUserServe = params =>
  request({
    url: "/api/jobslink-api/serve/push/policyUserServe",
    method: "post",
    data: params
  });

export const pushPostUserServe = params =>
  request({
    url: "/api/jobslink-api/serve/push/postUserServe",
    method: "post",
    data: params
  });

export const getListAllTalents = params =>
  request({
    url: "/api/jobslink-api/serve/listAllTalents",
    method: "get",
    params
  });

export const getListUserAllTalents = params =>
  request({
    url: "/api/jobslink-api/serve/user/listAllTalents",
    method: "get",
    params
  });

export const addServeLog = data =>
  request({
    url: "/api/jobslink-api/tenant/mainserveuserlog/save",
    method: "post",
    data
  });

export const updateServeLog = data =>
  request({
    url: "/api/jobslink-api/tenant/mainserveuserlog/update",
    method: "post",
    data
  });

export const removeServeLog = data =>
  request({
    url: "/api/jobslink-api/tenant/mainserveuserlog/remove",
    method: "post",
    params: data
  });

/*服务日志*/
export const getMainServeUserLog = params => {
  return request({
    url: "/api/jobslink-api/tenant/mainserveuserlog/listUserLog",
    method: "get",
    params: params
  });
};


export const saveGroupServeInfo = (data) => {
  return request({
    url: "/api/jobslink-api/serve/tree/save",
    method: "post",
    data
  });
};

export const updateGroupServeInfo = (data) => {
  return request({
    url: "/api/jobslink-api/serve/tree/update",
    method: "post",
    data
  });
};
export const getPhoneList = (params) => {
  return request({
    url: "/api/jobslink-api/serve/phoneList",
    method: "get",
    params
  });
}


export const phoneUpdate = (params) => {
  return request({
    url: "/api/jobslink-api/serve/phoneUpdate",
    method: "post",
    params
  });
};

export const serveUpdate = (params) => {
  return request({
    url: "/api/jobslink-api/serve/serveUpdate",
    method: "post",
    params
  });
};

export const serveRegion = (params) => {
  return request({
    url: "/api/jobslink-api/serve/region",
    method: "get",
    params
  });
};


export const serveExitReason = (params) => {
  return request({
    url: "/api/jobslink-api/serve/exitReason",
    method: "get",
    params
  });
};


export const getMsgContent = (params) => {
  return request({
    url: "/api/jobslink-api/serve/getMsgContent",
    method: "get",
    params
  });
};

export const pushMsg = (params) => {
  return request({
    url: "/api/jobslink-api/serve/push/msg",
    method: "POST",
    data: params
  });
};
