Commit 452f62f3 by 冒粤蓉
2 parents 024c7833 694e0fb4
@import './common.scss'; @import './common.scss';
@import './reset.scss';
body { body {
overflow: hidden; overflow: hidden;
...@@ -76,4 +77,4 @@ a:hover { ...@@ -76,4 +77,4 @@ a:hover {
.app-container { .app-container {
padding: 20px; padding: 20px;
} }
\ No newline at end of file \ No newline at end of file
.el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content {
background-color: #409EFF;
color: #ffffff;
}
\ No newline at end of file \ No newline at end of file
...@@ -51,7 +51,9 @@ export const Common = { ...@@ -51,7 +51,9 @@ export const Common = {
} }
}) })
}, },
// 正整数 /**
* 正整数
* */
checkRegExpNumber(rule, value, callback) { checkRegExpNumber(rule, value, callback) {
var rxp = /^\+?[1-9][0-9]*$/ var rxp = /^\+?[1-9][0-9]*$/
if (!rule.required) { if (!rule.required) {
...@@ -61,5 +63,31 @@ export const Common = { ...@@ -61,5 +63,31 @@ export const Common = {
return callback(new Error('只支持正整数')) return callback(new Error('只支持正整数'))
} }
} }
if (!value) {
return callback(new Error('请输入正整数'))
}else {
callback()
}
},
/**
* 手机号
* */
checkRegExpPhoneTel(rule, value, callback) {
var rxpPhone = /^1[345789]\d{9}$/
var rxpTel = /^(\(\d{3,4}\)|\d{3,4}-|\s)?\d{7,14}$/
if (!rule.required) {
if (!value) {
callback()
}else if (!rxpPhone.test(value)) {
return callback(new Error('请输入正确的手机号码'))
}
}
if (!value) {
return callback(new Error('请输入手机号码或固话'))
}else if (!rxpPhone.test(value) && !rxpTel.test(value)) {
return callback(new Error('请输入正确的手机号码或固话'))
}else {
callback()
}
} }
} }
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
size="mini" size="mini"
placeholder="输入内容搜索" placeholder="输入内容搜索"
v-model="orgName" v-model="orgName"
@change="treeInput" @input="treeInput"
></el-input> ></el-input>
<el-tree <el-tree
:data="treedata" :data="treedata"
...@@ -239,15 +239,18 @@ export default { ...@@ -239,15 +239,18 @@ export default {
username: [{ required: true, message: '请输入用户名称', trigger: 'blur' }], username: [{ required: true, message: '请输入用户名称', trigger: 'blur' }],
roleId: [{ required: true, message: '请选择角色', trigger: 'change' }], roleId: [{ required: true, message: '请选择角色', trigger: 'change' }],
email: [{ type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change'] }], email: [{ type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change'] }],
phoneNumber: [{ required: true, message: '请输入手机号', trigger: 'blur' }], phoneNumber: [{ required: true, message: '请输入手机号', trigger: 'blur' },
{ validator: this.$Common.checkRegExpPhoneTel, trigger: 'blur' }],
enableStatus: [{ required: true }], enableStatus: [{ required: true }],
}, },
addRule: [{ required: true, message: '请输入密码', trigger: 'blur' }], addRule: [{ required: true, message: '请输入密码', trigger: 'blur' },
{ min: 6, max: 50, message: '长度在 6 到 50 个字符', trigger: 'blur' }],
// 部门弹窗 // 部门弹窗
filterDialogTitle: '选择组织', filterDialogTitle: '选择组织',
filterVisible: false, filterVisible: false,
filterText: '', filterText: '',
filterTextData: [], filterTextData: [],
isOpen: true
} }
}, },
watch: { watch: {
...@@ -274,6 +277,9 @@ export default { ...@@ -274,6 +277,9 @@ export default {
// 重置搜索条件 // 重置搜索条件
refresh() { refresh() {
this.searchForm = {} this.searchForm = {}
this.orgName = ''
this.getTreeOrg()
this.$refs.userTable.refreshTable()
}, },
// 确定,新增用户、编辑用户 // 确定,新增用户、编辑用户
handleConfirm() { handleConfirm() {
...@@ -286,6 +292,7 @@ export default { ...@@ -286,6 +292,7 @@ export default {
delete params.superiorName delete params.superiorName
delete params.createdDate delete params.createdDate
delete params.roleName delete params.roleName
delete params.deptDepth
this.emptyData(params) this.emptyData(params)
let api = addUser let api = addUser
if (params.id) api = editUser if (params.id) api = editUser
...@@ -328,6 +335,7 @@ export default { ...@@ -328,6 +335,7 @@ export default {
btnClick(pType, scope) { btnClick(pType, scope) {
switch (pType) { switch (pType) {
case 'create': case 'create':
this.isOpen = true
this.userDialogTitle = '新增用户' this.userDialogTitle = '新增用户'
this.$set(this.userRules, 'password', this.addRule) this.$set(this.userRules, 'password', this.addRule)
this.userForm = { this.userForm = {
...@@ -344,6 +352,7 @@ export default { ...@@ -344,6 +352,7 @@ export default {
this.handleClose() this.handleClose()
break break
case 'edit': case 'edit':
this.isOpen = false
this.userDialogTitle = '编辑用户' this.userDialogTitle = '编辑用户'
if (this.userRules.password) { if (this.userRules.password) {
this.$set(this.userRules, 'password', null) this.$set(this.userRules, 'password', null)
...@@ -365,7 +374,7 @@ export default { ...@@ -365,7 +374,7 @@ export default {
this.userForm.gender = this.userForm.gender + '' this.userForm.gender = this.userForm.gender + ''
this.userData.map(item => { this.userData.map(item => {
if (item.prop == 'superiorName') { if (item.prop == 'superiorName') {
item.hidden = !(this.userForm.deptDepth == 0) item.hidden = this.userForm.deptDepth == 0
} }
}) })
this.handleClose(res.data) this.handleClose(res.data)
...@@ -397,10 +406,12 @@ export default { ...@@ -397,10 +406,12 @@ export default {
}, },
// 部门弹窗 // 部门弹窗
selectDepart() { selectDepart() {
this.filterText = '' if (this.isOpen) {
this.filterDialogTitle = '选择组织' this.filterText = ''
this.getSimpleList() this.filterDialogTitle = '选择组织'
this.closeFilter() this.getSimpleList()
this.closeFilter()
}
}, },
// 上级弹窗 // 上级弹窗
selectSuperior() { selectSuperior() {
...@@ -416,8 +427,13 @@ export default { ...@@ -416,8 +427,13 @@ export default {
filterConfirm() { filterConfirm() {
console.log(this.$refs.tree.getCurrentNode()) console.log(this.$refs.tree.getCurrentNode())
if (this.filterDialogTitle == '选择直接上级') { if (this.filterDialogTitle == '选择直接上级') {
this.userForm.superiorId = this.$refs.tree.getCurrentNode().id if (this.$refs.tree.getCurrentNode().disabled) {
this.userForm.superiorName = this.$refs.tree.getCurrentNode().label this.$message('该选项不可选择为直接上级')
} else {
this.userForm.superiorId = this.$refs.tree.getCurrentNode().id
this.userForm.superiorName = this.$refs.tree.getCurrentNode().label
this.closeFilter()
}
} else { } else {
this.userForm.departmentId = this.$refs.tree.getCurrentNode().id this.userForm.departmentId = this.$refs.tree.getCurrentNode().id
this.userForm.departmentName = this.$refs.tree.getCurrentNode().label this.userForm.departmentName = this.$refs.tree.getCurrentNode().label
...@@ -430,8 +446,8 @@ export default { ...@@ -430,8 +446,8 @@ export default {
} }
} }
}) })
this.closeFilter()
} }
this.closeFilter()
}, },
filterNode(value, data) { filterNode(value, data) {
if (!value) return true if (!value) return true
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!