diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js index c63452f8..50c23bf9 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js @@ -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 diff --git a/pc4mobx/hrmSalary/pages/ledger/addUserModal.js b/pc4mobx/hrmSalary/pages/ledger/addUserModal.js index 32b6efeb..80eb615f 100644 --- a/pc4mobx/hrmSalary/pages/ledger/addUserModal.js +++ b/pc4mobx/hrmSalary/pages/ledger/addUserModal.js @@ -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 { 对象类型: -
+
选择员工状态: + { + if (checkAll === "1") { + const checked = _.map(employeeStatus, it => it.key); + this.setState({ + checkAll: "1", + radioValue: checked.join(",") + }); + } else { + this.setState({ + checkAll: "0", + radioValue: "" + }); + } + }}/> 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} /> diff --git a/pc4mobx/hrmSalary/pages/taxAgent/addTaxAgentModal.js b/pc4mobx/hrmSalary/pages/taxAgent/addTaxAgentModal.js index 770ddcae..23d14a23 100644 --- a/pc4mobx/hrmSalary/pages/taxAgent/addTaxAgentModal.js +++ b/pc4mobx/hrmSalary/pages/taxAgent/addTaxAgentModal.js @@ -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 (
-
- {this.state.selectedKey == "EMPLOYEE" && ( +
+ {this.state.selectedKey === "EMPLOYEE" && ( )} - {this.state.selectedKey == "DEPT" && ( + {this.state.selectedKey === "DEPT" && ( )} - {this.state.selectedKey == "SUBCOMPANY" && ( + {this.state.selectedKey === "SUBCOMPANY" && ( )} - {this.state.selectedKey == "POSITION" && ( + {this.state.selectedKey === "POSITION" && ( 选择员工状态 - + + { + if (checkAll === "1") { + const checked = _.map(employeeStatus, it => it.id); + this.setState({ + checkAll: '1', + checkboxValue: checked.join(",") + }); + } else { + this.setState({ + checkAll: '0', + checkboxValue: '' + }); + } + }}/>