custom/大成

This commit is contained in:
黎永顺 2024-09-12 17:50:19 +08:00
parent 4a386102ef
commit 85cdbbe8b2
2 changed files with 36 additions and 6 deletions

View File

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

View File

@ -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 {
<RoleDetailSetDialog {...roleSetDialog} onSearch={this.getRoleList}
onCancel={callback => this.setState({
roleSetDialog: { ...roleSetDialog, visible: false }
}, () => callback && callback())}/>
}, () => {
this.props.taxAgentStore.initRoleForm();
callback && callback();
})}/>
</div>
</WeaTop>
);