feature/2.15.1.2407.01-导入工具
This commit is contained in:
parent
d09c5f1d96
commit
75b6c0969a
|
|
@ -1,5 +1,5 @@
|
|||
import { WeaTools } from "ecCom";
|
||||
import { postFetch } from "../util/request";
|
||||
import { postExportFetch, postFetch } from "../util/request";
|
||||
|
||||
// 薪资项目-获取列表
|
||||
export const getItemList = params => {
|
||||
|
|
@ -84,3 +84,19 @@ export const getSalarySobBySalaryItem = params => {
|
|||
export const syncSalaryItemToSalarySobItem = params => {
|
||||
return postFetch("/api/bs/hrmsalary/salaryitem/syncSalaryItemToSalarySobItem", params);
|
||||
};
|
||||
|
||||
// 导出薪资项目
|
||||
export const exportSalaryitem = (params) => {
|
||||
return postExportFetch("/api/bs/hrmsalary/salaryitem/export", params);
|
||||
};
|
||||
// 下载模板
|
||||
export const downloadTemplate = (params) => {
|
||||
return postExportFetch("/api/bs/hrmsalary/salaryitem/downloadTemplate", params);
|
||||
};
|
||||
|
||||
// 导入薪资项目
|
||||
export const importSalaryitem = (params) => {
|
||||
return postFetch("/api/bs/hrmsalary/salaryitem/import", params);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
import React from "react";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { Button, Dropdown, Menu, message, Modal, Switch } from "antd";
|
||||
import { WeaInputSearch, WeaLocaleProvider, WeaNewScroll, WeaSlideModal, WeaTop } from "ecCom";
|
||||
import { WeaInputSearch, WeaLoadingGlobal, WeaLocaleProvider, WeaNewScroll, WeaSlideModal, WeaTop } from "ecCom";
|
||||
import { renderLoading, toDecimal_n } from "../../util";
|
||||
import CustomTab from "../../components/customTab";
|
||||
import SystemSalaryItemModal from "./systemSalaryItemModal";
|
||||
import { columns } from "./columns";
|
||||
import SlideModalTitle from "../../components/slideModalTitle";
|
||||
|
|
@ -12,6 +11,8 @@ import CustomPaginationTable from "../../components/customPaginationTable";
|
|||
import SyncToSalaryAccountSetDialog from "./syncToSalaryAccountSetDialog";
|
||||
import "../socialSecurityBenefits/programme/index.less";
|
||||
import LogDialog from "../../components/logViewModal";
|
||||
import SalaryItemImportDialog from "./salaryItemImport";
|
||||
import * as API from "../../apis/item";
|
||||
|
||||
const { getLabel } = WeaLocaleProvider;
|
||||
@inject("salaryItemStore", "taxAgentStore", "salaryFileStore")
|
||||
|
|
@ -29,7 +30,8 @@ export default class SalaryItem extends React.Component {
|
|||
searchParams: { current: 1, pageSize: 10, total: 0 },
|
||||
selectedRowKeys: [],
|
||||
syncSalarySetDialog: { visible: false, title: "", id: "" },
|
||||
logDialogVisible: false, filterConditions: "[]"
|
||||
logDialogVisible: false, filterConditions: "[]",
|
||||
salaryItemImpDialog: { visible: false, title: getLabel(24023, "数据导入") }
|
||||
};
|
||||
columns.map(item => {
|
||||
if (item.dataIndex == "refere") {
|
||||
|
|
@ -213,6 +215,19 @@ export default class SalaryItem extends React.Component {
|
|||
filterConditions: targetid ? `[{\"connectCondition\":\"AND\",\"columIndex\":\"targetid\",\"type\":\"=\",\"value\":\"${targetid}\"}]` : "[]"
|
||||
});
|
||||
break;
|
||||
case "export":
|
||||
WeaLoadingGlobal.start();
|
||||
const { selectedRowKeys } = this.state;
|
||||
const promise = API.exportSalaryitem({ ids: selectedRowKeys });
|
||||
WeaLoadingGlobal.destroy();
|
||||
break;
|
||||
case "import":
|
||||
this.setState({
|
||||
salaryItemImpDialog: {
|
||||
...this.state.salaryItemImpDialog, visible: true
|
||||
}
|
||||
});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -220,12 +235,10 @@ export default class SalaryItem extends React.Component {
|
|||
|
||||
render() {
|
||||
const {
|
||||
salaryItemStore,
|
||||
salaryFileStore,
|
||||
taxAgentStore: { showOperateBtn, showSalaryItemBtn, taxAgentOption }
|
||||
salaryItemStore, salaryFileStore, taxAgentStore: { showOperateBtn, showSalaryItemBtn, taxAgentOption }
|
||||
} = this.props;
|
||||
const { userStatusList } = salaryFileStore;
|
||||
const { selectedRowKeys, logDialogVisible, filterConditions } = this.state;
|
||||
const { selectedRowKeys, logDialogVisible, filterConditions, salaryItemImpDialog } = this.state;
|
||||
const { loading, deleteItemRequest, getTableDatas } = salaryItemStore;
|
||||
const {
|
||||
tableDataSource,
|
||||
|
|
@ -257,51 +270,36 @@ export default class SalaryItem extends React.Component {
|
|||
</Menu>
|
||||
);
|
||||
|
||||
const renderRightOperation = () => {
|
||||
return (<div style={{ display: "inline-block" }}>
|
||||
{
|
||||
(showOperateBtn || showSalaryItemBtn) &&
|
||||
<Dropdown.Button overlay={menu} type="primary" onClick={() => handleMenuClick({ key: "1" })}
|
||||
style={{ marginRight: "10px" }}>{getLabel(111, "新增自定义薪资项")}</Dropdown.Button>
|
||||
const buttons = [
|
||||
<Dropdown.Button overlay={menu} type="primary"
|
||||
onClick={() => handleMenuClick({ key: "1" })}>{getLabel(111, "新增自定义薪资项")}</Dropdown.Button>,
|
||||
<Button type="primary" onClick={() => {
|
||||
if (!selectedRowKeys.length) {
|
||||
message.info("未选中任何数据!");
|
||||
return;
|
||||
}
|
||||
{
|
||||
(showOperateBtn || showSalaryItemBtn) &&
|
||||
<Button
|
||||
type="primary"
|
||||
style={{ marginRight: "10px" }}
|
||||
onClick={() => {
|
||||
if (!selectedRowKeys.length) {
|
||||
message.info("未选中任何数据!");
|
||||
return;
|
||||
}
|
||||
Modal.confirm({
|
||||
title: "信息确认",
|
||||
content: `确定要将所选的薪资项(共${selectedRowKeys.length}条数据)删除吗?`,
|
||||
onOk: () => {
|
||||
deleteItemRequest(selectedRowKeys).then(() => {
|
||||
getTableDatas({ ...this.state.searchParams }).then(res => {
|
||||
this.setState({
|
||||
selectedRowKeys: [],
|
||||
searchParams: {
|
||||
...this.state.searchParams,
|
||||
total: res.total
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
Modal.confirm({
|
||||
title: "信息确认",
|
||||
content: `确定要将所选的薪资项(共${selectedRowKeys.length}条数据)删除吗?`,
|
||||
onOk: () => {
|
||||
deleteItemRequest(selectedRowKeys).then(() => {
|
||||
getTableDatas({ ...this.state.searchParams }).then(res => {
|
||||
this.setState({
|
||||
selectedRowKeys: [],
|
||||
searchParams: {
|
||||
...this.state.searchParams,
|
||||
total: res.total
|
||||
}
|
||||
});
|
||||
});
|
||||
}}>{getLabel(32136, "批量删除")}</Button>
|
||||
}
|
||||
<WeaInputSearch value={this.state.searchValue} placeholder={"请输入名称"} onChange={(value) => {
|
||||
this.setState({ searchValue: value });
|
||||
}} onSearch={(value) => {
|
||||
this.handleSearch(value);
|
||||
}}/>
|
||||
</div>);
|
||||
|
||||
};
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
}}>{getLabel(32136, "批量删除")}</Button>,
|
||||
<WeaInputSearch value={this.state.searchValue} placeholder={getLabel(111, "请输入名称")}
|
||||
onChange={value => this.setState({ searchValue: value })}
|
||||
onSearch={value => this.handleSearch(value)}/>
|
||||
];
|
||||
// 新建和修改保存的回调
|
||||
const handleSlideSave = (continueFlag) => {
|
||||
const { salaryItemStore: { saveItem, request, getTableDatas } } = this.props;
|
||||
|
|
@ -367,23 +365,31 @@ export default class SalaryItem extends React.Component {
|
|||
};
|
||||
const rowSelection = {
|
||||
selectedRowKeys,
|
||||
onChange: (selectedRowKeys) => this.setState({ selectedRowKeys }),
|
||||
getCheckboxProps: record => ({
|
||||
disabled: !record.canDelete // Column configuration not to be checked
|
||||
})
|
||||
onChange: (selectedRowKeys) => this.setState({ selectedRowKeys })
|
||||
// getCheckboxProps: record => ({
|
||||
// disabled: !record.canDelete // Column configuration not to be checked
|
||||
// })
|
||||
};
|
||||
return (
|
||||
<div className="mySalaryBenefitsWrapper">
|
||||
<WeaTop title="薪资项目管理" icon={<i className="icon-coms-fa"/>} iconBgcolor="#F14A2D"
|
||||
showDropIcon onDropMenuClick={this.onDropMenuClick}
|
||||
dropMenuDatas={[
|
||||
{
|
||||
key: "import",
|
||||
icon: <i className="icon-coms02-Template-import1"/>,
|
||||
content: getLabel(111, "导入")
|
||||
},
|
||||
{
|
||||
key: "export",
|
||||
icon: <i className="iconfont icon-daochu"/>,
|
||||
content: getLabel(111, "导出")
|
||||
},
|
||||
{
|
||||
key: "log", icon: <i className="iconfont icon-caozuorizhi32"/>,
|
||||
content: getLabel(545781, "操作日志")
|
||||
}
|
||||
]}
|
||||
>
|
||||
<CustomTab searchOperationItem={renderRightOperation()}/>
|
||||
]} buttons={(showOperateBtn || showSalaryItemBtn) ? buttons : buttons.slice(-1)}>
|
||||
<div className="tableWrapper">
|
||||
<WeaNewScroll height="100%">
|
||||
<CustomPaginationTable
|
||||
|
|
@ -425,6 +431,13 @@ export default class SalaryItem extends React.Component {
|
|||
{/*操作日志*/}
|
||||
<LogDialog visible={logDialogVisible} logFunction="salaryitem" filterConditions={filterConditions}
|
||||
onCancel={() => this.setState({ logDialogVisible: false })}/>
|
||||
{/* 导入*/}
|
||||
<SalaryItemImportDialog {...salaryItemImpDialog}
|
||||
onCancel={callback => {
|
||||
this.setState({
|
||||
salaryItemImpDialog: { ...salaryItemImpDialog, visible: false }
|
||||
}, () => callback && this.handleSearch(this.state.searchValue));
|
||||
}}/>
|
||||
{
|
||||
systemItemVisible &&
|
||||
<SystemSalaryItemModal
|
||||
|
|
|
|||
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* 薪资项目导入
|
||||
*
|
||||
* @Author: 黎永顺
|
||||
* @Date: 2024/8/7
|
||||
* @Wechat:
|
||||
* @Email: 971387674@qq.com
|
||||
* @description:
|
||||
*/
|
||||
import React, { Component } from "react";
|
||||
import { WeaCheckbox, WeaLoadingGlobal, WeaLocaleProvider } from "ecCom";
|
||||
import ImportDialog from "../../../components/importDialog";
|
||||
import * as API from "../../../apis/item";
|
||||
|
||||
const getLabel = WeaLocaleProvider.getLabel;
|
||||
|
||||
class Index extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
importDialog: {
|
||||
nextloading: false, link: null, importResult: {}, imageId: "",
|
||||
previewUrl: "/api/bs/hrmsalary/salaryitem/preview", hasData: false
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps, nextContext) {
|
||||
if (nextProps.visible !== this.props.visible && nextProps.visible) {
|
||||
this.setState({ importDialog: { ...this.state.importDialog, link: this.handleExportTemp } });
|
||||
} else {
|
||||
this.setState({
|
||||
importDialog: {
|
||||
nextloading: false, link: null, importResult: {}, imageId: "",
|
||||
previewUrl: "/api/bs/hrmsalary/salaryitem/preview", hasData: false
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
handleExportTemp = () => {
|
||||
const { importDialog } = this.state;
|
||||
const { hasData } = importDialog;
|
||||
WeaLoadingGlobal.start();
|
||||
const promise = API.downloadTemplate({ hasData });
|
||||
WeaLoadingGlobal.destroy();
|
||||
};
|
||||
handleImport = (payload) => {
|
||||
const { importDialog } = this.state, { isExtEmp } = this.props;
|
||||
const { extraPreview } = importDialog;
|
||||
this.setState({ importDialog: { ...importDialog, nextloading: true } });
|
||||
API.importSalaryitem({ ...payload, ...extraPreview, isExtEmp }).then(({ data, status }) => {
|
||||
this.setState({ importDialog: { ...importDialog, nextloading: false } });
|
||||
if (status) {
|
||||
this.setState({
|
||||
importDialog: { ...importDialog, ...payload, importResult: data }
|
||||
});
|
||||
}
|
||||
}).catch(() => this.setState({ importDialog: { ...importDialog, nextloading: false } }));
|
||||
};
|
||||
|
||||
render() {
|
||||
const { importDialog } = this.state;
|
||||
return (
|
||||
<ImportDialog
|
||||
{...this.props} {...importDialog}
|
||||
onResetImportResult={() => this.setState({
|
||||
importDialog: { ...importDialog, importResult: {}, imageId: "", link: null }
|
||||
})}
|
||||
exportDataDom={
|
||||
<WeaCheckbox
|
||||
value={importDialog.hasData ? "1" : "0"}
|
||||
content={getLabel(543208, "导出现有数据")}
|
||||
helpfulTip={getLabel(111, "提示:建议先导出现有最新数据,修改后再导入")}
|
||||
onChange={val => {
|
||||
this.setState({ importDialog: { ...importDialog, hasData: val === "1" } });
|
||||
}}
|
||||
/>
|
||||
}
|
||||
nextCallback={imageId => this.setState({ importDialog: { ...importDialog, imageId } })}
|
||||
nextUplaodCallback={imageId => this.handleImport({ imageId })}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default Index;
|
||||
Loading…
Reference in New Issue