修改职务管理

This commit is contained in:
liyongshun 2022-06-22 16:09:43 +08:00
parent 9fa6b9da32
commit 4878b6be1d
5 changed files with 282 additions and 221 deletions

View File

@ -2,11 +2,11 @@
* Author: 黎永顺 * Author: 黎永顺
* Description: * Description:
* Date: 2022-05-13 16:36:09 * 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"; import { WeaTools } from "ecCom";
export const getHasRight = (params) => { export const getHasRight = params => {
return WeaTools.callApi( return WeaTools.callApi(
"/api/bs/hrmorganization/postinfo/getHasRight", "/api/bs/hrmorganization/postinfo/getHasRight",
"GET", "GET",
@ -14,7 +14,7 @@ export const getHasRight = (params) => {
); );
}; };
export const getSearchCondition = (params) => { export const getSearchCondition = params => {
return WeaTools.callApi( return WeaTools.callApi(
"/api/bs/hrmorganization/postinfo/getSearchCondition", "/api/bs/hrmorganization/postinfo/getSearchCondition",
"GET", "GET",
@ -22,84 +22,94 @@ export const getSearchCondition = (params) => {
); );
}; };
export const getPostInfoForm = (params) => { export const getPostInfoForm = params => {
return WeaTools.callApi( return WeaTools.callApi(
"/api/bs/hrmorganization/postinfo/getPostInfoForm", "/api/bs/hrmorganization/postinfo/getPostInfoForm",
"GET", "GET",
params params
); );
}; };
export const savePostInfo = (params) => { export const savePostInfo = params => {
return fetch("/api/bs/hrmorganization/postinfo/savePostInfo", { return fetch("/api/bs/hrmorganization/postinfo/savePostInfo", {
method: "POST", method: "POST",
mode: "cors", mode: "cors",
headers: { 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", { return fetch("/api/bs/hrmorganization/postinfo/updatePostInfo", {
method: "POST", method: "POST",
mode: "cors", mode: "cors",
headers: { 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", { return fetch("/api/bs/hrmorganization/postinfo/updateForbiddenTagById", {
method: "POST", method: "POST",
mode: "cors", mode: "cors",
headers: { 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", { return fetch("/api/bs/hrmorganization/post/savePost", {
method: "POST", method: "POST",
mode: "cors", mode: "cors",
headers: { 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", { return fetch("/api/bs/hrmorganization/post/deleteByIds", {
method: "POST", method: "POST",
mode: "cors", mode: "cors",
headers: { 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", { return fetch("/api/bs/hrmorganization/postinfo/deleteByIds", {
method: "POST", method: "POST",
mode: "cors", mode: "cors",
headers: { 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( return WeaTools.callApi(
"/api/bs/hrmorganization/post/getTreeData", "/api/bs/hrmorganization/post/getTreeData",
"GET", "GET",
params params
); );
}; };
export const getPostForm = (params) => { export const getPostForm = params => {
return WeaTools.callApi( return WeaTools.callApi(
"/api/bs/hrmorganization/post/getPostForm", "/api/bs/hrmorganization/post/getPostForm",
"GET", "GET",
@ -107,7 +117,7 @@ export const getPostForm = (params) => {
); );
}; };
export const getPostInfoTable = (params) => { export const getPostInfoTable = params => {
return WeaTools.callApi( return WeaTools.callApi(
"/api/bs/hrmorganization/postinfo/getPostInfoTable", "/api/bs/hrmorganization/postinfo/getPostInfoTable",
"GET", "GET",

View File

@ -10,49 +10,6 @@ import "../index.less";
const confirm = Modal.confirm; const confirm = Modal.confirm;
const TreeNode = Tree.TreeNode; 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") @inject("officeManageStore")
@observer @observer
@ -66,7 +23,7 @@ class LeftTree extends Component {
copyTree: [], copyTree: [],
copyExpandedKeys: [], copyExpandedKeys: [],
searchValue: "", searchValue: "",
rightClickNodeTreeItem: null, rightClickNodeTreeItem: null
}; };
} }
componentDidMount() { componentDidMount() {
@ -77,9 +34,19 @@ class LeftTree extends Component {
document.removeEventListener("click", this.handleClick); document.removeEventListener("click", this.handleClick);
} }
componentWillReceiveProps(nextProps) {
if (
nextProps.deleteOfficeClassifyFlag !== this.props.deleteOfficeClassifyFlag
) {
const { officeManageStore } = this.props;
const { officeClassifyId } = officeManageStore;
this.handleDelete(officeClassifyId);
}
}
getTreeData = () => { getTreeData = () => {
const { officeManageStore } = this.props; const { officeManageStore } = this.props;
officeManageStore.getTreeData().then((res) => { officeManageStore.getTreeData().then(res => {
const { code, data, msg } = res; const { code, data, msg } = res;
if (code === 200) { if (code === 200) {
let cp = JSON.stringify([data]); let cp = JSON.stringify([data]);
@ -87,7 +54,7 @@ class LeftTree extends Component {
treeData: [data], treeData: [data],
expandedKeys: this.expandedKeysFun([data]), expandedKeys: this.expandedKeysFun([data]),
copyTree: cp, copyTree: cp,
copyExpandedKeys: [], copyExpandedKeys: []
}); });
} else { } else {
message.error(res.msg); message.error(res.msg);
@ -98,23 +65,28 @@ class LeftTree extends Component {
handleClick = () => { handleClick = () => {
this.setState({ rightClickNodeTreeItem: null }); this.setState({ rightClickNodeTreeItem: null });
}; };
onSelect = (node) => { onSelect = node => {
const [postId] = node; const [postId] = node;
const { officeManageStore } = this.props; const { officeManageStore } = this.props;
officeManageStore.setOfficeClassifyId(
!postId
? officeManageStore.officeClassifyId
: postId != "-1" ? postId : ""
);
officeManageStore.getPostInfoTable(postId); officeManageStore.getPostInfoTable(postId);
this.setState({ this.setState({
rightClickNodeTreeItem: null, rightClickNodeTreeItem: null
}); });
}; };
treeNodeonRightClick = (e) => { treeNodeonRightClick = e => {
this.setState({ this.setState({
rightClickNodeTreeItem: { rightClickNodeTreeItem: {
pageX: e.event.pageX, pageX: e.event.pageX,
pageY: e.event.pageY, pageY: e.event.pageY,
id: e.node.props["eventKey"], 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); return new RegExp(filterText, "i").test(data.title);
}; };
flatTreeFun = (treeData) => { flatTreeFun = treeData => {
let arr = []; let arr = [];
const flatTree = (treeData) => { const flatTree = treeData => {
treeData.map((item, index) => { treeData.map((item, index) => {
arr.push(item); arr.push(item);
if (item.children && item.children.length > 0) { if (item.children && item.children.length > 0) {
@ -163,12 +135,12 @@ class LeftTree extends Component {
flatTree(treeData); flatTree(treeData);
return arr; return arr;
}; };
expandedKeysFun = (treeData) => { expandedKeysFun = treeData => {
if (treeData && treeData.length == 0) { if (treeData && treeData.length == 0) {
return []; return [];
} }
let arr = []; let arr = [];
const expandedKeysFn = (treeData) => { const expandedKeysFn = treeData => {
treeData.map((item, index) => { treeData.map((item, index) => {
arr.push(item.key); arr.push(item.key);
if (item.children && item.children.length > 0) { if (item.children && item.children.length > 0) {
@ -179,13 +151,13 @@ class LeftTree extends Component {
expandedKeysFn(treeData); expandedKeysFn(treeData);
return arr; return arr;
}; };
onChange = (value) => { onChange = value => {
if (value == "") { if (value == "") {
let { copyTree, copyExpandedKeys } = this.state; let { copyTree, copyExpandedKeys } = this.state;
this.setState({ this.setState({
treeData: JSON.parse(copyTree), treeData: JSON.parse(copyTree),
expandedKeys: copyExpandedKeys, expandedKeys: copyExpandedKeys,
searchValue: value, searchValue: value
}); });
} else { } else {
let { copyTree, copyExpandedKeys } = this.state; let { copyTree, copyExpandedKeys } = this.state;
@ -198,7 +170,7 @@ class LeftTree extends Component {
this.setState({ this.setState({
treeData: res, treeData: res,
expandedKeys: expkey, expandedKeys: expkey,
searchValue: value, searchValue: value
}); });
} }
}; };
@ -208,7 +180,7 @@ class LeftTree extends Component {
const tmpStyle = { const tmpStyle = {
position: "absolute", position: "absolute",
left: `${pageX}px`, left: `${pageX}px`,
top: `${pageY}px`, top: `${pageY}px`
}; };
const menu = ( const menu = (
<Menu <Menu
@ -222,7 +194,7 @@ class LeftTree extends Component {
return this.state.rightClickNodeTreeItem == null ? "" : menu; return this.state.rightClickNodeTreeItem == null ? "" : menu;
}; };
handleMenuClick = (menu) => { handleMenuClick = menu => {
const { officeManageStore } = this.props; const { officeManageStore } = this.props;
const { id } = this.state.rightClickNodeTreeItem; const { id } = this.state.rightClickNodeTreeItem;
const { key } = menu; const { key } = menu;
@ -240,7 +212,7 @@ class LeftTree extends Component {
onOk: () => this.handleDelete(id), onOk: () => this.handleDelete(id),
onCancel() { onCancel() {
return false; return false;
}, }
}); });
break; break;
default: default:
@ -248,26 +220,28 @@ class LeftTree extends Component {
} }
}; };
renderTreeNode = (data) => { renderTreeNode = data => {
//生成树结构函数 //生成树结构函数
if (data.length == 0) { if (data.length == 0) {
return; return;
} }
let { expandedKeys, searchValue } = this.state; let { expandedKeys, searchValue } = this.state;
return data.map((item) => { return data.map(item => {
const index = item.title.indexOf(searchValue); const index = item.title.indexOf(searchValue);
const beforeStr = item.title.substr(0, index); const beforeStr = item.title.substr(0, index);
const afterStr = item.title.substr(index + searchValue.length); const afterStr = item.title.substr(index + searchValue.length);
const title = const title =
index > -1 ? ( index > -1
<span> ? <span>
{beforeStr} {beforeStr}
<span style={{ color: "red" }}>{searchValue}</span> <span style={{ color: "red" }}>
{afterStr} {searchValue}
</span> </span>
) : ( {afterStr}
<span>{item.title}</span> </span>
); : <span>
{item.title}
</span>;
if (item.children && item.children.length > 0) { if (item.children && item.children.length > 0) {
return ( return (
<TreeNode key={item.key} title={title} className="tree-node"> <TreeNode key={item.key} title={title} className="tree-node">
@ -275,31 +249,46 @@ class LeftTree extends Component {
</TreeNode> </TreeNode>
); );
} }
return ( return <TreeNode key={item.key} title={title} className="tree-node" />;
<TreeNode key={item.key} title={title} className="tree-node"></TreeNode>
);
}); });
}; };
onExpand = (expandedKeys) => { onExpand = expandedKeys => {
this.setState({ this.setState({
expandedKeys, expandedKeys
}); });
}; };
handleSave = () => { handleSave = () => {
const { form1, savePost } = this.props.officeManageStore; const {
form1.validateForm().then((f) => { form1,
savePost,
updatePost,
officeClassifyId,
officeVisible
} = this.props.officeManageStore;
form1.validateForm().then(f => {
if (f.isValid) { if (f.isValid) {
// 验证通过, balabala业务代码 // 验证通过, 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 }); this.setState({ loading: true });
savePost(payload).then(({ code, msg }) => { result.then(({ code, msg }) => {
this.setState({ loading: false }); this.setState({ loading: false });
if (code === 200) { if (code === 200) {
message.success("新增成功"); message.success(
officeClassifyId && officeVisible.type === "editPlan"
? "编辑成功"
: "新增成功"
);
this.getTreeData(); this.getTreeData();
this.props.officeManageStore.setOfficeVisible(false); this.props.officeManageStore.setOfficeVisible({
bool: false,
type: officeVisible.type
});
} else { } else {
message.error(msg || "新增失败"); message.error(msg || "新增失败");
} }
@ -310,11 +299,12 @@ class LeftTree extends Component {
} }
}); });
}; };
handleDelete = (ids) => { handleDelete = ids => {
const { deleteByIds } = this.props.officeManageStore; const { deleteByIds } = this.props.officeManageStore;
deleteByIds({ ids }).then(({ code, msg }) => { deleteByIds({ ids }).then(({ code, msg }) => {
if (code === 200) { if (code === 200) {
message.success("删除成功"); message.success("删除成功");
this.props.officeManageStore.setOfficeClassifyId("");
this.getTreeData(); this.getTreeData();
} else { } else {
message.error(msg || "删除失败"); message.error(msg || "删除失败");
@ -325,7 +315,12 @@ class LeftTree extends Component {
render() { render() {
let { expandedKeys, treeData, searchValue, loading } = this.state; let { expandedKeys, treeData, searchValue, loading } = this.state;
const { officeManageStore } = this.props; const { officeManageStore } = this.props;
const { officeCondition, form1, officeVisible } = officeManageStore; const {
officeCondition,
form1,
officeVisible,
officeClassifyId
} = officeManageStore;
return ( return (
<div> <div>
<div style={{ padding: 10 }}> <div style={{ padding: 10 }}>
@ -338,17 +333,21 @@ class LeftTree extends Component {
<Tree <Tree
onExpand={this.onExpand} onExpand={this.onExpand}
expandedKeys={expandedKeys} expandedKeys={expandedKeys}
onRightClick={this.treeNodeonRightClick} // 右击注释
// onRightClick={this.treeNodeonRightClick}
onSelect={this.onSelect}> onSelect={this.onSelect}>
{this.renderTreeNode(treeData)} {this.renderTreeNode(treeData)}
</Tree> </Tree>
{this.getNodeTreeRightClickMenu()} {this.getNodeTreeRightClickMenu()}
<NewAndEditDialog <NewAndEditDialog
ecId={`${ ecId={`${(this && this.props && this.props.ecId) ||
(this && this.props && this.props.ecId) || "" ""}_NewAndEditDialog@q4rrwm`}
}_NewAndEditDialog@q4rrwm`} title={
title={i18n.label.newOfficeName()} officeClassifyId && officeVisible.type === "editPlan"
visible={officeVisible} ? i18n.label.editOfficeClassifyName()
: i18n.label.newOfficeClassifyName()
}
visible={officeVisible.bool}
condition={toJS(officeCondition)} condition={toJS(officeCondition)}
form={form1} form={form1}
isFormInit={form1.isFormInit} isFormInit={form1.isFormInit}
@ -357,7 +356,11 @@ class LeftTree extends Component {
height={250} height={250}
conditionLen={3} conditionLen={3}
save={() => this.handleSave()} save={() => this.handleSave()}
onCancel={() => officeManageStore.setOfficeVisible(false)} onCancel={() =>
officeManageStore.setOfficeVisible({
bool: false,
type: officeVisible.type
})}
/> />
</div> </div>
); );

View File

@ -9,13 +9,12 @@ import {
WeaTab, WeaTab,
WeaFormItem, WeaFormItem,
WeaRightMenu, WeaRightMenu,
WeaLeftRightLayout, WeaLeftRightLayout
} from "ecCom"; } from "ecCom";
import { Row, Col, Spin, Modal, Button, message, Switch } from "antd"; 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";
const confirm = Modal.confirm; const confirm = Modal.confirm;
const WeaTable = WeaTableNew.WeaTable; const WeaTable = WeaTableNew.WeaTable;
@ -28,6 +27,7 @@ export default class OfficeManage extends Component {
date: "", date: "",
editId: "", editId: "",
loading: false, loading: false,
deleteOfficeClassifyFlag: false
}; };
} }
componentDidMount() { componentDidMount() {
@ -44,7 +44,7 @@ export default class OfficeManage extends Component {
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 (
item.menuFun == "collection" || item.menuFun == "collection" ||
@ -58,7 +58,7 @@ export default class OfficeManage extends Component {
return menus; return menus;
}; };
handleMenuClick = (key) => { handleMenuClick = key => {
const { officeManageStore } = this.props; const { officeManageStore } = this.props;
const { isPanelShow, tableStore } = officeManageStore; const { isPanelShow, tableStore } = officeManageStore;
isPanelShow && officeManageStore.setPanelStatus(false); isPanelShow && officeManageStore.setPanelStatus(false);
@ -78,10 +78,14 @@ export default class OfficeManage extends Component {
}; };
handleSave() { handleSave() {
const { form, condition, savePostInfo, updatePostInfo } = const {
this.props.officeManageStore; form,
condition,
savePostInfo,
updatePostInfo
} = this.props.officeManageStore;
const { editId } = this.state; const { editId } = this.state;
form.validateForm().then((f) => { form.validateForm().then(f => {
if (f.isValid) { if (f.isValid) {
// 验证通过, balabala业务代码 // 验证通过, balabala业务代码
const payload = editId const payload = editId
@ -121,21 +125,63 @@ export default class OfficeManage extends Component {
} }
getTopMenuBtns = () => { getTopMenuBtns = () => {
const { officeManageStore } = this.props; const { officeManageStore } = this.props;
const { topMenu, tableStore } = officeManageStore; const { topMenu, tableStore, officeClassifyId } = officeManageStore;
let btns = []; let btns = [];
topMenu.map((item, i) => { 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( btns.push(
<Button <Button
type="primary" type="primary"
onClick={() => { onClick={() => {
const { officeManageStore } = this.props; confirm({
officeManageStore.isPanelShow && title: i18n.confirm.defaultTitle(),
officeManageStore.setPanelStatus(false); content: i18n.confirm.delete(),
officeManageStore.getPostInfoForm(); okText: i18n.button.ok(),
officeManageStore.setVisible(true); cancelText: i18n.button.cancel(),
officeManageStore.setNeDialogTitle(i18n.label.newOfficeName()); onOk: () => {
}}> this.setState({
deleteOfficeClassifyFlag: !this.state
.deleteOfficeClassifyFlag
});
},
onCancel() {
return false;
}
});
}}
disabled={
!officeClassifyId ||
(officeClassifyId && !_.isEmpty(toJS(tableStore.datas)))
}>
{item.menuName} {item.menuName}
</Button> </Button>
); );
@ -168,11 +214,11 @@ export default class OfficeManage extends Component {
onOk: () => this.deletePostinfoByIds(ids), onOk: () => this.deletePostinfoByIds(ids),
onCancel() { onCancel() {
return false; return false;
}, }
}); });
}; };
deletePostinfoByIds = (ids) => { deletePostinfoByIds = ids => {
const { officeManageStore } = this.props; const { officeManageStore } = this.props;
const { deletePostinfoByIds } = officeManageStore; const { deletePostinfoByIds } = officeManageStore;
deletePostinfoByIds({ ids }).then(({ code, msg }) => { deletePostinfoByIds({ ids }).then(({ code, msg }) => {
@ -185,27 +231,25 @@ export default class OfficeManage extends Component {
}); });
}; };
reRenderColumns = (columns) => { reRenderColumns = columns => {
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}
onChange={(checked) => { onChange={checked => {
confirm({ confirm({
title: i18n.confirm.defaultTitle(), title: i18n.confirm.defaultTitle(),
content: content:
record.forbidden_tag === "0" record.forbidden_tag === "0" ? "确定禁用该记录吗?" : "确定启用该记录吗?",
? "确定要禁用吗?"
: "确定要启用吗?",
okText: i18n.button.ok(), okText: i18n.button.ok(),
cancelText: i18n.button.cancel(), cancelText: i18n.button.cancel(),
onOk: () => _this.updateForbiddenTag(checked, record.id), onOk: () => _this.updateForbiddenTag(checked, record.id),
onCancel() { onCancel() {
return false; return false;
}, }
}); });
}} }}
/> />
@ -220,7 +264,7 @@ export default class OfficeManage extends Component {
const { updateForbiddenTagById } = officeManageStore; const { updateForbiddenTagById } = officeManageStore;
const payload = { const payload = {
id, id,
forbiddentag, forbiddentag
}; };
updateForbiddenTagById(payload).then(({ code, msg }) => { updateForbiddenTagById(payload).then(({ code, msg }) => {
if (code === 200) { if (code === 200) {
@ -236,7 +280,7 @@ export default class OfficeManage extends Component {
operate.index == "0" && this.doEdit(record.randomFieldId); operate.index == "0" && this.doEdit(record.randomFieldId);
operate.index === "1" && this.showConfirm("del", record.randomFieldId); operate.index === "1" && this.showConfirm("del", record.randomFieldId);
}; };
doEdit = (editId) => { doEdit = editId => {
this.setState({ editId }); this.setState({ editId });
const { officeManageStore } = this.props; const { officeManageStore } = this.props;
officeManageStore.isPanelShow && officeManageStore.setPanelStatus(false); officeManageStore.isPanelShow && officeManageStore.setPanelStatus(false);
@ -245,44 +289,36 @@ export default class OfficeManage extends Component {
officeManageStore.setNeDialogTitle(i18n.label.editOfficeName()); officeManageStore.setNeDialogTitle(i18n.label.editOfficeName());
}; };
custom = () => {
debugger
const {
officeManageStore
} = this.props, {
tableStore,
} = officeManageStore;
}
getPanelComponents = () => { getPanelComponents = () => {
const { officeManageStore } = this.props; const { officeManageStore } = this.props;
const { searchCondition, form2, searchConditionLoading } = const {
officeManageStore; searchCondition,
form2,
searchConditionLoading
} = officeManageStore;
let arr = []; let arr = [];
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}
@ -299,16 +335,17 @@ export default class OfficeManage extends Component {
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}></Spin> spinning={searchConditionLoading}
/>
</div> </div>
); );
} else { } else {
return ( return (
<Row <Row
ecId={`${(this && this.props && this.props.ecId) || ""}_Row@ppeb6z`} ecId={`${(this && this.props && this.props.ecId) || ""}_Row@ppeb6z`}
onKeyDown={(e) => { onKeyDown={e => {
if (e.keyCode == 13 && e.target.tagName === "INPUT") { if (e.keyCode == 13 && e.target.tagName === "INPUT") {
officeManageStore.getPostInfoTable(); officeManageStore.getPostInfoTable();
officeManageStore.setPanelStatus(false); officeManageStore.setPanelStatus(false);
@ -342,12 +379,12 @@ export default class OfficeManage extends Component {
ecId={`${(this && this.props && this.props.ecId) || ""}_Button@5u9mfz`} ecId={`${(this && this.props && this.props.ecId) || ""}_Button@5u9mfz`}
onClick={() => officeManageStore.setPanelStatus(false)}> onClick={() => officeManageStore.setPanelStatus(false)}>
{i18n.button.cancel()} {i18n.button.cancel()}
</Button>, </Button>
]; ];
return btn; return btn;
}; };
onSearchChange = (val) => { onSearchChange = val => {
const { officeManageStore } = this.props; const { officeManageStore } = this.props;
const { form2 } = officeManageStore; const { form2 } = officeManageStore;
officeManageStore.setPostInfoName(val); officeManageStore.setPostInfoName(val);
@ -356,7 +393,7 @@ export default class OfficeManage extends Component {
render() { render() {
const { officeManageStore } = this.props; const { officeManageStore } = this.props;
const { date, loading } = this.state; const { date, loading, deleteOfficeClassifyFlag } = this.state;
const { const {
isPanelShow, isPanelShow,
form2, form2,
@ -374,22 +411,24 @@ export default class OfficeManage extends Component {
if (hasRight === false) { if (hasRight === false) {
return renderNoright(); return renderNoright();
} }
return ( return (
hasRight && <div className="office-wapper"> <div className="office-wapper">
<WeaLeftRightLayout <WeaLeftRightLayout
isNew={true} isNew={true}
leftWidth={310} leftWidth={310}
leftCom={<LeftTree />} leftCom={
onCollapse={(showLeft) => console.log("showLeft:", showLeft)}> <LeftTree deleteOfficeClassifyFlag={deleteOfficeClassifyFlag} />
}
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"
@ -397,10 +436,10 @@ export default class OfficeManage extends Component {
buttons={this.getTopMenuBtns()} buttons={this.getTopMenuBtns()}
showDropIcon={true} showDropIcon={true}
dropMenuDatas={this.getDropMenuDatas()} dropMenuDatas={this.getDropMenuDatas()}
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={
@ -408,42 +447,37 @@ export default class OfficeManage extends Component {
? postInfoName ? postInfoName
: form2.getFormParams().postInfoName : form2.getFormParams().postInfoName
} }
setShowSearchAd={(bool) => setShowSearchAd={bool => officeManageStore.setPanelStatus(bool)}
officeManageStore.setPanelStatus(bool)
}
hideSearchAd={() => officeManageStore.setPanelStatus(false)} hideSearchAd={() => officeManageStore.setPanelStatus(false)}
searchsAd={ searchsAd={isPanelShow ? this.getPanelComponents() : <div />}
isPanelShow ? this.getPanelComponents() : <div></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()}
onSearch={() => officeManageStore.getPostInfoTable()} onSearch={() => officeManageStore.getPostInfoTable()}
onSearchChange={(val) => this.onSearchChange(val)} onSearchChange={val => this.onSearchChange(val)}
/> />
<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}
rowSelection={{ rowSelection={{
getCheckboxProps: (record) => { getCheckboxProps: record => {
console.log(record); console.log(record);
return { return {
disabled: true, // 配置无法勾选的列 disabled: true // 配置无法勾选的列
}; };
}, }
}} }}
getColumns={(c) => this.reRenderColumns(c)} getColumns={c => this.reRenderColumns(c)}
onOperatesClick={(record, index, operate) => onOperatesClick={(record, index, operate) =>
this.onOperatesClick(record, index, operate) this.onOperatesClick(record, index, operate)}
}
/> />
</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)}

View File

@ -127,7 +127,8 @@ export const i18n = {
officeName: () => getLabel(385936, '职务管理'), officeName: () => getLabel(385936, '职务管理'),
newOfficeName: () => getLabel(386246, '新建职务信息'), newOfficeName: () => getLabel(386246, '新建职务信息'),
editOfficeName: () => getLabel(386247, '编辑职务信息'), editOfficeName: () => getLabel(386247, '编辑职务信息'),
newOfficeClassifyName: () => getLabel(386246, '新建职务分类信息'), newOfficeClassifyName: () => getLabel(386246, '新建职务分类'),
editOfficeClassifyName: () => getLabel(386246, '编辑职务分类'),
branchNumSetting: () => getLabel(386246, '分部编号设置'), branchNumSetting: () => getLabel(386246, '分部编号设置'),
deptNumSetting: () => getLabel(386246, '部门编号设置'), deptNumSetting: () => getLabel(386246, '部门编号设置'),
postNumSetting: () => getLabel(386246, '岗位编号设置'), postNumSetting: () => getLabel(386246, '岗位编号设置'),

View File

@ -22,20 +22,26 @@ export class OfficeManageStore {
@observable form = new WeaForm(); //新增编辑渲染的表单 @observable form = new WeaForm(); //新增编辑渲染的表单
@observable form1 = new WeaForm(); //职务分类渲染的表单 @observable form1 = new WeaForm(); //职务分类渲染的表单
@observable postInfoName = ""; @observable postInfoName = "";
@observable officeClassifyId = ""; //选中职务分类的id
@observable conditionNum = 2; @observable conditionNum = 2;
@observable ids = ""; //选择行id @observable ids = ""; //选择行id
@observable searchConditionLoading = false; @observable searchConditionLoading = false;
@observable nEdialogTitle = ""; @observable nEdialogTitle = "";
@observable officeVisible = false; @observable officeVisible = {};
@observable visible = false; @observable visible = false;
@observable dialogLoading = false; @observable dialogLoading = false;
@observable schemeId = ""; @observable schemeId = "";
@observable date = ""; @observable date = "";
@observable hasRight = ''; @observable hasRight = "";
@action
setOfficeClassifyId(id) {
this.officeClassifyId = id;
}
@action @action
getHasRight() { getHasRight() {
API.getHasRight().then((res) => { API.getHasRight().then(res => {
const { code, data, msg } = res; const { code, data, msg } = res;
if (code === 200) { if (code === 200) {
const { rightMenu, topMenu } = data; const { rightMenu, topMenu } = data;
@ -50,7 +56,7 @@ export class OfficeManageStore {
@action("高级搜索表单渲染") @action("高级搜索表单渲染")
getSearchCondition() { getSearchCondition() {
this.setScLoadingStatus(true); this.setScLoadingStatus(true);
API.getSearchCondition().then((res) => { API.getSearchCondition().then(res => {
this.setScLoadingStatus(false); this.setScLoadingStatus(false);
const { code, data, msg } = res; const { code, data, msg } = res;
if (code === 200) { if (code === 200) {
@ -65,7 +71,7 @@ export class OfficeManageStore {
@action("获取新增/编辑表单") @action("获取新增/编辑表单")
getPostInfoForm(id) { getPostInfoForm(id) {
this.setDialogLoadingStatus(true); this.setDialogLoadingStatus(true);
API.getPostInfoForm({ id }).then((res) => { API.getPostInfoForm({ id }).then(res => {
this.setDialogLoadingStatus(false); this.setDialogLoadingStatus(false);
const { code, data, msg } = res; const { code, data, msg } = res;
if (code === 200) { if (code === 200) {
@ -85,15 +91,15 @@ export class OfficeManageStore {
params = { params = {
...this.form2.getFormParams(), ...this.form2.getFormParams(),
postId, postId,
postInfoName: this.postInfoName, postInfoName: this.postInfoName
}; };
} else { } else {
params = { params = {
postId, postId,
...this.form2.getFormParams(), ...this.form2.getFormParams()
}; };
} }
API.getPostInfoTable(params).then((res) => { API.getPostInfoTable(params).then(res => {
if (res.code === 200) { if (res.code === 200) {
this.setHasRight(res.data.hasRight); this.setHasRight(res.data.hasRight);
res.data.datas && this.tableStore.getDatas(res.data.datas, 1); res.data.datas && this.tableStore.getDatas(res.data.datas, 1);
@ -110,21 +116,28 @@ export class OfficeManageStore {
@action("保存职务分类") @action("保存职务分类")
savePost(payload) { 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(); return response.json();
}); });
} }
@action("删除职务分类") @action("删除职务分类")
deleteByIds(payload) { deleteByIds(payload) {
return API.deleteByIds(payload).then((response) => { return API.deleteByIds(payload).then(response => {
return response.json(); return response.json();
}); });
} }
@action("删除职务信息") @action("删除职务信息")
deletePostinfoByIds(payload) { deletePostinfoByIds(payload) {
return API.deletePostinfoByIds(payload).then((response) => { return API.deletePostinfoByIds(payload).then(response => {
return response.json(); return response.json();
}); });
} }
@ -132,7 +145,7 @@ export class OfficeManageStore {
@action("获取职务分类表单") @action("获取职务分类表单")
getPostForm(id) { getPostForm(id) {
this.setDialogLoadingStatus(true); this.setDialogLoadingStatus(true);
API.getPostForm({ id }).then((res) => { API.getPostForm({ id }).then(res => {
this.setDialogLoadingStatus(false); this.setDialogLoadingStatus(false);
const { code, data, msg } = res; const { code, data, msg } = res;
if (code === 200) { if (code === 200) {
@ -155,21 +168,21 @@ export class OfficeManageStore {
@action("新增职务信息") @action("新增职务信息")
savePostInfo(payload) { savePostInfo(payload) {
return API.savePostInfo(payload).then((response) => { return API.savePostInfo(payload).then(response => {
return response.json(); return response.json();
}); });
} }
@action("更新职务信息") @action("更新职务信息")
updatePostInfo(payload) { updatePostInfo(payload) {
return API.updatePostInfo(payload).then((response) => { return API.updatePostInfo(payload).then(response => {
return response.json(); return response.json();
}); });
} }
@action("更新禁用标识 ") @action("更新禁用标识 ")
updateForbiddenTagById(payload) { updateForbiddenTagById(payload) {
return API.updateForbiddenTagById(payload).then((response) => { return API.updateForbiddenTagById(payload).then(response => {
return response.json(); return response.json();
}); });
} }
@ -200,8 +213,8 @@ export class OfficeManageStore {
if (!bool) this.setDialogLoadingStatus(false); if (!bool) this.setDialogLoadingStatus(false);
} }
setOfficeVisible(bool) { setOfficeVisible({ bool, type }) {
this.officeVisible = bool; this.officeVisible = { bool, type };
this.officeFormReset(); this.officeFormReset();
if (!bool) this.setDialogLoadingStatus(false); if (!bool) this.setDialogLoadingStatus(false);
} }
@ -217,8 +230,8 @@ export class OfficeManageStore {
updateFields(val) { updateFields(val) {
this.form2.updateFields({ this.form2.updateFields({
postInfoName: { postInfoName: {
value: val, value: val
}, }
}); });
} }