职务分类新增和编辑成功列表查询失败的bug

This commit is contained in:
liyongshun 2022-07-07 18:49:54 +08:00
parent d5e13c6057
commit 6e152af3a2
2 changed files with 66 additions and 63 deletions

View File

@ -1,11 +1,10 @@
import React, { Component } from "react";
import { Input, Tree, Menu, message, Modal } from "antd";
import { Menu, message, Modal, Tree } from "antd";
import { WeaInputSearch } from "ecCom";
import { i18n } from "../../../public/i18n";
import NewAndEditDialog from "../../NewAndEditDialog";
import { inject, observer } from "mobx-react";
import { toJS } from "mobx";
import _ from "lodash";
import "../index.less";
const confirm = Modal.confirm;
@ -26,10 +25,12 @@ class LeftTree extends Component {
rightClickNodeTreeItem: null
};
}
componentDidMount() {
this.getTreeData();
document.addEventListener("click", this.handleClick);
}
componentWillUnmount() {
document.removeEventListener("click", this.handleClick);
}
@ -71,9 +72,11 @@ class LeftTree extends Component {
officeManageStore.setOfficeClassifyId(
!postId
? officeManageStore.officeClassifyId
: postId != "-1" ? postId : ""
: postId !== "-1" ? postId : ""
);
officeManageStore.getPostInfoTable(postId);
officeManageStore.getPostInfoTable(!postId
? officeManageStore.officeClassifyId
: postId !== "-1" ? postId : "");
this.setState({
rightClickNodeTreeItem: null
});
@ -234,10 +237,10 @@ class LeftTree extends Component {
index > -1
? <span>
{beforeStr}
<span style={{ color: "red" }}>
<span style={{ color: "red" }}>
{searchValue}
</span>
{afterStr}
{afterStr}
</span>
: <span>
{item.title}
@ -249,7 +252,7 @@ class LeftTree extends Component {
</TreeNode>
);
}
return <TreeNode key={item.key} title={title} className="tree-node" />;
return <TreeNode key={item.key} title={title} className="tree-node"/>;
});
};
@ -341,7 +344,7 @@ class LeftTree extends Component {
{this.getNodeTreeRightClickMenu()}
<NewAndEditDialog
ecId={`${(this && this.props && this.props.ecId) ||
""}_NewAndEditDialog@q4rrwm`}
""}_NewAndEditDialog@q4rrwm`}
title={
officeClassifyId && officeVisible.type === "editPlan"
? i18n.label.editOfficeClassifyName()
@ -366,4 +369,5 @@ class LeftTree extends Component {
);
}
}
export default LeftTree;

View File

@ -4,14 +4,8 @@ import { inject, observer } from "mobx-react";
import { i18n } from "../../public/i18n";
import LeftTree from "./components/leftTree";
import NewAndEditDialog from "../NewAndEditDialog";
import {
WeaTop,
WeaTab,
WeaFormItem,
WeaRightMenu,
WeaLeftRightLayout
} from "ecCom";
import { Row, Col, Spin, Modal, Button, message, Switch } from "antd";
import { WeaFormItem, WeaLeftRightLayout, WeaRightMenu, WeaTab, WeaTop } from "ecCom";
import { Button, Col, message, Modal, Row, Spin, Switch } from "antd";
import { WeaSwitch, WeaTableNew } from "comsMobx";
import "./index.less";
import { renderNoright } from "../../util";
@ -30,12 +24,14 @@ export default class OfficeManage extends Component {
deleteOfficeClassifyFlag: false
};
}
componentDidMount() {
const { officeManageStore } = this.props;
officeManageStore.getTreeData && officeManageStore.getTreeData();
officeManageStore.getHasRight && officeManageStore.getHasRight();
officeManageStore.getPostInfoTable && officeManageStore.getPostInfoTable();
}
getDropMenuDatas = () => {
const { officeManageStore } = this.props;
const { rightMenu } = officeManageStore;
@ -43,7 +39,7 @@ export default class OfficeManage extends Component {
toJS(rightMenu).map((item, index) => {
let obj = {
key: item.menuFun,
icon: <i className={`${item.menuIcon}`} />,
icon: <i className={`${item.menuIcon}`}/>,
content: item.menuName
};
if (
@ -97,9 +93,10 @@ export default class OfficeManage extends Component {
this.setState({ loading: false });
if (code === 200) {
message.success("编辑成功");
this.props.officeManageStore.setVisible(false);
this.props.officeManageStore.getPostInfoTable();
this.setState({ editId: "" });
this.setState({ editId: "" }, () => {
this.props.officeManageStore.setVisible(false);
this.props.officeManageStore.getPostInfoTable(this.props.officeManageStore.officeClassifyId);
});
} else {
message.error(msg || "编辑失败");
}
@ -110,9 +107,10 @@ export default class OfficeManage extends Component {
this.setState({ loading: false });
if (code === 200) {
message.success("新增成功");
this.props.officeManageStore.setVisible(false);
this.props.officeManageStore.getPostInfoTable();
this.setState({ editId: "" });
this.setState({ editId: "" }, () => {
this.props.officeManageStore.setVisible(false);
this.props.officeManageStore.getPostInfoTable(this.props.officeManageStore.officeClassifyId);
});
} else {
message.error(msg || "新增失败");
}
@ -123,6 +121,7 @@ export default class OfficeManage extends Component {
}
});
}
getTopMenuBtns = () => {
const { officeManageStore } = this.props;
const { topMenu, tableStore, officeClassifyId } = officeManageStore;
@ -137,7 +136,7 @@ export default class OfficeManage extends Component {
const { officeManageStore } = this.props;
if (item.menuFun == "new") {
officeManageStore.isPanelShow &&
officeManageStore.setPanelStatus(false);
officeManageStore.setPanelStatus(false);
officeManageStore.getPostInfoForm();
officeManageStore.setVisible(true);
officeManageStore.setNeDialogTitle(i18n.label.newOfficeName());
@ -235,7 +234,7 @@ export default class OfficeManage extends Component {
let _this = this;
columns.forEach((c, index) => {
if (c.dataIndex == "forbidden_tag") {
c.render = function(text, record) {
c.render = function (text, record) {
return (
<Switch
checked={record.forbidden_tag == "0" ? true : false}
@ -300,43 +299,43 @@ export default class OfficeManage extends Component {
let formParams = form2.getFormParams();
const { isFormInit } = form2;
isFormInit &&
searchCondition.map(c => {
c.items.map((field, index) => {
arr.push(
<Col
ecId={`${(this && this.props && this.props.ecId) ||
""}_Col@4cc308@${index}`}
span={index % 2 == 0 ? 10 : 11}
offset={1}>
<div style={{ marginTop: 20 }}>
<WeaFormItem
ecId={`${(this && this.props && this.props.ecId) ||
""}_WeaFormItem@u6ex85@${index}`}
label={`${field.label}`}
labelCol={{ span: `${field.labelcol}` }}
wrapperCol={{ span: `${field.fieldcol}` }}>
{
<WeaSwitch
ecId={`${(this && this.props && this.props.ecId) ||
""}_WeaSwitch@p7d3td@${index}`}
fieldConfig={field}
form={form2}
formParams={formParams}
/>
}
</WeaFormItem>
</div>
</Col>
);
});
searchCondition.map(c => {
c.items.map((field, index) => {
arr.push(
<Col
ecId={`${(this && this.props && this.props.ecId) ||
""}_Col@4cc308@${index}`}
span={index % 2 == 0 ? 10 : 11}
offset={1}>
<div style={{ marginTop: 20 }}>
<WeaFormItem
ecId={`${(this && this.props && this.props.ecId) ||
""}_WeaFormItem@u6ex85@${index}`}
label={`${field.label}`}
labelCol={{ span: `${field.labelcol}` }}
wrapperCol={{ span: `${field.fieldcol}` }}>
{
<WeaSwitch
ecId={`${(this && this.props && this.props.ecId) ||
""}_WeaSwitch@p7d3td@${index}`}
fieldConfig={field}
form={form2}
formParams={formParams}
/>
}
</WeaFormItem>
</div>
</Col>
);
});
});
if (searchConditionLoading) {
return (
<div className="hrm-loading-center-small" style={{ top: "25%" }}>
<Spin
ecId={`${(this && this.props && this.props.ecId) ||
""}_Spin@lbktzb`}
""}_Spin@lbktzb`}
spinning={searchConditionLoading}
/>
</div>
@ -418,19 +417,19 @@ export default class OfficeManage extends Component {
isNew={true}
leftWidth={310}
leftCom={
<LeftTree deleteOfficeClassifyFlag={deleteOfficeClassifyFlag} />
<LeftTree deleteOfficeClassifyFlag={deleteOfficeClassifyFlag}/>
}
onCollapse={showLeft => console.log("showLeft:", showLeft)}>
<WeaRightMenu
ecId={`${(this && this.props && this.props.ecId) ||
""}_WeaRightMenu@cea97d`}
""}_WeaRightMenu@cea97d`}
datas={this.getDropMenuDatas()}
onClick={key => this.handleMenuClick(key)}>
<WeaTop
ecId={`${(this && this.props && this.props.ecId) ||
""}_WeaTop@446d12`}
""}_WeaTop@446d12`}
title={i18n.label.officeName()}
icon={<i className="icon-coms-hrm" />}
icon={<i className="icon-coms-hrm"/>}
iconBgcolor="#217346"
loading={true}
buttons={this.getTopMenuBtns()}
@ -439,7 +438,7 @@ export default class OfficeManage extends Component {
onDropMenuClick={e => this.handleMenuClick(e)}>
<WeaTab
ecId={`${(this && this.props && this.props.ecId) ||
""}_WeaTab@39c727`}
""}_WeaTab@39c727`}
searchType={["base", "advanced"]}
showSearchAd={isPanelShow}
searchsBaseValue={
@ -449,7 +448,7 @@ export default class OfficeManage extends Component {
}
setShowSearchAd={bool => officeManageStore.setPanelStatus(bool)}
hideSearchAd={() => officeManageStore.setPanelStatus(false)}
searchsAd={isPanelShow ? this.getPanelComponents() : <div />}
searchsAd={isPanelShow ? this.getPanelComponents() : <div/>}
advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20}
hasMask={false}
buttonsAd={this.getTabBtn()}
@ -458,7 +457,7 @@ export default class OfficeManage extends Component {
/>
<WeaTable
ecId={`${(this && this.props && this.props.ecId) ||
""}_WeaTable@b43a4c`}
""}_WeaTable@b43a4c`}
comsWeaTableStore={tableStore}
hasOrder={true}
needScroll={true}
@ -477,7 +476,7 @@ export default class OfficeManage extends Component {
</WeaTop>
<NewAndEditDialog
ecId={`${(this && this.props && this.props.ecId) ||
""}_NewAndEditDialog@q4rrwm`}
""}_NewAndEditDialog@q4rrwm`}
title={nEdialogTitle}
visible={visible}
condition={toJS(condition)}