feature/2.15.1.2407.01-权限

This commit is contained in:
黎永顺 2024-10-08 17:57:10 +08:00
parent f55898b8a0
commit dd82ecf445
7 changed files with 103 additions and 38 deletions

View File

@ -5,8 +5,11 @@
* Date: 2022/11/22
*/
import React, { Component } from "react";
import { WeaLocaleProvider } from "ecCom";
import "./index.less";
const { getLabel } = WeaLocaleProvider;
class ComHint extends Component {
/*
* Author: 黎永顺
@ -18,9 +21,10 @@ class ComHint extends Component {
const { isChief = true } = this.props;
if (isChief) {
return [
<p>1个税扣缴义务人与档案中的个税扣缴义务人匹配修改个税扣缴义务人名称薪资档案的个税扣缴义务人数据同步更新</p>,
<p>2删除个税扣缴义务人需先确认档案里无人员使用该个税扣缴义务人否则不予删除</p>,
<p>3开启分权需维护个税扣缴义务人的管理员当前总管理员默认有管理员的权限</p>
<p>{getLabel(111, "1、个税扣缴义务人与档案中的个税扣缴义务人匹配修改个税扣缴义务人名称薪资档案的个税扣缴义务人数据同步更新")}</p>,
<p>{getLabel(111, "2、删除个税扣缴义务人需先确认档案里无人员使用该个税扣缴义务人否则不予删除")}</p>,
<p>{getLabel(111, "3、只有薪酬总管理员能够操作个税扣缴义务人的增减和开启/关闭分权;")}</p>,
<p>{getLabel(111, "4、开启分权需维护个税扣缴义务人的管理员当前总管理员默认有管理员的权限")}</p>
];
} else {
return [];
@ -30,7 +34,7 @@ class ComHint extends Component {
render() {
return (
<div className="comHint">
<div className="hintHeader">小提示</div>
<div className="hintHeader">{getLabel(111, "小提示")}</div>
<div className="hintTips">
{this.renderTips()}
</div>

View File

@ -28,6 +28,7 @@
width: 100%;
margin: 16px 0;
border: 1px solid #e5e5e5;
background: #FFF;
.hintHeader {
background: #f6f6f6;

View File

@ -229,7 +229,6 @@ class TaxAgentSlide extends Component {
handleChangeSlideTab = (current) => {
this.setState({ current: Number(current) });
};
handleSubmit = (selectKey) => {
const { taxFilingInfoDialofg, taxAgentId } = this.state;
const { fieldForm } = this.taxInfoRef.state;
@ -267,14 +266,48 @@ class TaxAgentSlide extends Component {
};
render() {
const tabs = [
{ key: 0, title: getLabel(82751, "基础设置") },
{ key: 1, title: getLabel(544342, "报税信息") },
{ key: 2, title: getLabel(124810, "人员范围") }
const {
isEdit, title, visible, onCancel, salaryOn, decentralization, isChief, taxAgentStore: { showOperateBtn }
} = this.props;
const { current, taxAgentId, taxFilingInfoDialofg, loading, verifyLoading } = this.state;
let tabs = [
{
key: 0, title: getLabel(82751, "基础设置"),
createBtns: [
<Button type="primary" onClick={this.handleSave}
loading={loading}>{getLabel(33199, "保存并进入下一步")}</Button>
],
editBtns: [
<Button type="primary" onClick={this.handleSave}
loading={loading}>{getLabel(537558, "保存")}</Button>
],
children: <BaseSettings decentralization={decentralization} isChief={isChief}/>
},
{
key: 1, title: getLabel(544342, "报税信息"),
createBtns: [
<Button type="ghost" loading={verifyLoading}
onClick={() => this.handleSaveAndVerify(true)}>{getLabel(543470, "完成,跳过所有步骤")}</Button>,
<Button type="ghost"
onClick={() => this.setState({ current: current + 1 })}>{getLabel(1402, "下一步")}</Button>
],
editBtns: [
<Button type="primary" loading={verifyLoading}
onClick={() => this.handleSaveAndVerify(false)}>{getLabel(544343, "保存并验证")}</Button>
],
children: <TaxDeclarationInfo ref={dom => this.taxInfoRef = dom} taxAgentId={taxAgentId} isChief={isChief}/>
},
{
key: 2, title: getLabel(124810, "人员范围"),
createBtns: [
<Button type="ghost"
onClick={() => this.setState({ current: current - 1 })}>{getLabel(1876, "上一步")}</Button>
],
editBtns: [],
children: <PersonalScope taxAgentId={taxAgentId}/>
}
];
const { isEdit, title, visible, onCancel, salaryOn, taxAgentStore: { showOperateBtn } } = this.props;
const { current, taxAgentId, taxFilingInfoDialofg } = this.state;
const tabData = !salaryOn ? _.filter(tabs, it => it.key !== 1) : tabs;
tabs = !salaryOn ? _.filter(tabs, it => it.key !== 1) : tabs;
return (
<WeaSlideModal
className="slideOuterWrapper"
@ -287,7 +320,7 @@ class TaxAgentSlide extends Component {
title={
<SlideModalTitle
subtitle={title}
tabs={isEdit ? tabData : []}
tabs={isEdit ? tabs : []}
loading={false}
showOperateBtn={showOperateBtn}
editable={false}
@ -304,16 +337,14 @@ class TaxAgentSlide extends Component {
!isEdit &&
<WeaSteps current={current} style={{ margin: "20px 0" }}>
{
_.map(tabData, item => {
_.map(tabs, item => {
const { key, title } = item;
return <Step description={title} key={key}/>;
})
}
</WeaSteps>
}
{
this.renderChildren()
}
{_.find(tabs, o => current === o.key).children}
<TaxFilingInfoDialofg
{...taxFilingInfoDialofg}
onSubmit={this.handleSubmit}

View File

@ -108,18 +108,18 @@ class TaxAgentTable extends Component {
width: 120,
render: (text, record) =>
<div className="operationWapper">
<a href="javaScript:void(0);"
<a href="javaScript:void(0);" style={{ marginRight: 10 }}
onClick={() => onOperate("edit", record.id)}>{getLabel(501169, "编辑")}</a>
{
isChief &&
<a href="javaScript:void(0);" style={{ marginLeft: 10 }}
<a href="javaScript:void(0);" style={{ marginRight: 10 }}
onClick={() => onOperate("delete", record.id)}>{getLabel(535052, "删除")}</a>
}
<Dropdown
overlay={
<Menu>
<Menu.Item>
<a href="javascript:void(0)" style={{ marginLeft: 10 }}
<a href="javascript:void(0)"
onClick={() => onOperate("log", record.id)}>{getLabel(545781, "操作日志")}</a>
</Menu.Item>
</Menu>

View File

@ -1,5 +1,37 @@
.salaryAgentWrapper {
.wea-new-top-content {
background: #f6f6f6;
padding: 8px 16px 0;
}
.wea-new-top {
.wea-input-focus {
height: 31.36px;
line-height: 0;
}
}
.comContent {
.wea-search-group:first-child {
margin-bottom: 16px;
}
.wea-search-group {
padding: 0;
background: #fff;
.wea-title {
padding: 0 10px;
}
.wea-content {
padding: 0;
.wea-form-item {
padding-left: 18px;
}
}
}
.customTitleWrapper {
width: 100%;

View File

@ -5,8 +5,8 @@ import { WeaCheckbox, WeaFormItem, WeaInputSearch, WeaLocaleProvider, WeaSearchG
import ComHint from "./components/comHint";
import TaxAgentTable from "./components/taxAgentTable";
import TaxAgentSlide from "./components/taxAgentSlide";
import * as API from "../../apis/taxAgent";
import LogDialog from "../../components/logViewModal";
import * as API from "../../apis/taxAgent";
import "./index.less";
const { getLabel } = WeaLocaleProvider;
@ -20,10 +20,9 @@ class TaxAgent extends Component {
syncLoading: false, //同步人员范围loading
searchValue: "",
decentralization: "0", //启用分权
permission: {},
taxAgentSlideProps: {
isEdit: false, visible: false, title: getLabel(543629, "新增个税扣缴义务人"),
taxAgentId: "", current: 0, salaryOn: true
taxAgentId: "", current: 0, salaryOn: false
},
logDialogVisible: false,
filterConditions: "[]"
@ -33,7 +32,6 @@ class TaxAgent extends Component {
componentDidMount() {
this.getTaxAgentBaseForm();
this.getPermission();
}
getTaxAgentBaseForm = () => {
@ -44,14 +42,6 @@ class TaxAgent extends Component {
}
});
};
getPermission = () => {
const { taxAgentStore: { getPermission } } = this.props;
getPermission().then(({ status, data }) => {
if (status) {
this.setState({ permission: data });
}
});
};
/*
* Author: 黎永顺
* Description:开启关闭个税扣缴义务人开关
@ -71,7 +61,6 @@ class TaxAgent extends Component {
if (status) {
message.success(`${devolutionStatus === "0" ? "停用" : "启用"}分权成功`);
this.getTaxAgentBaseForm();
this.getPermission();
this.taxAgentTableRef.getTaxAgentList();
setSalarytaxAgentForm();
} else {
@ -172,9 +161,9 @@ class TaxAgent extends Component {
};
render() {
const { taxAgentStore: { PageAndOptAuth: permission } } = this.props;
const {
searchValue, decentralization, taxAgentSlideProps,
permission, syncLoading, logDialogVisible, filterConditions
searchValue, decentralization, taxAgentSlideProps, syncLoading, logDialogVisible, filterConditions
} = this.state;
const btns = [
<Button type="primary" onClick={this.taxAgentRangeSync}
@ -196,13 +185,14 @@ class TaxAgent extends Component {
</Button>
}
</div>;
const showOperateBtn = permission.opts.includes("admin");
return (
<div className="salaryAgentWrapper">
<WeaTop
title={getLabel(537996, "个税扣缴义务人")}
icon={<i className="icon-coms-fa"/>}
iconBgcolor="#F14A2D"
buttons={btns}
buttons={showOperateBtn ? btns : btns.slice(1)}
showDropIcon onDropMenuClick={key => this.handleOperate(key)}
dropMenuDatas={[
{
@ -214,13 +204,13 @@ class TaxAgent extends Component {
<div className="comContent">
{
permission.isChief &&
<WeaSearchGroup title={getLabel(82743, "基础信息")} showGroup>
<WeaSearchGroup title={getLabel(82743, "基础信息")} showGroup needTigger={false}>
<WeaFormItem label={getLabel(543639, "启用分权")} labelCol={{ span: 6 }} wrapperCol={{ span: 18 }}>
<WeaCheckbox value={decentralization} display="switch" onChange={this.taxAgentBaseSave}/>
</WeaFormItem>
</WeaSearchGroup>
}
<WeaSearchGroup title={customTitle} showGroup>
<WeaSearchGroup title={customTitle} showGroup needTigger={false}>
<TaxAgentTable searchValue={searchValue} onOperate={this.handleOperate}
isChief={permission.isChief} //isChief- 是否是总管理员
ref={dom => this.taxAgentTableRef = dom}/>

View File

@ -9,6 +9,11 @@ import { PAGE } from "../config";
const { TableStore } = WeaTableNew;
export class TaxAgentStore {
@observable salarytaxAgentForm = new WeaForm(); //新版个税扣缴义务人表单实体
@observable taxfillInfoForm = new WeaForm(); //报税信息查看form
@action setTaxfillInfoForm = () => this.taxfillInfoForm = new WeaForm(); //报税信息form初始化
@observable deptfillInfoForm = new WeaForm(); //报税信息部门备案form
@action initDeptfillInfoForm = () => this.deptfillInfoForm = new WeaForm(); //报税信息部门备案form初始化
@observable advanceForm = new WeaForm(); //权限-角色高级搜索form表单
@observable roleForm = new WeaForm(); //权限-角色form表单
@action initRoleForm = () => this.roleForm = new WeaForm();
@ -52,6 +57,8 @@ export class TaxAgentStore {
@action setStatisticsReportBtn = bool => (this.statisticsReportBtn = bool);//薪酬统计报表权限
@action setPayrollPermission = bool => (this.payrollPermission = bool);// 薪资核算页面权限
@action setSalarytaxAgentForm = () => (this.salarytaxAgentForm = new WeaForm());//薪资项目权限
// 初始化操作
@action
doInit = params => {