From 38f2b630349493e374436df00c916df2273f3afe Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Tue, 25 Jun 2024 14:29:31 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E5=88=B6=E4=BF=A1=E6=81=AF=E5=AF=BC?= =?UTF-8?q?=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/organization/apis/staff.js | 19 ++++++++++++++++++- .../organization/components/staff/Staff.js | 12 ++++++++++-- pc4mobx/organization/public/i18n.js | 2 +- pc4mobx/organization/stores/staff.js | 10 ++++++++++ 4 files changed, 39 insertions(+), 4 deletions(-) diff --git a/pc4mobx/organization/apis/staff.js b/pc4mobx/organization/apis/staff.js index adc688e..8aa31b9 100644 --- a/pc4mobx/organization/apis/staff.js +++ b/pc4mobx/organization/apis/staff.js @@ -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); + })) + }); } \ No newline at end of file diff --git a/pc4mobx/organization/components/staff/Staff.js b/pc4mobx/organization/components/staff/Staff.js index aca020c..e5f3455 100644 --- a/pc4mobx/organization/components/staff/Staff.js +++ b/pc4mobx/organization/components/staff/Staff.js @@ -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()} /> - + getLabel(547620, '确定启用组织管理分权吗'), checkOffDetach: () => getLabel(547621, '确定取消组织管理分权吗'), checkResume: () => getLabel(547657, '简历模板加载失败'), - + checkStaff: () => getLabel(547734, '请选择编制方案后导出数据'), authFailed: () => getLabel(2012, '对不起,您暂时没有权限!'), actionError: () => getLabel(132200, '操作失败!'), diff --git a/pc4mobx/organization/stores/staff.js b/pc4mobx/organization/stores/staff.js index 21b1b82..ec93739 100644 --- a/pc4mobx/organization/stores/staff.js +++ b/pc4mobx/organization/stores/staff.js @@ -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 = {