diff --git a/pc4mobx/hrmSalary/apis/taxAgent.js b/pc4mobx/hrmSalary/apis/taxAgent.js index f3c527b1..fff90ce4 100644 --- a/pc4mobx/hrmSalary/apis/taxAgent.js +++ b/pc4mobx/hrmSalary/apis/taxAgent.js @@ -98,3 +98,14 @@ export const getTaxAgentSelectListAsAdmin = (params) => { export const hasIconInTax = (params) => { return WeaTools.callApi("/api/bs/hrmsalary/sys/conf/code?code=hideIconInTax", "GET", params); }; + +/**权限-角色相关*/ +//保存角色 +export const saveAuthRole = (params) => { + return postFetch("/api/bs/hrmsalary/auth/role/save", params); +}; +//删除角色 +export const deleteAuthRole = (params) => { + return postFetch("/api/bs/hrmsalary/auth/role/delete", params); +}; + diff --git a/pc4mobx/hrmSalary/pages/taxAgent/components/addRoleDialog/index.js b/pc4mobx/hrmSalary/pages/taxAgent/components/addRoleDialog/index.js index 3bee7608..e196b343 100644 --- a/pc4mobx/hrmSalary/pages/taxAgent/components/addRoleDialog/index.js +++ b/pc4mobx/hrmSalary/pages/taxAgent/components/addRoleDialog/index.js @@ -10,9 +10,10 @@ import React, { Component } from "react"; import { inject, observer } from "mobx-react"; import { WeaDialog, WeaLocaleProvider } from "ecCom"; +import { Button, message } from "antd"; import { getSearchs } from "../../../../util"; import { roleConditions } from "../conditions"; -import { Button } from "antd"; +import * as API from "../../../../apis/taxAgent"; import "../index.less"; const getLabel = WeaLocaleProvider.getLabel; @@ -33,20 +34,43 @@ class Index extends Component { conditions: _.map(roleConditions, item => ({ ...item, items: _.map(item.items, o => ({ ...o, label: getLabel(o.lanId, o.label) })) })) - }, () => this.props.taxAgentStore.roleForm(this.state.conditions)); + }, () => nextProps.taxAgentStore.roleForm.initFormFields(this.state.conditions)); } - if (nextProps.visible !== this.props.visible && !nextProps.visible) this.props.taxAgentStore.initRoleForm(); + if (nextProps.visible !== this.props.visible && !nextProps.visible) nextProps.taxAgentStore.initRoleForm(); } + save = (isSetting) => { + const { taxAgentStore: { roleForm }, taxAgentId } = this.props; + roleForm.validateForm().then(f => { + if (f.isValid) { + const payload = roleForm.getFormParams(); + this.setState({ loading: true }); + API.saveAuthRole({ ...payload, taxAgentId }).then(({ status, data, errormsg }) => { + this.setState({ loading: false }); + if (status) { + message.success(getLabel(111, "操作成功!")); + this.props.onCancel(() => this.props.onSearch()); + isSetting && this.props.showRoleSetDialog({ id: data, name: payload.name }); + } else { + message.error(errormsg); + } + }); + } else { + f.showErrors(); + } + }); + }; + render() { - const { conditions } = this.state; + const { conditions, loading, roleSetDialog } = this.state; const { taxAgentStore: { roleForm } } = this.props; return ( {getLabel(111, "保存")}, - + , + ]} >
{getSearchs(roleForm, conditions, 1, false)}
diff --git a/pc4mobx/hrmSalary/pages/taxAgent/components/index.less b/pc4mobx/hrmSalary/pages/taxAgent/components/index.less index 7d064e3e..aa53099d 100644 --- a/pc4mobx/hrmSalary/pages/taxAgent/components/index.less +++ b/pc4mobx/hrmSalary/pages/taxAgent/components/index.less @@ -6,9 +6,77 @@ cursor: default !important; } + .wea-field-readonly.border .child-item { + margin-bottom: 4px; + } + .only-operate { - white-space: normal !important; - display: inline !important; - color: #2db7f5; + position: relative; + + & > a { + white-space: normal !important; + display: inline !important; + color: #2db7f5; + } + + } + + .only-operate:hover { + .ant-select-selection__choice__remove { + visibility: visible; + } + } + + .ant-select-selection__choice__remove:before { + content: "\E62D"; + font-family: anticon !important; + } + + .ant-select-selection__choice__remove { + visibility: hidden; + right: -3px; + font-size: 12px !important; + top: 50%; + margin-top: -6px; + text-decoration: none; + position: static; + padding: 0; + cursor: pointer; + transform: scale(.66666667) rotate(0deg); + } +} + +.tax_role_set_dialog { + .tax_role_set_container { + padding: 10px 25px; + + .tax_role_row_groupname { + padding: 10px 0; + } + + .tax_role_form_item { + min-height: 190px; + border: 1px solid rgb(217, 217, 217); + + & > .wea-select { + margin: 10px 10px 0 20px; + line-height: 25px; + } + + .tax_role_operator_setting { + border-top: 1px solid rgb(217, 217, 217); + padding: 8px; + display: table; + width: 100%; + + & > div { + text-align: right; + } + } + + .tax_role_browser_form_item { + margin: 12px 14px; + } + } } } diff --git a/pc4mobx/hrmSalary/pages/taxAgent/components/roleDetailSetDialog/index.js b/pc4mobx/hrmSalary/pages/taxAgent/components/roleDetailSetDialog/index.js new file mode 100644 index 00000000..d39d5af8 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/taxAgent/components/roleDetailSetDialog/index.js @@ -0,0 +1,123 @@ +/* + * 角色详情设置弹窗 + * + * @Author: 黎永顺 + * @Date: 2024/8/5 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import { WeaBrowser, WeaDialog, WeaFormItem, WeaInput, WeaLocaleProvider, WeaSelect, WeaTab, WeaTextarea } from "ecCom"; +import { commonEnumList } from "../../../../apis/archive"; +import { Button, Col, Row } from "antd"; +import "../index.less"; + +const getLabel = WeaLocaleProvider.getLabel; + +class Index extends Component { + constructor(props) { + super(props); + this.state = { + selectedKey: "auth.MemberTargetTypeEnum", name: "", options: [], enumType: "" + }; + } + + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.visible !== this.props.visible && nextProps.visible) { + this.setState({ name: nextProps.name, selectedKey: "auth.MemberTargetTypeEnum" }, () => this.getEnumList()); + } + } + + getEnumList = () => { + const payload = { enumClass: `com.engine.salary.enums.${this.state.selectedKey}` }; + commonEnumList(payload).then(({ status, data }) => { + if (status) this.setState({ + options: _.map(data, o => ({ key: o.enum, showname: o.defaultLabel })), + enumType: _.head(data).enum || "" + }); + if (!status) this.setState({ options: [], enumType: "" }); + }); + }; + getOperatorSetting = () => { + const { selectedKey, enumType } = this.state; + if (selectedKey !== "auth.AuthTargetTypeEnum") { + let browserType = {}; + switch (enumType) { + case "EMP": + browserType = { ...browserType, type: 17, title: getLabel(82246, "人员选择") }; + break; + case "DEPARTMENT": + browserType = { ...browserType, type: 57, title: getLabel(111, "部门选择") }; + break; + case "JOB": + browserType = { ...browserType, type: 278, title: getLabel(111, "岗位选择") }; + break; + case "SUB_COMPANY": + browserType = { ...browserType, type: 164, title: getLabel(111, "分部选择") }; + break; + case "ROLE": + browserType = { ...browserType, type: 65, title: getLabel(111, "角色选择") }; + break; + case "SQL": + return ( + + ); + default: + break; + } + return ( + + ); + } else { + return (权限); + } + }; + + render() { + const { selectedKey, name, options, enumType } = this.state; + const tabs = [ + { title: getLabel(111, "成员"), viewcondition: "auth.MemberTargetTypeEnum" }, + { title: getLabel(111, "权限"), viewcondition: "auth.AuthTargetTypeEnum" }, + { title: getLabel(111, "数据"), viewcondition: "auth.DataTargetTypeEnum" } + ]; + return ( + +
+ + + + this.setState({ name: val })}/> + + + + +
+ this.setState({ + selectedKey: v, name: !name ? null : name + }, () => this.state.selectedKey !== "auth.AuthTargetTypeEnum" && this.getEnumList())}/> + this.setState({ enumType: v })}/> + {this.getOperatorSetting()} + + + +
+
+ +
+
+ ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/taxAgent/components/roleSetting/index.js b/pc4mobx/hrmSalary/pages/taxAgent/components/roleSetting/index.js index df837e76..31e392d8 100644 --- a/pc4mobx/hrmSalary/pages/taxAgent/components/roleSetting/index.js +++ b/pc4mobx/hrmSalary/pages/taxAgent/components/roleSetting/index.js @@ -9,7 +9,10 @@ */ 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; @@ -18,29 +21,58 @@ class Index extends Component { constructor(props) { super(props); this.state = { - addRoleDialog: { visible: false, taxAgentId: "" } + addRoleDialog: { visible: false, taxAgentId: "" }, + roleSetDialog: { visible: false, roleId: "", name: "" } }; } - componentDidMount() { - console.log(this.props); - } + 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 } = this.state; - const { taxAgent } = this.props; + const { addRoleDialog, roleSetDialog } = this.state; + const { taxAgent, onSearch } = this.props; + const { role } = taxAgent; return ( - this.setState({ addRoleDialog: { taxAgentId: taxAgent.id, visible: true } })} - replaceDatas={[{ id: 1, name: 操作者 }]} - onChange={(ids, names, datas) => - console.log("单人力", ids, names, datas) - }/> - ({ + 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())}/> ); } diff --git a/pc4mobx/hrmSalary/pages/taxAgent/index.js b/pc4mobx/hrmSalary/pages/taxAgent/index.js index 82120cc3..3fd39f88 100644 --- a/pc4mobx/hrmSalary/pages/taxAgent/index.js +++ b/pc4mobx/hrmSalary/pages/taxAgent/index.js @@ -412,11 +412,11 @@ export default class TaxAgent extends React.Component { ); } }; - }else if(item.dataIndex === "role"){ + } else if (item.dataIndex === "role") { return { ...item, - render: (text, record) => () - } + render: (text, record) => ( getTaxAgentList({})}/>) + }; } else { return { ...item }; }