|
@@ -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);
|