employee add

This commit is contained in:
shawnzhang 2019-02-26 09:13:20 +08:00
parent 7aaf100c18
commit 1fb6688bc6
14 changed files with 760 additions and 201 deletions

View file

@ -4,3 +4,4 @@ src/assets
src/views/home
src/views/Repair
src/views/Employee
src/views/layout/components/Sidebar

View file

@ -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
})
}

54
src/api/public.js Normal file
View file

@ -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
})
}

View file

@ -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

View file

@ -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) {

1
src/icons/svg/ziliao.svg Normal file
View file

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1551059467051" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2183" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M83.5 328.1l415.3 226.3c4.2 2.3 8.8 3.4 13.4 3.4 4.5 0 9.1-1.1 13.3-3.4l419.7-226.3c9.2-4.9 14.8-14.5 14.7-25-0.1-10.4-6-19.9-15.3-24.6L529.3 67.5c-7.9-4-17.3-4-25.3 0L84.4 278.6c-9.3 4.7-15.3 14.1-15.4 24.6C68.8 313.5 74.4 323.2 83.5 328.1zM516.5 117.8l361.1 186.5L512.3 504.1 151.2 304.5 516.5 117.8z" p-id="2184"></path><path d="M939.8 484.3l-83-42.2-53.9 32.3 69.9 35.5L507.5 709.8 146.4 510.2l74.5-37.5-53.7-32.6-87.7 44.1c-9.3 4.7-15.3 14.1-15.4 24.5-0.2 10.4 5.5 20.1 14.6 25L494 760.1c4.2 2.3 8.8 3.4 13.4 3.4 4.5 0 9.1-1.1 13.3-3.4l419.7-226.3c9.2-4.9 14.8-14.6 14.7-25C954.9 498.5 949 489 939.8 484.3z" p-id="2185"></path><path d="M939.8 680.2l-78.7-38.7-11.2 32.3 22.9 32L507.5 905.7 146.4 706.2l26.6-31.4-11-32.6-82.5 38c-9.3 4.7-15.3 14.1-15.4 24.5-0.2 10.4 5.5 20.1 14.6 25.1L494 956.1c4.2 2.3 8.8 3.4 13.4 3.4 4.5 0 9.1-1.1 13.3-3.4l419.7-226.3c9.2-4.9 14.8-14.5 14.7-25C954.9 694.4 949 685 939.8 680.2z" p-id="2186"></path></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -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',

View file

@ -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: '状态'
}
}

View file

@ -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 }
}
]
},

View file

@ -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 = []

View file

