|
@@ -0,0 +1,92 @@
|
|
|
+import { Pagination } from 'antd';
|
|
|
+import React, { useEffect, useState } from 'react';
|
|
|
+import { connect } from 'umi';
|
|
|
+import styles from './index.less';
|
|
|
+import { treeFilter } from 'enzyme/src/RSTTraversal';
|
|
|
+
|
|
|
+const BugSingleList = (props) => {
|
|
|
+ const {dispatch,commonId,bugTreeList,bugSingleList,type} = props;
|
|
|
+ const [start,setStart] = useState(0);
|
|
|
+ const [page,setPage] = useState('null');
|
|
|
+ const [currentItem,setCurrentItem] = useState([]);
|
|
|
+
|
|
|
+ const onPageChange = (num)=>{
|
|
|
+ console.log('page',num)
|
|
|
+ }
|
|
|
+
|
|
|
+ const handleSingleItemClick = (item)=>{
|
|
|
+ const currItem = bugSingleList.TreeRoot.filter(i=>i[0]===item[0]);
|
|
|
+ setCurrentItem(currItem[0]);
|
|
|
+ }
|
|
|
+
|
|
|
+ useEffect(()=>{
|
|
|
+ bugSingleList.TreeRoot && setCurrentItem(bugSingleList.TreeRoot[0])
|
|
|
+ },[bugSingleList])
|
|
|
+
|
|
|
+ useEffect(()=>{
|
|
|
+ if(JSON.stringify(currentItem)!=='[]'){
|
|
|
+ //获取bug详情信息用于展示
|
|
|
+ dispatch({
|
|
|
+ type: 'editReport/getBugDetail',
|
|
|
+ payload:{
|
|
|
+ id:currentItem[0]
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ dispatch({
|
|
|
+ type: 'allBugs/saveBugItemDetail',
|
|
|
+ payload:{
|
|
|
+ ...res
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },[currentItem])
|
|
|
+
|
|
|
+ useEffect(()=>{
|
|
|
+ dispatch({
|
|
|
+ type:'allBugs/getSingleList',
|
|
|
+ payload:{
|
|
|
+ case_take_id:`${commonId.caseId}-${commonId.examId}`,
|
|
|
+ start,
|
|
|
+ count:"10",
|
|
|
+ page
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },[])
|
|
|
+
|
|
|
+ return (
|
|
|
+ <div>
|
|
|
+ <div className={styles.bugSingleList}>
|
|
|
+ {
|
|
|
+ bugSingleList&&bugSingleList.TreeRoot&&bugSingleList.TreeRoot.map((item,index)=>{
|
|
|
+ return (
|
|
|
+ <div key={item[0]}
|
|
|
+ className={`${styles.bugListItem} ${currentItem[0] === item[0] ? styles.bugListItemActive : ''}`}
|
|
|
+ onClick={()=>{handleSingleItemClick(item)}}>
|
|
|
+ <span className={styles.bugListItemNum}>
|
|
|
+ Bug{index+1}:
|
|
|
+ </span>
|
|
|
+ <div className={styles.bugListItemInfo}>
|
|
|
+ <div className={styles.bugListItemTitle}>
|
|
|
+ {item[2]}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ })
|
|
|
+ }
|
|
|
+ </div>
|
|
|
+ <div className={styles.pagination}>
|
|
|
+ <Pagination showQuickJumpe defaultCurrent={2} total={bugSingleList.Count} onChange={onPageChange} />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+};
|
|
|
+
|
|
|
+export default connect(({ allBugs , editReport}) => ({
|
|
|
+ data: allBugs.step,
|
|
|
+ bugSingleList: allBugs.bugSingleList,
|
|
|
+ reportCommonInfo: editReport.reportCommonInfo,
|
|
|
+ commonId: editReport.commonId,
|
|
|
+}))(BugSingleList);
|