trunk/pc4mobx/organization/apis/staff.js

70 lines
2.0 KiB
JavaScript

import {
WeaTools,
WeaLocaleProvider
} from 'ecCom'
const getLabel = WeaLocaleProvider.getLabel;
export const getSearchList = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/staff/getTable', 'GET', params);
}
export const deleteTableData = (params) => {
return fetch('/api/bs/hrmorganization/staff/deleteByIds', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const getAdvanceSearchCondition = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/staff/getSearchCondition', 'GET', params);
}
export const add = (params) => {
return fetch('/api/bs/hrmorganization/staff/saveStaff', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const edit = (params) => {
return fetch('/api/bs/hrmorganization/staff/updateStaff', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const getForm = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/staff/getForm', 'GET', params);
}
export const getHasRight = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/staff/getHasRight', 'GET', params);
}
export const exportData = (planId) => {
return new Promise(resolve => {
fetch(`/api/bs/hrmorganization/common/staff/export?planId=${planId}`).then(res => res.blob().then(blob => {
resolve();
var filename=`${getLabel(547733,'编制信息档案')}.xlsx`
var a = document.createElement('a');
var url = window.URL.createObjectURL(blob);
a.href = url;
a.download = filename;
a.click();
window.URL.revokeObjectURL(url);
}))
});
}