/* * 个税扣缴义务人-角色设置 * * @Author: 黎永顺 * @Date: 2024/8/5 * @Wechat: * @Email: 971387674@qq.com * @description: */ import React, { Component } from "react"; import { WeaBrowser, WeaLocaleProvider } from "ecCom"; import { message, Modal } from "antd"; import AddRoleDialog from "../addRoleDialog"; import RoleDetailSetDialog from "../roleDetailSetDialog"; import * as API from "../../../../apis/taxAgent"; import "../index.less"; const getLabel = WeaLocaleProvider.getLabel; class Index extends Component { constructor(props) { super(props); this.state = { addRoleDialog: { visible: false, taxAgentId: "" }, roleSetDialog: { visible: false, roleId: "", name: "" } }; } showRoleSetDialog = (role) => this.setState({ roleSetDialog: { visible: true, roleId: role.id, name: role.name } }); deleteAuthRole = (role) => { Modal.confirm({ title: getLabel(111, "信息确认"), content: getLabel(111, "确认要删除吗?"), onOk: () => { API.deleteAuthRole([role.id]).then(({ status, errormsg }) => { if (status) { message.success(getLabel(111, "操作成功!")); this.props.onSearch(); } else { message.error(errormsg); } }); } }); }; render() { const { addRoleDialog, roleSetDialog } = this.state; const { taxAgent, onSearch } = this.props; const { role } = taxAgent; return ( this.setState({ addRoleDialog: { taxAgentId: taxAgent.id, visible: true } })} replaceDatas={_.map(role, o => ({ id: o.id, name: this.showRoleSetDialog(o)}>{o.name} this.deleteAuthRole(o)}/> }))}/> {/*添加角色*/} this.setState({ addRoleDialog: { ...addRoleDialog, visible: false } }, () => callback && callback())}/> {/*角色详情设置*/} this.setState({ roleSetDialog: { ...roleSetDialog, visible: false } }, () => callback && callback())}/> ); } } export default Index;