diff --git a/pc4mobx/organization/components/office/components/leftTree.js b/pc4mobx/organization/components/office/components/leftTree.js index 3559189..bb12530 100644 --- a/pc4mobx/organization/components/office/components/leftTree.js +++ b/pc4mobx/organization/components/office/components/leftTree.js @@ -67,16 +67,13 @@ class LeftTree extends Component { this.setState({ rightClickNodeTreeItem: null }); }; onSelect = node => { - const [postId] = node; const { officeManageStore } = this.props; - officeManageStore.setOfficeClassifyId( - !postId - ? officeManageStore.officeClassifyId - : postId !== "-1" ? postId : "" - ); - officeManageStore.getPostInfoTable(!postId + const [postId] = node; + const officeId = !postId ? officeManageStore.officeClassifyId - : postId !== "-1" ? postId : ""); + : postId !== "-1" ? postId : ""; + officeManageStore.setOfficeClassifyId(officeId); + officeManageStore.getPostInfoTable(officeId); this.setState({ rightClickNodeTreeItem: null }); diff --git a/pc4mobx/organization/components/office/officeManage.js b/pc4mobx/organization/components/office/officeManage.js index e3f0706..0266e9a 100644 --- a/pc4mobx/organization/components/office/officeManage.js +++ b/pc4mobx/organization/components/office/officeManage.js @@ -56,11 +56,11 @@ export default class OfficeManage extends Component { handleMenuClick = key => { const { officeManageStore } = this.props; - const { isPanelShow, tableStore } = officeManageStore; + const { isPanelShow, tableStore, officeClassifyId } = officeManageStore; isPanelShow && officeManageStore.setPanelStatus(false); switch (key) { case "new": - officeManageStore.getPostInfoForm(); + officeManageStore.getPostInfoForm({ planId: officeClassifyId }); officeManageStore.setVisible(true); officeManageStore.setNeDialogTitle(i18n.label.newOfficeName()); break; @@ -137,7 +137,7 @@ export default class OfficeManage extends Component { if (item.menuFun == "new") { officeManageStore.isPanelShow && officeManageStore.setPanelStatus(false); - officeManageStore.getPostInfoForm(); + officeManageStore.getPostInfoForm({ planId: officeClassifyId }); officeManageStore.setVisible(true); officeManageStore.setNeDialogTitle(i18n.label.newOfficeName()); } else if ( @@ -223,7 +223,7 @@ export default class OfficeManage extends Component { deletePostinfoByIds({ ids }).then(({ code, msg }) => { if (code === 200) { message.success("删除成功"); - officeManageStore.getPostInfoTable(); + officeManageStore.getPostInfoTable(officeManageStore.officeClassifyId); } else { message.error(msg || "删除失败"); } @@ -268,7 +268,7 @@ export default class OfficeManage extends Component { updateForbiddenTagById(payload).then(({ code, msg }) => { if (code === 200) { message.success("操作成功"); - officeManageStore.getPostInfoTable(); + officeManageStore.getPostInfoTable(officeManageStore.officeClassifyId); } else { message.error(msg || "操作失败"); } @@ -283,7 +283,7 @@ export default class OfficeManage extends Component { this.setState({ editId }); const { officeManageStore } = this.props; officeManageStore.isPanelShow && officeManageStore.setPanelStatus(false); - officeManageStore.getPostInfoForm(editId); + officeManageStore.getPostInfoForm({ id: editId }); officeManageStore.setVisible(true); officeManageStore.setNeDialogTitle(i18n.label.editOfficeName()); }; diff --git a/pc4mobx/organization/stores/officeManage.js b/pc4mobx/organization/stores/officeManage.js index c848b9a..87c5cd3 100644 --- a/pc4mobx/organization/stores/officeManage.js +++ b/pc4mobx/organization/stores/officeManage.js @@ -1,8 +1,6 @@ -import { observable, action, toJS } from "mobx"; -import { WeaForm } from "comsMobx"; -import { WeaTableNew } from "comsMobx"; -import { Modal, message } from "antd"; -import { i18n } from "../public/i18n"; +import { action, observable } from "mobx"; +import { WeaForm, WeaTableNew } from "comsMobx"; +import { message } from "antd"; import * as API from "../apis/officeManage"; import _ from "lodash"; @@ -69,13 +67,12 @@ export class OfficeManageStore { } @action("获取新增/编辑表单") - getPostInfoForm(id) { + getPostInfoForm(params) { this.setDialogLoadingStatus(true); - API.getPostInfoForm({ id }).then(res => { + API.getPostInfoForm(params).then(res => { this.setDialogLoadingStatus(false); const { code, data, msg } = res; if (code === 200) { - console.log(); data.condition && this.setCondition(data.condition); data.condition && this.form.initFormFields(data.condition); } else { @@ -83,6 +80,7 @@ export class OfficeManageStore { } }); } + @action("获取表格数据") getPostInfoTable(postId) { let params; @@ -95,8 +93,8 @@ export class OfficeManageStore { }; } else { params = { - postId, - ...this.form2.getFormParams() + ...this.form2.getFormParams(), + postId }; } API.getPostInfoTable(params).then(res => {