花名册全部导出8万多人效率太慢 切换为标准table导出

This commit is contained in:
Chengliang 2025-03-31 11:39:13 +08:00
parent 51937a5ba8
commit 9b885110c5
3 changed files with 28 additions and 3 deletions

View File

@ -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',

View File

@ -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()}`)

View File

@ -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) {