salary-management-front/pc4mobx/hrmSalary/apis/item.js

186 lines
5.0 KiB
JavaScript

import { WeaTools } from 'ecCom';
/**
* 薪资项目api
* @param data
*/
// 薪资项目-获取列表
export const getItemList = params => {
return fetch('/api/bs/hrmsalary/salaryitem/list', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
}).then(res => res.json())
};
//薪资项目的高级搜索
export const getSaCondition = params => {
return WeaTools.callApi('/api/bs/hrmsalary/salaryitem/getSearchCondition', 'GET', params);
};
//数据源列表字典项
export const formulaDatasourceList = params => {
return WeaTools.callApi('/api/bs/hrmsalary/formula/datasource/list', 'GET', params);
};
//薪资项目-系统薪资项目列表
export const getSysItemList = params => {
return fetch('/api/bs/hrmsalary/salaryitem/sysList', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
}).then(res => res.json())
};
//系统薪资项目的高级搜索
export const getSysSaCondition = params => {
return WeaTools.callApi('/api/bs/hrmsalary/salaryitem/getSysSearchCondition', 'GET', params);
}
//薪资项目-批量删除薪资项目
export const deleteItem = params => {
return fetch('/api/bs/hrmsalary/salaryitem/delete', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
}).then(res => res.json())
}
//薪资项目-批量删除列表
export const deleteItemList = params => {
return fetch('/api/bs/hrmsalary/salaryitem/listCanDelete', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
}).then(res => res.json())
}
//薪资项目-新增薪资项目
export const saveItem = params => {
delete params.formulaContent
return fetch('/api/bs/hrmsalary/salaryitem/save', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
}).then(res => res.json())
}
//薪资项目-更新薪资项目
export const updateItem = params => {
return WeaTools.callApi('/api/bs/hrmsalary/salaryitem/update', 'POST', params);
}
//薪资项目-薪资项目详情
export const getItemForm = params => {
return WeaTools.callApi('/api/bs/hrmsalary/salaryitem/getSalaryForm', 'GET', params);
}
//薪资项目-添加系统薪资项目
export const saveSysItem = params => {
return fetch('/api/bs/hrmsalary/salaryitem/saveSys', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
}).then(res => res.json())
}
//获取薪资项目可选的类型(与属性有联动)
export const getItemTypeOption = params => {
return WeaTools.callApi('/api/bs/hrmsalary/salaryitem/listSalaryItemTypeOption', 'GET', params);
}
//获取公式描述
export const getFormulaDes = params => {
return WeaTools.callApi('/api/bs/hrmsalary/formula/des', 'GET', params);
}
// *** 公式 start ***
// 获取公式变量类型
export const formualSearchGroup = params => {
return fetch('/api/bs/hrmsalary/formula/search/group', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
}).then(res => res.json())
}
//获取公式变量字段
export const formualSearchField = params => {
return fetch('/api/bs/hrmsalary/formula/search/field', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
}).then(res => res.json())
}
// /api/bs/hrmsalary/formula/save
// 保存公式
export const saveFormual = params => {
return fetch('/api/bs/hrmsalary/formula/save', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
}).then(res => res.json())
}
// 公式测试
export const testFormual = params => {
return fetch('/api/bs/hrmsalary/formula/mock', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
}).then(res => res.json())
}
// 根据id获取formual
export const detailFormual = params => {
return WeaTools.callApi('/api/bs/hrmsalary/formula/detail', 'GET', params);
}
// *** 公式 end ***
// 列出可以删除的薪资项目
export const listCanDelete = params => {
return fetch('/api/bs/hrmsalary/salaryitem/listCanDelete', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
}).then(res => res.json())
}