浏览代码

FIX:菜单清空,树状图点击

wjj 4 年之前
父节点
当前提交
bb16175a03

+ 26 - 26
src/components/GlobalHeader/RightContent.jsx

@@ -22,31 +22,31 @@ const GlobalHeaderRight = (props) => {
     className = `${styles.right}  ${styles.dark}`;
   }
 
-  useEffect(()=>{
-    let token = window.location.search.split('token=') && window.location.search.split('token=')[1];
-    dispatch({
-      type: 'editReport/getIdByToken',
-      payload: {
-        token
-      }
-    }).then(res=>{
-      //{result: "fail", cause: "身份验证失败,请重新点击按钮进入答题页面"}
-      if(res.result === 'success'){
-        let idInfo = {
-          roleId:res.roleId,
-          caseId:res.caseId,
-          examId:res.examId,
-          userId:res.userId,
-          case_take_id:res.caseId + '-' + res.examId,
-        }
-        setIdInfo(idInfo);
-      }else{
-        //错误处理
-        message.error(res.cause);
-        console.log(res)
-      }
-    })
-  },[])
+  // useEffect(()=>{
+  //   let token = window.location.search.split('token=') && window.location.search.split('token=')[1];
+  //   dispatch({
+  //     type: 'editReport/getIdByToken',
+  //     payload: {
+  //       token
+  //     }
+  //   }).then(res=>{
+  //     //{result: "fail", cause: "身份验证失败,请重新点击按钮进入答题页面"}
+  //     if(res.result === 'success'){
+  //       let idInfo = {
+  //         roleId:res.roleId,
+  //         caseId:res.caseId,
+  //         examId:res.examId,
+  //         userId:res.userId,
+  //         case_take_id:res.caseId + '-' + res.examId,
+  //       }
+  //       setIdInfo(idInfo);
+  //     }else{
+  //       //错误处理
+  //       message.error(res.cause);
+  //       console.log(res)
+  //     }
+  //   })
+  // },[])
 
 
   useEffect(() => {
@@ -66,7 +66,7 @@ const GlobalHeaderRight = (props) => {
   return (
     <div className={className}>
       {/*<NoticeIconView />*/}
-      <h3>{taskName ? `${taskName} [${collaborative_type==='0' ? '智能推荐模式' : ''}]` : ''}</h3>
+      <h3>{taskName ? `${taskName} [${collaborative_type==='0' ? '智能推荐模式' : '独立探索模式'}]` : ''}</h3>
       {/*<h3>{taskName || ''}</h3>*/}
       {/*<SelectLang className={styles.action}/>*/}
     </div>

+ 27 - 5
src/pages/bugs/components/BugTreeGraph/index.jsx

@@ -9,7 +9,7 @@ import * as echarts from 'echarts';
 const imgArr = ['grade.png', 'noGrade.png'];
 
 const BugTreeGraph = (props) => {
-  const { dispatch, bugItemDetail, treeGraph } = props;
+  const { dispatch, bugItemDetail, treeGraph,bugTreeNode } = props;
 
   const [path,setPath] = useState([]);
   const [invalid,setInvalid] = useState([]);
@@ -155,8 +155,8 @@ const BugTreeGraph = (props) => {
       ],
     };
     const chart = echarts.init(document.getElementById('treeGraphChart'));
-    console.log(chart);
     chart.setOption(echartOption);
+    chart.on("click",onChartClick);
   };
 
   //包装数据
@@ -265,6 +265,27 @@ const BugTreeGraph = (props) => {
     return ret;
   }
 
+  //点击树状图
+  const onChartClick = (param)=>{
+    console.log('点击事件')
+    let id = param.data.id;
+    console.log(id)
+    dispatch({
+      type: 'editReport/getBugDetail',
+      payload: {
+        id:param.data.id
+      },
+    }).then(res => {
+      // 点击tree node,tree不刷新,只刷新detail modal
+      dispatch({
+        type: 'allBugs/saveBugItemDetail',
+        payload: {
+          ...res,
+        },
+      });
+    });
+  }
+
   useEffect(()=>{
     if(treeData.length){
       initItemRecursion(treeData);
@@ -273,11 +294,11 @@ const BugTreeGraph = (props) => {
   },[treeData])
 
   useEffect(()=>{
-    if(JSON.stringify(bugItemDetail)!=='{}'){
+    if(JSON.stringify(bugTreeNode)!=='{}'){
       dispatch({
         type:'allBugs/getTreeGraph',
         payload:{
-          id:bugItemDetail.detail.id
+          id:bugTreeNode.detail.id
         }
       }).then(res=>{
         if(res){
@@ -295,7 +316,7 @@ const BugTreeGraph = (props) => {
         // initEcharts();
       })
     }
-  },[bugItemDetail])
+  },[bugTreeNode])
 
   useEffect(()=>{
     if(path.length){
@@ -311,5 +332,6 @@ const BugTreeGraph = (props) => {
 
 export default connect(({ allBugs, editReport }) => ({
   treeGraph: allBugs.treeGraph,
+  bugTreeNode: allBugs.bugTreeNode,
   bugItemDetail: allBugs.bugItemDetail,
 }))(BugTreeGraph);

+ 8 - 0
src/pages/bugs/components/BugTreeList/index.jsx

@@ -32,6 +32,14 @@ const BugTreeList = (props) => {
           id: currentTreeItem[0],
         },
       }).then(res => {
+        console.log(res)
+        //这里是根据list 的 item获取的,需要刷新bug tree,还需要更新detail modal
+        dispatch({
+          type: 'allBugs/saveBugTreeNode',
+          payload: {
+            ...res,
+          },
+        });
         dispatch({
           type: 'allBugs/saveBugItemDetail',
           payload: {

+ 12 - 2
src/pages/bugs/index.jsx

@@ -1,5 +1,5 @@
 import React, { useState, useEffect, useRef } from 'react';
-import { Select, Radio, Card, Row, Col, Input } from 'antd';
+import { Select, Radio, Card, Row, Col, Input ,Button} from 'antd';
 import { PageContainer } from '@ant-design/pro-layout';
 import { connect } from 'umi';
 
@@ -20,7 +20,7 @@ const AllBugs = (props) => {
   const { dispatch, commonId, reportCommonInfo, reportReview, categories } = props;
   const [status, setStatus] = useState('tree');
   const [page2List, setPage2List] = useState([]);
-  const [page3List, setPage3List] = useState([]);
+  const [page3List, setPage3List] = useState([])
   const [page1, setPage1] = useState('');
   const [page2, setPage2] = useState('');
   const [page3, setPage3] = useState('');
@@ -62,6 +62,8 @@ const AllBugs = (props) => {
     if (page1) {
       const newPage = `${page1}${page2 ? '-' + page2 : ''}${page3 ? '-' + page3 : ''}`;
       setPage(newPage);
+    }else{
+
     }
   }, [page1, page2, page3]);
 
@@ -75,6 +77,13 @@ const AllBugs = (props) => {
     });
   };
 
+  const clearPageSelect = ()=>{
+    setPage1("");
+    setPage2("");
+    setPage3("");
+    setPage("null");
+  }
+
   useEffect(() => {
     if (!categories.length) {
       dispatch({
@@ -145,6 +154,7 @@ const AllBugs = (props) => {
                   return <Select.Option value={item.item} key={item.item}>{item.item}</Select.Option>;
                 })}
               </Select>
+              <Button type="primary" onClick={clearPageSelect}>清空选择</Button>
             </div>
           </Col>
 

+ 4 - 0
src/pages/bugs/model.js

@@ -11,6 +11,7 @@ const Model = {
     reportReview:{},
     bugTreeList:[],
     bugSingleList:[],
+    bugTreeNode:{},
     bugItemDetail:{},
     treeGraph:{}
   },
@@ -69,6 +70,9 @@ const Model = {
     saveBugItemDetail(state, { payload }) {
       return { ...state, bugItemDetail: payload };
     },
+    saveBugTreeNode(state, { payload }) {
+      return { ...state, bugTreeNode: payload };
+    },
     saveTreeGraph(state, { payload }) {
       return { ...state, treeGraph: payload };
     },

+ 3 - 4
src/pages/edit/components/Step2/index.jsx

@@ -469,7 +469,7 @@ const Step2 = (props) => {
                             className={`${styles.testCaseItemNo} ${styles.testCaseItemTitle}`}>{`编号.${((item.id).substring((item.id.length) - 6)).toUpperCase()}`}</span>}
                         </Col>
                           <Col span={15} className={styles.testCaseItemTitle}>
-                            <Tooltip title={item.name}>
+                            <Tooltip placement="topLeft" title={item.name}>
                               {item.name}
                             </Tooltip>
                           </Col>
@@ -515,7 +515,7 @@ const Step2 = (props) => {
                         <Col span={12}>
                           <div>
                             <div className={styles.testBugItemTitleBlock}>
-                              <Tooltip title={item.title}>
+                              <Tooltip placement="topLeft" title={item.title}>
                                 <span className={styles.testBugItemTitleDetail}>标题:{item.title}</span>
                               </Tooltip>
                             </div>
@@ -534,7 +534,7 @@ const Step2 = (props) => {
                               {item.bug_page}
                             </div>
                             <div className={styles.testBugItemTitleBlock}>
-                              <Tooltip title={item.description}>
+                              <Tooltip placement="topLeft" title={item.description}>
                                 <span className={styles.testBugItemDesc}>描述:{item.description}</span>
                               </Tooltip>
                             </div>
@@ -646,7 +646,6 @@ const Step2 = (props) => {
                <span className={styles.modalTitle} key="title">添加用例缺陷</span>,
                <Search
                  placeholder="输入Bug标识进行fork"
-                 allowClear
                  enterButton="fork"
                  onSearch={searchBugToFork}
                  className={styles.forkBtn}

+ 8 - 8
src/pages/edit/model.js

@@ -46,14 +46,14 @@ const Model = {
     recommendPath: [],
     bugRecommendList: [],
     commonId:{
-      // result:"success",
-      // roleId:1,
-      // caseId:"1718",
-      // examId:"1718",
-      // beginTime:"1621945823000",
-      // endTime:"1624291200000",
-      // userId:"99557",
-      // case_take_id:"1718_1718",
+      result:"success",
+      roleId:1,
+      caseId:"1718",
+      examId:"1718",
+      beginTime:"1621945823000",
+      endTime:"1624291200000",
+      userId:"99222",
+      case_take_id:"1718_1718",
     },
   },
   effects: {