diff --git a/pc4mobx/organization/apis/resource.js b/pc4mobx/organization/apis/resource.js index 81a2e76..5a1ae02 100644 --- a/pc4mobx/organization/apis/resource.js +++ b/pc4mobx/organization/apis/resource.js @@ -65,6 +65,12 @@ export const exportResource = (ids) => { } +export const exportExcel = (params) => { + return WeaTools.callApi('/api/ec/dev/table/export', 'POST', params) +} + + + export const saveSearchTemplate = (params) => { return fetch('/api/bs/hrmorganization/hrmresource/saveSearchTemplate', { method: 'POST', diff --git a/pc4mobx/organization/components/resource/resource.js b/pc4mobx/organization/components/resource/resource.js index 35b38c6..d31e309 100644 --- a/pc4mobx/organization/components/resource/resource.js +++ b/pc4mobx/organization/components/resource/resource.js @@ -208,7 +208,7 @@ export default class Resource extends React.Component { btnOnClick={key => { if (key == "1") { tableStore.selectedRowKeysAllPages = []; - resource.export(); + resource.exportExcel(); } if (key == "2") { tableStore.selectedRowKeysAllPages.length > 0 ? resource.export() : message.error(`${i18n.message.checkExport()}`) diff --git a/pc4mobx/organization/stores/resource.js b/pc4mobx/organization/stores/resource.js index 14a7b7f..190bfb9 100644 --- a/pc4mobx/organization/stores/resource.js +++ b/pc4mobx/organization/stores/resource.js @@ -22,7 +22,7 @@ import { import { i18n } from '../public/i18n'; -import { getSecondPath } from '../util/index' +import { getSecondPath,addContentPath } from '../util/index' import { cloneDeep, isEmpty, trim } from 'lodash'; import HrmBaseStore from './baseStore'; @@ -121,6 +121,7 @@ export class ResourceStore extends HrmBaseStore{ } + @observable dataKey = ''; @action("列表") getTableInfo() { this.tableStore = new TableStore(); let params = {}; @@ -152,6 +153,7 @@ export class ResourceStore extends HrmBaseStore{ //this.form2.resetForm(); Api.getSearchList(params).then(res => { if (res.code === 200) { + this.dataKey = res.data.datas; res.data.datas && this.tableStore.getDatas(res.data.datas, 1); } else { message.warning(res.msg); @@ -262,9 +264,26 @@ export class ResourceStore extends HrmBaseStore{ await Api.exportResource(toJS(this.tableStore.selectedRowKeysAllPages).toString()); this.exSpinning = false; this.tableStore.selectedRowKeys = []; - } + @action("全部导出") exportExcel = () => { + if (!this.dataKey) { + return false; + } + const params = { + dataKey:this.dataKey, + filename: getLabel(547539,'人员信息') + } + this.exSpinning = true; + Api.exportExcel(params).then(data => { + if (data.url) { + this.exSpinning = false; + window.location.href = addContentPath(data.url); + } + }) + } + + @action("另存为版本") version(id) { Api.version({ id: id }).then(res => { if (res.code === 200) {