@ -0,0 +1,456 @@
<template>
<div class="ERP-container">
<div class="app-container">
<el-tabs v-model="information">
<el-tab-pane name="one">
<span slot="label">个人信息</span>
<el-form ref="personalForm" :model="personalForm" :rules="personalrules" :inline="true" status-icon class="demo-ruleForm" label-position="top" label-width="300px">
<el-form-item :label="$t('NewEmployeeInformation.account')" prop="account" style="width: 40%;margin-top:1%">
<el-input v-model="personalForm.account" placeholder="请输入账号名" clearable/>
</el-form-item>
<el-form-item :label="$t('NewEmployeeInformation.password')" style="width: 40%;margin-top:1%">
<el-input v-model="personalForm.passwd" type="password" placeholder="请输入密码" clearable/>
</el-form-item>
<el-form-item :label="$t('NewEmployeeInformation.firstname')" prop="firstname" style="width: 40%">
<el-input v-model="personalForm.firstname" placeholder="请输入姓氏" clearable/>
</el-form-item>
<el-form-item :label="$t('NewEmployeeInformation.middlename')" style="width: 40%">
<el-input v-model="personalForm.middlename" placeholder="请输入中间名" clearable/>
</el-form-item>
<el-form-item :label="$t('NewEmployeeInformation.lastname')" prop="lastname" style="width: 40%;">
<el-input v-model="personalForm.lastname" placeholder="请输入名" clearable/>
</el-form-item>
<el-form-item :label="$t('NewEmployeeInformation.birthday')" style="width: 40%">
<el-date-picker
v-model="personalForm.birthday"
type="date"
placeholder="选择生日"
value-format="yyyy-MM-dd"
clearable
style="width: 100%"/>
</el-form-item>
<el-form-item :label="$t('NewEmployeeInformation.email')" style="width: 40%">
<el-input v-model="personalForm.email" placeholder="请输入邮箱地址" clearable/>
</el-form-item>
<el-form-item :label="$t('NewEmployeeInformation.gender')" prop="gender" style="width: 40%">
<el-radio-group v-model="personalForm.gender" style="width: 80%">
<el-radio :label="1" style="width: 50%">{{ $t('NewEmployeeInformation.male') }}</el-radio>
<el-radio :label="2">{{ $t('NewEmployeeInformation.female') }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item :label="$t('NewEmployeeInformation.certificatetype')" style="width: 40%">
<el-select v-model="personalForm.certificatetype" placeholder="请选择证件类型" style="width: 100%;">
<el-option label="类型1" value="1"/>
<el-option label="类型2" value="2"/>
</el-select>
</el-form-item>
<el-form-item :label="$t('NewEmployeeInformation.certificatenumber')" style="width: 40%">
<el-input v-model="personalForm.certificatenumber" clearable/>
</el-form-item>
<el-form-item :label="$t('NewEmployeeInformation.country')" style="width: 40%">
<el-select v-model="personalForm.country" placeholder="请选择国籍" style="width: 100%;" @change ="handlechange">
<el-option
v-for="(item, index) in nations"
:key="index"
:label="item.name"
:value="item.id"/>
</el-select>
</el-form-item>
</el-form>
<el-button type="primary" @click="handlenext('personalForm')">下一步</el-button>
</el-tab-pane>
<el-tab-pane name="two">
<span slot="label">联系信息</span>
<el-form ref="connectForm" :model="connectForm" :rules="connectrules" status-icon class="demo-ruleForm" label-position="top" label-width="300px">
<el-form-item :label="$t('NewEmployeeInformation.address')" prop="address" style="width: 40%;margin-top:1%">
<el-input v-model="connectForm.address" placeholder="请输入地址" clearable/>
</el-form-item>
<el-form-item :label="$t('NewEmployeeInformation.phone')" prop="phone" style="width: 40%;margin-top:1%">
<el-input v-model.number="connectForm.phone" placeholder="请输入手机号" clearable/>
</el-form-item>
<el-form-item :label="$t('NewEmployeeInformation.provinceid')" prop="provinceid" style="width: 40%;margin-top: 1%">
<el-select v-model="connectForm.provinceid" placeholder="请选择省" style="width: 100%;" @change="handlechange2">
<el-option
v-for="(item, index) in provinces"
:key="index"
:label="item.name"
:value="item.id"/>
</el-select>
</el-form-item>
<el-form-item :label="$t('NewEmployeeInformation.cityid')" prop="cityid" style="width: 40%;margin-top: 1%">
<el-select v-model="connectForm.cityid" placeholder="请选择市" style="width: 100%;">
<el-option
v-for="(item, index) in cities"
:key="index"
:label="item.name"
:value="item.id"/>
</el-select>
</el-form-item>
</el-form>
<el-button type="primary" @click="handlenext2('connectForm')">下一步</el-button>
</el-tab-pane>
<el-tab-pane name="three">
<span slot="label">公司信息</span>
<el-form ref="companyForm" :model="companyForm" :rules="companyrules" status-icon class="demo-ruleForm" label-position="top" label-width="300px">
<el-form-item :label="$t('NewEmployeeInformation.jobnumber')" style="width: 40%;margin-top:1%">
<el-input v-model.number="companyForm.jobnumber" placeholder="请输入工号" clearable/>
</el-form-item>
<el-form-item :label="$t('NewEmployeeInformation.postid')" style="width: 40%;margin-top: 1%">
<el-select v-model="companyForm.postid" placeholder="请选择职称" style="width: 100%;">
<el-option label="xxx" value="1"/>
<el-option label="xxx" value="2"/>
</el-select>
</el-form-item>
<el-form-item :label="$t('NewEmployeeInformation.deptid')" prop="deptid" style="width: 40%;margin-top: 1%">
<el-select v-model="companyForm.deptid" placeholder="请选择部门" style="width: 100%;">
<el-option
v-for="(item, index) in depts"
:key="index"
:label="item.deptName"
:value="item.id"/>
</el-select>
</el-form-item>
<el-form-item :label="$t('NewEmployeeInformation.regionid')" prop="regionid" style="width: 40%;margin-top: 1%">
<el-cascader
:options="regions"
:props="props"
v-model="companyForm.regionid"
:show-all-levels="false"
placeholder="请选择区域"
change-on-select
filterable
clearable
style="width: 100%;"
@change="handlechange4"
/>
</el-form-item>
<el-form-item :label="$t('NewEmployeeInformation.repositoryid')" prop="repositoryid" style="width: 40%;margin-top: 1%">
<el-select v-model="companyForm.repositoryid" placeholder="请选择门店" style="width: 100%;">
<el-option
v-for="(item, index) in repositories"
:key="index"
:label="item.repositoryName"
:value="item.id"/>
</el-select>
</el-form-item>
<el-form-item style="margin-top: 5%;">
<el-button type="primary" @click="handlesave()">保存</el-button>
<el-button type="success" @click="handleentry()">继续录入</el-button>
<el-button type="danger" @click="handlecancel()">取消</el-button>
</el-form-item>
</el-form>
</el-tab-pane>
</el-tabs>
</div>
</div>
</template>
<script>
import { getcountrylist, getprovincelist, getcitylist, regionlist, searchRepository } from '@/api/public'
import { getdeptlist, register } from '@/api/EmployeeInformation'
export default {
name: 'NewEmployeeInformation',
data() {
var checkphone = (rule, value, callback) => {
if (!value) {
return callback(new Error('手机号不能为空'))
}
setTimeout(() => {
if (!Number.isInteger(value)) {
callback(new Error('请输入数字值'))
} else {
callback()
}
}, 1000)
}
return {
information: 'one',
listLoading: true,
nations: [],
provinces: [],
cities: [],
regions: [],
repositories: [],
depts: [],
props: {
value: 'id',
label: 'regionName',
children: 'regionListVos'
},
personalForm: {
account: '',
passwd: '',
firstname: '',
middlename: '',
lastname: '',
birthday: '',
email: '',
gender: '',
certificatetype: '',
certificatenumber: '',
country: ''
},
personalrules: {
account: [
{ required: true, message: '请输入员工端登陆账号', trigger: 'blur' }
],
firstname: [
{ required: true, message: '请输入姓氏', trigger: 'blur' }
],
lastname: [
{ required: true, message: '请输入名', trigger: 'blur' }
],
gender: [
{ required: true, message: '请输入性别', trigger: 'change' }
]
},
connectForm: {
address: '',
phone: '',
provinceid: '',
cityid: ''
},
connectrules: {
address: [
{ required: true, message: '请输入地址', trigger: 'blur' }
],
provinceid: [
{ required: true, message: '请选择省', trigger: 'change' }
],
cityid: [
{ required: true, message: '请选择市', trigger: 'change' }
],
phone: [
{ required: true, validator: checkphone, trigger: 'change' }
]
},
companyForm: {
jobnumber: '',
postid: '',
deptid: '',
regionid: [],
repositoryid: ''
},
companyrules: {
deptid: [
{ required: true, message: '请选择部门', trigger: 'change' }
],
regionid: [
{ required: true, message: '请选择区域', trigger: 'change' }
],
repositoryid: [
{ required: true, message: '请选择门店', trigger: 'change' }
]
}
}
},
created() {
this.getnationlist()
},
methods: {
//
getnationlist() {
this.listLoading = true
getcountrylist().then(res => {
if (res.data.ret === 200) {
this.nations = res.data.data.content
} else {
this.listLoading = false
}
setTimeout(() => {
this.listLoading = false
}, 0.5 * 100)
})
regionlist().then(res => {
if (res.data.ret === 200) {
this.regions = this.tranKTree(res.data.data.content)
}
})
getdeptlist().then(res => {
if (res.data.ret === 200) {
this.depts = res.data.data.content
}
})
},
//
handlenext(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.information = 'two'
} else {
this.$message({
message: '信息未填完整',
center: true
})
return false
}
})
},
//
handlenext2(form) {
this.$refs[form].validate((valid) => {
if (valid) {
this.information = 'three'
} else {
this.$message({
message: '信息未填完整',
center: true
})
return false
}
})
},
//
handlechange(val) {
getprovincelist(val).then(res => {
if (res.data.ret === 200) {
this.provinces = res.data.data.content
}
})
},
//
handlechange2(val) {
getcitylist(val).then(res => {
console.log(res)
if (res.data.ret === 200) {
this.cities = res.data.data.content
}
})
},
//
tranKTree(arr) {
if (!arr || !arr.length) return
return arr.map(item => ({
id: item.id,
regionName: item.regionName,
regionListVos: this.tranKTree(item.regionListVos)
}))
},
//
handlechange4(val) {
const finalid = val[val.length - 1]
searchRepository(finalid).then(res => {
console.log(res)
if (res.data.ret === 200) {
this.repositories = res.data.data.content
}
})
},
// json
extend(jsonbject1, jsonbject2) {
var resultJsonObject = {}
for (const attr in jsonbject1) {
resultJsonObject[attr] = jsonbject1[attr]
}
for (const attr in jsonbject2) {
resultJsonObject[attr] = jsonbject2[attr]
}
return resultJsonObject
},
//
handlesave() {
const form2 = this.extend(this.companyForm, this.connectForm)
const form3 = this.extend(form2, this.personalForm)
const quyu = this.companyForm.regionid.length
form3.regionid1 = form3.regionid[quyu - 1]
this.$refs.personalForm.validate((valid) => {
if (valid) {
this.$refs.connectForm.validate((valid) => {
if (valid) {
this.$refs.companyForm.validate((valid) => {
if (valid) {
register(form3).then(res => {
console.log(res)
this.$message({
message: '保存成功',
type: 'success'
})
})
} else {
this.$message({
message: '信息未填完整',
center: true
})
this.information = 'three'
return false
}
})
} else {
this.$message({
message: '信息未填完整',
center: true
})
this.information = 'two'
return false
}
})
} else {
this.$message({
message: '信息未填完整',
center: true
})
this.information = 'one'
return false
}
})
},
//
restAllForm() {
this.personalForm = {
account: '',
passwd: '',
firstname: '',
middlename: '',
lastname: '',
birthday: '',
email: '',
gender: '',
certificatetype: '',
certificatenumber: '',
country: ''
}
this.connectForm = {
address: '',
phone: '',
provinceid: '',
cityid: ''
}
this.companyForm = {
jobnumber: '',
postid: '',
deptid: '',
regionid: [],
repositoryid: ''
}
this.contractForm = {
contractName: '',
contractType: '',
contractAttributes: '',
SigningTime: '',
effectiveTime: '',
status: ''
}
},
//
handleentry() {
this.restAllForm()
this.$refs.personalForm.resetFields()
this.$refs.connectForm.resetFields()
this.$refs.companyForm.resetFields()
this.information = 'one'
},
handlecancel() {
this.$router.go(-1)
const view = { path: '/EmployeeInformation/NewEmployeeInformation', name: 'NewEmployeeInformation', fullPath: '/EmployeeInformation/NewEmployeeInformation', title: 'NewEmployeeInformation' }
this.$store.dispatch('delView', view).then(({ visitedViews }) => {
})
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.ERP-container{
margin:0 30px;
}
</style>

View file

@ -2,7 +2,7 @@
<div class="navbar">
<hamburger :toggle-click="toggleSideBar" :is-active="sidebar.opened" class="hamburger-container"/>
<el-menu class="el-menu-demo" mode="horizontal" style="float: left;height: 50px" @select="handleSelect">
<el-menu-item index="1">系统管理</el-menu-item>
<el-menu-item index="1"><router-link to="/">系统管理</router-link></el-menu-item>
<el-menu-item index="2">采购管理</el-menu-item>
<el-menu-item index="3">销售管理</el-menu-item>
<el-menu-item index="4">库存管理</el-menu-item>
@ -70,7 +70,8 @@ export default {
'name',
'avatar',
'device',
'name'
'name',
'permission_routers'
])
},
methods: {

View file

@ -157,7 +157,6 @@ export default {
this.bobao2 * 0
},
toptrans(par) {
console.log(par)
if (par == this.topmenu || par == 0) {
return true
} else {
@ -189,6 +188,7 @@ export default {
return false
},
resolvePath(routePath) {
if (this.isExternalLink(routePath)) {
return routePath
}

View file

@ -12,14 +12,15 @@
@click.middle.native="closeSelectedTag(tag)"
@contextmenu.prevent.native="openMenu(tag,$event)">
{{ generateTitle(tag.title) }}
<span class="el-icon-close" @click.prevent.stop="closeSelectedTag(tag)" />
<span v-if="!tag.meta.affix" class="el-icon-close" @click.prevent.stop="closeSelectedTag(tag)" />
</router-link>
</scroll-pane>
<ul v-show="visible" :style="{left:left+'px',top:top+'px'}" class="contextmenu">
<li @click="refreshSelectedTag(selectedTag)">{{ $t('tagsView.refresh') }}</li>
<li @click="closeSelectedTag(selectedTag)">{{ $t('tagsView.close') }}</li>
<li v-if="!(selectedTag.meta&&selectedTag.meta.affix)" @click="closeSelectedTag(selectedTag)">{{
$t('tagsView.close') }}</li>
<li @click="closeOthersTags">{{ $t('tagsView.closeOthers') }}</li>
<li @click="closeAllTags">{{ $t('tagsView.closeAll') }}</li>
<li @click="closeAllTags(selectedTag)">{{ $t('tagsView.closeAll') }}</li>
</ul>
</div>
</template>
@ -27,7 +28,7 @@
<script>
import ScrollPane from '@/components/ScrollPane'
import { generateTitle } from '@/utils/i18n'
import path from 'path'
export default {
components: { ScrollPane },
data() {
@ -35,17 +36,21 @@ export default {
visible: false,
top: 0,
left: 0,
selectedTag: {}
selectedTag: {},
affixTags: []
}
},
computed: {
visitedViews() {
return this.$store.state.tagsView.visitedViews
},
routers() {
return this.$store.state.permission.routers
}
},
watch: {
$route() {
this.addViewTags()
this.addTags()
this.moveToCurrentTag()
},
visible(value) {
@ -57,14 +62,43 @@ export default {
}
},
mounted() {
this.addViewTags()
this.initTags()
this.addTags()
},
methods: {
generateTitle, // generateTitle by vue-i18n
isActive(route) {
return route.path === this.$route.path
},
addViewTags() {
filterAffixTags(routes, basePath = '/') {
let tags = []
routes.forEach(route => {
if (route.meta && route.meta.affix) {
tags.push({
path: path.resolve(basePath, route.path),
name: route.name,
meta: { ...route.meta }
})
}
if (route.children) {
const tempTags = this.filterAffixTags(route.children, route.path)
if (tempTags.length >= 1) {
tags = [...tags, ...tempTags]
}
}
})
return tags
},
initTags() {
const affixTags = this.affixTags = this.filterAffixTags(this.routers)
for (const tag of affixTags) {
// Must have tag name
if (tag.name) {
this.$store.dispatch('addVisitedView', tag)
}
}
},
addTags() {
const { name } = this.$route
if (name) {
this.$store.dispatch('addView', this.$route)
@ -77,12 +111,10 @@ export default {
for (const tag of tags) {
if (tag.to.path === this.$route.path) {
this.$refs.scrollPane.moveToTarget(tag)
// when query is different then update
if (tag.to.fullPath !== this.$route.fullPath) {
this.$store.dispatch('updateVisitedView', this.$route)
}
break
}
}
@ -99,14 +131,11 @@ export default {
})
},
closeSelectedTag(view) {
console.log(view)
this.$store.dispatch('delView', view).then(({ visitedViews }) => {
console.log(visitedViews)
if (this.isActive(view)) {
const latestView = visitedViews.slice(-1)[0]
if (latestView) {
this.$router.push(latestView)
} else {
this.$router.push('/')
}
this.toLastView(visitedViews)
}
})
},
@ -116,9 +145,22 @@ export default {
this.moveToCurrentTag()
})
},
closeAllTags() {
this.$store.dispatch('delAllViews')
this.$router.push('/')
closeAllTags(view) {
this.$store.dispatch('delAllViews').then(({ visitedViews }) => {
if (this.affixTags.some(tag => tag.path === view.path)) {
return
}
this.toLastView(visitedViews)
})
},
toLastView(visitedViews) {
const latestView = visitedViews.slice(-1)[0]
if (latestView) {
this.$router.push(latestView)
} else {
// You can set another route
this.$router.push('/')
}
},
openMenu(tag, e) {
const menuMinWidth = 105
@ -126,14 +168,12 @@ export default {
const offsetWidth = this.$el.offsetWidth // container width
const maxLeft = offsetWidth - menuMinWidth // left boundary
const left = e.clientX - offsetLeft + 15 // 15: margin right
if (left > maxLeft) {
this.left = maxLeft
} else {
this.left = left
}
this.top = e.clientY
this.visible = true
this.selectedTag = tag
},
@ -145,95 +185,95 @@ export default {
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.tags-view-container {
height: 34px;
width: 100%;
background: #fff;
border-bottom: 1px solid #d8dce5;
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .12), 0 0 3px 0 rgba(0, 0, 0, .04);
.tags-view-wrapper {
.tags-view-item {
display: inline-block;
position: relative;
cursor: pointer;
height: 26px;
line-height: 26px;
border: 1px solid #d8dce5;
color: #495060;
.tags-view-container {
height: 34px;
width: 100%;
background: #fff;
border-bottom: 1px solid #d8dce5;
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .12), 0 0 3px 0 rgba(0, 0, 0, .04);
.tags-view-wrapper {
.tags-view-item {
display: inline-block;
position: relative;
cursor: pointer;
height: 26px;
line-height: 26px;
border: 1px solid #d8dce5;
color: #495060;
background: #fff;
padding: 0 8px;
font-size: 12px;
margin-left: 5px;
margin-top: 4px;
&:first-of-type {
margin-left: 15px;
}
&:last-of-type {
margin-right: 15px;
}
&.active {
background-color: #42b983;
color: #fff;
border-color: #42b983;
&::before {
content: '';
background: #fff;
display: inline-block;
width: 8px;
height: 8px;
border-radius: 50%;
position: relative;
margin-right: 2px;
}
}
}
}
.contextmenu {
margin: 0;
background: #fff;
padding: 0 8px;
z-index: 100;
position: absolute;
list-style-type: none;
padding: 5px 0;
border-radius: 4px;
font-size: 12px;
margin-left: 5px;
margin-top: 4px;
&:first-of-type {
margin-left: 15px;
}
&:last-of-type {
margin-right: 15px;
}
&.active {
background-color: #42b983;
color: #fff;
border-color: #42b983;
&::before {
content: '';
background: #fff;
display: inline-block;
width: 8px;
height: 8px;
border-radius: 50%;
position: relative;
margin-right: 2px;
font-weight: 400;
color: #333;
box-shadow: 2px 2px 3px 0 rgba(0, 0, 0, .3);
li {
margin: 0;
padding: 7px 16px;
cursor: pointer;
&:hover {
background: #eee;
}
}
}
}
.contextmenu {
margin: 0;
background: #fff;
z-index: 100;
position: absolute;
list-style-type: none;
padding: 5px 0;
border-radius: 4px;
font-size: 12px;
font-weight: 400;
color: #333;
box-shadow: 2px 2px 3px 0 rgba(0, 0, 0, .3);
li {
margin: 0;
padding: 7px 16px;
cursor: pointer;
&:hover {
background: #eee;
}
}
}
}
</style>
<style rel="stylesheet/scss" lang="scss">
//reset element css of el-icon-close
.tags-view-wrapper {
.tags-view-item {
.el-icon-close {
width: 16px;
height: 16px;
vertical-align: 2px;
border-radius: 50%;
text-align: center;
transition: all .3s cubic-bezier(.645, .045, .355, 1);
transform-origin: 100% 50%;
&:before {
transform: scale(.6);
display: inline-block;
vertical-align: -3px;
}
&:hover {
background-color: #b4bccc;
color: #fff;
//reset element css of el-icon-close
.tags-view-wrapper {
.tags-view-item {
.el-icon-close {
width: 16px;
height: 16px;
vertical-align: 2px;
border-radius: 50%;
text-align: center;
transition: all .3s cubic-bezier(.645, .045, .355, 1);
transform-origin: 100% 50%;
&:before {
transform: scale(.6);
display: inline-block;
vertical-align: -3px;
}
&:hover {
background-color: #b4bccc;
color: #fff;
}
}
}
}
}
</style>