diff --git a/pc4mobx/hrmSalary/pages/salary/components/constants.js b/pc4mobx/hrmSalary/pages/salary/components/constants.js index 8682937c..58da8c6b 100644 --- a/pc4mobx/hrmSalary/pages/salary/components/constants.js +++ b/pc4mobx/hrmSalary/pages/salary/components/constants.js @@ -238,7 +238,6 @@ export const deptFillCondition = [ defaultshow: true } ]; - export const taxFillColumns = [ { dataIndex: "taxCode", @@ -292,3 +291,34 @@ export const taxFillColumns = [ titleId: "545141" } ]; +export const personScopeConditions = [ + { + items: [ + { + conditionType: "SELECT_LINKAGE", + domkey: ["targetParams"], + fieldcol: 16, + label: "对象类型", + lanId: 111, + labelcol: 8, + options: [], + rules: "required|string", + selectLinkageDatas: {}, + viewAttr: 3 + }, + { + conditionType: "SELECT", + domkey: ["employeeStatus"], + fieldcol: 16, + label: "选择员工状态", + lanId: 111, + labelcol: 8, + value: "", + detailtype: "2", + rules: "required|string", + viewAttr: 3 + } + ], + defaultshow: true + } +]; diff --git a/pc4mobx/hrmSalary/pages/salary/components/personalScopeModal.js b/pc4mobx/hrmSalary/pages/salary/components/personalScopeModal.js index 9e4c09af..a5ad7786 100644 --- a/pc4mobx/hrmSalary/pages/salary/components/personalScopeModal.js +++ b/pc4mobx/hrmSalary/pages/salary/components/personalScopeModal.js @@ -5,17 +5,23 @@ * Date: 2022/11/30 */ import React, { Component } from "react"; -import { WeaBrowser, WeaDialog, WeaFormItem, WeaSearchGroup, WeaSelect } from "ecCom"; +import { inject, observer } from "mobx-react"; +import { WeaBrowser, WeaDialog, WeaLocaleProvider, WeaTools } from "ecCom"; import { Button, message, Modal } from "antd"; import { getTaxAgentRangeForm, taxAgentRangeSave } from "../../../apis/taxAgent"; -import { SelectWithAll } from "../../socialSecurityBenefits/standingBookDetail/components/regAddEmployee"; -import "./index.less"; +import { personScopeConditions } from "./constants"; +import { getSearchs } from "../../../util"; +const getKey = WeaTools.getKey; +const getLabel = WeaLocaleProvider.getLabel; + +@inject("taxAgentStore") +@observer class PersonalScopeModal extends Component { constructor(props) { super(props); this.state = { - loading: false, + loading: false, conditions: [], employeeStatus: [], targetTypeList: [], targetType: "EMPLOYEE", @@ -26,8 +32,15 @@ class PersonalScopeModal extends Component { }; } + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.visible !== this.props.visible && nextProps.visible) this.getTaxAgentRangeForm(); + if (nextProps.visible !== this.props.visible && !nextProps.visible) { + this.props.taxAgentStore.initPersonScopeForm(); + } + } + componentDidMount() { - this.getTaxAgentRangeForm(); + // this.getTaxAgentRangeForm(); } getTaxAgentRangeForm = () => { @@ -36,8 +49,22 @@ class PersonalScopeModal extends Component { const { employeeStatus, targetTypeList } = data; this.setState({ targetTypeList: _.map(targetTypeList, it => ({ key: it.id, showname: it.name })), - employeeStatus: _.map(employeeStatus, it => ({ key: it.id, showname: it.name })) - }); + employeeStatus: _.map(employeeStatus, it => ({ key: it.id, showname: it.name })), + conditions: _.map(personScopeConditions, item => ({ + ...item, items: _.map(item.items, o => { + if (getKey(o) === "employeeStatus") { + return { + ...o, label: getLabel(o.lanId, o.label), + options: _.map(employeeStatus, it => ({ key: it.id, showname: it.name })) + }; + } + return { + ...o, label: getLabel(o.lanId, o.label), + options: _.map(targetTypeList, it => ({ key: it.id, showname: it.name })) + }; + }) + })) + }, () => this.props.taxAgentStore.personScopeForm.initFormFields(this.state.conditions)); } }); }; @@ -111,78 +138,72 @@ class PersonalScopeModal extends Component { }; render() { - const { onCancel, title, visible } = this.props; - const { employeeStatus, targetTypeList, targetType, status, statusAll, loading } = this.state; + const { onCancel, title, visible, taxAgentStore: { personScopeForm } } = this.props; + const { employeeStatus, targetTypeList, targetType, status, statusAll, loading, conditions } = this.state; const buttons = [ , ]; return ( - { - this.handleReset(); - onCancel(); - }} - > - - -
- this.setState({ targetType })} - /> - {this.renderBrowser()} -
-
- { - SelectWithAll({ - label: "选择员工状态", - options: employeeStatus, - detailtype: 2, - valueAll: statusAll, - value: status, - onChangeAll: ({ selected }) => { - if (selected) { - this.setState({ - status: _.map(employeeStatus, it => it.key).join(","), - statusAll: selected - }); - } else { - this.setState({ - status: "", - statusAll: selected - }); - } - }, - onChange: ({ selected }) => { - const bool = _.every(_.map(employeeStatus, it => it.key), item => selected.split(",").includes(item)); - if (bool) { - this.setState({ - status: selected, - statusAll: "0" - }); - } else { - this.setState({ - status: selected, - statusAll: "" - }); - } - } - }) - } -
+ { + this.handleReset(); + onCancel(); + }}> +
{getSearchs(personScopeForm, conditions, 1, false)}
+ {/**/} + {/* */} + {/*
*/} + {/* this.setState({ targetType })}*/} + {/* />*/} + {/* {this.renderBrowser()}*/} + {/*
*/} + {/* */} + {/* {*/} + {/* SelectWithAll({*/} + {/* label: "选择员工状态",*/} + {/* options: employeeStatus,*/} + {/* detailtype: 2,*/} + {/* valueAll: statusAll,*/} + {/* value: status,*/} + {/* onChangeAll: ({ selected }) => {*/} + {/* if (selected) {*/} + {/* this.setState({*/} + {/* status: _.map(employeeStatus, it => it.key).join(","),*/} + {/* statusAll: selected*/} + {/* });*/} + {/* } else {*/} + {/* this.setState({*/} + {/* status: "",*/} + {/* statusAll: selected*/} + {/* });*/} + {/* }*/} + {/* },*/} + {/* onChange: ({ selected }) => {*/} + {/* const bool = _.every(_.map(employeeStatus, it => it.key), item => selected.split(",").includes(item));*/} + {/* if (bool) {*/} + {/* this.setState({*/} + {/* status: selected,*/} + {/* statusAll: "0"*/} + {/* });*/} + {/* } else {*/} + {/* this.setState({*/} + {/* status: selected,*/} + {/* statusAll: ""*/} + {/* });*/} + {/* }*/} + {/* }*/} + {/* })*/} + {/* }*/} + {/*
*/}
); } diff --git a/pc4mobx/hrmSalary/stores/taxAgent.js b/pc4mobx/hrmSalary/stores/taxAgent.js index d4e25ec5..45fe8041 100644 --- a/pc4mobx/hrmSalary/stores/taxAgent.js +++ b/pc4mobx/hrmSalary/stores/taxAgent.js @@ -12,6 +12,8 @@ export class TaxAgentStore { @observable salarytaxAgentForm = new WeaForm(); //新版个税扣缴义务人表单实体 @observable taxfillInfoForm = new WeaForm(); //报税信息查看form @action setTaxfillInfoForm = () => this.taxfillInfoForm = new WeaForm(); //报税信息form初始化 + @observable personScopeForm = new WeaForm(); //个税扣缴义务人新增人员form + @action initPersonScopeForm = () => this.personScopeForm = new WeaForm(); //个税扣缴义务人新增人员form初始化 @observable deptfillInfoForm = new WeaForm(); //报税信息部门备案form @action initDeptfillInfoForm = () => this.deptfillInfoForm = new WeaForm(); //报税信息部门备案form初始化 @observable advanceForm = new WeaForm(); //权限-角色高级搜索form表单