From 2348cfb54dbb57b54fd5f69475c397eb1e8cb387 Mon Sep 17 00:00:00 2001 From: unknown <18119604035@163.com> Date: Mon, 7 Aug 2023 10:15:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=BB=93=E6=9E=84=E9=87=8D?= =?UTF-8?q?=E6=9E=84=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compenents/select-attachment/index.tsx | 10 ++++++++-- src/compenents/select-resource/index.tsx | 12 ++++++++++-- src/compenents/tree-category/index.tsx | 6 +++--- src/compenents/tree-department/index.tsx | 12 ++++++++---- 4 files changed, 29 insertions(+), 11 deletions(-) diff --git a/src/compenents/select-attachment/index.tsx b/src/compenents/select-attachment/index.tsx index 1a40742..78297b7 100644 --- a/src/compenents/select-attachment/index.tsx +++ b/src/compenents/select-attachment/index.tsx @@ -11,12 +11,18 @@ interface PropsInterface { onCancel: () => void; } +type selAttachmentModel = { + name: string; + rid: number; + type: string; +}; + export const SelectAttachment = (props: PropsInterface) => { const [refresh, setRefresh] = useState(true); const [tabKey, setTabKey] = useState(1); - const [selectKeys, setSelectKeys] = useState([]); - const [selectVideos, setSelectVideos] = useState([]); + const [selectKeys, setSelectKeys] = useState([]); + const [selectVideos, setSelectVideos] = useState([]); useEffect(() => { setRefresh(!refresh); diff --git a/src/compenents/select-resource/index.tsx b/src/compenents/select-resource/index.tsx index b30c29e..85d1e18 100644 --- a/src/compenents/select-resource/index.tsx +++ b/src/compenents/select-resource/index.tsx @@ -11,11 +11,18 @@ interface PropsInterface { onCancel: () => void; } +type selVideosModel = { + name: string; + rid: number; + type: string; + duration: number; +}; + export const SelectResource = (props: PropsInterface) => { const [refresh, setRefresh] = useState(true); const [tabKey, setTabKey] = useState(1); - const [selectKeys, setSelectKeys] = useState([]); - const [selectVideos, setSelectVideos] = useState([]); + const [selectKeys, setSelectKeys] = useState([]); + const [selectVideos, setSelectVideos] = useState([]); useEffect(() => { setRefresh(!refresh); @@ -62,6 +69,7 @@ export const SelectResource = (props: PropsInterface) => { maskClosable={false} onOk={() => { props.onSelected(selectKeys, selectVideos); + console.log(selectKeys, selectVideos); setSelectKeys([]); setSelectVideos([]); }} diff --git a/src/compenents/tree-category/index.tsx b/src/compenents/tree-category/index.tsx index 9f0a259..1e3c2a7 100644 --- a/src/compenents/tree-category/index.tsx +++ b/src/compenents/tree-category/index.tsx @@ -18,7 +18,7 @@ interface PropInterface { export const TreeCategory = (props: PropInterface) => { const [treeData, setTreeData] = useState([]); const [loading, setLoading] = useState(true); - const [selectKey, setSelectKey] = useState([]); + const [selectKey, setSelectKey] = useState([]); useEffect(() => { if (props.selected && props.selected.length > 0) { @@ -28,7 +28,7 @@ export const TreeCategory = (props: PropInterface) => { useEffect(() => { resourceCategory.resourceCategoryList().then((res: any) => { - const categories = res.data.categories; + const categories: CategoriesBoxModel = res.data.categories; if (JSON.stringify(categories) !== "{}") { const new_arr: Option[] = checkArr(categories, 0); if (props.type === "no-cate") { @@ -43,7 +43,7 @@ export const TreeCategory = (props: PropInterface) => { }); }, []); - const checkArr = (categories: any[], id: number) => { + const checkArr = (categories: CategoriesBoxModel, id: number) => { const arr = []; for (let i = 0; i < categories[id].length; i++) { if (!categories[categories[id][i].id]) { diff --git a/src/compenents/tree-department/index.tsx b/src/compenents/tree-department/index.tsx index 249d7a2..4c03389 100644 --- a/src/compenents/tree-department/index.tsx +++ b/src/compenents/tree-department/index.tsx @@ -32,8 +32,8 @@ export const TreeDepartment = (props: PropInterface) => { useEffect(() => { setLoading(true); department.departmentList().then((res: any) => { - const departments = res.data.departments; - const departCount = res.data.dep_user_count; + const departments: DepartmentsBoxModel = res.data.departments; + const departCount: DepIdsModel = res.data.dep_user_count; setUserTotal(res.data.user_total); if (JSON.stringify(departments) !== "{}") { if (props.showNum) { @@ -57,7 +57,11 @@ export const TreeDepartment = (props: PropInterface) => { }); }, [props.refresh]); - const checkNewArr = (departments: any[], id: number, counts: any) => { + const checkNewArr = ( + departments: DepartmentsBoxModel, + id: number, + counts: any + ) => { const arr = []; for (let i = 0; i < departments[id].length; i++) { if (!departments[departments[id][i].id]) { @@ -89,7 +93,7 @@ export const TreeDepartment = (props: PropInterface) => { return arr; }; - const checkArr = (departments: any[], id: number) => { + const checkArr = (departments: DepartmentsBoxModel, id: number) => { const arr = []; for (let i = 0; i < departments[id].length; i++) { if (!departments[departments[id][i].id]) {