feature/2.15.1.2407.01-权限

This commit is contained in:
黎永顺 2024-10-09 14:51:55 +08:00
parent b23662c09e
commit 94a4d3a930
3 changed files with 128 additions and 75 deletions

View File

@ -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
}
];

View File

@ -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 = [
<Button type="primary" onClick={this.taxAgentRangeSave} loading={loading}>确定</Button>,
<Button type="ghost" onClick={this.handleReset}>重置</Button>
];
return (
<WeaDialog
initLoadCss
className="personalScopeModalWrapper"
title={title}
visible={visible}
style={{ width: 600 }}
buttons={buttons}
onCancel={() => {
this.handleReset();
onCancel();
}}
>
<WeaSearchGroup col={1} needTigger title="" showGroup center>
<WeaFormItem
label="对象类型"
labelCol={{ span: 6 }}
wrapperCol={{ span: 18 }}
>
<div style={{ display: "flex", alignItems: "center" }}>
<WeaSelect
style={{ width: 60, marginRight: 12 }}
value={targetType}
options={targetTypeList}
onChange={(targetType) => this.setState({ targetType })}
/>
{this.renderBrowser()}
</div>
</WeaFormItem>
{
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: ""
});
}
}
})
}
</WeaSearchGroup>
<WeaDialog initLoadCss title={title} visible={visible} style={{ width: 600 }} buttons={buttons}
onCancel={() => {
this.handleReset();
onCancel();
}}>
<div className="form-dialog-layout">{getSearchs(personScopeForm, conditions, 1, false)}</div>
{/*<WeaSearchGroup col={1} needTigger title="" showGroup center>*/}
{/* <WeaFormItem*/}
{/* label="对象类型"*/}
{/* labelCol={{ span: 6 }}*/}
{/* wrapperCol={{ span: 18 }}*/}
{/* >*/}
{/* <div style={{ display: "flex", alignItems: "center" }}>*/}
{/* <WeaSelect*/}
{/* style={{ width: 60, marginRight: 12 }}*/}
{/* value={targetType}*/}
{/* options={targetTypeList}*/}
{/* onChange={(targetType) => this.setState({ targetType })}*/}
{/* />*/}
{/* {this.renderBrowser()}*/}
{/* </div>*/}
{/* </WeaFormItem>*/}
{/* {*/}
{/* 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: ""*/}
{/* });*/}
{/* }*/}
{/* }*/}
{/* })*/}
{/* }*/}
{/*</WeaSearchGroup>*/}
</WeaDialog>
);
}

View File

@ -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表单