Merge pull request 'fix : 角色替换' (#688) from dd into master
Reviewed-on: http://git.feashow.cn/clay/mosr-web/pulls/688
This commit is contained in:
@@ -124,22 +124,30 @@ const schame = computed(() => {
|
||||
change: async (val) => {
|
||||
const {code, data} = await judgeIsSameRole(form.value.getValues().userId)
|
||||
if (code === 1000) {
|
||||
console.log('currentRoleArray.value',data)
|
||||
if (currentRoleArray.value.length !== 0) {
|
||||
console.log('currentRoleArray.value', currentRoleArray.value)
|
||||
console.log('data,val', data, val)
|
||||
if (currentRoleArray.value.length !== 0) {//当前用户存在角色
|
||||
val.forEach(selectItem => {
|
||||
currentRoleArray.value.forEach(currentItem => {
|
||||
if (data[selectItem]?.length > 0 && selectItem != currentItem) {
|
||||
ElMessageBox.confirm(`此角色存在对应人员:${data[selectItem][0].nickName},您确定要替换该人员?`, "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(async () => {
|
||||
currentRoleArray.value?.forEach(currentItem => {
|
||||
if (selectItem != currentItem) {
|
||||
console.log('currentItem', currentItem,data[currentItem],form.value.getValues().userId)
|
||||
if (currentItem &&data[currentItem]&& data[currentItem].length > 0&& data[currentItem][0].userId==form.value.getValues().userId) {
|
||||
|
||||
}).catch((action) => {
|
||||
if (action == 'cancel') {
|
||||
form.value.getValues().roleIds = form.value.getValues().roleIds.filter(roleItem => roleItem != selectItem);
|
||||
}else{
|
||||
if (data[selectItem]?.length > 0 ) {
|
||||
ElMessageBox.confirm(`${getRoleName(selectItem)}角色存在对应人员:${data[selectItem][0].nickName},您确定要替换为 ${form.value.getValues().nickName}?`, "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(async () => {
|
||||
|
||||
}).catch((action) => {
|
||||
if (action == 'cancel') {
|
||||
form.value.getValues().roleIds = form.value.getValues().roleIds.filter(roleItem => roleItem != selectItem);
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -226,7 +234,10 @@ const rules = reactive({
|
||||
sex: [{required: true, message: '请选择', trigger: 'change'}],
|
||||
state: [{required: true, message: '请选择', trigger: 'change'}],
|
||||
})
|
||||
|
||||
const getRoleName=(roleId)=>{
|
||||
console.log('roleId',roleId,localData.roleOpt,localData.roleOpt.filter(item=>item.value==roleId))
|
||||
return localData.roleOpt.filter(item=>item.value==roleId)[0].label
|
||||
}
|
||||
const getInstance = (e) => {
|
||||
form.value = e
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user