Commit 7a37243a by cwq0219

验证优化

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