Commit 7a37243a by cwq0219

验证优化

1 parent e731c91a
......@@ -8,9 +8,8 @@ const roleCreateStructure = {
departId: '',
departName: '',
departPath: '',
rights: [],
rights: '',
state: 1
// createTime: ''
}
const roleDataColumn = [{
......
......@@ -65,7 +65,7 @@ export default {
},
watch: {
createVisible(val) {
!val && this.$validator.errors.clear()
this.$validator.errors.clear()
this.keyFresh = val
},
flagCOrE(val) {
......
......@@ -94,7 +94,7 @@ export default {
watch: {
dialogFormVisible(val) {
this.key = Date.now()
!val && this.$validator.errors.clear()
this.$validator.errors.clear()
},
'userManageForm.id'(val) {
this.placeholder = val ? '不填为不修改' : '请输入密码'
......
......@@ -71,7 +71,6 @@ export default {
detailVisible: false,
userDetailVisible: false,
roleParam: this.$deep_clone(roleCreateStructure),
roleParamName: String,
roleMenu: [],
columnParam: [],
consoleParam: [],
......@@ -102,7 +101,6 @@ export default {
type: 'text',
callback: (index, rows) => {
this.roleParam = this.$deep_clone(rows[index])
this.roleParamName = this.$deep_clone(rows[index].roleName)
this.handleCreateOrEdit(this.flagCOrE = false)
}
}, {
......@@ -238,13 +236,19 @@ export default {
userDetailDialogVisible() {
this.userDetailVisible = !this.userDetailVisible
},
createOrEditSuccess() {
emptyParam() {
this.createDialogVisible()
clearTimeout(timer)
var timer = setTimeout(() => {
this.roleParam = this.$deep_clone(roleCreateStructure)
}, 200)
},
createOrEditSuccess() {
// this.createDialogVisible()
this.emptyParam()
this.loading = false
notice.okTips(this.flagCOrE ? '创建角色成功!' : '已经成功修改数据!')
// this.loading = false
this.roleMenu = []
this.roleParamName = ''
this.getList()
},
// 调取接口相关函数
......@@ -281,22 +285,17 @@ export default {
},
handleCreateOrEdit() {
this.roleParam = this.flagCOrE ? this.$deep_clone(roleCreateStructure) : this.roleParam
// this.createDialogVisible()
this.flagCOrE && this.createDialogVisible()
!this.flagCOrE && this.getMenuTree(this.roleParam.id, this.editOrDetail = true)
this.flagCOrE ? this.createDialogVisible() : this.getMenuTree(this.roleParam.id, this.editOrDetail = true)
},
// 关闭新增用户组件
handleCreateClose(data) {
if (!data) {
this.createDialogVisible()
this.roleMenu = []
this.roleParamName = ''
this.emptyParam()
return false
}
this.loading = true
// 将数据提交给后台,根据返回结果做判断
this.flagCOrE && this.addRole(data)
!this.flagCOrE && this.updateRoleInfo(data)
this.flagCOrE ? this.addRole(data) : this.updateRoleInfo(data)
}
}
}
......
......@@ -222,7 +222,7 @@ export default {
updateUser_Post(params) {
updateUser.req(params).then(res => {
notice.okTips('操作成功')
this.dialogFormVisible = !this.dialogFormVisible
this.emptyForm()
this.loading = false
this.findUserList()
}).catch(message => {
......@@ -242,11 +242,18 @@ export default {
(params.state === 2) && this.findUserList()
})
},
emptyForm() {
this.dialogFormVisible = !this.dialogFormVisible
clearTimeout(timer)
var timer = setTimeout(() => {
this.userManageForm = this.$deep_clone(userForm)
}, 200)
},
// 接受子组件传递的值
handleUserFormData(isEdit, params) {
this.loading = true
params && this.updateUser_Post(params)
!params && (this.dialogFormVisible = !this.dialogFormVisible)
!params && this.emptyForm()
},
// 新增按钮
createUser() {
......@@ -327,8 +334,7 @@ export default {
}).then(() => {
this.operatUser({ id: rows[index].id, state: 2 })
notice.okTips('成功删除该用户')
}).catch(err => {
notice.errorTips(err)
}).catch(() => {
})
},
findRolesName(params) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!