Commit e950fa02 by zhangleyuan

feat:修改课程分类的编辑子分类

parent afe9fe10
......@@ -2,7 +2,7 @@
* @Author: wufan
* @Date: 2020-11-25 18:25:02
* @LastEditors: zhangleyuan
* @LastEditTime: 2020-12-04 11:11:50
* @LastEditTime: 2020-12-08 15:12:57
* @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
......@@ -37,7 +37,7 @@ export function deleteEmployee(params: object) {
}
export function getCourseCatalogList(params: object) {
return Service.Hades("public/hades/getParentCategoryPage", params);
return Service.Hades("public/hades/getCategoryPage", params);
}
export function getAllSonCategory(params: object) {
......
......@@ -18,7 +18,7 @@ import "./CourseCatalogPage.less";
import User from '@/common/js/user';
const { confirm } = Modal;
interface RecordTypes {
child: any;
sonCategoryList: any;
}
function CourseCatalogPage() {
......@@ -228,11 +228,13 @@ function CourseCatalogPage() {
listData.map((item:any,index:any) => {
item.type = "parent"
item.key = item.id;
// item.child.map((_item:any,_index:any) =>{
// _item.type = "child";
// _item.key=_item.id
// return _item
// });
if(item.sonCategoryList){
item.sonCategoryList.map((_item:any,_index:any) =>{
_item.type = "child";
_item.key=_item.id
return _item
});
}
return item
})
return listData
......@@ -264,8 +266,6 @@ function CourseCatalogPage() {
// return
// });
// }
return (
<div className=" page course-catalog-page">
<div className="page-content">
......@@ -285,23 +285,16 @@ function CourseCatalogPage() {
columns={ parseColumn() }
pagination={false}
expandedRowRender={(record:RecordTypes) => {
if(!record.child){
if(!record.sonCategoryList){
return <div>还未添加任何子分类</div>;
}
if (record.child.length !== 0){
return <Table columns={parseColumn()} dataSource={record.child} pagination={false} className="child-table"/>
// return <div>{
// record.child.map((item:any,index:any)=>{
// return <span>{item.categoryName}</span>
// })
// }
// </div>
if (record.sonCategoryList.length !== 0){
return <Table columns={parseColumn()} dataSource={record.sonCategoryList} pagination={false} className="child-table"/>
}else{
return <div>还未添加任何子分类</div>;
}
}}
dataSource={courseCatalogList}
// onExpand={(expanded, record)=>expandSecondCatalog(expanded, record)}
/>
</div>
<div className="box-footer">
......
......@@ -2,7 +2,7 @@
* @Author: wufan
* @Date: 2020-11-27 16:21:49
* @LastEditors: zhangleyuan
* @LastEditTime: 2020-12-08 14:12:20
* @LastEditTime: 2020-12-08 15:17:37
* @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
......@@ -20,6 +20,7 @@ interface CatalogAddOrEditModalProps {
function CatalogAddOrEditModal(props: CatalogAddOrEditModalProps) {
const {onClose,modalType,refreshCatalogList,choosedItem} = props;
const [catalogName,setCatalogName] = useState(choosedItem.categoryName);
useEffect(() => {
});
......
......@@ -2,7 +2,7 @@
* @Author: wufan
* @Date: 2020-11-27 16:21:49
* @LastEditors: zhangleyuan
* @LastEditTime: 2020-12-08 14:11:44
* @LastEditTime: 2020-12-08 15:34:07
* @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
......@@ -26,6 +26,7 @@ interface SecondCatalogAddOrEditModalProps {
function SecondCatalogAddOrEditModal(props: SecondCatalogAddOrEditModalProps) {
const {onClose,modalType,parentId,refreshCatalogList,choosedItem} = props;
console.log('choosedItem',choosedItem);
const [secondCatalogName,setSecondCatalogName] = useState(choosedItem.categoryName);
const [selectParentId,setSelectParentId] = useState(parentId);
const [optionList,setOptionList] = useState([]);
......@@ -36,14 +37,32 @@ function SecondCatalogAddOrEditModal(props: SecondCatalogAddOrEditModalProps) {
});
useEffect(() => {
getOptionList();
console.log('')
},[query]);
function getOptionList():any {
let _query = _.clone(query);
_query.current = query.current + 1;
StoreService.getCourseCatalogList(_query).then((res: any) => {
setOptionList(res.result.records);
let resultData = handleCatalogListData(res.result.records)
setOptionList(resultData);
});
}
function handleCatalogListData(listData:any){
listData.map((item:any,index:any) => {
item.type = "parent"
item.key = item.id;
if(item.sonCategoryList){
item.sonCategoryList.map((_item:any,_index:any) =>{
_item.type = "child";
_item.key=_item.id
return _item
});
}
return item
})
return listData
}
function handleConfirm(){
if(modalType === "add"){
addSecondcatalog();
......@@ -119,7 +138,7 @@ function SecondCatalogAddOrEditModal(props: SecondCatalogAddOrEditModalProps) {
placeholder="请输入子分类名称,最多10个字"
maxLength={10}
style={{ width: 240 }}
value={secondCatalogName}
defaultValue={secondCatalogName}
onChange={(e) => {
setSecondCatalogName(e.target.value);
}}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment