mirror of
https://github.com/PlayEdu/backend
synced 2025-12-23 03:39:34 +08:00
分类、部门删除关联跳转相关页面时选中
This commit is contained in:
@@ -5,13 +5,13 @@ import { resourceCategory } from "../../api/index";
|
||||
interface Option {
|
||||
key: string | number;
|
||||
title: any;
|
||||
|
||||
children?: Option[];
|
||||
}
|
||||
|
||||
interface PropInterface {
|
||||
type: string;
|
||||
text: string;
|
||||
selected: any;
|
||||
onUpdate: (keys: any, title: any) => void;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,12 @@ export const TreeCategory = (props: PropInterface) => {
|
||||
const [loading, setLoading] = useState<boolean>(true);
|
||||
const [selectKey, setSelectKey] = useState<any>([]);
|
||||
|
||||
useEffect(() => {
|
||||
if (props.selected && props.selected.length > 0) {
|
||||
setSelectKey(props.selected);
|
||||
}
|
||||
}, [props.selected]);
|
||||
|
||||
useEffect(() => {
|
||||
resourceCategory.resourceCategoryList().then((res: any) => {
|
||||
const categories = res.data.categories;
|
||||
|
||||
@@ -13,6 +13,7 @@ interface PropInterface {
|
||||
text: string;
|
||||
refresh: boolean;
|
||||
showNum: boolean;
|
||||
selected: any;
|
||||
onUpdate: (keys: any, title: any) => void;
|
||||
}
|
||||
|
||||
@@ -22,6 +23,12 @@ export const TreeDepartment = (props: PropInterface) => {
|
||||
const [selectKey, setSelectKey] = useState<any>([]);
|
||||
const [userTotal, setUserTotal] = useState(0);
|
||||
|
||||
useEffect(() => {
|
||||
if (props.selected && props.selected.length > 0) {
|
||||
setSelectKey(props.selected);
|
||||
}
|
||||
}, [props.selected]);
|
||||
|
||||
useEffect(() => {
|
||||
setLoading(true);
|
||||
department.departmentList().then((res: any) => {
|
||||
|
||||
@@ -110,6 +110,7 @@ export const UploadImageButton = (props: PropsInterface) => {
|
||||
<Row style={{ width: 752, minHeight: 520, marginTop: 24 }}>
|
||||
<Col span={7}>
|
||||
<TreeCategory
|
||||
selected={category_ids}
|
||||
type="no-cate"
|
||||
text={"图片"}
|
||||
onUpdate={(keys: any) => {
|
||||
|
||||
@@ -173,6 +173,7 @@ export const UploadVideoSub = (props: PropsInterface) => {
|
||||
<Row style={{ width: 752, minHeight: 520 }}>
|
||||
<Col span={7}>
|
||||
<TreeCategory
|
||||
selected={[]}
|
||||
type="no-cate"
|
||||
text={props.label}
|
||||
onUpdate={(keys: any) => setCategoryIds(keys)}
|
||||
|
||||
Reference in New Issue
Block a user