From 1e02e00000b41d6e7e3467a122177d7ea574b494 Mon Sep 17 00:00:00 2001 From: odjbin <1042039504@qq.com> Date: Mon, 12 Aug 2024 22:50:56 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix=20:=20=E4=BF=AE=E5=A4=8D=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E5=AE=9E=E6=96=BD-=E9=99=84=E4=BB=B6=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E9=80=89=E9=A1=B9=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/project-management/implementation/attachment.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/views/project-management/implementation/attachment.vue b/src/views/project-management/implementation/attachment.vue index 848fb32..ce2638c 100644 --- a/src/views/project-management/implementation/attachment.vue +++ b/src/views/project-management/implementation/attachment.vue @@ -392,6 +392,7 @@ const handleDownload = (row) => { onActivated(()=>{ handleSearch() + getTagsOption() }) handleSearch() getTagsOption() From 1dd381cc1ebf2a77e9cbc1f4ac9706c12733387f Mon Sep 17 00:00:00 2001 From: odjbin <1042039504@qq.com> Date: Mon, 12 Aug 2024 23:25:56 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix=20:=20=E4=BF=AE=E5=A4=8D=E8=A7=92?= =?UTF-8?q?=E8=89=B2=E6=9B=BF=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/system/user/add.vue | 78 ++++++++++++++++------------------- 1 file changed, 36 insertions(+), 42 deletions(-) diff --git a/src/views/system/user/add.vue b/src/views/system/user/add.vue index b170c2e..1c7249c 100644 --- a/src/views/system/user/add.vue +++ b/src/views/system/user/add.vue @@ -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