diff --git a/src/pages/department/index.tsx b/src/pages/department/index.tsx
index f81f17b..631ec1f 100644
--- a/src/pages/department/index.tsx
+++ b/src/pages/department/index.tsx
@@ -150,13 +150,16 @@ const DepartmentPage = () => {
}
department.checkDestroy(id).then((res: any) => {
if (
+ res.data.children &&
res.data.children.length === 0 &&
+ res.data.courses &&
res.data.courses.length === 0 &&
+ res.data.users &&
res.data.users.length === 0
) {
delUser(id);
} else {
- if (res.data.children.length > 0) {
+ if (res.data.children && res.data.children.length > 0) {
modal.warning({
title: "操作确认",
centered: true,
@@ -179,7 +182,7 @@ const DepartmentPage = () => {
content: (
此部门已关联
- {res.data.courses.length > 0 && (
+ {res.data.courses && res.data.courses.length > 0 && (
)}
- {res.data.users.length > 0 && (
+ {res.data.users && res.data.users.length > 0 && (