职务管理模块接口联调
This commit is contained in:
parent
559ed2cbee
commit
5bc2f44073
|
|
@ -1,3 +1,9 @@
|
|||
/*
|
||||
* Author: 黎永顺
|
||||
* Description:
|
||||
* Date: 2022-05-13 16:36:09
|
||||
* LastEditTime: 2022-05-16 16:27:08
|
||||
*/
|
||||
import { WeaTools } from "ecCom";
|
||||
|
||||
export const getHasRight = (params) => {
|
||||
|
|
@ -23,3 +29,88 @@ export const getPostInfoForm = (params) => {
|
|||
params
|
||||
);
|
||||
};
|
||||
export const savePostInfo = (params) => {
|
||||
return fetch("/api/bs/hrmorganization/postinfo/savePostInfo", {
|
||||
method: "POST",
|
||||
mode: "cors",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(params),
|
||||
});
|
||||
};
|
||||
export const updatePostInfo = (params) => {
|
||||
return fetch("/api/bs/hrmorganization/postinfo/updatePostInfo", {
|
||||
method: "POST",
|
||||
mode: "cors",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(params),
|
||||
});
|
||||
};
|
||||
export const updateForbiddenTagById = (params) => {
|
||||
return fetch("/api/bs/hrmorganization/postinfo/updateForbiddenTagById", {
|
||||
method: "POST",
|
||||
mode: "cors",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(params),
|
||||
});
|
||||
};
|
||||
export const savePost = (params) => {
|
||||
return fetch("/api/bs/hrmorganization/post/savePost", {
|
||||
method: "POST",
|
||||
mode: "cors",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(params),
|
||||
});
|
||||
};
|
||||
|
||||
export const deleteByIds = (params) => {
|
||||
return fetch("/api/bs/hrmorganization/post/deleteByIds", {
|
||||
method: "POST",
|
||||
mode: "cors",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(params),
|
||||
});
|
||||
};
|
||||
|
||||
export const deletePostinfoByIds = (params) => {
|
||||
return fetch("/api/bs/hrmorganization/postinfo/deleteByIds", {
|
||||
method: "POST",
|
||||
mode: "cors",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(params),
|
||||
});
|
||||
};
|
||||
|
||||
export const getTreeData = (params) => {
|
||||
return WeaTools.callApi(
|
||||
"/api/bs/hrmorganization/post/getTreeData",
|
||||
"GET",
|
||||
params
|
||||
);
|
||||
};
|
||||
export const getPostForm = (params) => {
|
||||
return WeaTools.callApi(
|
||||
"/api/bs/hrmorganization/post/getPostForm",
|
||||
"GET",
|
||||
params
|
||||
);
|
||||
};
|
||||
|
||||
export const getPostInfoTable = (params) => {
|
||||
return WeaTools.callApi(
|
||||
"/api/bs/hrmorganization/postinfo/getPostInfoTable",
|
||||
"GET",
|
||||
params
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,9 +1,14 @@
|
|||
import React, { Component } from "react";
|
||||
import { Input, Tree, Menu } from "antd";
|
||||
import { Input, Tree, Menu, message, Modal } 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;
|
||||
const TreeNode = Tree.TreeNode;
|
||||
const treeData = [
|
||||
{
|
||||
|
|
@ -48,10 +53,14 @@ const treeData = [
|
|||
key: "0-2",
|
||||
},
|
||||
];
|
||||
|
||||
@inject("officeManageStore")
|
||||
@observer
|
||||
class LeftTree extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
loading: false,
|
||||
expandedKeys: [],
|
||||
treeData: [],
|
||||
copyTree: [],
|
||||
|
|
@ -61,23 +70,38 @@ class LeftTree extends Component {
|
|||
};
|
||||
}
|
||||
componentDidMount() {
|
||||
let cp = JSON.stringify(treeData);
|
||||
this.setState({
|
||||
treeData,
|
||||
expandedKeys: [],
|
||||
copyTree: cp,
|
||||
copyExpandedKeys: [],
|
||||
});
|
||||
this.getTreeData();
|
||||
document.addEventListener("click", this.handleClick);
|
||||
}
|
||||
componentWillUnmount() {
|
||||
document.removeEventListener("click", this.handleClick);
|
||||
}
|
||||
|
||||
getTreeData = () => {
|
||||
const { officeManageStore } = this.props;
|
||||
officeManageStore.getTreeData().then((res) => {
|
||||
const { code, data, msg } = res;
|
||||
if (code === 200) {
|
||||
let cp = JSON.stringify([data]);
|
||||
this.setState({
|
||||
treeData: [data],
|
||||
expandedKeys: this.expandedKeysFun([data]),
|
||||
copyTree: cp,
|
||||
copyExpandedKeys: [],
|
||||
});
|
||||
} else {
|
||||
message.error(res.msg);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
handleClick = () => {
|
||||
this.setState({ rightClickNodeTreeItem: null });
|
||||
};
|
||||
onSelect = (node) => {
|
||||
const [postId] = node;
|
||||
const { officeManageStore } = this.props;
|
||||
officeManageStore.getPostInfoTable(postId);
|
||||
this.setState({
|
||||
rightClickNodeTreeItem: null,
|
||||
});
|
||||
|
|
@ -88,7 +112,7 @@ class LeftTree extends Component {
|
|||
rightClickNodeTreeItem: {
|
||||
pageX: e.event.pageX,
|
||||
pageY: e.event.pageY,
|
||||
id: e.node.props["data-key"],
|
||||
id: e.node.props["eventKey"],
|
||||
categoryName: e.node.props["data-title"],
|
||||
},
|
||||
});
|
||||
|
|
@ -188,17 +212,42 @@ class LeftTree extends Component {
|
|||
};
|
||||
const menu = (
|
||||
<Menu
|
||||
// onClick={this.handleMenuClick}
|
||||
onClick={this.handleMenuClick}
|
||||
style={tmpStyle}
|
||||
className='rightmenu'
|
||||
>
|
||||
<Menu.Item key="1">新增</Menu.Item>
|
||||
<Menu.Item key="3">删除</Menu.Item>
|
||||
className="rightmenu">
|
||||
<Menu.Item key="ADD">新增</Menu.Item>
|
||||
<Menu.Item key="DELETE">删除</Menu.Item>
|
||||
</Menu>
|
||||
);
|
||||
return this.state.rightClickNodeTreeItem == null ? "" : menu;
|
||||
};
|
||||
|
||||
handleMenuClick = (menu) => {
|
||||
const { officeManageStore } = this.props;
|
||||
const { id } = this.state.rightClickNodeTreeItem;
|
||||
const { key } = menu;
|
||||
switch (key) {
|
||||
case "ADD":
|
||||
officeManageStore.getPostForm();
|
||||
officeManageStore.setOfficeVisible(true);
|
||||
break;
|
||||
case "DELETE":
|
||||
confirm({
|
||||
title: i18n.confirm.defaultTitle(),
|
||||
content: i18n.confirm.delete(),
|
||||
okText: i18n.button.ok(),
|
||||
cancelText: i18n.button.cancel(),
|
||||
onOk: () => this.handleDelete(id),
|
||||
onCancel() {
|
||||
return false;
|
||||
},
|
||||
});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
renderTreeNode = (data) => {
|
||||
//生成树结构函数
|
||||
if (data.length == 0) {
|
||||
|
|
@ -237,8 +286,46 @@ class LeftTree extends Component {
|
|||
expandedKeys,
|
||||
});
|
||||
};
|
||||
|
||||
handleSave = () => {
|
||||
const { form1, savePost } = this.props.officeManageStore;
|
||||
form1.validateForm().then((f) => {
|
||||
if (f.isValid) {
|
||||
// 验证通过, balabala业务代码
|
||||
const payload = { ...form1.getFormParams() };
|
||||
this.setState({ loading: true });
|
||||
savePost(payload).then(({ code, msg }) => {
|
||||
this.setState({ loading: false });
|
||||
if (code === 200) {
|
||||
message.success("新增成功");
|
||||
this.getTreeData();
|
||||
this.props.officeManageStore.setOfficeVisible(false);
|
||||
} else {
|
||||
message.error(msg || "新增失败");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
f.showErrors();
|
||||
this.setState({ date: new Date() }); // 改变一个state的变量,强制页面刷新
|
||||
}
|
||||
});
|
||||
};
|
||||
handleDelete = (ids) => {
|
||||
const { deleteByIds } = this.props.officeManageStore;
|
||||
deleteByIds({ ids }).then(({ code, msg }) => {
|
||||
if (code === 200) {
|
||||
message.success("删除成功");
|
||||
this.getTreeData();
|
||||
} else {
|
||||
message.error(msg || "删除失败");
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
render() {
|
||||
let { expandedKeys, treeData, searchValue } = this.state;
|
||||
let { expandedKeys, treeData, searchValue, loading } = this.state;
|
||||
const { officeManageStore } = this.props;
|
||||
const { officeCondition, form1, officeVisible } = officeManageStore;
|
||||
return (
|
||||
<div>
|
||||
<div style={{ padding: 10 }}>
|
||||
|
|
@ -256,6 +343,22 @@ class LeftTree extends Component {
|
|||
{this.renderTreeNode(treeData)}
|
||||
</Tree>
|
||||
{this.getNodeTreeRightClickMenu()}
|
||||
<NewAndEditDialog
|
||||
ecId={`${
|
||||
(this && this.props && this.props.ecId) || ""
|
||||
}_NewAndEditDialog@q4rrwm`}
|
||||
title={i18n.label.newOfficeName()}
|
||||
visible={officeVisible}
|
||||
condition={toJS(officeCondition)}
|
||||
form={form1}
|
||||
isFormInit={form1.isFormInit}
|
||||
loading={loading}
|
||||
isEdit={true}
|
||||
height={250}
|
||||
conditionLen={3}
|
||||
save={() => this.handleSave()}
|
||||
onCancel={() => officeManageStore.setOfficeVisible(false)}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,12 +15,24 @@ import { Row, Col, Spin, Modal, Button, message, Switch } from "antd";
|
|||
import { WeaSwitch, WeaTableNew } from "comsMobx";
|
||||
import "./index.less";
|
||||
|
||||
const confirm = Modal.confirm;
|
||||
const WeaTable = WeaTableNew.WeaTable;
|
||||
@inject("officeManageStore")
|
||||
@observer
|
||||
export default class OfficeManage extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
date: "",
|
||||
editId: "",
|
||||
loading: false,
|
||||
};
|
||||
}
|
||||
componentDidMount() {
|
||||
const { officeManageStore } = this.props;
|
||||
officeManageStore.getTreeData && officeManageStore.getTreeData();
|
||||
officeManageStore.getHasRight && officeManageStore.getHasRight();
|
||||
officeManageStore.getPostInfoTable && officeManageStore.getPostInfoTable();
|
||||
}
|
||||
getDropMenuDatas = () => {
|
||||
const { officeManageStore } = this.props;
|
||||
|
|
@ -44,11 +56,66 @@ export default class OfficeManage extends Component {
|
|||
return menus;
|
||||
};
|
||||
|
||||
handleMenuClick = (key) => {};
|
||||
handleMenuClick = (key) => {
|
||||
const { officeManageStore } = this.props;
|
||||
const { isPanelShow } = officeManageStore;
|
||||
isPanelShow && officeManageStore.setPanelStatus(false);
|
||||
switch (key) {
|
||||
case "new":
|
||||
officeManageStore.getPostInfoForm();
|
||||
officeManageStore.setVisible(true);
|
||||
officeManageStore.setNeDialogTitle(i18n.label.newOfficeName());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
handleSave() {
|
||||
const { form, condition, savePostInfo, updatePostInfo } =
|
||||
this.props.officeManageStore;
|
||||
const { editId } = this.state;
|
||||
form.validateForm().then((f) => {
|
||||
if (f.isValid) {
|
||||
// 验证通过, balabala业务代码
|
||||
const payload = editId
|
||||
? { ...form.getFormParams(), id: editId }
|
||||
: { ...form.getFormParams() };
|
||||
this.setState({ loading: true });
|
||||
if (editId) {
|
||||
updatePostInfo(payload).then(({ code, msg }) => {
|
||||
this.setState({ loading: false });
|
||||
if (code === 200) {
|
||||
message.success("编辑成功");
|
||||
this.props.officeManageStore.setVisible(false);
|
||||
this.props.officeManageStore.getPostInfoTable();
|
||||
this.setState({ editId: "" });
|
||||
} else {
|
||||
message.error(msg || "编辑失败");
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
savePostInfo(payload).then(({ code, msg }) => {
|
||||
this.setState({ loading: false });
|
||||
if (code === 200) {
|
||||
message.success("新增成功");
|
||||
this.props.officeManageStore.setVisible(false);
|
||||
this.props.officeManageStore.getPostInfoTable();
|
||||
this.setState({ editId: "" });
|
||||
} else {
|
||||
message.error(msg || "新增失败");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
f.showErrors();
|
||||
this.setState({ date: new Date() }); // 改变一个state的变量,强制页面刷新
|
||||
}
|
||||
});
|
||||
}
|
||||
getTopMenuBtns = () => {
|
||||
const { officeManageStore } = this.props;
|
||||
const { topMenu, tableStore, getPostInfoForm } = officeManageStore;
|
||||
const { topMenu, tableStore } = officeManageStore;
|
||||
let btns = [];
|
||||
topMenu.map((item, i) => {
|
||||
if (item.menuFun !== "batchDelete") {
|
||||
|
|
@ -57,9 +124,11 @@ export default class OfficeManage extends Component {
|
|||
type="primary"
|
||||
onClick={() => {
|
||||
const { officeManageStore } = this.props;
|
||||
const { isPanelShow, setPanelStatus } = officeManageStore;
|
||||
isPanelShow && setPanelStatus(false);
|
||||
getPostInfoForm();
|
||||
officeManageStore.isPanelShow &&
|
||||
officeManageStore.setPanelStatus(false);
|
||||
officeManageStore.getPostInfoForm();
|
||||
officeManageStore.setVisible(true);
|
||||
officeManageStore.setNeDialogTitle(i18n.label.newOfficeName());
|
||||
}}>
|
||||
{item.menuName}
|
||||
</Button>
|
||||
|
|
@ -68,17 +137,108 @@ export default class OfficeManage extends Component {
|
|||
btns.push(
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => console.log(item)}
|
||||
// disabled={tableStore.selectedRowKeys.length > 0 ? false : true}
|
||||
>
|
||||
onClick={() => {
|
||||
const { officeManageStore } = this.props;
|
||||
const { tableStore } = officeManageStore;
|
||||
const ids = toJS(tableStore.selectedRowKeys).toString();
|
||||
this.showConfirm("batchDel", ids);
|
||||
}}
|
||||
disabled={tableStore.selectedRowKeys.length > 0 ? false : true}>
|
||||
{item.menuName}
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
return btns;
|
||||
};
|
||||
|
||||
showConfirm = (v, ids) => {
|
||||
confirm({
|
||||
title: i18n.confirm.defaultTitle(),
|
||||
content:
|
||||
v == "del" ? i18n.confirm.delete() : i18n.confirm.batchDeleteConfirm(),
|
||||
okText: i18n.button.ok(),
|
||||
cancelText: i18n.button.cancel(),
|
||||
onOk: () => this.deletePostinfoByIds(ids),
|
||||
onCancel() {
|
||||
return false;
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
deletePostinfoByIds = (ids) => {
|
||||
const { officeManageStore } = this.props;
|
||||
const { deletePostinfoByIds } = officeManageStore;
|
||||
deletePostinfoByIds({ ids }).then(({ code, msg }) => {
|
||||
if (code === 200) {
|
||||
message.success("删除成功");
|
||||
officeManageStore.getPostInfoTable();
|
||||
} else {
|
||||
message.error(msg || "删除失败");
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
reRenderColumns = (columns) => {
|
||||
let _this = this;
|
||||
columns.forEach((c, index) => {
|
||||
if (c.dataIndex == "forbidden_tag") {
|
||||
c.render = function (text, record) {
|
||||
return (
|
||||
<Switch
|
||||
checked={record.forbidden_tag == "0" ? true : false}
|
||||
onChange={(checked) => {
|
||||
confirm({
|
||||
title: i18n.confirm.defaultTitle(),
|
||||
content:
|
||||
record.forbidden_tag === "0"
|
||||
? "确定要禁用吗?"
|
||||
: "确定要启用吗?",
|
||||
okText: i18n.button.ok(),
|
||||
cancelText: i18n.button.cancel(),
|
||||
onOk: () => _this.updateForbiddenTag(checked, record.id),
|
||||
onCancel() {
|
||||
return false;
|
||||
},
|
||||
});
|
||||
}}
|
||||
/>
|
||||
);
|
||||
};
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
updateForbiddenTag = (forbiddentag, id) => {
|
||||
const { officeManageStore } = this.props;
|
||||
const { updateForbiddenTagById } = officeManageStore;
|
||||
const payload = {
|
||||
id,
|
||||
forbiddentag,
|
||||
};
|
||||
updateForbiddenTagById(payload).then(({ code, msg }) => {
|
||||
if (code === 200) {
|
||||
message.success("操作成功");
|
||||
officeManageStore.getPostInfoTable();
|
||||
} else {
|
||||
message.error(msg || "操作失败");
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
onOperatesClick = (record, index, operate) => {
|
||||
operate.index == "0" && this.doEdit(record.randomFieldId);
|
||||
operate.index === "1" && this.showConfirm("del", record.randomFieldId);
|
||||
};
|
||||
doEdit = (editId) => {
|
||||
this.setState({ editId });
|
||||
const { officeManageStore } = this.props;
|
||||
officeManageStore.isPanelShow && officeManageStore.setPanelStatus(false);
|
||||
officeManageStore.getPostInfoForm(editId);
|
||||
officeManageStore.setVisible(true);
|
||||
officeManageStore.setNeDialogTitle(i18n.label.editOfficeName());
|
||||
};
|
||||
|
||||
getPanelComponents = () => {
|
||||
const { officeManageStore } = this.props;
|
||||
const { searchCondition, form2, searchConditionLoading } =
|
||||
|
|
@ -135,13 +295,12 @@ export default class OfficeManage extends Component {
|
|||
return (
|
||||
<Row
|
||||
ecId={`${(this && this.props && this.props.ecId) || ""}_Row@ppeb6z`}
|
||||
// onKeyDown={(e) => {
|
||||
// if (e.keyCode == 13 && e.target.tagName === "INPUT") {
|
||||
// officeManageStore.getTableInfo();
|
||||
// officeManageStore.setPanelStatus(false);
|
||||
// }
|
||||
// }}
|
||||
>
|
||||
onKeyDown={(e) => {
|
||||
if (e.keyCode == 13 && e.target.tagName === "INPUT") {
|
||||
officeManageStore.getPostInfoTable();
|
||||
officeManageStore.setPanelStatus(false);
|
||||
}
|
||||
}}>
|
||||
{arr}
|
||||
</Row>
|
||||
);
|
||||
|
|
@ -149,15 +308,15 @@ export default class OfficeManage extends Component {
|
|||
};
|
||||
getTabBtn = () => {
|
||||
const { officeManageStore } = this.props;
|
||||
const { form2, setPanelStatus } = officeManageStore;
|
||||
const { form2 } = officeManageStore;
|
||||
|
||||
const btn = [
|
||||
<Button
|
||||
ecId={`${(this && this.props && this.props.ecId) || ""}_Button@bx87i8`}
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
officeManageStore.getTableInfo();
|
||||
setPanelStatus(false);
|
||||
officeManageStore.getPostInfoTable();
|
||||
officeManageStore.setPanelStatus(false);
|
||||
}}>
|
||||
{i18n.button.search()}
|
||||
</Button>,
|
||||
|
|
@ -168,7 +327,7 @@ export default class OfficeManage extends Component {
|
|||
</Button>,
|
||||
<Button
|
||||
ecId={`${(this && this.props && this.props.ecId) || ""}_Button@5u9mfz`}
|
||||
onClick={() => setPanelStatus(false)}>
|
||||
onClick={() => officeManageStore.setPanelStatus(false)}>
|
||||
{i18n.button.cancel()}
|
||||
</Button>,
|
||||
];
|
||||
|
|
@ -178,17 +337,17 @@ export default class OfficeManage extends Component {
|
|||
onSearchChange = (val) => {
|
||||
const { officeManageStore } = this.props;
|
||||
const { form2 } = officeManageStore;
|
||||
|
||||
officeManageStore.setSchemeName(val);
|
||||
officeManageStore.setPostInfoName(val);
|
||||
!_.isEmpty(form2.getFormParams()) && officeManageStore.updateFields(val);
|
||||
};
|
||||
|
||||
render() {
|
||||
const { officeManageStore } = this.props;
|
||||
const { date, loading } = this.state;
|
||||
const {
|
||||
isPanelShow,
|
||||
form2,
|
||||
schemeName,
|
||||
postInfoName,
|
||||
conditionNum,
|
||||
tableStore,
|
||||
nEdialogTitle,
|
||||
|
|
@ -214,7 +373,7 @@ export default class OfficeManage extends Component {
|
|||
ecId={`${
|
||||
(this && this.props && this.props.ecId) || ""
|
||||
}_WeaTop@446d12`}
|
||||
title={i18n.label.schemeName()}
|
||||
title={i18n.label.officeName()}
|
||||
icon={<i className="icon-coms-hrm" />}
|
||||
iconBgcolor="#217346"
|
||||
loading={true}
|
||||
|
|
@ -230,8 +389,8 @@ export default class OfficeManage extends Component {
|
|||
showSearchAd={isPanelShow}
|
||||
searchsBaseValue={
|
||||
_.isEmpty(form2.getFormParams())
|
||||
? schemeName
|
||||
: form2.getFormParams().schemeName
|
||||
? postInfoName
|
||||
: form2.getFormParams().postInfoName
|
||||
}
|
||||
setShowSearchAd={(bool) =>
|
||||
officeManageStore.setPanelStatus(bool)
|
||||
|
|
@ -243,21 +402,29 @@ export default class OfficeManage extends Component {
|
|||
advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20}
|
||||
hasMask={false}
|
||||
buttonsAd={this.getTabBtn()}
|
||||
// onSearch={() => officeManageStore.getSearchCondition()}
|
||||
onSearch={() => officeManageStore.getPostInfoTable()}
|
||||
onSearchChange={(val) => this.onSearchChange(val)}
|
||||
/>
|
||||
{/* <WeaTable
|
||||
<WeaTable
|
||||
ecId={`${
|
||||
(this && this.props && this.props.ecId) || ""
|
||||
}_WeaTable@b43a4c`}
|
||||
comsWeaTableStore={tableStore}
|
||||
hasOrder={true}
|
||||
needScroll={true}
|
||||
rowSelection={{
|
||||
getCheckboxProps: (record) => {
|
||||
console.log(record);
|
||||
return {
|
||||
disabled: true, // 配置无法勾选的列
|
||||
};
|
||||
},
|
||||
}}
|
||||
getColumns={(c) => this.reRenderColumns(c)}
|
||||
onOperatesClick={(record, index, operate) =>
|
||||
this.onOperatesClick(record, index, operate)
|
||||
}
|
||||
/> */}
|
||||
/>
|
||||
</WeaTop>
|
||||
<NewAndEditDialog
|
||||
ecId={`${
|
||||
|
|
@ -268,12 +435,15 @@ export default class OfficeManage extends Component {
|
|||
condition={toJS(condition)}
|
||||
form={form}
|
||||
isFormInit={form.isFormInit}
|
||||
loading={dialogLoading}
|
||||
isEdit={false}
|
||||
loading={dialogLoading || loading}
|
||||
isEdit={true}
|
||||
height={250}
|
||||
conditionLen={3}
|
||||
// save={() => this.handleSave()}
|
||||
// onCancel={() => rankScheme.setVisible(false)}
|
||||
save={() => this.handleSave()}
|
||||
onCancel={() => {
|
||||
officeManageStore.setVisible(false);
|
||||
this.setState({ editId: "" });
|
||||
}}
|
||||
/>
|
||||
</WeaRightMenu>
|
||||
</WeaLeftRightLayout>
|
||||
|
|
|
|||
|
|
@ -124,6 +124,10 @@ export const i18n = {
|
|||
editSequence: () => getLabel(386247, '编辑岗位序列'),
|
||||
groupInfo: () => getLabel(385936, '总部'),
|
||||
editGroup: () => getLabel(386247, '编辑总部'),
|
||||
officeName: () => getLabel(385936, '职务管理'),
|
||||
newOfficeName: () => getLabel(386246, '新建职务信息'),
|
||||
editOfficeName: () => getLabel(386247, '编辑职务信息'),
|
||||
newOfficeClassifyName: () => getLabel(386246, '新建职务分类信息'),
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -12,19 +12,21 @@ export class OfficeManageStore {
|
|||
@observable tableStore = new TableStore();
|
||||
@observable topMenu = []; //顶部菜单
|
||||
@observable rightMenu = []; //右侧更多菜单
|
||||
@observable condition = [];
|
||||
@observable searchCondition = [];
|
||||
@observable condition = []; //新增职务信息form数据
|
||||
@observable searchCondition = []; //高级搜索框form 数据
|
||||
@observable officeCondition = []; //新增职务分类form数据
|
||||
@observable isEdit = true;
|
||||
@observable isNew = true;
|
||||
@observable isPanelShow = false; //高级搜索面板
|
||||
@observable form2 = new WeaForm();
|
||||
@observable form2 = new WeaForm(); //高级搜索渲染的表单
|
||||
@observable form = new WeaForm(); //新增编辑渲染的表单
|
||||
@observable form1 = new WeaForm();
|
||||
@observable schemeName = "";
|
||||
@observable form1 = new WeaForm(); //职务分类渲染的表单
|
||||
@observable postInfoName = "";
|
||||
@observable conditionNum = 2;
|
||||
@observable ids = ""; //选择行id
|
||||
@observable searchConditionLoading = false;
|
||||
@observable nEdialogTitle = "";
|
||||
@observable officeVisible = false;
|
||||
@observable visible = false;
|
||||
@observable dialogLoading = false;
|
||||
@observable schemeId = "";
|
||||
|
|
@ -51,8 +53,8 @@ export class OfficeManageStore {
|
|||
this.setScLoadingStatus(false);
|
||||
const { code, data, msg } = res;
|
||||
if (code === 200) {
|
||||
res.data.conditions && this.setSearchCondition(res.data.conditions);
|
||||
res.data.conditions && this.form2.initFormFields(res.data.conditions);
|
||||
res.data.conditions && this.setSearchCondition(data.conditions);
|
||||
res.data.conditions && this.form2.initFormFields(data.conditions);
|
||||
} else {
|
||||
message.error(res.msg);
|
||||
}
|
||||
|
|
@ -61,11 +63,12 @@ export class OfficeManageStore {
|
|||
|
||||
@action("获取新增/编辑表单")
|
||||
getPostInfoForm(id) {
|
||||
// this.setDialogLoadingStatus(true);
|
||||
this.setDialogLoadingStatus(true);
|
||||
API.getPostInfoForm({ id }).then((res) => {
|
||||
// this.setDialogLoadingStatus(false);
|
||||
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 {
|
||||
|
|
@ -73,6 +76,71 @@ export class OfficeManageStore {
|
|||
}
|
||||
});
|
||||
}
|
||||
@action("获取表格数据")
|
||||
getPostInfoTable(postId) {
|
||||
let params;
|
||||
this.tableStore = new TableStore();
|
||||
if (_.isEmpty(this.form2.getFormParams())) {
|
||||
params = {
|
||||
...this.form2.getFormParams(),
|
||||
postId,
|
||||
postInfoName: this.postInfoName,
|
||||
};
|
||||
} else {
|
||||
params = {
|
||||
postId,
|
||||
...this.form2.getFormParams(),
|
||||
};
|
||||
}
|
||||
API.getPostInfoTable(params).then((res) => {
|
||||
if (res.code === 200) {
|
||||
res.data.datas && this.tableStore.getDatas(res.data.datas, 1);
|
||||
} else {
|
||||
message.error(res.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@action("获取左侧树")
|
||||
getTreeData() {
|
||||
return API.getTreeData();
|
||||
}
|
||||
|
||||
@action("保存职务分类")
|
||||
savePost(payload) {
|
||||
return API.savePost(payload).then((response) => {
|
||||
return response.json();
|
||||
});
|
||||
}
|
||||
|
||||
@action("删除职务分类")
|
||||
deleteByIds(payload) {
|
||||
return API.deleteByIds(payload).then((response) => {
|
||||
return response.json();
|
||||
});
|
||||
}
|
||||
|
||||
@action("删除职务信息")
|
||||
deletePostinfoByIds(payload) {
|
||||
return API.deletePostinfoByIds(payload).then((response) => {
|
||||
return response.json();
|
||||
});
|
||||
}
|
||||
|
||||
@action("获取职务分类表单")
|
||||
getPostForm(id) {
|
||||
this.setDialogLoadingStatus(true);
|
||||
API.getPostForm({ id }).then((res) => {
|
||||
this.setDialogLoadingStatus(false);
|
||||
const { code, data, msg } = res;
|
||||
if (code === 200) {
|
||||
data.condition && this.setOfficeCondition(data.condition);
|
||||
data.condition && this.form1.initFormFields(data.condition);
|
||||
} else {
|
||||
message.error(res.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@action("展开关闭搜索面板")
|
||||
setPanelStatus(bool) {
|
||||
|
|
@ -83,6 +151,31 @@ export class OfficeManageStore {
|
|||
}
|
||||
}
|
||||
|
||||
@action("新增职务信息")
|
||||
savePostInfo(payload) {
|
||||
return API.savePostInfo(payload).then((response) => {
|
||||
return response.json();
|
||||
});
|
||||
}
|
||||
|
||||
@action("更新职务信息")
|
||||
updatePostInfo(payload) {
|
||||
return API.updatePostInfo(payload).then((response) => {
|
||||
return response.json();
|
||||
});
|
||||
}
|
||||
|
||||
@action("更新禁用标识 ")
|
||||
updateForbiddenTagById(payload) {
|
||||
return API.updateForbiddenTagById(payload).then((response) => {
|
||||
return response.json();
|
||||
});
|
||||
}
|
||||
|
||||
setPostInfoName(val) {
|
||||
this.postInfoName = val;
|
||||
}
|
||||
|
||||
setScLoadingStatus(bool) {
|
||||
this.searchConditionLoading = bool;
|
||||
}
|
||||
|
|
@ -91,23 +184,37 @@ export class OfficeManageStore {
|
|||
this.searchCondition = condition;
|
||||
}
|
||||
|
||||
setCondition(condition) {
|
||||
this.condition = condition;
|
||||
}
|
||||
|
||||
setOfficeCondition(condition) {
|
||||
this.officeCondition = condition;
|
||||
}
|
||||
|
||||
setVisible(bool) {
|
||||
this.visible = bool;
|
||||
this.formReset();
|
||||
if (!bool) this.setDialogLoadingStatus(false);
|
||||
}
|
||||
|
||||
setOfficeVisible(bool) {
|
||||
this.officeVisible = bool;
|
||||
this.officeFormReset();
|
||||
if (!bool) this.setDialogLoadingStatus(false);
|
||||
}
|
||||
|
||||
setDialogLoadingStatus(bool) {
|
||||
this.dialogLoading = bool;
|
||||
}
|
||||
|
||||
setCondition(condition) {
|
||||
this.condition = condition;
|
||||
setNeDialogTitle(title) {
|
||||
this.nEdialogTitle = title;
|
||||
}
|
||||
|
||||
|
||||
updateFields(val) {
|
||||
this.form2.updateFields({
|
||||
schemeName: {
|
||||
postInfoName: {
|
||||
value: val,
|
||||
},
|
||||
});
|
||||
|
|
@ -116,4 +223,8 @@ export class OfficeManageStore {
|
|||
formReset() {
|
||||
this.form = new WeaForm();
|
||||
}
|
||||
|
||||
officeFormReset() {
|
||||
this.form1 = new WeaForm();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue