修改职务管理
This commit is contained in:
parent
9fa6b9da32
commit
4878b6be1d
|
|
@ -2,11 +2,11 @@
|
|||
* Author: 黎永顺
|
||||
* Description:
|
||||
* Date: 2022-05-13 16:36:09
|
||||
* LastEditTime: 2022-05-16 16:27:08
|
||||
* LastEditTime: 2022-06-22 14:37:27
|
||||
*/
|
||||
import { WeaTools } from "ecCom";
|
||||
|
||||
export const getHasRight = (params) => {
|
||||
export const getHasRight = params => {
|
||||
return WeaTools.callApi(
|
||||
"/api/bs/hrmorganization/postinfo/getHasRight",
|
||||
"GET",
|
||||
|
|
@ -14,7 +14,7 @@ export const getHasRight = (params) => {
|
|||
);
|
||||
};
|
||||
|
||||
export const getSearchCondition = (params) => {
|
||||
export const getSearchCondition = params => {
|
||||
return WeaTools.callApi(
|
||||
"/api/bs/hrmorganization/postinfo/getSearchCondition",
|
||||
"GET",
|
||||
|
|
@ -22,84 +22,94 @@ export const getSearchCondition = (params) => {
|
|||
);
|
||||
};
|
||||
|
||||
export const getPostInfoForm = (params) => {
|
||||
export const getPostInfoForm = params => {
|
||||
return WeaTools.callApi(
|
||||
"/api/bs/hrmorganization/postinfo/getPostInfoForm",
|
||||
"GET",
|
||||
params
|
||||
);
|
||||
};
|
||||
export const savePostInfo = (params) => {
|
||||
export const savePostInfo = params => {
|
||||
return fetch("/api/bs/hrmorganization/postinfo/savePostInfo", {
|
||||
method: "POST",
|
||||
mode: "cors",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify(params),
|
||||
body: JSON.stringify(params)
|
||||
});
|
||||
};
|
||||
export const updatePostInfo = (params) => {
|
||||
export const updatePostInfo = params => {
|
||||
return fetch("/api/bs/hrmorganization/postinfo/updatePostInfo", {
|
||||
method: "POST",
|
||||
mode: "cors",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify(params),
|
||||
body: JSON.stringify(params)
|
||||
});
|
||||
};
|
||||
export const updateForbiddenTagById = (params) => {
|
||||
export const updateForbiddenTagById = params => {
|
||||
return fetch("/api/bs/hrmorganization/postinfo/updateForbiddenTagById", {
|
||||
method: "POST",
|
||||
mode: "cors",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify(params),
|
||||
body: JSON.stringify(params)
|
||||
});
|
||||
};
|
||||
export const savePost = (params) => {
|
||||
export const savePost = params => {
|
||||
return fetch("/api/bs/hrmorganization/post/savePost", {
|
||||
method: "POST",
|
||||
mode: "cors",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify(params),
|
||||
body: JSON.stringify(params)
|
||||
});
|
||||
};
|
||||
export const updatePost = params => {
|
||||
return fetch("/api/bs/hrmorganization/post/updatePost", {
|
||||
method: "POST",
|
||||
mode: "cors",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify(params)
|
||||
});
|
||||
};
|
||||
|
||||
export const deleteByIds = (params) => {
|
||||
export const deleteByIds = params => {
|
||||
return fetch("/api/bs/hrmorganization/post/deleteByIds", {
|
||||
method: "POST",
|
||||
mode: "cors",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify(params),
|
||||
body: JSON.stringify(params)
|
||||
});
|
||||
};
|
||||
|
||||
export const deletePostinfoByIds = (params) => {
|
||||
export const deletePostinfoByIds = params => {
|
||||
return fetch("/api/bs/hrmorganization/postinfo/deleteByIds", {
|
||||
method: "POST",
|
||||
mode: "cors",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify(params),
|
||||
body: JSON.stringify(params)
|
||||
});
|
||||
};
|
||||
|
||||
export const getTreeData = (params) => {
|
||||
export const getTreeData = params => {
|
||||
return WeaTools.callApi(
|
||||
"/api/bs/hrmorganization/post/getTreeData",
|
||||
"GET",
|
||||
params
|
||||
);
|
||||
};
|
||||
export const getPostForm = (params) => {
|
||||
export const getPostForm = params => {
|
||||
return WeaTools.callApi(
|
||||
"/api/bs/hrmorganization/post/getPostForm",
|
||||
"GET",
|
||||
|
|
@ -107,7 +117,7 @@ export const getPostForm = (params) => {
|
|||
);
|
||||
};
|
||||
|
||||
export const getPostInfoTable = (params) => {
|
||||
export const getPostInfoTable = params => {
|
||||
return WeaTools.callApi(
|
||||
"/api/bs/hrmorganization/postinfo/getPostInfoTable",
|
||||
"GET",
|
||||
|
|
|
|||
|
|
@ -10,49 +10,6 @@ import "../index.less";
|
|||
|
||||
const confirm = Modal.confirm;
|
||||
const TreeNode = Tree.TreeNode;
|
||||
const treeData = [
|
||||
{
|
||||
title: "0-0",
|
||||
key: "0-0",
|
||||
children: [
|
||||
{
|
||||
title: "0-0-0",
|
||||
key: "0-0-0",
|
||||
children: [
|
||||
{ title: "0-0-0-0-88", key: "0-0-0-0" },
|
||||
{ title: "0-0-0-1", key: "0-0-0-1" },
|
||||
{ title: "0-0-0-2", key: "0-0-0-2" },
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "0-0-1",
|
||||
key: "0-0-1",
|
||||
children: [
|
||||
{ title: "0-0-1-0", key: "0-0-1-0" },
|
||||
{ title: "0-0-1-1", key: "0-0-1-1" },
|
||||
{ title: "0-0-1-2", key: "0-0-1-2" },
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "0-0-2",
|
||||
key: "0-0-2",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "99",
|
||||
key: "0-1",
|
||||
children: [
|
||||
{ title: "0-1-0-0", key: "0-1-0-0" },
|
||||
{ title: "9988", key: "0-1-0-1" },
|
||||
{ title: "0-1-0-2-99988", key: "0-1-0-2" },
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "0-2",
|
||||
key: "0-2",
|
||||
},
|
||||
];
|
||||
|
||||
@inject("officeManageStore")
|
||||
@observer
|
||||
|
|
@ -66,7 +23,7 @@ class LeftTree extends Component {
|
|||
copyTree: [],
|
||||
copyExpandedKeys: [],
|
||||
searchValue: "",
|
||||
rightClickNodeTreeItem: null,
|
||||
rightClickNodeTreeItem: null
|
||||
};
|
||||
}
|
||||
componentDidMount() {
|
||||
|
|
@ -77,9 +34,19 @@ class LeftTree extends Component {
|
|||
document.removeEventListener("click", this.handleClick);
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
if (
|
||||
nextProps.deleteOfficeClassifyFlag !== this.props.deleteOfficeClassifyFlag
|
||||
) {
|
||||
const { officeManageStore } = this.props;
|
||||
const { officeClassifyId } = officeManageStore;
|
||||
this.handleDelete(officeClassifyId);
|
||||
}
|
||||
}
|
||||
|
||||
getTreeData = () => {
|
||||
const { officeManageStore } = this.props;
|
||||
officeManageStore.getTreeData().then((res) => {
|
||||
officeManageStore.getTreeData().then(res => {
|
||||
const { code, data, msg } = res;
|
||||
if (code === 200) {
|
||||
let cp = JSON.stringify([data]);
|
||||
|
|
@ -87,7 +54,7 @@ class LeftTree extends Component {
|
|||
treeData: [data],
|
||||
expandedKeys: this.expandedKeysFun([data]),
|
||||
copyTree: cp,
|
||||
copyExpandedKeys: [],
|
||||
copyExpandedKeys: []
|
||||
});
|
||||
} else {
|
||||
message.error(res.msg);
|
||||
|
|
@ -98,23 +65,28 @@ class LeftTree extends Component {
|
|||
handleClick = () => {
|
||||
this.setState({ rightClickNodeTreeItem: null });
|
||||
};
|
||||
onSelect = (node) => {
|
||||
onSelect = node => {
|
||||
const [postId] = node;
|
||||
const { officeManageStore } = this.props;
|
||||
officeManageStore.setOfficeClassifyId(
|
||||
!postId
|
||||
? officeManageStore.officeClassifyId
|
||||
: postId != "-1" ? postId : ""
|
||||
);
|
||||
officeManageStore.getPostInfoTable(postId);
|
||||
this.setState({
|
||||
rightClickNodeTreeItem: null,
|
||||
rightClickNodeTreeItem: null
|
||||
});
|
||||
};
|
||||
|
||||
treeNodeonRightClick = (e) => {
|
||||
treeNodeonRightClick = e => {
|
||||
this.setState({
|
||||
rightClickNodeTreeItem: {
|
||||
pageX: e.event.pageX,
|
||||
pageY: e.event.pageY,
|
||||
id: e.node.props["eventKey"],
|
||||
categoryName: e.node.props["data-title"],
|
||||
},
|
||||
categoryName: e.node.props["data-title"]
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -149,9 +121,9 @@ class LeftTree extends Component {
|
|||
}
|
||||
return new RegExp(filterText, "i").test(data.title);
|
||||
};
|
||||
flatTreeFun = (treeData) => {
|
||||
flatTreeFun = treeData => {
|
||||
let arr = [];
|
||||
const flatTree = (treeData) => {
|
||||
const flatTree = treeData => {
|
||||
treeData.map((item, index) => {
|
||||
arr.push(item);
|
||||
if (item.children && item.children.length > 0) {
|
||||
|
|
@ -163,12 +135,12 @@ class LeftTree extends Component {
|
|||
flatTree(treeData);
|
||||
return arr;
|
||||
};
|
||||
expandedKeysFun = (treeData) => {
|
||||
expandedKeysFun = treeData => {
|
||||
if (treeData && treeData.length == 0) {
|
||||
return [];
|
||||
}
|
||||
let arr = [];
|
||||
const expandedKeysFn = (treeData) => {
|
||||
const expandedKeysFn = treeData => {
|
||||
treeData.map((item, index) => {
|
||||
arr.push(item.key);
|
||||
if (item.children && item.children.length > 0) {
|
||||
|
|
@ -179,13 +151,13 @@ class LeftTree extends Component {
|
|||
expandedKeysFn(treeData);
|
||||
return arr;
|
||||
};
|
||||
onChange = (value) => {
|
||||
onChange = value => {
|
||||
if (value == "") {
|
||||
let { copyTree, copyExpandedKeys } = this.state;
|
||||
this.setState({
|
||||
treeData: JSON.parse(copyTree),
|
||||
expandedKeys: copyExpandedKeys,
|
||||
searchValue: value,
|
||||
searchValue: value
|
||||
});
|
||||
} else {
|
||||
let { copyTree, copyExpandedKeys } = this.state;
|
||||
|
|
@ -198,7 +170,7 @@ class LeftTree extends Component {
|
|||
this.setState({
|
||||
treeData: res,
|
||||
expandedKeys: expkey,
|
||||
searchValue: value,
|
||||
searchValue: value
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -208,7 +180,7 @@ class LeftTree extends Component {
|
|||
const tmpStyle = {
|
||||
position: "absolute",
|
||||
left: `${pageX}px`,
|
||||
top: `${pageY}px`,
|
||||
top: `${pageY}px`
|
||||
};
|
||||
const menu = (
|
||||
<Menu
|
||||
|
|
@ -222,7 +194,7 @@ class LeftTree extends Component {
|
|||
return this.state.rightClickNodeTreeItem == null ? "" : menu;
|
||||
};
|
||||
|
||||
handleMenuClick = (menu) => {
|
||||
handleMenuClick = menu => {
|
||||
const { officeManageStore } = this.props;
|
||||
const { id } = this.state.rightClickNodeTreeItem;
|
||||
const { key } = menu;
|
||||
|
|
@ -240,7 +212,7 @@ class LeftTree extends Component {
|
|||
onOk: () => this.handleDelete(id),
|
||||
onCancel() {
|
||||
return false;
|
||||
},
|
||||
}
|
||||
});
|
||||
break;
|
||||
default:
|
||||
|
|
@ -248,26 +220,28 @@ class LeftTree extends Component {
|
|||
}
|
||||
};
|
||||
|
||||
renderTreeNode = (data) => {
|
||||
renderTreeNode = data => {
|
||||
//生成树结构函数
|
||||
if (data.length == 0) {
|
||||
return;
|
||||
}
|
||||
let { expandedKeys, searchValue } = this.state;
|
||||
return data.map((item) => {
|
||||
return data.map(item => {
|
||||
const index = item.title.indexOf(searchValue);
|
||||
const beforeStr = item.title.substr(0, index);
|
||||
const afterStr = item.title.substr(index + searchValue.length);
|
||||
const title =
|
||||
index > -1 ? (
|
||||
<span>
|
||||
{beforeStr}
|
||||
<span style={{ color: "red" }}>{searchValue}</span>
|
||||
{afterStr}
|
||||
</span>
|
||||
) : (
|
||||
<span>{item.title}</span>
|
||||
);
|
||||
index > -1
|
||||
? <span>
|
||||
{beforeStr}
|
||||
<span style={{ color: "red" }}>
|
||||
{searchValue}
|
||||
</span>
|
||||
{afterStr}
|
||||
</span>
|
||||
: <span>
|
||||
{item.title}
|
||||
</span>;
|
||||
if (item.children && item.children.length > 0) {
|
||||
return (
|
||||
<TreeNode key={item.key} title={title} className="tree-node">
|
||||
|
|
@ -275,31 +249,46 @@ class LeftTree extends Component {
|
|||
</TreeNode>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<TreeNode key={item.key} title={title} className="tree-node"></TreeNode>
|
||||
);
|
||||
return <TreeNode key={item.key} title={title} className="tree-node" />;
|
||||
});
|
||||
};
|
||||
|
||||
onExpand = (expandedKeys) => {
|
||||
onExpand = expandedKeys => {
|
||||
this.setState({
|
||||
expandedKeys,
|
||||
expandedKeys
|
||||
});
|
||||
};
|
||||
|
||||
handleSave = () => {
|
||||
const { form1, savePost } = this.props.officeManageStore;
|
||||
form1.validateForm().then((f) => {
|
||||
const {
|
||||
form1,
|
||||
savePost,
|
||||
updatePost,
|
||||
officeClassifyId,
|
||||
officeVisible
|
||||
} = this.props.officeManageStore;
|
||||
form1.validateForm().then(f => {
|
||||
if (f.isValid) {
|
||||
// 验证通过, balabala业务代码
|
||||
const payload = { ...form1.getFormParams() };
|
||||
const payload = { ...form1.getFormParams(), id: officeClassifyId };
|
||||
const result =
|
||||
officeClassifyId && officeVisible.type === "editPlan"
|
||||
? updatePost(payload)
|
||||
: savePost(payload);
|
||||
this.setState({ loading: true });
|
||||
savePost(payload).then(({ code, msg }) => {
|
||||
result.then(({ code, msg }) => {
|
||||
this.setState({ loading: false });
|
||||
if (code === 200) {
|
||||
message.success("新增成功");
|
||||
message.success(
|
||||
officeClassifyId && officeVisible.type === "editPlan"
|
||||
? "编辑成功"
|
||||
: "新增成功"
|
||||
);
|
||||
this.getTreeData();
|
||||
this.props.officeManageStore.setOfficeVisible(false);
|
||||
this.props.officeManageStore.setOfficeVisible({
|
||||
bool: false,
|
||||
type: officeVisible.type
|
||||
});
|
||||
} else {
|
||||
message.error(msg || "新增失败");
|
||||
}
|
||||
|
|
@ -310,11 +299,12 @@ class LeftTree extends Component {
|
|||
}
|
||||
});
|
||||
};
|
||||
handleDelete = (ids) => {
|
||||
handleDelete = ids => {
|
||||
const { deleteByIds } = this.props.officeManageStore;
|
||||
deleteByIds({ ids }).then(({ code, msg }) => {
|
||||
if (code === 200) {
|
||||
message.success("删除成功");
|
||||
this.props.officeManageStore.setOfficeClassifyId("");
|
||||
this.getTreeData();
|
||||
} else {
|
||||
message.error(msg || "删除失败");
|
||||
|
|
@ -325,7 +315,12 @@ class LeftTree extends Component {
|
|||
render() {
|
||||
let { expandedKeys, treeData, searchValue, loading } = this.state;
|
||||
const { officeManageStore } = this.props;
|
||||
const { officeCondition, form1, officeVisible } = officeManageStore;
|
||||
const {
|
||||
officeCondition,
|
||||
form1,
|
||||
officeVisible,
|
||||
officeClassifyId
|
||||
} = officeManageStore;
|
||||
return (
|
||||
<div>
|
||||
<div style={{ padding: 10 }}>
|
||||
|
|
@ -338,17 +333,21 @@ class LeftTree extends Component {
|
|||
<Tree
|
||||
onExpand={this.onExpand}
|
||||
expandedKeys={expandedKeys}
|
||||
onRightClick={this.treeNodeonRightClick}
|
||||
// 右击注释
|
||||
// onRightClick={this.treeNodeonRightClick}
|
||||
onSelect={this.onSelect}>
|
||||
{this.renderTreeNode(treeData)}
|
||||
</Tree>
|
||||
{this.getNodeTreeRightClickMenu()}
|
||||
<NewAndEditDialog
|
||||
ecId={`${
|
||||
(this && this.props && this.props.ecId) || ""
|
||||
}_NewAndEditDialog@q4rrwm`}
|
||||
title={i18n.label.newOfficeName()}
|
||||
visible={officeVisible}
|
||||
ecId={`${(this && this.props && this.props.ecId) ||
|
||||
""}_NewAndEditDialog@q4rrwm`}
|
||||
title={
|
||||
officeClassifyId && officeVisible.type === "editPlan"
|
||||
? i18n.label.editOfficeClassifyName()
|
||||
: i18n.label.newOfficeClassifyName()
|
||||
}
|
||||
visible={officeVisible.bool}
|
||||
condition={toJS(officeCondition)}
|
||||
form={form1}
|
||||
isFormInit={form1.isFormInit}
|
||||
|
|
@ -357,7 +356,11 @@ class LeftTree extends Component {
|
|||
height={250}
|
||||
conditionLen={3}
|
||||
save={() => this.handleSave()}
|
||||
onCancel={() => officeManageStore.setOfficeVisible(false)}
|
||||
onCancel={() =>
|
||||
officeManageStore.setOfficeVisible({
|
||||
bool: false,
|
||||
type: officeVisible.type
|
||||
})}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -9,13 +9,12 @@ import {
|
|||
WeaTab,
|
||||
WeaFormItem,
|
||||
WeaRightMenu,
|
||||
WeaLeftRightLayout,
|
||||
WeaLeftRightLayout
|
||||
} from "ecCom";
|
||||
import { Row, Col, Spin, Modal, Button, message, Switch } from "antd";
|
||||
import { WeaSwitch, WeaTableNew } from "comsMobx";
|
||||
import "./index.less";
|
||||
import { renderNoright } from '../../util';
|
||||
|
||||
import { renderNoright } from "../../util";
|
||||
|
||||
const confirm = Modal.confirm;
|
||||
const WeaTable = WeaTableNew.WeaTable;
|
||||
|
|
@ -28,6 +27,7 @@ export default class OfficeManage extends Component {
|
|||
date: "",
|
||||
editId: "",
|
||||
loading: false,
|
||||
deleteOfficeClassifyFlag: false
|
||||
};
|
||||
}
|
||||
componentDidMount() {
|
||||
|
|
@ -44,7 +44,7 @@ export default class OfficeManage extends Component {
|
|||
let obj = {
|
||||
key: item.menuFun,
|
||||
icon: <i className={`${item.menuIcon}`} />,
|
||||
content: item.menuName,
|
||||
content: item.menuName
|
||||
};
|
||||
if (
|
||||
item.menuFun == "collection" ||
|
||||
|
|
@ -58,7 +58,7 @@ export default class OfficeManage extends Component {
|
|||
return menus;
|
||||
};
|
||||
|
||||
handleMenuClick = (key) => {
|
||||
handleMenuClick = key => {
|
||||
const { officeManageStore } = this.props;
|
||||
const { isPanelShow, tableStore } = officeManageStore;
|
||||
isPanelShow && officeManageStore.setPanelStatus(false);
|
||||
|
|
@ -78,10 +78,14 @@ export default class OfficeManage extends Component {
|
|||
};
|
||||
|
||||
handleSave() {
|
||||
const { form, condition, savePostInfo, updatePostInfo } =
|
||||
this.props.officeManageStore;
|
||||
const {
|
||||
form,
|
||||
condition,
|
||||
savePostInfo,
|
||||
updatePostInfo
|
||||
} = this.props.officeManageStore;
|
||||
const { editId } = this.state;
|
||||
form.validateForm().then((f) => {
|
||||
form.validateForm().then(f => {
|
||||
if (f.isValid) {
|
||||
// 验证通过, balabala业务代码
|
||||
const payload = editId
|
||||
|
|
@ -121,21 +125,63 @@ export default class OfficeManage extends Component {
|
|||
}
|
||||
getTopMenuBtns = () => {
|
||||
const { officeManageStore } = this.props;
|
||||
const { topMenu, tableStore } = officeManageStore;
|
||||
const { topMenu, tableStore, officeClassifyId } = officeManageStore;
|
||||
let btns = [];
|
||||
topMenu.map((item, i) => {
|
||||
if (item.menuFun !== "batchDelete") {
|
||||
if (item.menuFun !== "batchDelete" && item.menuFun !== "delPlan") {
|
||||
btns.push(
|
||||
<Button
|
||||
type="primary"
|
||||
disabled={item.menuFun == "editPlan" && !officeClassifyId}
|
||||
onClick={() => {
|
||||
const { officeManageStore } = this.props;
|
||||
if (item.menuFun == "new") {
|
||||
officeManageStore.isPanelShow &&
|
||||
officeManageStore.setPanelStatus(false);
|
||||
officeManageStore.getPostInfoForm();
|
||||
officeManageStore.setVisible(true);
|
||||
officeManageStore.setNeDialogTitle(i18n.label.newOfficeName());
|
||||
} else if (
|
||||
item.menuFun == "addPlan" ||
|
||||
item.menuFun == "editPlan"
|
||||
) {
|
||||
officeManageStore.getPostForm(
|
||||
item.menuFun == "editPlan" ? officeClassifyId : ""
|
||||
);
|
||||
officeManageStore.setOfficeVisible({
|
||||
bool: true,
|
||||
type: item.menuFun
|
||||
});
|
||||
}
|
||||
}}>
|
||||
{item.menuName}
|
||||
</Button>
|
||||
);
|
||||
} else if (item.menuFun === "delPlan") {
|
||||
btns.push(
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
const { officeManageStore } = this.props;
|
||||
officeManageStore.isPanelShow &&
|
||||
officeManageStore.setPanelStatus(false);
|
||||
officeManageStore.getPostInfoForm();
|
||||
officeManageStore.setVisible(true);
|
||||
officeManageStore.setNeDialogTitle(i18n.label.newOfficeName());
|
||||
}}>
|
||||
confirm({
|
||||
title: i18n.confirm.defaultTitle(),
|
||||
content: i18n.confirm.delete(),
|
||||
okText: i18n.button.ok(),
|
||||
cancelText: i18n.button.cancel(),
|
||||
onOk: () => {
|
||||
this.setState({
|
||||
deleteOfficeClassifyFlag: !this.state
|
||||
.deleteOfficeClassifyFlag
|
||||
});
|
||||
},
|
||||
onCancel() {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}}
|
||||
disabled={
|
||||
!officeClassifyId ||
|
||||
(officeClassifyId && !_.isEmpty(toJS(tableStore.datas)))
|
||||
}>
|
||||
{item.menuName}
|
||||
</Button>
|
||||
);
|
||||
|
|
@ -168,11 +214,11 @@ export default class OfficeManage extends Component {
|
|||
onOk: () => this.deletePostinfoByIds(ids),
|
||||
onCancel() {
|
||||
return false;
|
||||
},
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
deletePostinfoByIds = (ids) => {
|
||||
deletePostinfoByIds = ids => {
|
||||
const { officeManageStore } = this.props;
|
||||
const { deletePostinfoByIds } = officeManageStore;
|
||||
deletePostinfoByIds({ ids }).then(({ code, msg }) => {
|
||||
|
|
@ -185,27 +231,25 @@ export default class OfficeManage extends Component {
|
|||
});
|
||||
};
|
||||
|
||||
reRenderColumns = (columns) => {
|
||||
reRenderColumns = columns => {
|
||||
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}
|
||||
onChange={(checked) => {
|
||||
onChange={checked => {
|
||||
confirm({
|
||||
title: i18n.confirm.defaultTitle(),
|
||||
content:
|
||||
record.forbidden_tag === "0"
|
||||
? "确定要禁用吗?"
|
||||
: "确定要启用吗?",
|
||||
record.forbidden_tag === "0" ? "确定禁用该记录吗?" : "确定启用该记录吗?",
|
||||
okText: i18n.button.ok(),
|
||||
cancelText: i18n.button.cancel(),
|
||||
onOk: () => _this.updateForbiddenTag(checked, record.id),
|
||||
onCancel() {
|
||||
return false;
|
||||
},
|
||||
}
|
||||
});
|
||||
}}
|
||||
/>
|
||||
|
|
@ -220,7 +264,7 @@ export default class OfficeManage extends Component {
|
|||
const { updateForbiddenTagById } = officeManageStore;
|
||||
const payload = {
|
||||
id,
|
||||
forbiddentag,
|
||||
forbiddentag
|
||||
};
|
||||
updateForbiddenTagById(payload).then(({ code, msg }) => {
|
||||
if (code === 200) {
|
||||
|
|
@ -236,7 +280,7 @@ export default class OfficeManage extends Component {
|
|||
operate.index == "0" && this.doEdit(record.randomFieldId);
|
||||
operate.index === "1" && this.showConfirm("del", record.randomFieldId);
|
||||
};
|
||||
doEdit = (editId) => {
|
||||
doEdit = editId => {
|
||||
this.setState({ editId });
|
||||
const { officeManageStore } = this.props;
|
||||
officeManageStore.isPanelShow && officeManageStore.setPanelStatus(false);
|
||||
|
|
@ -245,44 +289,36 @@ export default class OfficeManage extends Component {
|
|||
officeManageStore.setNeDialogTitle(i18n.label.editOfficeName());
|
||||
};
|
||||
|
||||
custom = () => {
|
||||
debugger
|
||||
const {
|
||||
officeManageStore
|
||||
} = this.props, {
|
||||
tableStore,
|
||||
} = officeManageStore;
|
||||
|
||||
|
||||
}
|
||||
|
||||
getPanelComponents = () => {
|
||||
const { officeManageStore } = this.props;
|
||||
const { searchCondition, form2, searchConditionLoading } =
|
||||
officeManageStore;
|
||||
const {
|
||||
searchCondition,
|
||||
form2,
|
||||
searchConditionLoading
|
||||
} = officeManageStore;
|
||||
let arr = [];
|
||||
let formParams = form2.getFormParams();
|
||||
const { isFormInit } = form2;
|
||||
isFormInit &&
|
||||
searchCondition.map((c) => {
|
||||
searchCondition.map(c => {
|
||||
c.items.map((field, index) => {
|
||||
arr.push(
|
||||
<Col
|
||||
ecId={`${(this && this.props && this.props.ecId) || ""
|
||||
}_Col@4cc308@${index}`}
|
||||
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}`}
|
||||
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}`}
|
||||
ecId={`${(this && this.props && this.props.ecId) ||
|
||||
""}_WeaSwitch@p7d3td@${index}`}
|
||||
fieldConfig={field}
|
||||
form={form2}
|
||||
formParams={formParams}
|
||||
|
|
@ -299,16 +335,17 @@ export default class OfficeManage extends Component {
|
|||
return (
|
||||
<div className="hrm-loading-center-small" style={{ top: "25%" }}>
|
||||
<Spin
|
||||
ecId={`${(this && this.props && this.props.ecId) || ""
|
||||
}_Spin@lbktzb`}
|
||||
spinning={searchConditionLoading}></Spin>
|
||||
ecId={`${(this && this.props && this.props.ecId) ||
|
||||
""}_Spin@lbktzb`}
|
||||
spinning={searchConditionLoading}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<Row
|
||||
ecId={`${(this && this.props && this.props.ecId) || ""}_Row@ppeb6z`}
|
||||
onKeyDown={(e) => {
|
||||
onKeyDown={e => {
|
||||
if (e.keyCode == 13 && e.target.tagName === "INPUT") {
|
||||
officeManageStore.getPostInfoTable();
|
||||
officeManageStore.setPanelStatus(false);
|
||||
|
|
@ -342,12 +379,12 @@ export default class OfficeManage extends Component {
|
|||
ecId={`${(this && this.props && this.props.ecId) || ""}_Button@5u9mfz`}
|
||||
onClick={() => officeManageStore.setPanelStatus(false)}>
|
||||
{i18n.button.cancel()}
|
||||
</Button>,
|
||||
</Button>
|
||||
];
|
||||
|
||||
return btn;
|
||||
};
|
||||
onSearchChange = (val) => {
|
||||
onSearchChange = val => {
|
||||
const { officeManageStore } = this.props;
|
||||
const { form2 } = officeManageStore;
|
||||
officeManageStore.setPostInfoName(val);
|
||||
|
|
@ -356,7 +393,7 @@ export default class OfficeManage extends Component {
|
|||
|
||||
render() {
|
||||
const { officeManageStore } = this.props;
|
||||
const { date, loading } = this.state;
|
||||
const { date, loading, deleteOfficeClassifyFlag } = this.state;
|
||||
const {
|
||||
isPanelShow,
|
||||
form2,
|
||||
|
|
@ -374,22 +411,24 @@ export default class OfficeManage extends Component {
|
|||
if (hasRight === false) {
|
||||
return renderNoright();
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
hasRight && <div className="office-wapper">
|
||||
<div className="office-wapper">
|
||||
<WeaLeftRightLayout
|
||||
isNew={true}
|
||||
leftWidth={310}
|
||||
leftCom={<LeftTree />}
|
||||
onCollapse={(showLeft) => console.log("showLeft:", showLeft)}>
|
||||
leftCom={
|
||||
<LeftTree deleteOfficeClassifyFlag={deleteOfficeClassifyFlag} />
|
||||
}
|
||||
onCollapse={showLeft => console.log("showLeft:", showLeft)}>
|
||||
<WeaRightMenu
|
||||
ecId={`${(this && this.props && this.props.ecId) || ""
|
||||
}_WeaRightMenu@cea97d`}
|
||||
ecId={`${(this && this.props && this.props.ecId) ||
|
||||
""}_WeaRightMenu@cea97d`}
|
||||
datas={this.getDropMenuDatas()}
|
||||
onClick={(key) => this.handleMenuClick(key)}>
|
||||
onClick={key => this.handleMenuClick(key)}>
|
||||
<WeaTop
|
||||
ecId={`${(this && this.props && this.props.ecId) || ""
|
||||
}_WeaTop@446d12`}
|
||||
ecId={`${(this && this.props && this.props.ecId) ||
|
||||
""}_WeaTop@446d12`}
|
||||
title={i18n.label.officeName()}
|
||||
icon={<i className="icon-coms-hrm" />}
|
||||
iconBgcolor="#217346"
|
||||
|
|
@ -397,10 +436,10 @@ export default class OfficeManage extends Component {
|
|||
buttons={this.getTopMenuBtns()}
|
||||
showDropIcon={true}
|
||||
dropMenuDatas={this.getDropMenuDatas()}
|
||||
onDropMenuClick={(e) => this.handleMenuClick(e)}>
|
||||
onDropMenuClick={e => this.handleMenuClick(e)}>
|
||||
<WeaTab
|
||||
ecId={`${(this && this.props && this.props.ecId) || ""
|
||||
}_WeaTab@39c727`}
|
||||
ecId={`${(this && this.props && this.props.ecId) ||
|
||||
""}_WeaTab@39c727`}
|
||||
searchType={["base", "advanced"]}
|
||||
showSearchAd={isPanelShow}
|
||||
searchsBaseValue={
|
||||
|
|
@ -408,42 +447,37 @@ export default class OfficeManage extends Component {
|
|||
? postInfoName
|
||||
: form2.getFormParams().postInfoName
|
||||
}
|
||||
setShowSearchAd={(bool) =>
|
||||
officeManageStore.setPanelStatus(bool)
|
||||
}
|
||||
setShowSearchAd={bool => officeManageStore.setPanelStatus(bool)}
|
||||
hideSearchAd={() => officeManageStore.setPanelStatus(false)}
|
||||
searchsAd={
|
||||
isPanelShow ? this.getPanelComponents() : <div></div>
|
||||
}
|
||||
searchsAd={isPanelShow ? this.getPanelComponents() : <div />}
|
||||
advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20}
|
||||
hasMask={false}
|
||||
buttonsAd={this.getTabBtn()}
|
||||
onSearch={() => officeManageStore.getPostInfoTable()}
|
||||
onSearchChange={(val) => this.onSearchChange(val)}
|
||||
onSearchChange={val => this.onSearchChange(val)}
|
||||
/>
|
||||
<WeaTable
|
||||
ecId={`${(this && this.props && this.props.ecId) || ""
|
||||
}_WeaTable@b43a4c`}
|
||||
ecId={`${(this && this.props && this.props.ecId) ||
|
||||
""}_WeaTable@b43a4c`}
|
||||
comsWeaTableStore={tableStore}
|
||||
hasOrder={true}
|
||||
needScroll={true}
|
||||
rowSelection={{
|
||||
getCheckboxProps: (record) => {
|
||||
getCheckboxProps: record => {
|
||||
console.log(record);
|
||||
return {
|
||||
disabled: true, // 配置无法勾选的列
|
||||
disabled: true // 配置无法勾选的列
|
||||
};
|
||||
},
|
||||
}
|
||||
}}
|
||||
getColumns={(c) => this.reRenderColumns(c)}
|
||||
getColumns={c => this.reRenderColumns(c)}
|
||||
onOperatesClick={(record, index, operate) =>
|
||||
this.onOperatesClick(record, index, operate)
|
||||
}
|
||||
this.onOperatesClick(record, index, operate)}
|
||||
/>
|
||||
</WeaTop>
|
||||
<NewAndEditDialog
|
||||
ecId={`${(this && this.props && this.props.ecId) || ""
|
||||
}_NewAndEditDialog@q4rrwm`}
|
||||
ecId={`${(this && this.props && this.props.ecId) ||
|
||||
""}_NewAndEditDialog@q4rrwm`}
|
||||
title={nEdialogTitle}
|
||||
visible={visible}
|
||||
condition={toJS(condition)}
|
||||
|
|
|
|||
|
|
@ -127,7 +127,8 @@ export const i18n = {
|
|||
officeName: () => getLabel(385936, '职务管理'),
|
||||
newOfficeName: () => getLabel(386246, '新建职务信息'),
|
||||
editOfficeName: () => getLabel(386247, '编辑职务信息'),
|
||||
newOfficeClassifyName: () => getLabel(386246, '新建职务分类信息'),
|
||||
newOfficeClassifyName: () => getLabel(386246, '新建职务分类'),
|
||||
editOfficeClassifyName: () => getLabel(386246, '编辑职务分类'),
|
||||
branchNumSetting: () => getLabel(386246, '分部编号设置'),
|
||||
deptNumSetting: () => getLabel(386246, '部门编号设置'),
|
||||
postNumSetting: () => getLabel(386246, '岗位编号设置'),
|
||||
|
|
|
|||
|
|
@ -22,20 +22,26 @@ export class OfficeManageStore {
|
|||
@observable form = new WeaForm(); //新增编辑渲染的表单
|
||||
@observable form1 = new WeaForm(); //职务分类渲染的表单
|
||||
@observable postInfoName = "";
|
||||
@observable officeClassifyId = ""; //选中职务分类的id
|
||||
@observable conditionNum = 2;
|
||||
@observable ids = ""; //选择行id
|
||||
@observable searchConditionLoading = false;
|
||||
@observable nEdialogTitle = "";
|
||||
@observable officeVisible = false;
|
||||
@observable officeVisible = {};
|
||||
@observable visible = false;
|
||||
@observable dialogLoading = false;
|
||||
@observable schemeId = "";
|
||||
@observable date = "";
|
||||
@observable hasRight = '';
|
||||
@observable hasRight = "";
|
||||
|
||||
@action
|
||||
setOfficeClassifyId(id) {
|
||||
this.officeClassifyId = id;
|
||||
}
|
||||
|
||||
@action
|
||||
getHasRight() {
|
||||
API.getHasRight().then((res) => {
|
||||
API.getHasRight().then(res => {
|
||||
const { code, data, msg } = res;
|
||||
if (code === 200) {
|
||||
const { rightMenu, topMenu } = data;
|
||||
|
|
@ -50,7 +56,7 @@ export class OfficeManageStore {
|
|||
@action("高级搜索表单渲染")
|
||||
getSearchCondition() {
|
||||
this.setScLoadingStatus(true);
|
||||
API.getSearchCondition().then((res) => {
|
||||
API.getSearchCondition().then(res => {
|
||||
this.setScLoadingStatus(false);
|
||||
const { code, data, msg } = res;
|
||||
if (code === 200) {
|
||||
|
|
@ -65,7 +71,7 @@ export class OfficeManageStore {
|
|||
@action("获取新增/编辑表单")
|
||||
getPostInfoForm(id) {
|
||||
this.setDialogLoadingStatus(true);
|
||||
API.getPostInfoForm({ id }).then((res) => {
|
||||
API.getPostInfoForm({ id }).then(res => {
|
||||
this.setDialogLoadingStatus(false);
|
||||
const { code, data, msg } = res;
|
||||
if (code === 200) {
|
||||
|
|
@ -85,15 +91,15 @@ export class OfficeManageStore {
|
|||
params = {
|
||||
...this.form2.getFormParams(),
|
||||
postId,
|
||||
postInfoName: this.postInfoName,
|
||||
postInfoName: this.postInfoName
|
||||
};
|
||||
} else {
|
||||
params = {
|
||||
postId,
|
||||
...this.form2.getFormParams(),
|
||||
...this.form2.getFormParams()
|
||||
};
|
||||
}
|
||||
API.getPostInfoTable(params).then((res) => {
|
||||
API.getPostInfoTable(params).then(res => {
|
||||
if (res.code === 200) {
|
||||
this.setHasRight(res.data.hasRight);
|
||||
res.data.datas && this.tableStore.getDatas(res.data.datas, 1);
|
||||
|
|
@ -110,21 +116,28 @@ export class OfficeManageStore {
|
|||
|
||||
@action("保存职务分类")
|
||||
savePost(payload) {
|
||||
return API.savePost(payload).then((response) => {
|
||||
return API.savePost(payload).then(response => {
|
||||
return response.json();
|
||||
});
|
||||
}
|
||||
|
||||
@action("编辑职务分类")
|
||||
updatePost(payload) {
|
||||
return API.updatePost(payload).then(response => {
|
||||
return response.json();
|
||||
});
|
||||
}
|
||||
|
||||
@action("删除职务分类")
|
||||
deleteByIds(payload) {
|
||||
return API.deleteByIds(payload).then((response) => {
|
||||
return API.deleteByIds(payload).then(response => {
|
||||
return response.json();
|
||||
});
|
||||
}
|
||||
|
||||
@action("删除职务信息")
|
||||
deletePostinfoByIds(payload) {
|
||||
return API.deletePostinfoByIds(payload).then((response) => {
|
||||
return API.deletePostinfoByIds(payload).then(response => {
|
||||
return response.json();
|
||||
});
|
||||
}
|
||||
|
|
@ -132,7 +145,7 @@ export class OfficeManageStore {
|
|||
@action("获取职务分类表单")
|
||||
getPostForm(id) {
|
||||
this.setDialogLoadingStatus(true);
|
||||
API.getPostForm({ id }).then((res) => {
|
||||
API.getPostForm({ id }).then(res => {
|
||||
this.setDialogLoadingStatus(false);
|
||||
const { code, data, msg } = res;
|
||||
if (code === 200) {
|
||||
|
|
@ -155,21 +168,21 @@ export class OfficeManageStore {
|
|||
|
||||
@action("新增职务信息")
|
||||
savePostInfo(payload) {
|
||||
return API.savePostInfo(payload).then((response) => {
|
||||
return API.savePostInfo(payload).then(response => {
|
||||
return response.json();
|
||||
});
|
||||
}
|
||||
|
||||
@action("更新职务信息")
|
||||
updatePostInfo(payload) {
|
||||
return API.updatePostInfo(payload).then((response) => {
|
||||
return API.updatePostInfo(payload).then(response => {
|
||||
return response.json();
|
||||
});
|
||||
}
|
||||
|
||||
@action("更新禁用标识 ")
|
||||
updateForbiddenTagById(payload) {
|
||||
return API.updateForbiddenTagById(payload).then((response) => {
|
||||
return API.updateForbiddenTagById(payload).then(response => {
|
||||
return response.json();
|
||||
});
|
||||
}
|
||||
|
|
@ -200,8 +213,8 @@ export class OfficeManageStore {
|
|||
if (!bool) this.setDialogLoadingStatus(false);
|
||||
}
|
||||
|
||||
setOfficeVisible(bool) {
|
||||
this.officeVisible = bool;
|
||||
setOfficeVisible({ bool, type }) {
|
||||
this.officeVisible = { bool, type };
|
||||
this.officeFormReset();
|
||||
if (!bool) this.setDialogLoadingStatus(false);
|
||||
}
|
||||
|
|
@ -217,8 +230,8 @@ export class OfficeManageStore {
|
|||
updateFields(val) {
|
||||
this.form2.updateFields({
|
||||
postInfoName: {
|
||||
value: val,
|
||||
},
|
||||
value: val
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue