编制信息导出

This commit is contained in:
Chengliang 2024-06-25 14:29:31 +08:00
parent a5c7400b99
commit 38f2b63034
4 changed files with 39 additions and 4 deletions

View File

@ -1,7 +1,9 @@
import {
WeaTools
WeaTools,
WeaLocaleProvider
} from 'ecCom'
const getLabel = WeaLocaleProvider.getLabel;
export const getSearchList = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/staff/getTable', 'GET', params);
@ -50,4 +52,19 @@ export const getForm = (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);
}))
});
}

View File

@ -131,6 +131,14 @@ export default class Staff extends React.Component {
}
exportStaff() {
const {
staff
} = this.props;
staff.exportData();
}
log = () => {
window.setLogViewProp({
logMoudleType: 13,
@ -488,7 +496,7 @@ export default class Staff extends React.Component {
} = this.props;
const {
isPanelShow, form2, staffName, conditionNum, tableStore, nEdialogTitle, visible, condition,
form, dialogLoading, isEdit, date, hasRight
form, dialogLoading, isEdit, date, hasRight,exSpinning
} = staff;
const {importVisible} = importDialog;
@ -528,7 +536,7 @@ export default class Staff extends React.Component {
onSearchChange={val => this.onSearchChange(val)}
replaceLeft={this.replaceLeft()}
/>
<Spin size="large" spinning={exSpinning} tip={getLabel(547647,'正在导出请稍候....')} className="hrm-loading-center-small"/>
<WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@pgmg3x`}
comsWeaTableStore={tableStore}
hasOrder={true}

View File

@ -1064,7 +1064,7 @@ export const i18n = {
checkOnDetach: () => getLabel(547620, '确定启用组织管理分权吗'),
checkOffDetach: () => getLabel(547621, '确定取消组织管理分权吗'),
checkResume: () => getLabel(547657, '简历模板加载失败'),
checkStaff: () => getLabel(547734, '请选择编制方案后导出数据'),
authFailed: () => getLabel(2012, '对不起,您暂时没有权限!'),
actionError: () => getLabel(132200, '操作失败!'),

View File

@ -48,6 +48,7 @@ export class StaffStore {
@observable date = '';
@observable hasRight = '';
@observable operateType = ''; //1 编辑 2 变更
@observable exSpinning = false;
@observable companysId = 1;
@observable planId = '';
@ -86,6 +87,15 @@ export class StaffStore {
}
@action("导出") async exportData() {
if(this.planId.length == 0) {
return message.warning(i18n.message.checkStaff())
}
this.exSpinning = true;
await Api.exportData(this.planId);
this.exSpinning = false;
}
//删除
delete() {
let params = {