trunk/pc4mobx/organization/apis/staff.js

70 lines
2.0 KiB
JavaScript
Raw Normal View History

2022-05-25 14:58:27 +08:00
import {
2024-06-25 14:29:31 +08:00
WeaTools,
WeaLocaleProvider
2022-05-25 14:58:27 +08:00
} from 'ecCom'
2024-06-25 14:29:31 +08:00
const getLabel = WeaLocaleProvider.getLabel;
2022-05-25 14:58:27 +08:00
export const getSearchList = (params) => {
2022-05-26 13:55:26 +08:00
return WeaTools.callApi('/api/bs/hrmorganization/staff/getTable', 'GET', params);
2022-05-25 14:58:27 +08:00
}
export const deleteTableData = (params) => {
2022-05-26 13:55:26 +08:00
return fetch('/api/bs/hrmorganization/staff/deleteByIds', {
2022-05-25 14:58:27 +08:00
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const getAdvanceSearchCondition = (params) => {
2022-05-26 13:55:26 +08:00
return WeaTools.callApi('/api/bs/hrmorganization/staff/getSearchCondition', 'GET', params);
2022-05-25 14:58:27 +08:00
}
export const add = (params) => {
2022-05-26 13:55:26 +08:00
return fetch('/api/bs/hrmorganization/staff/saveStaff', {
2022-05-25 14:58:27 +08:00
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
export const edit = (params) => {
2022-05-26 13:55:26 +08:00
return fetch('/api/bs/hrmorganization/staff/updateStaff', {
2022-05-25 14:58:27 +08:00
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
}
2022-05-26 13:55:26 +08:00
export const getForm = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/staff/getForm', 'GET', params);
2022-05-25 14:58:27 +08:00
}
export const getHasRight = (params) => {
2022-05-26 13:55:26 +08:00
return WeaTools.callApi('/api/bs/hrmorganization/staff/getHasRight', 'GET', params);
2024-06-25 14:29:31 +08:00
}
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);
}))
});
2022-05-25 14:58:27 +08:00
}