职务分类新增和编辑成功列表查询失败的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 React, { Component } from "react";
import { Input, Tree, Menu, message, Modal } from "antd"; import { Menu, message, Modal, Tree } from "antd";
import { WeaInputSearch } from "ecCom"; import { WeaInputSearch } from "ecCom";
import { i18n } from "../../../public/i18n"; import { i18n } from "../../../public/i18n";
import NewAndEditDialog from "../../NewAndEditDialog"; import NewAndEditDialog from "../../NewAndEditDialog";
import { inject, observer } from "mobx-react"; import { inject, observer } from "mobx-react";
import { toJS } from "mobx"; import { toJS } from "mobx";
import _ from "lodash";
import "../index.less"; import "../index.less";
const confirm = Modal.confirm; const confirm = Modal.confirm;
@ -26,10 +25,12 @@ class LeftTree extends Component {
rightClickNodeTreeItem: null rightClickNodeTreeItem: null
}; };
} }
componentDidMount() { componentDidMount() {
this.getTreeData(); this.getTreeData();
document.addEventListener("click", this.handleClick); document.addEventListener("click", this.handleClick);
} }
componentWillUnmount() { componentWillUnmount() {
document.removeEventListener("click", this.handleClick); document.removeEventListener("click", this.handleClick);
} }
@ -71,9 +72,11 @@ class LeftTree extends Component {
officeManageStore.setOfficeClassifyId( officeManageStore.setOfficeClassifyId(
!postId !postId
? officeManageStore.officeClassifyId ? officeManageStore.officeClassifyId
: postId != "-1" ? postId : "" : postId !== "-1" ? postId : ""
); );
officeManageStore.getPostInfoTable(postId); officeManageStore.getPostInfoTable(!postId
? officeManageStore.officeClassifyId
: postId !== "-1" ? postId : "");
this.setState({ this.setState({
rightClickNodeTreeItem: null rightClickNodeTreeItem: null
}); });
@ -234,10 +237,10 @@ class LeftTree extends Component {
index > -1 index > -1
? <span> ? <span>
{beforeStr} {beforeStr}
<span style={{ color: "red" }}> <span style={{ color: "red" }}>
{searchValue} {searchValue}
</span> </span>
{afterStr} {afterStr}
</span> </span>
: <span> : <span>
{item.title} {item.title}
@ -249,7 +252,7 @@ class LeftTree extends Component {
</TreeNode> </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()} {this.getNodeTreeRightClickMenu()}
<NewAndEditDialog <NewAndEditDialog
ecId={`${(this && this.props && this.props.ecId) || ecId={`${(this && this.props && this.props.ecId) ||
""}_NewAndEditDialog@q4rrwm`} ""}_NewAndEditDialog@q4rrwm`}
title={ title={
officeClassifyId && officeVisible.type === "editPlan" officeClassifyId && officeVisible.type === "editPlan"
? i18n.label.editOfficeClassifyName() ? i18n.label.editOfficeClassifyName()
@ -366,4 +369,5 @@ class LeftTree extends Component {
); );
} }
} }
export default LeftTree; export default LeftTree;

View File

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