Commit 3ca97c43 by cwq0219

解决角色名重复

1 parent 42115ac1
...@@ -38,15 +38,16 @@ export default { ...@@ -38,15 +38,16 @@ export default {
data() { data() {
return { return {
roleName: '', roleName: '',
roleId: Number, // roleId: Number,
createVisible: false, createVisible: false,
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: [],
apiParam: Number, apiParam: Object,
flagRoleOrUser: true, flagRoleOrUser: true,
flagCOrE: Boolean, flagCOrE: Boolean,
editOrDetail: Boolean, editOrDetail: Boolean,
...@@ -72,6 +73,7 @@ export default { ...@@ -72,6 +73,7 @@ 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)
} }
}, { }, {
...@@ -186,18 +188,22 @@ export default { ...@@ -186,18 +188,22 @@ export default {
console.log(data) console.log(data)
this.createOrEditSuccess() this.createOrEditSuccess()
}).catch(err => { }).catch(err => {
this.message(err, 'error')
console.log(err) console.log(err)
}) })
}, },
// 编辑角色 // 编辑角色
updateRoleInfo(params) { updateRoleInfo(params) {
console.log(params) // console.log(this.roleParamName)
// console.log(params.roleName)
// if (this.roleParamName === params.roleName) delete params.roleName
delete params.createTime delete params.createTime
delete params.updateTime delete params.updateTime
updateRole.req(params).then((data) => { updateRole.req(params).then((data) => {
console.log(data) // console.log(data)
this.createOrEditSuccess() this.createOrEditSuccess()
}).catch(err => { }).catch(err => {
this.message(err, 'error')
console.log(err) console.log(err)
}) })
}, },
...@@ -215,6 +221,7 @@ export default { ...@@ -215,6 +221,7 @@ export default {
this.createDialogVisible() this.createDialogVisible()
this.message(this.flagCOrE ? '创建角色成功!' : '已经成功修改数据!', 'success') this.message(this.flagCOrE ? '创建角色成功!' : '已经成功修改数据!', 'success')
this.roleMenu = [] this.roleMenu = []
this.roleParamName = ''
this.getList() this.getList()
}, },
// 调取接口相关函数 // 调取接口相关函数
...@@ -247,7 +254,7 @@ export default { ...@@ -247,7 +254,7 @@ export default {
handleUserDetailClose() { handleUserDetailClose() {
this.userDetailDialogVisible() this.userDetailDialogVisible()
this.getList() this.getList()
this.apiParam = Number this.apiParam = Object
}, },
handleCreateOrEdit() { handleCreateOrEdit() {
this.roleParam = this.flagCOrE ? this.$deep_clone(roleCreateStructure) : this.roleParam this.roleParam = this.flagCOrE ? this.$deep_clone(roleCreateStructure) : this.roleParam
...@@ -262,6 +269,7 @@ export default { ...@@ -262,6 +269,7 @@ export default {
if (!data) { if (!data) {
this.createDialogVisible() this.createDialogVisible()
this.roleMenu = [] this.roleMenu = []
this.roleParamName = ''
this.message(this.flagCOrE ? '取消创建角色' : '取消编辑角色', 'info') this.message(this.flagCOrE ? '取消创建角色' : '取消编辑角色', 'info')
return false return false
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!