|
@@ -1,83 +1,85 @@
|
|
|
-import { Pagination } from 'antd';
|
|
|
+import { Pagination, Tooltip } 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,page} = props;
|
|
|
- const [currPage,setCurrPage] = useState(1);
|
|
|
- const [currentItem,setCurrentItem] = useState([]);
|
|
|
+ const { dispatch, commonId, bugTreeList, bugSingleList, page } = props;
|
|
|
+ const [currPage, setCurrPage] = useState(1);
|
|
|
+ const [currentItem, setCurrentItem] = useState([]);
|
|
|
|
|
|
- const onPageChange = (num)=>{
|
|
|
+ const onPageChange = (num) => {
|
|
|
setCurrPage(num);
|
|
|
- }
|
|
|
+ };
|
|
|
|
|
|
- const handleSingleItemClick = (item)=>{
|
|
|
- const currItem = bugSingleList.TreeRoot.filter(i=>i[0]===item[0]);
|
|
|
+ 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(() => {
|
|
|
+ bugSingleList.TreeRoot && setCurrentItem(bugSingleList.TreeRoot[0]);
|
|
|
+ }, [bugSingleList]);
|
|
|
|
|
|
- useEffect(()=>{
|
|
|
- if(JSON.stringify(currentItem)!=='[]'){
|
|
|
+ useEffect(() => {
|
|
|
+ if (JSON.stringify(currentItem) !== '[]') {
|
|
|
//获取bug详情信息用于展示
|
|
|
dispatch({
|
|
|
type: 'editReport/getBugDetail',
|
|
|
- payload:{
|
|
|
- id:currentItem[0]
|
|
|
- }
|
|
|
+ payload: {
|
|
|
+ id: currentItem[0],
|
|
|
+ },
|
|
|
}).then(res => {
|
|
|
dispatch({
|
|
|
type: 'allBugs/saveBugItemDetail',
|
|
|
- payload:{
|
|
|
- ...res
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
+ payload: {
|
|
|
+ ...res,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ });
|
|
|
}
|
|
|
- },[currentItem])
|
|
|
+ }, [currentItem]);
|
|
|
|
|
|
- const getSingleBugList = ()=>{
|
|
|
+ const getSingleBugList = () => {
|
|
|
dispatch({
|
|
|
- type:'allBugs/getSingleList',
|
|
|
- payload:{
|
|
|
- case_take_id:`${commonId.caseId}-${commonId.examId}`,
|
|
|
- start:10*(currPage-1),
|
|
|
- count:"10",
|
|
|
+ type: 'allBugs/getSingleList',
|
|
|
+ payload: {
|
|
|
+ case_take_id: `${commonId.caseId}-${commonId.examId}`,
|
|
|
+ start: 10 * (currPage - 1),
|
|
|
+ count: '10',
|
|
|
page,
|
|
|
- condition:null,
|
|
|
- roleId:commonId.roleId
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
+ condition: null,
|
|
|
+ roleId: commonId.roleId,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ };
|
|
|
|
|
|
- useEffect(()=>{
|
|
|
+ useEffect(() => {
|
|
|
getSingleBugList();
|
|
|
- },[currPage,page])
|
|
|
+ }, [currPage, page]);
|
|
|
|
|
|
return (
|
|
|
<div>
|
|
|
<div className={styles.bugSingleList}>
|
|
|
{
|
|
|
- bugSingleList&&bugSingleList.TreeRoot&&bugSingleList.TreeRoot.map((item,index)=>{
|
|
|
+ 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)}}>
|
|
|
+ className={`${styles.bugListItem} ${currentItem[0] === item[0] ? styles.bugListItemActive : ''}`}
|
|
|
+ onClick={() => {
|
|
|
+ handleSingleItemClick(item);
|
|
|
+ }}>
|
|
|
<span className={styles.bugListItemNum}>
|
|
|
- Bug{index+1}:
|
|
|
+ Bug{index + 1}:
|
|
|
</span>
|
|
|
<div className={styles.bugListItemInfo}>
|
|
|
- <div className={styles.bugListItemTitle}>
|
|
|
- {item[2]}
|
|
|
- </div>
|
|
|
+ <Tooltip title={item[2]}>
|
|
|
+ {item[2] + item[2] + item[2]}
|
|
|
+ </Tooltip>
|
|
|
</div>
|
|
|
</div>
|
|
|
- )
|
|
|
+ );
|
|
|
})
|
|
|
}
|
|
|
</div>
|
|
@@ -88,7 +90,7 @@ const BugSingleList = (props) => {
|
|
|
);
|
|
|
};
|
|
|
|
|
|
-export default connect(({ allBugs , editReport}) => ({
|
|
|
+export default connect(({ allBugs, editReport }) => ({
|
|
|
data: allBugs.step,
|
|
|
bugSingleList: allBugs.bugSingleList,
|
|
|
reportCommonInfo: editReport.reportCommonInfo,
|