diff --git a/src/api/organization.js b/src/api/organization.js
index a7ba9d7e74af3a54ff5bff6f289539a81fc137eb..be858d7967cac040926bfe62f7b87eb6a5d5f1d5 100644
--- a/src/api/organization.js
+++ b/src/api/organization.js
@@ -8,7 +8,12 @@ function updateJobsApi(data) {
return putReq('/api/v1/jobs', data);
}
+function getOrganizationList(data) {
+ return getReq('/api/v1/organizations', data);
+}
+
export default {
- add: addJobsApi,
- update: updateJobsApi,
+ addJobs: addJobsApi,
+ updateJobs: updateJobsApi,
+ getOrganizationList: getOrganizationList,
};
diff --git a/src/pages/system/view/organization/jobmanagement/JobManagement.vue b/src/pages/system/view/organization/jobmanagement/JobManagement.vue
deleted file mode 100644
index 4bd4e9360ddecb05b1d33f39ef3f770b06f60f0e..0000000000000000000000000000000000000000
--- a/src/pages/system/view/organization/jobmanagement/JobManagement.vue
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
- view(row, 1)">编辑
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/pages/system/view/organization/jobmanagement/form.vue b/src/pages/system/view/organization/jobmanagement/form.vue
deleted file mode 100644
index fb91fd58820f9a0421b27ee60e5e97baffc83990..0000000000000000000000000000000000000000
--- a/src/pages/system/view/organization/jobmanagement/form.vue
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/pages/system/view/organization/jobmanagement/index.js b/src/pages/system/view/organization/jobmanagement/index.js
deleted file mode 100644
index 199f40f1434ec22234692d530c4fdedcc141cc70..0000000000000000000000000000000000000000
--- a/src/pages/system/view/organization/jobmanagement/index.js
+++ /dev/null
@@ -1,3 +0,0 @@
-import JobManagement from './JobManagement';
-
-export default JobManagement;
diff --git a/src/router/config.js b/src/router/config.js
index 782ebb0f8c46910b77e136671c0b72f3fcc672dd..bc39b4d978eb5b66b0a6d1c64498ab72a0f6fc4a 100644
--- a/src/router/config.js
+++ b/src/router/config.js
@@ -78,7 +78,14 @@ const options = {
{
path: 'job_management',
name: '岗位管理',
- component: () => import('@/pages/system/view/organization/jobmanagement'),
+ component: () =>
+ import('@/pages/system/view/organization/jobsmanagement'),
+ },
+ {
+ path: 'user_management',
+ name: '用户管理',
+ component: () =>
+ import('@/pages/system/view/organization/usermanagement'),
},
],
},
diff --git a/src/utils/index.js b/src/utils/index.js
index 2bb55c6ffa5be5c967364db2b1547f09ee8df883..0df8d96076a14e38543650a4bbbb63e624e967bb 100644
--- a/src/utils/index.js
+++ b/src/utils/index.js
@@ -31,3 +31,60 @@ export function convertListToTree(menuList, filterMenu = false) {
export function EMPTY_FUN() {}
export const isFunction = val => typeof val === 'function';
+export function arrayToTree(options) {
+ options = JSON.parse(JSON.stringify(options));
+ this.data = options.data || [];
+ this.parentKey = options.parentKey || 'parent_code';
+ this.childrenKey = options.childrenKey || 'children';
+ this.key = options.key || 'code';
+ this.maping = options.maping || undefined;
+ this.rootValue = options.rootValue || '0';
+ this.treeData = [];
+ this.indexStorage = {};
+ this.getDataBykey = function(key) {
+ return this.indexStorage[key];
+ };
+ this.setMapping = function() {
+ for (let i = 0; i < this.data.length; i++) {
+ var item = this.data[i];
+ for (const x in this.maping) {
+ item[this.maping[x]] = item[x];
+ }
+ }
+ };
+ if (this.maping) {
+ this.setMapping();
+ }
+ this.setIndexStorage = function() {
+ for (let i = 0; i < this.data.length; i++) {
+ this.indexStorage[this.data[i][this.key]] = this.data[i]; // 以id作为索引存储元素,可以无需遍历直接定位元素
+ }
+ };
+ this.setIndexStorage();
+ // 利用数组浅拷贝
+ this.toTree = function() {
+ const THISDATA = JSON.parse(JSON.stringify(this.data));
+ for (let i = 0; i < this.data.length; i++) {
+ let currentElement = this.data[i];
+ let tempCurrentElementParent = this.indexStorage[currentElement[this.parentKey]]; // 临时变量里面的当前元素的父元素
+ if (tempCurrentElementParent) {
+ // 如果存在父元素
+ if (!tempCurrentElementParent[this.childrenKey]) {
+ // 如果父元素没有chindren键
+ tempCurrentElementParent[this.childrenKey] = []; // 设上父元素的children键
+ }
+ tempCurrentElementParent[this.childrenKey].push(currentElement); // 给父元素加上当前元素作为子元素
+ } else {
+ // 不存在父元素,意味着当前元素是一级元素
+ if (this.rootValue != undefined && currentElement[this.key] === this.rootValue) {
+ this.treeData.push(currentElement);
+ } else {
+ this.treeData.push(currentElement);
+ }
+ }
+ }
+ return this.treeData;
+ };
+ this.toTree();
+ return this;
+}