diff --git a/pc4mobx/hrmSalary/pages/roleManagement/components/roleDetailSetDialog/index.js b/pc4mobx/hrmSalary/pages/roleManagement/components/roleDetailSetDialog/index.js index 411b267a..511d2ce8 100644 --- a/pc4mobx/hrmSalary/pages/roleManagement/components/roleDetailSetDialog/index.js +++ b/pc4mobx/hrmSalary/pages/roleManagement/components/roleDetailSetDialog/index.js @@ -19,7 +19,8 @@ import { WeaSelect, WeaTab, WeaTable, - WeaTextarea + WeaTextarea, + WeaTools } from "ecCom"; import { commonEnumList } from "../../../../apis/archive"; import EditRoleDialog from "./editRoleDialog"; @@ -32,6 +33,7 @@ import { roleConditions } from "../conditions"; import { getSearchs } from "../../../../util"; const getLabel = WeaLocaleProvider.getLabel; +const getKey = WeaTools.getKey; const APIFOX = { "auth.MemberTargetTypeEnum": API.authMemberList, "save.auth.MemberTargetTypeEnum": API.saveAuthMember, @@ -72,12 +74,33 @@ class Index extends Component { getRole = (id) => { API.getRole({ id }).then(({ status, data }) => { if (status) { - console.log(data); this.setState({ conditions: _.map(roleConditions, item => ({ - ...item, items: _.map(item.items, o => ({ ...o, label: getLabel(o.lanId, o.label) })) - })) - }, () => this.props.taxAgentStore.roleForm.initFormFields(this.state.conditions)); + ...item, items: _.map(item.items, o => { + if (getKey(o) === "taxAgentIds" || getKey(o) === "sobIds") { + return { + ...o, label: getLabel(o.lanId, o.label), + value: _.map(data[getKey(o)], i => String(i.id)).join(","), + browserConditionParam: { + ...o.browserConditionParam, + replaceDatas: _.map(data[getKey(o)], i => ({ id: String(i.id), name: i.name })) + } + }; + } + return { ...o, label: getLabel(o.lanId, o.label) }; + }) + })), + formData: { + taxAgentIds: _.map(data["taxAgentIds"], i => ({ id: String(i.id), name: i.name })), + sobIds: _.map(data["sobIds"], i => ({ id: String(i.id), name: i.name })) + } + }, () => { + this.props.taxAgentStore.roleForm.initFormFields(this.state.conditions); + this.props.taxAgentStore.roleForm.updateFields({ + name: { value: data.name }, + description: { value: data.description } + }); + }); } }); }; @@ -206,6 +229,7 @@ class Index extends Component { this.setState({ loading: { ...this.state.loading, set: false } }); if (status) { message.success(getLabel(111, "操作成功!")); + this.props.onSearch && this.props.onSearch(); } else { message.error(errormsg); } diff --git a/pc4mobx/hrmSalary/pages/roleManagement/index.js b/pc4mobx/hrmSalary/pages/roleManagement/index.js index 425e1a9f..b827825e 100644 --- a/pc4mobx/hrmSalary/pages/roleManagement/index.js +++ b/pc4mobx/hrmSalary/pages/roleManagement/index.js @@ -8,6 +8,7 @@ * @description: */ import React, { Component } from "react"; +import { inject, observer } from "mobx-react"; import { WeaInputSearch, WeaLocaleProvider, WeaTable, WeaTop } from "ecCom"; import { Button, message, Modal } from "antd"; import * as API from "../../apis/taxAgent"; @@ -17,6 +18,8 @@ import RoleDetailSetDialog from "./components/roleDetailSetDialog"; const getLabel = WeaLocaleProvider.getLabel; +@inject("taxAgentStore") +@observer class Index extends Component { constructor(props) { super(props); @@ -122,7 +125,10 @@ class Index extends Component { this.setState({ roleSetDialog: { ...roleSetDialog, visible: false } - }, () => callback && callback())}/> + }, () => { + this.props.taxAgentStore.initRoleForm(); + callback && callback(); + })}/> );