From fca2c2006d80e39983fc4bec73b0510885227801 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=B5=A9=E7=8E=AE?= Date: Wed, 30 Jun 2021 15:32:57 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 3 +- src/api/organization.js | 24 +- src/components/Acron/ACron.vue | 86 ++ src/components/Acron/AntCron.vue | 1150 +++++++++++++++++ src/components/Acron/index.js | 3 + src/components/Acron/validator.js | 22 + src/components/MySelect/index.vue | 38 + src/components/table/index.vue | 38 +- .../components/OrganizationTree.vue | 29 +- .../view/organization/jobsmanagement/index.js | 3 - .../view/organization/orgmanagement/Org.vue | 73 ++ .../view/organization/orgmanagement/form.vue | 68 + .../view/organization/usermanagement/index.js | 3 - src/router/config.js | 15 +- src/utils/index.js | 14 + 15 files changed, 1536 insertions(+), 33 deletions(-) create mode 100644 src/components/Acron/ACron.vue create mode 100644 src/components/Acron/AntCron.vue create mode 100644 src/components/Acron/index.js create mode 100644 src/components/Acron/validator.js create mode 100644 src/components/MySelect/index.vue delete mode 100644 src/pages/system/view/organization/jobsmanagement/index.js create mode 100644 src/pages/system/view/organization/orgmanagement/Org.vue create mode 100644 src/pages/system/view/organization/orgmanagement/form.vue delete mode 100644 src/pages/system/view/organization/usermanagement/index.js diff --git a/package.json b/package.json index 217a181..8494dae 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "homepage": "https://iczer.github.io/vue-antd-admin", "private": true, "scripts": { + "start": "vue-cli-service serve", "serve": "vue-cli-service serve", "build": "vue-cli-service build", "lint": "vue-cli-service lint", @@ -86,4 +87,4 @@ "git add" ] } -} +} \ No newline at end of file diff --git a/src/api/organization.js b/src/api/organization.js index be858d7..944790d 100644 --- a/src/api/organization.js +++ b/src/api/organization.js @@ -1,5 +1,9 @@ import { delReq, getReq, postReq, putReq } from '@/utils'; +function getJobsApi(data) { + return getReq('/api/v1/jobs', data); +} + function addJobsApi(data) { return postReq('/api/v1/jobs', data); } @@ -8,12 +12,28 @@ function updateJobsApi(data) { return putReq('/api/v1/jobs', data); } -function getOrganizationList(data) { +function getOrganizationListApi(data) { return getReq('/api/v1/organizations', data); } +function getOrganizationDetailsApi(id) { + return getReq(`/api/v1/organizations/${id}`); +} + +function addOrgApi(data) { + return postReq('/api/v1/organizations', data); +} + +function updateOrgApi(data) { + return putReq('/api/v1/organizations', data); +} + export default { addJobs: addJobsApi, updateJobs: updateJobsApi, - getOrganizationList: getOrganizationList, + getOrganizationList: getOrganizationListApi, + getJobs: getJobsApi, + getOrganizationDetails: getOrganizationDetailsApi, + addOrg: addOrgApi, + updateOrg: updateOrgApi, }; diff --git a/src/components/Acron/ACron.vue b/src/components/Acron/ACron.vue new file mode 100644 index 0000000..242833b --- /dev/null +++ b/src/components/Acron/ACron.vue @@ -0,0 +1,86 @@ + + + \ No newline at end of file diff --git a/src/components/Acron/AntCron.vue b/src/components/Acron/AntCron.vue new file mode 100644 index 0000000..cc0aa09 --- /dev/null +++ b/src/components/Acron/AntCron.vue @@ -0,0 +1,1150 @@ + + + + + \ No newline at end of file diff --git a/src/components/Acron/index.js b/src/components/Acron/index.js new file mode 100644 index 0000000..9bf9702 --- /dev/null +++ b/src/components/Acron/index.js @@ -0,0 +1,3 @@ +import ACron from './ACron' + +export default ACron \ No newline at end of file diff --git a/src/components/Acron/validator.js b/src/components/Acron/validator.js new file mode 100644 index 0000000..f45bc05 --- /dev/null +++ b/src/components/Acron/validator.js @@ -0,0 +1,22 @@ +// import CronParser from 'cron-parser' +export const WEEK_MAP_EN = { + 'sun': '0', + 'mon': '1', + 'tue': '2', + 'wed': '3', + 'thu': '4', + 'fri': '5', + 'sat': '6', + + } + +export const replaceWeekName = (c) => { + if (c) { + c = c.toLowerCase() + Object.keys(WEEK_MAP_EN).forEach(k => { + c = c.replace(new RegExp(k, 'g'), WEEK_MAP_EN[k]) + }) + c = c.replace(new RegExp('7', 'g'), '0') + } + return c +} diff --git a/src/components/MySelect/index.vue b/src/components/MySelect/index.vue new file mode 100644 index 0000000..0c9ff1c --- /dev/null +++ b/src/components/MySelect/index.vue @@ -0,0 +1,38 @@ + + + diff --git a/src/components/table/index.vue b/src/components/table/index.vue index ebee3a6..8d7a9ec 100644 --- a/src/components/table/index.vue +++ b/src/components/table/index.vue @@ -24,13 +24,22 @@ {{ btn.text }} - +
+ +
@@ -85,6 +94,7 @@ export default { }, formatData: Function, noPage: Boolean, + rowSelection: Object, // radio OR checkbox }, data() { return { @@ -114,6 +124,8 @@ export default { wrapperCol: { span: 20 }, }, total: 0, + selectedRowKeys: [], + selectedRows: [], }; }, watch: { @@ -135,6 +147,15 @@ export default { total: this.total, }; }, + isRowSelection() { + return this.rowSelection + ? { + ...this.rowSelection, + selectedRowKeys: this.selectedRowKeys, + onChange: this.onSelectChange, + } + : undefined; + }, }, methods: { @@ -202,6 +223,21 @@ export default { this.initQuery.pageNum = page.current; this.getData(); }, + + onSelectChange(selectedRowKeys, selectedRows) { + this.selectedRowKeys = selectedRowKeys; + this.selectedRows = selectedRows; + }, + handleClose() { + this.selectedRowKeys = []; + this.selectedRows = []; + }, + getSelectedRowKeys() { + return this.selectedRowKeys; + }, + getTableData() { + return this.data; + }, }, }; diff --git a/src/pages/system/view/organization/components/OrganizationTree.vue b/src/pages/system/view/organization/components/OrganizationTree.vue index cf0d023..bf0e9b2 100644 --- a/src/pages/system/view/organization/components/OrganizationTree.vue +++ b/src/pages/system/view/organization/components/OrganizationTree.vue @@ -1,19 +1,16 @@ \ No newline at end of file diff --git a/src/pages/system/view/organization/orgmanagement/form.vue b/src/pages/system/view/organization/orgmanagement/form.vue new file mode 100644 index 0000000..d676792 --- /dev/null +++ b/src/pages/system/view/organization/orgmanagement/form.vue @@ -0,0 +1,68 @@ + + + diff --git a/src/pages/system/view/organization/usermanagement/index.js b/src/pages/system/view/organization/usermanagement/index.js deleted file mode 100644 index b6916d8..0000000 --- a/src/pages/system/view/organization/usermanagement/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import User from './User'; - -export default User; diff --git a/src/router/config.js b/src/router/config.js index 948d40d..cf8d176 100644 --- a/src/router/config.js +++ b/src/router/config.js @@ -79,21 +79,22 @@ const options = { path: 'job_management', name: '岗位管理', component: () => - import('@/pages/system/view/organization/jobsmanagement'), + import('@/pages/system/view/organization/jobsmanagement/Jobs.vue'), }, { path: 'user_management', name: '用户管理', component: () => - import('@/pages/system/view/organization/usermanagement'), + import('@/pages/system/view/organization/usermanagement/User.vue'), + }, + { + path: 'org_management', + name: '机构管理', + component: () => + import('@/pages/system/view/organization/orgmanagement/Org.vue'), }, ], }, - { - path: 'user_management', - name: '用户管理', - component: () => import('@/pages/system/view/user'), - }, { path: 'role_management', name: '角色管理', diff --git a/src/utils/index.js b/src/utils/index.js index 0df8d96..71befbb 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -66,6 +66,7 @@ export function arrayToTree(options) { const THISDATA = JSON.parse(JSON.stringify(this.data)); for (let i = 0; i < this.data.length; i++) { let currentElement = this.data[i]; + currentElement.selectable = currentElement.orgType === 'DEPARTMENT'; let tempCurrentElementParent = this.indexStorage[currentElement[this.parentKey]]; // 临时变量里面的当前元素的父元素 if (tempCurrentElementParent) { // 如果存在父元素 @@ -88,3 +89,16 @@ export function arrayToTree(options) { this.toTree(); return this; } + +// select组件 数据格式化 +export const formatObj = async (ArrObj, obj) => { + const newData = [...ArrObj]; + const newDataOne = await newData.map(i => { + const newObj = { ...i }; + Object.keys(obj).forEach(key => { + newObj[key] = i[obj[key]]; + }); + return newObj; + }); + return newDataOne; +}; -- GitLab