Merge pull request 'dd' (#704) from dd into master

Reviewed-on: http://git.feashow.cn/clay/mosr-web/pulls/704
This commit is contained in:
2024-08-12 15:26:10 +00:00
2 changed files with 37 additions and 42 deletions

View File

@@ -392,6 +392,7 @@ const handleDownload = (row) => {
onActivated(()=>{
handleSearch()
getTagsOption()
})
handleSearch()
getTagsOption()

View File

@@ -37,7 +37,19 @@ const localData = reactive({
roleOpt: [],
jobOpt: []
})
const openChangeRoleDialog = (selectRoleId, data) => {
ElMessageBox.confirm(`${getRoleName(selectRoleId)} 角色存在对应人员:${data[selectRoleId][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 != selectRoleId);
}
})
}
const schame = computed(() => {
let arr = [
{
@@ -124,49 +136,31 @@ const schame = computed(() => {
change: async (val) => {
const {code, data} = await judgeIsSameRole(form.value.getValues().userId)
if (code === 1000) {
console.log('currentRoleArray.value', currentRoleArray.value)
console.log('data,val', data, val)
// console.log('currentRoleArray.value', currentRoleArray.value)
// console.log('data,val', data, val)
let selectRoleLast = val[val?.length - 1]
if (currentRoleArray.value.length !== 0) {//当前用户存在角色
val.forEach(selectItem => {
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) {
}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);
}
})
}
}
currentRoleArray.value?.forEach(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) {
console.log('已选择对接人')
//选择两个对接人
if (data[selectRoleLast]?.length > 0 && data[selectRoleLast][0].userId !== form.value.getValues().userId) {
console.log('选择两个对接人')
openChangeRoleDialog(selectRoleLast, data)
}
} else {
//当前用户未选择对接人
if (data[selectRoleLast]?.length > 0) {
openChangeRoleDialog(selectRoleLast, data)
}
})
})
} else {
val.forEach(selectItem => {
if (data[selectItem]?.length > 0) {
ElMessageBox.confirm(`此角色存在对应人员:${data[selectItem][0].nickName},您确定要替换该人员?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(async () => {
}).catch((action) => {
if (action == 'cancel') {
form.value.getValues().roleIds = form.value.getValues().roleIds.filter(roleItem => roleItem != selectItem);
}
})
}
})
} else {//当前用户未分配角色
if (data[selectRoleLast]?.length > 0) {
openChangeRoleDialog(selectRoleLast, data)
}
}
}
}
@@ -234,9 +228,9 @@ 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 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