From 4878b6be1d3c34d5eccae59cae7e790f1bbb9e17 Mon Sep 17 00:00:00 2001
From: liyongshun <971387674@qq.com>
Date: Wed, 22 Jun 2022 16:09:43 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=81=8C=E5=8A=A1=E7=AE=A1?=
=?UTF-8?q?=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pc4mobx/organization/apis/officeManage.js | 60 +++---
.../components/office/components/leftTree.js | 187 ++++++++--------
.../components/office/officeManage.js | 202 ++++++++++--------
pc4mobx/organization/public/i18n.js | 3 +-
pc4mobx/organization/stores/officeManage.js | 51 +++--
5 files changed, 282 insertions(+), 221 deletions(-)
diff --git a/pc4mobx/organization/apis/officeManage.js b/pc4mobx/organization/apis/officeManage.js
index db1be85..1d081fc 100644
--- a/pc4mobx/organization/apis/officeManage.js
+++ b/pc4mobx/organization/apis/officeManage.js
@@ -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",
diff --git a/pc4mobx/organization/components/office/components/leftTree.js b/pc4mobx/organization/components/office/components/leftTree.js
index 4fa7773..d84ffc5 100644
--- a/pc4mobx/organization/components/office/components/leftTree.js
+++ b/pc4mobx/organization/components/office/components/leftTree.js
@@ -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 = (