薪资账套关联人员添加导入人员的功能
This commit is contained in:
parent
3c6306638d
commit
03d282f0f3
|
|
@ -282,3 +282,11 @@ export const getBackitemForm = params => {
|
|||
export const salarysobBackitemSave = params => {
|
||||
return postFetch("/api/bs/hrmsalary/salarysob/backitem/save", params);
|
||||
};
|
||||
//预览人员范围导入
|
||||
export const salarysobRangePreview = params => {
|
||||
return postFetch("/api/bs/hrmsalary/salarysob/range/preview", params);
|
||||
};
|
||||
//导入人员范围
|
||||
export const salarysobRangeImportData = params => {
|
||||
return postFetch("/api/bs/hrmsalary/salarysob/range/importData", params);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
import React, { Component } from "react";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { message, Modal } from "antd";
|
||||
import { Button, message, Modal } from "antd";
|
||||
import { WeaButtonIcon, WeaInputSearch, WeaTab } from "ecCom";
|
||||
import PersonalScopeTable from "../../../components/PersonalScopeTable";
|
||||
import PersonalScopeModal from "../../../components/PersonalScopeModal";
|
||||
|
|
@ -14,8 +14,13 @@ import {
|
|||
deleteLedgerPersonRange,
|
||||
getLedgerPersonRangeExclude,
|
||||
getLedgerPersonRangeInclude,
|
||||
salarysobRangeImportData,
|
||||
salarysobRangePreview,
|
||||
saveLedgerPersonRange
|
||||
} from "../../../apis/ledger";
|
||||
import ImportModal from "../../../components/importModal";
|
||||
import { importEmployColumns } from "../../taxAgent/columns";
|
||||
|
||||
|
||||
const APIFox = {
|
||||
listInclude: getLedgerPersonRangeInclude,
|
||||
|
|
@ -34,6 +39,12 @@ class LedgerAssociatedPersonnel extends Component {
|
|||
searchValue: "",
|
||||
selectedKey: "listInclude",
|
||||
rowKeys: [],
|
||||
previewDataSource: [],
|
||||
importParams: {
|
||||
visible: false,
|
||||
step: 0,
|
||||
importResult: {}
|
||||
},
|
||||
personalAddModal: {
|
||||
visible: false,
|
||||
title: "关联人员",
|
||||
|
|
@ -82,9 +93,55 @@ class LedgerAssociatedPersonnel extends Component {
|
|||
}
|
||||
});
|
||||
};
|
||||
/*
|
||||
* Author: 黎永顺
|
||||
* Description:清空导入弹框列表数据
|
||||
* Params:
|
||||
* Date: 2023/1/9
|
||||
*/
|
||||
handleInitModal = () => {
|
||||
this.setState({
|
||||
previewDataSource: [],
|
||||
importParams: {
|
||||
...this.state.importParams,
|
||||
importResult: {}
|
||||
}
|
||||
});
|
||||
};
|
||||
handleImportFile = (params) => {
|
||||
const { editId: salarySobId } = this.props;
|
||||
salarysobRangeImportData({ ...params, salarySobId }).then(({ status, data }) => {
|
||||
if (status) {
|
||||
data.errorData = data.errorNotice;
|
||||
this.setState({
|
||||
importParams: {
|
||||
...this.state.importParams,
|
||||
importResult: data
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
salarysobRangePreview = (params) => {
|
||||
salarysobRangePreview(params).then(({ status, data }) => {
|
||||
if (status) {
|
||||
const { preview } = data;
|
||||
this.setState({
|
||||
previewDataSource: preview
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
render() {
|
||||
const { selectedKey, searchValue, rowKeys, personalAddModal } = this.state;
|
||||
const {
|
||||
selectedKey,
|
||||
searchValue,
|
||||
rowKeys,
|
||||
personalAddModal,
|
||||
importParams,
|
||||
previewDataSource
|
||||
} = this.state;
|
||||
const { taxAgentStore: { showOperateBtn }, editId, saveSalarySobId } = this.props;
|
||||
const topTab = [
|
||||
{
|
||||
|
|
@ -97,6 +154,14 @@ class LedgerAssociatedPersonnel extends Component {
|
|||
}
|
||||
];
|
||||
const btns = showOperateBtn ? [
|
||||
<Button type="primary" onClick={() => this.setState({
|
||||
importParams: {
|
||||
...this.state.importParams,
|
||||
visible: true,
|
||||
step: 0,
|
||||
importResult: {}
|
||||
}
|
||||
})}>导入</Button>,
|
||||
<WeaButtonIcon
|
||||
buttonType="del"
|
||||
type="primary"
|
||||
|
|
@ -124,7 +189,7 @@ class LedgerAssociatedPersonnel extends Component {
|
|||
datas={topTab}
|
||||
keyParam="viewcondition" //主键
|
||||
selectedKey={selectedKey}
|
||||
buttons={btns}
|
||||
buttons={showOperateBtn && selectedKey === "listExclude" ? btns.slice(1) : btns}
|
||||
onChange={selectedKey => this.setState({ selectedKey })}
|
||||
/>
|
||||
<PersonalScopeTable
|
||||
|
|
@ -135,6 +200,37 @@ class LedgerAssociatedPersonnel extends Component {
|
|||
searchValue={searchValue}
|
||||
onChangeSelectKey={rowKeys => this.setState({ rowKeys })}
|
||||
/>
|
||||
{/*关联人员范围导入*/}
|
||||
{importParams.visible && (
|
||||
<ImportModal
|
||||
init={() => {
|
||||
this.handleInitModal();
|
||||
}}
|
||||
isInit={false}
|
||||
columns={importEmployColumns}
|
||||
slideDataSource={previewDataSource}
|
||||
step={importParams.step}
|
||||
setStep={(step) => {
|
||||
this.setState({ importParams: { ...this.state.importParams, step } });
|
||||
}}
|
||||
importResult={importParams.importResult}
|
||||
onFinish={() => {
|
||||
this.setState({
|
||||
importParams: {
|
||||
...this.state.importParams,
|
||||
visible: false
|
||||
}
|
||||
}, () => this.personalScopeTableRef.getPersonalScopeList());
|
||||
}}
|
||||
previewImport={(params) => this.salarysobRangePreview(params)}
|
||||
importFile={(params) => this.handleImportFile(params)}
|
||||
templateLink={`/api/bs/hrmsalary/salarysob/range/downloadTemplate?salarySobId=${editId}`}
|
||||
visiable={importParams.visible}
|
||||
onCancel={() => {
|
||||
this.setState({ importParams: { ...this.state.importParams, visible: false } });
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{/*新增人员范围*/}
|
||||
<PersonalScopeModal
|
||||
{...personalAddModal}
|
||||
|
|
|
|||
|
|
@ -1,25 +1,47 @@
|
|||
export const columns = [
|
||||
{
|
||||
title: "序号",
|
||||
dataIndex: 'title',
|
||||
key: 'title',
|
||||
},
|
||||
{
|
||||
title: "个税扣缴义务人",
|
||||
dataIndex: 'title',
|
||||
key: 'title',
|
||||
},
|
||||
{
|
||||
title: "备注",
|
||||
dataIndex: 'title',
|
||||
key: 'title',
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
dataIndex: 'title',
|
||||
key: 'title',
|
||||
}
|
||||
]
|
||||
{
|
||||
title: "序号",
|
||||
dataIndex: "title",
|
||||
key: "title"
|
||||
},
|
||||
{
|
||||
title: "个税扣缴义务人",
|
||||
dataIndex: "title",
|
||||
key: "title"
|
||||
},
|
||||
{
|
||||
title: "备注",
|
||||
dataIndex: "title",
|
||||
key: "title"
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
dataIndex: "title",
|
||||
key: "title"
|
||||
}
|
||||
];
|
||||
export const importEmployColumns = [
|
||||
{
|
||||
title: "姓名",
|
||||
dataIndex: "username",
|
||||
key: "username"
|
||||
},
|
||||
{
|
||||
title: "部门",
|
||||
dataIndex: "departmentName",
|
||||
key: "departmentName"
|
||||
},
|
||||
{
|
||||
title: "工号",
|
||||
dataIndex: "jobNum",
|
||||
key: "jobNum"
|
||||
},
|
||||
{
|
||||
title: "手机号",
|
||||
dataIndex: "mobile",
|
||||
key: "mobile"
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
export const dataSource = [];
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import { WeaInputSearch, WeaTable } from "ecCom";
|
|||
import AddTaxAgentModal from "./addTaxAgentModal";
|
||||
import ImportModal from "../../components/importModal";
|
||||
import { taxAgentRangeImportData, taxAgentRangePreview } from "../../apis/taxAgent";
|
||||
import { importEmployColumns } from "./columns";
|
||||
|
||||
|
||||
export default class SlideTaxagentUser extends React.Component {
|
||||
constructor(props) {
|
||||
|
|
@ -13,7 +15,6 @@ export default class SlideTaxagentUser extends React.Component {
|
|||
includeType: 1,
|
||||
selectedRowKeys: [],
|
||||
searchValue: "",
|
||||
previewColumns: [],
|
||||
previewDataSource: [],
|
||||
importParams: {
|
||||
visible: false,
|
||||
|
|
@ -93,22 +94,9 @@ export default class SlideTaxagentUser extends React.Component {
|
|||
salaryArchivePreview = (params) => {
|
||||
taxAgentRangePreview(params).then(({ status, data }) => {
|
||||
if (status) {
|
||||
const { headers, list } = data;
|
||||
const { preview } = data;
|
||||
this.setState({
|
||||
previewColumns: headers.map((item, index) => {
|
||||
return {
|
||||
key: index,
|
||||
title: item,
|
||||
dataIndex: index
|
||||
};
|
||||
}),
|
||||
previewDataSource: list.map(item => {
|
||||
let result = {};
|
||||
item.map((i, index) => {
|
||||
result[index] = i;
|
||||
});
|
||||
return result;
|
||||
})
|
||||
previewDataSource: preview
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -121,7 +109,6 @@ export default class SlideTaxagentUser extends React.Component {
|
|||
searchValue,
|
||||
addTaxagentModalVisible,
|
||||
importParams,
|
||||
previewColumns,
|
||||
previewDataSource
|
||||
} = this.state;
|
||||
const {
|
||||
|
|
@ -279,7 +266,7 @@ export default class SlideTaxagentUser extends React.Component {
|
|||
this.handleInitModal();
|
||||
}}
|
||||
isInit={false}
|
||||
columns={previewColumns}
|
||||
columns={importEmployColumns}
|
||||
slideDataSource={previewDataSource}
|
||||
step={importParams.step}
|
||||
setStep={(step) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue