新增人员添加全选的按钮
This commit is contained in:
parent
a348e5e3db
commit
35633d753e
|
|
@ -416,10 +416,10 @@ export default class CumDeduct extends React.Component {
|
|||
const { monthValue: declareMonth, taxAgentId } = this.state;
|
||||
const { cumDeductStore: { doSearch } } = this.props;
|
||||
this.setState({ addAllLoading: true });
|
||||
API.autoAddAll({}).then(({ status, errormsg }) => {
|
||||
API.autoAddAll({ yearMonth: declareMonth }).then(({ status, data, errormsg }) => {
|
||||
this.setState({ addAllLoading: false });
|
||||
if (status) {
|
||||
message.success("操作成功");
|
||||
message.success(data || "操作成功");
|
||||
doSearch({
|
||||
declareMonth: [declareMonth],
|
||||
taxAgentId: taxAgentId === "All" ? "" : taxAgentId
|
||||
|
|
|
|||
|
|
@ -1,9 +1,19 @@
|
|||
import React from "react";
|
||||
import { Button, Col, Row } from "antd";
|
||||
import { WeaBrowser, WeaDialog, WeaSelect } from "ecCom";
|
||||
import { WeaBrowser, WeaCheckbox, WeaDialog, WeaSelect } from "ecCom";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import "./index.less";
|
||||
|
||||
const employeeStatus = [
|
||||
{ key: "", showname: "" },
|
||||
{ key: "TRIAL", showname: "试用" },
|
||||
{ key: "FORMAL", showname: "正式" },
|
||||
{ key: "TEMPORARY", showname: "临时" },
|
||||
{ key: "DELAY", showname: "试用延期" },
|
||||
{ key: "FIRE", showname: "解雇" },
|
||||
{ key: "DEPARTURE", showname: "离职" },
|
||||
{ key: "RETIRED", showname: "退休" }
|
||||
];
|
||||
const objectOptions = [
|
||||
{
|
||||
key: "EMPLOYEE",
|
||||
|
|
@ -35,12 +45,26 @@ export default class AddUserModal extends React.Component {
|
|||
this.state = {
|
||||
selectedKey: "EMPLOYEE",
|
||||
radioValue: "",
|
||||
checkAll: "0",
|
||||
ids: ""
|
||||
};
|
||||
}
|
||||
|
||||
onRadioChange(radioValue) {
|
||||
this.setState({ radioValue });
|
||||
const checked = _.map(employeeStatus, it => it.key);
|
||||
this.setState({ radioValue }, () => {
|
||||
const { radioValue } = this.state;
|
||||
const bool = _.every(checked, it => radioValue.indexOf(it) !== -1);
|
||||
if (bool) {
|
||||
this.setState({
|
||||
checkAll: "1"
|
||||
});
|
||||
} else {
|
||||
this.setState({
|
||||
checkAll: "0"
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 保存
|
||||
|
|
@ -51,7 +75,7 @@ export default class AddUserModal extends React.Component {
|
|||
saveLedgerPersonRange({
|
||||
salarySobId: salarySobId,
|
||||
includeType: includeType,
|
||||
employeeStatus: this.state.radioValue.split(','),
|
||||
employeeStatus: this.state.radioValue.split(","),
|
||||
targetParams: this.state.ids
|
||||
.split(",")
|
||||
.map((id) => ({ targetType: this.state.selectedKey, targetId: id }))
|
||||
|
|
@ -63,6 +87,7 @@ export default class AddUserModal extends React.Component {
|
|||
this.setState({
|
||||
selectedKey: "EMPLOYEE",
|
||||
radioValue: "",
|
||||
checkAll: "0",
|
||||
ids: ""
|
||||
});
|
||||
}
|
||||
|
|
@ -98,7 +123,7 @@ export default class AddUserModal extends React.Component {
|
|||
<Row style={{ lineHeight: "40px" }}>
|
||||
<Col span={5}>对象类型:</Col>
|
||||
<Col span={16}>
|
||||
<div style={{ display: "inline-block", verticalAlign: "top",marginRight: 10 }}>
|
||||
<div style={{ display: "inline-block", verticalAlign: "top", marginRight: 10 }}>
|
||||
<WeaSelect
|
||||
options={objectOptions}
|
||||
value={this.state.selectedKey}
|
||||
|
|
@ -166,23 +191,26 @@ export default class AddUserModal extends React.Component {
|
|||
<Row style={{ lineHeight: "40px" }}>
|
||||
<Col span={5}>选择员工状态:</Col>
|
||||
<Col span={16}>
|
||||
<WeaCheckbox value={this.state.checkAll} content="全选" onChange={(checkAll) => {
|
||||
if (checkAll === "1") {
|
||||
const checked = _.map(employeeStatus, it => it.key);
|
||||
this.setState({
|
||||
checkAll: "1",
|
||||
radioValue: checked.join(",")
|
||||
});
|
||||
} else {
|
||||
this.setState({
|
||||
checkAll: "0",
|
||||
radioValue: ""
|
||||
});
|
||||
}
|
||||
}}/>
|
||||
<WeaSelect
|
||||
viewAttr={3}
|
||||
detailtype={2}
|
||||
onChange={(e) => this.onRadioChange(e)}
|
||||
value={this.state.radioValue}
|
||||
options={
|
||||
[
|
||||
{ key: "", showname: "" },
|
||||
{ key: "TRIAL", showname: "试用" },
|
||||
{ key: "FORMAL", showname: "正式" },
|
||||
{ key: "TEMPORARY", showname: "临时" },
|
||||
{ key: "DELAY", showname: "试用延期" },
|
||||
{ key: "FIRE", showname: "解雇" },
|
||||
{ key: "DEPARTURE", showname: "离职" },
|
||||
{ key: "RETIRED", showname: "退休" },
|
||||
]
|
||||
}
|
||||
options={employeeStatus}
|
||||
/>
|
||||
</Col>
|
||||
</Row>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import React from "react";
|
||||
import { Button, Col, Row } from "antd";
|
||||
import { WeaBrowser, WeaDialog, WeaError, WeaSelect } from "ecCom";
|
||||
import { WeaBrowser, WeaCheckbox, WeaDialog, WeaError, WeaSelect } from "ecCom";
|
||||
import "../ledger/index.less";
|
||||
|
||||
export default class AddTaxAgentModal extends React.Component {
|
||||
|
|
@ -9,12 +9,27 @@ export default class AddTaxAgentModal extends React.Component {
|
|||
this.state = {
|
||||
selectedKey: "EMPLOYEE",
|
||||
checkboxValue: "",
|
||||
checkAll: "0",
|
||||
ids: ""
|
||||
};
|
||||
}
|
||||
|
||||
onCheckboxChange = (checkboxValue) => {
|
||||
this.setState({ checkboxValue });
|
||||
const { employeeStatus } = this.props;
|
||||
const checked = _.map(employeeStatus, it => it.id);
|
||||
this.setState({ checkboxValue }, () => {
|
||||
const { checkboxValue } = this.state;
|
||||
const bool = _.every(checked, it => checkboxValue.indexOf(it) !== -1);
|
||||
if (bool) {
|
||||
this.setState({
|
||||
checkAll: "1"
|
||||
});
|
||||
}else{
|
||||
this.setState({
|
||||
checkAll: "0"
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 保存
|
||||
|
|
@ -28,18 +43,18 @@ export default class AddTaxAgentModal extends React.Component {
|
|||
targetId: it
|
||||
}))
|
||||
};
|
||||
if(_.isEmpty(ids) && _.isEmpty(checkboxValue)){
|
||||
if (_.isEmpty(ids) && _.isEmpty(checkboxValue)) {
|
||||
this.refs.weaError.showError();
|
||||
this.refs.weaError1.showError();
|
||||
return
|
||||
return;
|
||||
}
|
||||
if(_.isEmpty(ids)){
|
||||
if (_.isEmpty(ids)) {
|
||||
this.refs.weaError.showError();
|
||||
return
|
||||
return;
|
||||
}
|
||||
if(_.isEmpty(checkboxValue)){
|
||||
if (_.isEmpty(checkboxValue)) {
|
||||
this.refs.weaError1.showError();
|
||||
return
|
||||
return;
|
||||
}
|
||||
onTaxAgentSave && onTaxAgentSave(payload);
|
||||
};
|
||||
|
|
@ -49,13 +64,13 @@ export default class AddTaxAgentModal extends React.Component {
|
|||
this.setState({
|
||||
selectedKey: "EMPLOYEE",
|
||||
checkboxValue: "",
|
||||
checkAll: '0',
|
||||
ids: ""
|
||||
});
|
||||
};
|
||||
|
||||
render() {
|
||||
const { employeeStatus, targetTypeList, visible, onCancel, loading } =
|
||||
this.props;
|
||||
const { employeeStatus, targetTypeList, visible, onCancel, loading } = this.props;
|
||||
return (
|
||||
<WeaDialog
|
||||
visible={visible}
|
||||
|
|
@ -94,8 +109,8 @@ export default class AddTaxAgentModal extends React.Component {
|
|||
}}
|
||||
/>
|
||||
</div>
|
||||
<div style={{ display: "inline-block", verticalAlign: "middle",lineHeight: 0 }}>
|
||||
{this.state.selectedKey == "EMPLOYEE" && (
|
||||
<div style={{ display: "inline-block", verticalAlign: "middle", lineHeight: 0 }}>
|
||||
{this.state.selectedKey === "EMPLOYEE" && (
|
||||
<WeaError tipPosition="bottom"
|
||||
style={{ width: "100%" }}
|
||||
ref="weaError"
|
||||
|
|
@ -113,7 +128,7 @@ export default class AddTaxAgentModal extends React.Component {
|
|||
/>
|
||||
</WeaError>
|
||||
)}
|
||||
{this.state.selectedKey == "DEPT" && (
|
||||
{this.state.selectedKey === "DEPT" && (
|
||||
<WeaError tipPosition="bottom"
|
||||
style={{ width: "100%" }}
|
||||
ref="weaError"
|
||||
|
|
@ -121,27 +136,7 @@ export default class AddTaxAgentModal extends React.Component {
|
|||
<WeaBrowser
|
||||
type={57}
|
||||
viewAttr={3}
|
||||
title={"部门选择"}
|
||||
tabs={[
|
||||
{
|
||||
dataParams: null,
|
||||
dataURL: null,
|
||||
isSearch: false,
|
||||
key: "2",
|
||||
name: "组织结构",
|
||||
selected: false,
|
||||
showOrder: 0
|
||||
},
|
||||
{
|
||||
dataParams: { list: "1" },
|
||||
dataURL: null,
|
||||
isSearch: true,
|
||||
key: "1",
|
||||
name: "按列表",
|
||||
selected: false,
|
||||
showOrder: 0
|
||||
}
|
||||
]}
|
||||
title="部门选择"
|
||||
isSingle={false}
|
||||
inputStyle={{ width: 200 }}
|
||||
value={this.state.ids}
|
||||
|
|
@ -151,7 +146,7 @@ export default class AddTaxAgentModal extends React.Component {
|
|||
/>
|
||||
</WeaError>
|
||||
)}
|
||||
{this.state.selectedKey == "SUBCOMPANY" && (
|
||||
{this.state.selectedKey === "SUBCOMPANY" && (
|
||||
<WeaError tipPosition="bottom"
|
||||
style={{ width: "100%" }}
|
||||
ref="weaError"
|
||||
|
|
@ -169,7 +164,7 @@ export default class AddTaxAgentModal extends React.Component {
|
|||
/>
|
||||
</WeaError>
|
||||
)}
|
||||
{this.state.selectedKey == "POSITION" && (
|
||||
{this.state.selectedKey === "POSITION" && (
|
||||
<WeaError tipPosition="bottom"
|
||||
style={{ width: "100%" }}
|
||||
ref="weaError"
|
||||
|
|
@ -193,10 +188,25 @@ export default class AddTaxAgentModal extends React.Component {
|
|||
<Row style={{ lineHeight: "40px" }}>
|
||||
<Col span={8}>选择员工状态</Col>
|
||||
<Col span={16}>
|
||||
<WeaError tipPosition="bottom"
|
||||
style={{ width: "100%" }}
|
||||
ref="weaError1"
|
||||
error="请选择员工状态">
|
||||
<WeaError
|
||||
tipPosition="bottom"
|
||||
style={{ width: "100%" }}
|
||||
ref="weaError1"
|
||||
error="请选择员工状态">
|
||||
<WeaCheckbox value={this.state.checkAll} content="全选" onChange={(checkAll) => {
|
||||
if (checkAll === "1") {
|
||||
const checked = _.map(employeeStatus, it => it.id);
|
||||
this.setState({
|
||||
checkAll: '1',
|
||||
checkboxValue: checked.join(",")
|
||||
});
|
||||
} else {
|
||||
this.setState({
|
||||
checkAll: '0',
|
||||
checkboxValue: ''
|
||||
});
|
||||
}
|
||||
}}/>
|
||||
<WeaSelect
|
||||
viewAttr={3}
|
||||
detailtype={2}
|
||||
|
|
|
|||
Loading…
Reference in New Issue