mirror of
https://github.com/PlayEdu/backend
synced 2025-07-21 04:39:39 +08:00
分类、部门删除功能优化
This commit is contained in:
parent
32eccf401c
commit
f047fad55d
@ -150,13 +150,16 @@ const DepartmentPage = () => {
|
|||||||
}
|
}
|
||||||
department.checkDestroy(id).then((res: any) => {
|
department.checkDestroy(id).then((res: any) => {
|
||||||
if (
|
if (
|
||||||
|
res.data.children &&
|
||||||
res.data.children.length === 0 &&
|
res.data.children.length === 0 &&
|
||||||
|
res.data.courses &&
|
||||||
res.data.courses.length === 0 &&
|
res.data.courses.length === 0 &&
|
||||||
|
res.data.users &&
|
||||||
res.data.users.length === 0
|
res.data.users.length === 0
|
||||||
) {
|
) {
|
||||||
delUser(id);
|
delUser(id);
|
||||||
} else {
|
} else {
|
||||||
if (res.data.children.length > 0) {
|
if (res.data.children && res.data.children.length > 0) {
|
||||||
modal.warning({
|
modal.warning({
|
||||||
title: "操作确认",
|
title: "操作确认",
|
||||||
centered: true,
|
centered: true,
|
||||||
@ -179,7 +182,7 @@ const DepartmentPage = () => {
|
|||||||
content: (
|
content: (
|
||||||
<p>
|
<p>
|
||||||
此部门已关联
|
此部门已关联
|
||||||
{res.data.courses.length > 0 && (
|
{res.data.courses && res.data.courses.length > 0 && (
|
||||||
<Button
|
<Button
|
||||||
style={{ paddingLeft: 4, paddingRight: 4 }}
|
style={{ paddingLeft: 4, paddingRight: 4 }}
|
||||||
type="link"
|
type="link"
|
||||||
@ -189,7 +192,7 @@ const DepartmentPage = () => {
|
|||||||
({res.data.courses.length}个线上课程),
|
({res.data.courses.length}个线上课程),
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
{res.data.users.length > 0 && (
|
{res.data.users && res.data.users.length > 0 && (
|
||||||
<Button
|
<Button
|
||||||
type="link"
|
type="link"
|
||||||
style={{ paddingLeft: 4, paddingRight: 4 }}
|
style={{ paddingLeft: 4, paddingRight: 4 }}
|
||||||
|
@ -148,14 +148,18 @@ const ResourceCategoryPage = () => {
|
|||||||
}
|
}
|
||||||
resourceCategory.checkDestroy(id).then((res: any) => {
|
resourceCategory.checkDestroy(id).then((res: any) => {
|
||||||
if (
|
if (
|
||||||
|
res.data.children &&
|
||||||
res.data.children.length === 0 &&
|
res.data.children.length === 0 &&
|
||||||
|
res.data.courses &&
|
||||||
res.data.courses.length === 0 &&
|
res.data.courses.length === 0 &&
|
||||||
|
res.data.images &&
|
||||||
res.data.images.length === 0 &&
|
res.data.images.length === 0 &&
|
||||||
|
res.data.videos &&
|
||||||
res.data.videos.length === 0
|
res.data.videos.length === 0
|
||||||
) {
|
) {
|
||||||
delUser(id);
|
delUser(id);
|
||||||
} else {
|
} else {
|
||||||
if (res.data.children.length > 0) {
|
if (res.data.children && res.data.children.length > 0) {
|
||||||
modal.warning({
|
modal.warning({
|
||||||
title: "操作确认",
|
title: "操作确认",
|
||||||
centered: true,
|
centered: true,
|
||||||
@ -178,7 +182,7 @@ const ResourceCategoryPage = () => {
|
|||||||
content: (
|
content: (
|
||||||
<p>
|
<p>
|
||||||
此分类已关联
|
此分类已关联
|
||||||
{res.data.courses.length > 0 && (
|
{res.data.courses && res.data.courses.length > 0 && (
|
||||||
<Button
|
<Button
|
||||||
style={{ paddingLeft: 4, paddingRight: 4 }}
|
style={{ paddingLeft: 4, paddingRight: 4 }}
|
||||||
type="link"
|
type="link"
|
||||||
@ -188,7 +192,7 @@ const ResourceCategoryPage = () => {
|
|||||||
({res.data.courses.length}个线上课程),
|
({res.data.courses.length}个线上课程),
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
{res.data.videos.length > 0 && (
|
{res.data.videos && res.data.videos.length > 0 && (
|
||||||
<Button
|
<Button
|
||||||
type="link"
|
type="link"
|
||||||
style={{ paddingLeft: 4, paddingRight: 4 }}
|
style={{ paddingLeft: 4, paddingRight: 4 }}
|
||||||
@ -198,7 +202,7 @@ const ResourceCategoryPage = () => {
|
|||||||
({res.data.videos.length}个视频文件),
|
({res.data.videos.length}个视频文件),
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
{res.data.images.length > 0 && (
|
{res.data.images && res.data.images.length > 0 && (
|
||||||
<Button
|
<Button
|
||||||
type="link"
|
type="link"
|
||||||
style={{ paddingLeft: 4, paddingRight: 4 }}
|
style={{ paddingLeft: 4, paddingRight: 4 }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user