职务管理模块接口联调

This commit is contained in:
liyongshun 2022-05-16 17:13:37 +08:00
parent 559ed2cbee
commit 5bc2f44073
5 changed files with 540 additions and 61 deletions

View File

@ -1,3 +1,9 @@
/*
* Author: 黎永顺
* Description:
* Date: 2022-05-13 16:36:09
* LastEditTime: 2022-05-16 16:27:08
*/
import { WeaTools } from "ecCom"; import { WeaTools } from "ecCom";
export const getHasRight = (params) => { export const getHasRight = (params) => {
@ -23,3 +29,88 @@ export const getPostInfoForm = (params) => {
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
);
};

View File

@ -1,9 +1,14 @@
import React, { Component } from "react"; import React, { Component } from "react";
import { Input, Tree, Menu } from "antd"; import { Input, Tree, Menu, message, Modal } from "antd";
import { WeaInputSearch } from "ecCom"; 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 _ from "lodash";
import "../index.less"; import "../index.less";
const confirm = Modal.confirm;
const TreeNode = Tree.TreeNode; const TreeNode = Tree.TreeNode;
const treeData = [ const treeData = [
{ {
@ -48,10 +53,14 @@ const treeData = [
key: "0-2", key: "0-2",
}, },
]; ];
@inject("officeManageStore")
@observer
class LeftTree extends Component { class LeftTree extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
loading: false,
expandedKeys: [], expandedKeys: [],
treeData: [], treeData: [],
copyTree: [], copyTree: [],
@ -61,23 +70,38 @@ class LeftTree extends Component {
}; };
} }
componentDidMount() { componentDidMount() {
let cp = JSON.stringify(treeData); this.getTreeData();
this.setState({
treeData,
expandedKeys: [],
copyTree: cp,
copyExpandedKeys: [],
});
document.addEventListener("click", this.handleClick); document.addEventListener("click", this.handleClick);
} }
componentWillUnmount() { componentWillUnmount() {
document.removeEventListener("click", this.handleClick); 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 = () => { handleClick = () => {
this.setState({ rightClickNodeTreeItem: null }); this.setState({ rightClickNodeTreeItem: null });
}; };
onSelect = (node) => { onSelect = (node) => {
const [postId] = node;
const { officeManageStore } = this.props;
officeManageStore.getPostInfoTable(postId);
this.setState({ this.setState({
rightClickNodeTreeItem: null, rightClickNodeTreeItem: null,
}); });
@ -88,7 +112,7 @@ class LeftTree extends Component {
rightClickNodeTreeItem: { rightClickNodeTreeItem: {
pageX: e.event.pageX, pageX: e.event.pageX,
pageY: e.event.pageY, pageY: e.event.pageY,
id: e.node.props["data-key"], id: e.node.props["eventKey"],
categoryName: e.node.props["data-title"], categoryName: e.node.props["data-title"],
}, },
}); });
@ -188,17 +212,42 @@ class LeftTree extends Component {
}; };
const menu = ( const menu = (
<Menu <Menu
// onClick={this.handleMenuClick} onClick={this.handleMenuClick}
style={tmpStyle} style={tmpStyle}
className='rightmenu' className="rightmenu">
> <Menu.Item key="ADD">新增</Menu.Item>
<Menu.Item key="1">新增</Menu.Item> <Menu.Item key="DELETE">删除</Menu.Item>
<Menu.Item key="3">删除</Menu.Item>
</Menu> </Menu>
); );
return this.state.rightClickNodeTreeItem == null ? "" : 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) => { renderTreeNode = (data) => {
//生成树结构函数 //生成树结构函数
if (data.length == 0) { if (data.length == 0) {
@ -237,8 +286,46 @@ class LeftTree extends Component {
expandedKeys, 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() { render() {
let { expandedKeys, treeData, searchValue } = this.state; let { expandedKeys, treeData, searchValue, loading } = this.state;
const { officeManageStore } = this.props;
const { officeCondition, form1, officeVisible } = officeManageStore;
return ( return (
<div> <div>
<div style={{ padding: 10 }}> <div style={{ padding: 10 }}>
@ -256,6 +343,22 @@ class LeftTree extends Component {
{this.renderTreeNode(treeData)} {this.renderTreeNode(treeData)}
</Tree> </Tree>
{this.getNodeTreeRightClickMenu()} {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> </div>
); );
} }

View File

@ -15,12 +15,24 @@ 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";
const confirm = Modal.confirm;
const WeaTable = WeaTableNew.WeaTable;
@inject("officeManageStore") @inject("officeManageStore")
@observer @observer
export default class OfficeManage extends Component { export default class OfficeManage extends Component {
constructor(props) {
super(props);
this.state = {
date: "",
editId: "",
loading: false,
};
}
componentDidMount() { componentDidMount() {
const { officeManageStore } = this.props; const { officeManageStore } = this.props;
officeManageStore.getTreeData && officeManageStore.getTreeData();
officeManageStore.getHasRight && officeManageStore.getHasRight(); officeManageStore.getHasRight && officeManageStore.getHasRight();
officeManageStore.getPostInfoTable && officeManageStore.getPostInfoTable();
} }
getDropMenuDatas = () => { getDropMenuDatas = () => {
const { officeManageStore } = this.props; const { officeManageStore } = this.props;
@ -44,11 +56,66 @@ export default class OfficeManage extends Component {
return menus; 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 = () => { getTopMenuBtns = () => {
const { officeManageStore } = this.props; const { officeManageStore } = this.props;
const { topMenu, tableStore, getPostInfoForm } = officeManageStore; const { topMenu, tableStore } = officeManageStore;
let btns = []; let btns = [];
topMenu.map((item, i) => { topMenu.map((item, i) => {
if (item.menuFun !== "batchDelete") { if (item.menuFun !== "batchDelete") {
@ -57,9 +124,11 @@ export default class OfficeManage extends Component {
type="primary" type="primary"
onClick={() => { onClick={() => {
const { officeManageStore } = this.props; const { officeManageStore } = this.props;
const { isPanelShow, setPanelStatus } = officeManageStore; officeManageStore.isPanelShow &&
isPanelShow && setPanelStatus(false); officeManageStore.setPanelStatus(false);
getPostInfoForm(); officeManageStore.getPostInfoForm();
officeManageStore.setVisible(true);
officeManageStore.setNeDialogTitle(i18n.label.newOfficeName());
}}> }}>
{item.menuName} {item.menuName}
</Button> </Button>
@ -68,17 +137,108 @@ export default class OfficeManage extends Component {
btns.push( btns.push(
<Button <Button
type="primary" type="primary"
onClick={() => console.log(item)} onClick={() => {
// disabled={tableStore.selectedRowKeys.length > 0 ? false : true} 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} {item.menuName}
</Button> </Button>
); );
} }
}); });
return btns; 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 = () => { getPanelComponents = () => {
const { officeManageStore } = this.props; const { officeManageStore } = this.props;
const { searchCondition, form2, searchConditionLoading } = const { searchCondition, form2, searchConditionLoading } =
@ -135,13 +295,12 @@ export default class OfficeManage extends Component {
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.getTableInfo(); officeManageStore.getPostInfoTable();
// officeManageStore.setPanelStatus(false); officeManageStore.setPanelStatus(false);
// } }
// }} }}>
>
{arr} {arr}
</Row> </Row>
); );
@ -149,15 +308,15 @@ export default class OfficeManage extends Component {
}; };
getTabBtn = () => { getTabBtn = () => {
const { officeManageStore } = this.props; const { officeManageStore } = this.props;
const { form2, setPanelStatus } = officeManageStore; const { form2 } = officeManageStore;
const btn = [ const btn = [
<Button <Button
ecId={`${(this && this.props && this.props.ecId) || ""}_Button@bx87i8`} ecId={`${(this && this.props && this.props.ecId) || ""}_Button@bx87i8`}
type="primary" type="primary"
onClick={() => { onClick={() => {
officeManageStore.getTableInfo(); officeManageStore.getPostInfoTable();
setPanelStatus(false); officeManageStore.setPanelStatus(false);
}}> }}>
{i18n.button.search()} {i18n.button.search()}
</Button>, </Button>,
@ -168,7 +327,7 @@ export default class OfficeManage extends Component {
</Button>, </Button>,
<Button <Button
ecId={`${(this && this.props && this.props.ecId) || ""}_Button@5u9mfz`} ecId={`${(this && this.props && this.props.ecId) || ""}_Button@5u9mfz`}
onClick={() => setPanelStatus(false)}> onClick={() => officeManageStore.setPanelStatus(false)}>
{i18n.button.cancel()} {i18n.button.cancel()}
</Button>, </Button>,
]; ];
@ -178,17 +337,17 @@ export default class OfficeManage extends Component {
onSearchChange = (val) => { onSearchChange = (val) => {
const { officeManageStore } = this.props; const { officeManageStore } = this.props;
const { form2 } = officeManageStore; const { form2 } = officeManageStore;
officeManageStore.setPostInfoName(val);
officeManageStore.setSchemeName(val);
!_.isEmpty(form2.getFormParams()) && officeManageStore.updateFields(val); !_.isEmpty(form2.getFormParams()) && officeManageStore.updateFields(val);
}; };
render() { render() {
const { officeManageStore } = this.props; const { officeManageStore } = this.props;
const { date, loading } = this.state;
const { const {
isPanelShow, isPanelShow,
form2, form2,
schemeName, postInfoName,
conditionNum, conditionNum,
tableStore, tableStore,
nEdialogTitle, nEdialogTitle,
@ -214,7 +373,7 @@ export default class OfficeManage extends Component {
ecId={`${ ecId={`${
(this && this.props && this.props.ecId) || "" (this && this.props && this.props.ecId) || ""
}_WeaTop@446d12`} }_WeaTop@446d12`}
title={i18n.label.schemeName()} title={i18n.label.officeName()}
icon={<i className="icon-coms-hrm" />} icon={<i className="icon-coms-hrm" />}
iconBgcolor="#217346" iconBgcolor="#217346"
loading={true} loading={true}
@ -230,8 +389,8 @@ export default class OfficeManage extends Component {
showSearchAd={isPanelShow} showSearchAd={isPanelShow}
searchsBaseValue={ searchsBaseValue={
_.isEmpty(form2.getFormParams()) _.isEmpty(form2.getFormParams())
? schemeName ? postInfoName
: form2.getFormParams().schemeName : form2.getFormParams().postInfoName
} }
setShowSearchAd={(bool) => setShowSearchAd={(bool) =>
officeManageStore.setPanelStatus(bool) officeManageStore.setPanelStatus(bool)
@ -243,21 +402,29 @@ export default class OfficeManage extends Component {
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.getSearchCondition()} onSearch={() => officeManageStore.getPostInfoTable()}
onSearchChange={(val) => this.onSearchChange(val)} onSearchChange={(val) => this.onSearchChange(val)}
/> />
{/* <WeaTable <WeaTable
ecId={`${ ecId={`${
(this && this.props && this.props.ecId) || "" (this && this.props && this.props.ecId) || ""
}_WeaTable@b43a4c`} }_WeaTable@b43a4c`}
comsWeaTableStore={tableStore} comsWeaTableStore={tableStore}
hasOrder={true} hasOrder={true}
needScroll={true} needScroll={true}
rowSelection={{
getCheckboxProps: (record) => {
console.log(record);
return {
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={`${ ecId={`${
@ -268,12 +435,15 @@ export default class OfficeManage extends Component {
condition={toJS(condition)} condition={toJS(condition)}
form={form} form={form}
isFormInit={form.isFormInit} isFormInit={form.isFormInit}
loading={dialogLoading} loading={dialogLoading || loading}
isEdit={false} isEdit={true}
height={250} height={250}
conditionLen={3} conditionLen={3}
// save={() => this.handleSave()} save={() => this.handleSave()}
// onCancel={() => rankScheme.setVisible(false)} onCancel={() => {
officeManageStore.setVisible(false);
this.setState({ editId: "" });
}}
/> />
</WeaRightMenu> </WeaRightMenu>
</WeaLeftRightLayout> </WeaLeftRightLayout>

View File

@ -124,6 +124,10 @@ export const i18n = {
editSequence: () => getLabel(386247, '编辑岗位序列'), editSequence: () => getLabel(386247, '编辑岗位序列'),
groupInfo: () => getLabel(385936, '总部'), groupInfo: () => getLabel(385936, '总部'),
editGroup: () => getLabel(386247, '编辑总部'), editGroup: () => getLabel(386247, '编辑总部'),
officeName: () => getLabel(385936, '职务管理'),
newOfficeName: () => getLabel(386246, '新建职务信息'),
editOfficeName: () => getLabel(386247, '编辑职务信息'),
newOfficeClassifyName: () => getLabel(386246, '新建职务分类信息'),

View File

@ -12,19 +12,21 @@ export class OfficeManageStore {
@observable tableStore = new TableStore(); @observable tableStore = new TableStore();
@observable topMenu = []; //顶部菜单 @observable topMenu = []; //顶部菜单
@observable rightMenu = []; //右侧更多菜单 @observable rightMenu = []; //右侧更多菜单
@observable condition = []; @observable condition = []; //新增职务信息form数据
@observable searchCondition = []; @observable searchCondition = []; //高级搜索框form 数据
@observable officeCondition = []; //新增职务分类form数据
@observable isEdit = true; @observable isEdit = true;
@observable isNew = true; @observable isNew = true;
@observable isPanelShow = false; //高级搜索面板 @observable isPanelShow = false; //高级搜索面板
@observable form2 = new WeaForm(); @observable form2 = new WeaForm(); //高级搜索渲染的表单
@observable form = new WeaForm(); //新增编辑渲染的表单 @observable form = new WeaForm(); //新增编辑渲染的表单
@observable form1 = new WeaForm(); @observable form1 = new WeaForm(); //职务分类渲染的表单
@observable schemeName = ""; @observable postInfoName = "";
@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 visible = false; @observable visible = false;
@observable dialogLoading = false; @observable dialogLoading = false;
@observable schemeId = ""; @observable schemeId = "";
@ -51,8 +53,8 @@ export class OfficeManageStore {
this.setScLoadingStatus(false); this.setScLoadingStatus(false);
const { code, data, msg } = res; const { code, data, msg } = res;
if (code === 200) { if (code === 200) {
res.data.conditions && this.setSearchCondition(res.data.conditions); res.data.conditions && this.setSearchCondition(data.conditions);
res.data.conditions && this.form2.initFormFields(res.data.conditions); res.data.conditions && this.form2.initFormFields(data.conditions);
} else { } else {
message.error(res.msg); message.error(res.msg);
} }
@ -61,11 +63,12 @@ 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) {
console.log();
data.condition && this.setCondition(data.condition); data.condition && this.setCondition(data.condition);
data.condition && this.form.initFormFields(data.condition); data.condition && this.form.initFormFields(data.condition);
} else { } 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("展开关闭搜索面板") @action("展开关闭搜索面板")
setPanelStatus(bool) { 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) { setScLoadingStatus(bool) {
this.searchConditionLoading = bool; this.searchConditionLoading = bool;
} }
@ -91,23 +184,37 @@ export class OfficeManageStore {
this.searchCondition = condition; this.searchCondition = condition;
} }
setCondition(condition) {
this.condition = condition;
}
setOfficeCondition(condition) {
this.officeCondition = condition;
}
setVisible(bool) { setVisible(bool) {
this.visible = bool; this.visible = bool;
this.formReset(); this.formReset();
if (!bool) this.setDialogLoadingStatus(false); if (!bool) this.setDialogLoadingStatus(false);
} }
setOfficeVisible(bool) {
this.officeVisible = bool;
this.officeFormReset();
if (!bool) this.setDialogLoadingStatus(false);
}
setDialogLoadingStatus(bool) { setDialogLoadingStatus(bool) {
this.dialogLoading = bool; this.dialogLoading = bool;
} }
setCondition(condition) { setNeDialogTitle(title) {
this.condition = condition; this.nEdialogTitle = title;
} }
updateFields(val) { updateFields(val) {
this.form2.updateFields({ this.form2.updateFields({
schemeName: { postInfoName: {
value: val, value: val,
}, },
}); });
@ -116,4 +223,8 @@ export class OfficeManageStore {
formReset() { formReset() {
this.form = new WeaForm(); this.form = new WeaForm();
} }
officeFormReset() {
this.form1 = new WeaForm();
}
} }