fix(depart): 切换部门排除depart_type=4的组织,部门变更后自动弹窗确认
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -50,7 +50,7 @@
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed, watch, unref } from 'vue';
|
||||
import { ref, computed, watch, unref, onMounted } from 'vue';
|
||||
import { Avatar } from 'ant-design-vue';
|
||||
import { BasicModal } from '/@/components/Modal';
|
||||
import { getUserDeparts, selectDepart } from '/@/views/system/depart/depart.api';
|
||||
@@ -125,8 +125,12 @@
|
||||
if (!result.list || result.list.length == 0) {
|
||||
return;
|
||||
}
|
||||
let currentDepart = result.list.filter((item) => item.orgCode == result.orgCode);
|
||||
departList.value = result.list;
|
||||
let filteredList = result.list.filter((item) => item.departType != '4');
|
||||
if (filteredList.length == 0) {
|
||||
return;
|
||||
}
|
||||
let currentDepart = filteredList.filter((item) => item.orgCode == result.orgCode);
|
||||
departList.value = filteredList;
|
||||
departSelected.value = currentDepart && currentDepart.length > 0 ? result.orgCode : '';
|
||||
currentDepartName.value = currentDepart && currentDepart.length > 0 ? currentDepart[0].departName : '';
|
||||
isMultiDepart.value = true;
|
||||
@@ -252,8 +256,29 @@
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* 检测当前 orgCode 与部门列表是否匹配,不匹配则自动弹出确认弹窗。
|
||||
* 用于管理员修改用户部门后,用户端自动提示确认。
|
||||
*/
|
||||
async function checkAndShow() {
|
||||
try {
|
||||
await loadDepartList();
|
||||
if (unref(departList).length > 0 && !unref(departSelected)) {
|
||||
currTitle.value = '部门信息已更新,请确认当前部门';
|
||||
visible.value = true;
|
||||
}
|
||||
} catch {
|
||||
// 部门信息加载失败(如未登录),静默跳过
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
checkAndShow();
|
||||
});
|
||||
|
||||
defineExpose({
|
||||
show,
|
||||
checkAndShow,
|
||||
});
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
|
||||
Reference in New Issue
Block a user