From 1fb6688bc6404d574e4881fe4fc56830a09ece38 Mon Sep 17 00:00:00 2001 From: shawnzhang Date: Tue, 26 Feb 2019 09:13:20 +0800 Subject: [PATCH] employee add --- .eslintignore | 1 + src/api/EmployeeInformation.js | 41 ++ src/api/public.js | 54 +++ src/components/ScrollPane/index.vue | 22 +- src/components/Sticky/index.vue | 7 +- src/icons/svg/ziliao.svg | 1 + src/lang/en.js | 4 +- src/lang/zh.js | 34 +- src/router/index.js | 81 +--- src/store/modules/tagsView.js | 13 +- .../NewEmployeeInformation.vue | 456 ++++++++++++++++++ src/views/layout/components/Navbar.vue | 5 +- .../layout/components/Sidebar/SidebarItem.vue | 2 +- src/views/layout/components/TagsView.vue | 240 +++++---- 14 files changed, 760 insertions(+), 201 deletions(-) create mode 100644 src/api/EmployeeInformation.js create mode 100644 src/api/public.js create mode 100644 src/icons/svg/ziliao.svg create mode 100644 src/views/EmployeeInformation/NewEmployeeInformation.vue diff --git a/.eslintignore b/.eslintignore index 0111f4c0..31578f67 100644 --- a/.eslintignore +++ b/.eslintignore @@ -4,3 +4,4 @@ src/assets src/views/home src/views/Repair src/views/Employee +src/views/layout/components/Sidebar diff --git a/src/api/EmployeeInformation.js b/src/api/EmployeeInformation.js new file mode 100644 index 00000000..5fface74 --- /dev/null +++ b/src/api/EmployeeInformation.js @@ -0,0 +1,41 @@ +import request from '@/utils/request' + +// 部门列表 +export function getdeptlist(query) { + return request({ + url: 'http://192.168.1.45:8080/erp/country/getdeptlist', + method: 'post', + params: query + }) +} + +// 添加员工 +export function register(query) { + var params = new URLSearchParams() + params.append('firstname', query.firstname) // 你要传给后台的参数值 key/value + params.append('middlename', query.middlename) // 你要传给后台的参数值 key/value + params.append('lastname', query.lastname) // 你要传给后台的参数值 key/value + params.append('passwd', query.passwd) // 你要传给后台的参数值 key/value + params.append('email', query.email) // 你要传给后台的参数值 key/value + params.append('phone', query.phone) // 你要传给后台的参数值 key/value + params.append('gender', query.gender) // 你要传给后台的参数值 key/value + params.append('countryid', query.country) // 你要传给后台的参数值 key/value + params.append('provinceid', query.provinceid) // 你要传给后台的参数值 key/value + params.append('cityid', query.cityid) // 你要传给后台的参数值 key/value + params.append('address', query.address) // 你要传给后台的参数值 key/value + params.append('birthday', query.birthday) // 你要传给后台的参数值 key/value + params.append('account', query.account) // 你要传给后台的参数值 key/value + params.append('jobnumber', query.jobnumber) // 你要传给后台的参数值 key/value + params.append('deptid', query.deptid) // 你要传给后台的参数值 key/value + params.append('roleid', query.roleid) // 你要传给后台的参数值 key/value + params.append('postid', query.postid) // 你要传给后台的参数值 key/value + params.append('repositoryid', query.repositoryid) // 你要传给后台的参数值 key/value + params.append('regionid', query.regionid1) // 你要传给后台的参数值 key/value + params.append('certificatetype', query.certificatetype) // 你要传给后台的参数值 key/value + params.append('certificatenumber', query.certificatenumber) // 你要传给后台的参数值 key/value + return request({ + url: 'http://192.168.1.45:8080/erp/employee/register', + method: 'post', + data: params + }) +} diff --git a/src/api/public.js b/src/api/public.js new file mode 100644 index 00000000..633bea1c --- /dev/null +++ b/src/api/public.js @@ -0,0 +1,54 @@ +import request from '@/utils/request' + +// 国家列表 +export function getcountrylist(query) { + return request({ + url: 'http://192.168.1.45:8080/erp/country/getcountrylist', + method: 'post', + params: query + }) +} + +// 全部区域 +export function regionlist(query) { + return request({ + url: 'http://192.168.1.45:8080/erp/region/detaillist', + method: 'post', + params: query + }) +} + +// 根据区域查门店 +export function searchRepository(query) { + var params = new URLSearchParams() + params.append('regionId', query) // 你要传给后台的参数值 key/value + params.append('pagenum', 1) // 你要传给后台的参数值 key/value + params.append('pagesize', 99999) // 你要传给后台的参数值 key/value + return request({ + url: 'http://192.168.1.45:8080/erp/repository/searchRepository', + method: 'post', + data: params + }) +} + +// 省列表 +export function getprovincelist(query) { + var params = new URLSearchParams() + params.append('countryid', query) // 你要传给后台的参数值 key/value + return request({ + url: 'http://192.168.1.45:8080/erp/country/getprovincelist', + method: 'post', + data: params + }) +} + +// 市列表 +export function getcitylist(query) { + var params = new URLSearchParams() + params.append('provinceid', query) // 你要传给后台的参数值 key/value + return request({ + url: 'http://192.168.1.45:8080/erp/country/getcitylist', + method: 'post', + data: params + }) +} diff --git a/src/components/ScrollPane/index.vue b/src/components/ScrollPane/index.vue index 89998e80..290a9b5a 100644 --- a/src/components/ScrollPane/index.vue +++ b/src/components/ScrollPane/index.vue @@ -28,35 +28,21 @@ export default { let firstTag = null let lastTag = null - let prevTag = null - let nextTag = null - // find first tag and last tag if (tagList.length > 0) { firstTag = tagList[0] lastTag = tagList[tagList.length - 1] } - // find preTag and nextTag - for (let i = 0; i < tagList.length; i++) { - if (tagList[i] === currentTag) { - if (i === 0) { - nextTag = tagList[i].length > 1 && tagList[i + 1] - } else if (i === tagList.length - 1) { - prevTag = tagList[i].length > 1 && tagList[i - 1] - } else { - prevTag = tagList[i - 1] - nextTag = tagList[i + 1] - } - break - } - } - if (firstTag === currentTag) { $scrollWrapper.scrollLeft = 0 } else if (lastTag === currentTag) { $scrollWrapper.scrollLeft = $scrollWrapper.scrollWidth - $containerWidth } else { + // find preTag and nextTag + const currentIndex = tagList.findIndex(item => item === currentTag) + const prevTag = tagList[currentIndex - 1] + const nextTag = tagList[currentIndex + 1] // the tag's offsetLeft after of nextTag const afterNextTagOffsetLeft = nextTag.$el.offsetLeft + nextTag.$el.offsetWidth + tagAndTagSpacing diff --git a/src/components/Sticky/index.vue b/src/components/Sticky/index.vue index e0fb7c57..a287216d 100644 --- a/src/components/Sticky/index.vue +++ b/src/components/Sticky/index.vue @@ -56,10 +56,13 @@ export default { this.width = this.width + 'px' this.isSticky = true }, - reset() { + handleReset() { if (!this.active) { return } + this.reset() + }, + reset() { this.position = '' this.width = 'auto' this.active = false @@ -72,7 +75,7 @@ export default { this.sticky() return } - this.reset() + this.handleReset() }, handleReize() { if (this.isSticky) { diff --git a/src/icons/svg/ziliao.svg b/src/icons/svg/ziliao.svg new file mode 100644 index 00000000..bd106ba2 --- /dev/null +++ b/src/icons/svg/ziliao.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/lang/en.js b/src/lang/en.js index 17f6abce..30dfecda 100644 --- a/src/lang/en.js +++ b/src/lang/en.js @@ -92,7 +92,9 @@ export default { SystemManagement: 'System', rolesManagement: 'Roles', nwow: 'NWOW Backstage', - servicestatistics: 'service statistics' + servicestatistics: 'service statistics', + EmployeeInformation: 'Employee Information', + NewEmployeeInformation: 'New Employee Information' }, navbar: { logOut: 'Log Out', diff --git a/src/lang/zh.js b/src/lang/zh.js index 27567811..591e95b3 100644 --- a/src/lang/zh.js +++ b/src/lang/zh.js @@ -98,7 +98,9 @@ export default { Store: '门店管理', BigData: '大数据统计', home: '首页', - servicestatistics: '维修统计' + servicestatistics: '维修统计', + EmployeeInformation: '员工资料', + NewEmployeeInformation: '新建员工资料' }, navbar: { logOut: '退出登录', @@ -624,5 +626,35 @@ export default { creator: '创建人', createtime: '创建时间', classifiednumber: '分类编号' + }, + NewEmployeeInformation: { + account: '员工端登陆账号', + password: '密码', + firstname: '姓氏', + middlename: '中间名', + lastname: '名', + birthday: '生日', + email: '邮箱', + gender: '性别', + male: '男', + female: '女', + certificatetype: '证件类型', + certificatenumber: '证件号', + country: '国籍', + address: '家庭住址', + phone: '手机号码', + provinceid: '省', + cityid: '市', + jobnumber: '工号', + postid: '职称', + deptid: '部门', + regionid: '所属区域', + repositoryid: '所属门店', + contractName: '合同名称', + contractType: '合同类型', + contractAttributes: '合同属性', + SigningTime: '签约时间', + effectiveTime: '生效时间', + status: '状态' } } diff --git a/src/router/index.js b/src/router/index.js index bf1909ac..caa44ff3 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -28,6 +28,7 @@ import Layout from '@/views/layout/Layout' title: 'title' the name show in submenu and breadcrumb (recommend set) icon: 'svg-name' the icon show in the sidebar, noCache: true if true ,the page will no be cached(default is false) + affix: true if true, the tag will affix in the tags-view } **/ export const constantRouterMap = [ @@ -74,7 +75,7 @@ export const constantRouterMap = [ path: 'home', component: () => import('@/views/home/index'), name: 'dashboard', - meta: { title: 'nwow', icon: 'shouye', noCache: true } + meta: { title: 'nwow', icon: 'shouye', noCache: true, affix: true } } ] } @@ -88,80 +89,22 @@ export default new Router({ export const asyncRouterMap = [ { - path: '/home', + path: '/EmployeeInformation', component: Layout, + redirect: 'noredirect', + name: 'EmployeeInformation', + alwaysShow: true, meta: { + title: 'EmployeeInformation', + icon: 'ziliao', type: 1 }, children: [ { - path: 'index', - component: () => import('@/views/home/index'), - name: 'home', - meta: { title: 'home', icon: 'quan', noCache: true } - } - ] - }, - { - path: '/Complaint', - component: Layout, - meta: { - roles: [14], - type: 2 - }, - children: [ - { - path: 'index', - component: () => import('@/views/Complaint/index'), - name: 'Complaint', - meta: { title: 'Complaint', icon: 'tousu', noCache: true, roles: [14] } - } - ] - }, - { - path: '/discount', - component: Layout, - meta: { - type: 1 - }, - children: [ - { - path: 'index', - component: () => import('@/views/discount/index'), - name: 'discount', - meta: { title: 'discount', icon: 'zhekou', noCache: true } - } - ] - }, - { - path: '/Store', - component: Layout, - meta: { - roles: [38], - type: 1 - }, - children: [ - { - path: 'index', - component: () => import('@/views/Store/index'), - name: 'Store', - meta: { title: 'Store', icon: 'Store', noCache: true, roles: [38] } - } - ] - }, - { - path: '/BigData', - component: Layout, - meta: { - roles: [63], - type: 1 - }, - children: [ - { - path: 'index', - component: () => import('@/views/BigData/index'), - name: 'BigData', - meta: { title: 'BigData', icon: 'bigdata', noCache: true, roles: [63] } + path: 'NewEmployeeInformation', + component: () => import('@/views/EmployeeInformation/NewEmployeeInformation'), + name: 'NewEmployeeInformation', + meta: { title: 'NewEmployeeInformation', noCache: false } } ] }, diff --git a/src/store/modules/tagsView.js b/src/store/modules/tagsView.js index cbf9eeb7..378cbcd3 100644 --- a/src/store/modules/tagsView.js +++ b/src/store/modules/tagsView.js @@ -38,12 +38,9 @@ const tagsView = { }, DEL_OTHERS_VISITED_VIEWS: (state, view) => { - for (const [i, v] of state.visitedViews.entries()) { - if (v.path === view.path) { - state.visitedViews = state.visitedViews.slice(i, i + 1) - break - } - } + state.visitedViews = state.visitedViews.filter(v => { + return v.meta.affix || v.path === view.path + }) }, DEL_OTHERS_CACHED_VIEWS: (state, view) => { for (const i of state.cachedViews) { @@ -56,7 +53,9 @@ const tagsView = { }, DEL_ALL_VISITED_VIEWS: state => { - state.visitedViews = [] + // keep affix tags + const affixTags = state.visitedViews.filter(tag => tag.meta.affix) + state.visitedViews = affixTags }, DEL_ALL_CACHED_VIEWS: state => { state.cachedViews = [] diff --git a/src/views/EmployeeInformation/NewEmployeeInformation.vue b/src/views/EmployeeInformation/NewEmployeeInformation.vue new file mode 100644 index 00000000..e9a94a05 --- /dev/null +++ b/src/views/EmployeeInformation/NewEmployeeInformation.vue @@ -0,0 +1,456 @@ + + + + + diff --git a/src/views/layout/components/Navbar.vue b/src/views/layout/components/Navbar.vue index 362e16af..320a4955 100644 --- a/src/views/layout/components/Navbar.vue +++ b/src/views/layout/components/Navbar.vue @@ -2,7 +2,7 @@ @@ -27,7 +28,7 @@