|
@@ -10,7 +10,7 @@ import { recurrent, severity, bug_categories } from '../Step2/const';
|
|
import * as echarts from 'echarts';
|
|
import * as echarts from 'echarts';
|
|
|
|
|
|
//这里只能放在 pages/edit/assets中作为路径显示
|
|
//这里只能放在 pages/edit/assets中作为路径显示
|
|
-const imgArr = ['noArrived.png', 'yellowFlag.png', 'redFlag.png', 'recPage.png']
|
|
|
|
|
|
+const imgArr = ['noArrived.png', 'yellowFlag.png', 'redFlag.png', 'recPage.png'];
|
|
|
|
|
|
const BugGuideTree = (props) => {
|
|
const BugGuideTree = (props) => {
|
|
const { dispatch, pathInfo, recommendPath, bugRecommendList, categories } = props;
|
|
const { dispatch, pathInfo, recommendPath, bugRecommendList, categories } = props;
|
|
@@ -18,7 +18,7 @@ const BugGuideTree = (props) => {
|
|
const userPath = pathInfo.self; //我的bug
|
|
const userPath = pathInfo.self; //我的bug
|
|
const { page, info } = recommendPath;
|
|
const { page, info } = recommendPath;
|
|
|
|
|
|
- let jsonPath={};
|
|
|
|
|
|
+ let jsonPath = {};
|
|
let timer = null;
|
|
let timer = null;
|
|
|
|
|
|
const [showTable, setShowTable] = useState(true);
|
|
const [showTable, setShowTable] = useState(true);
|
|
@@ -61,6 +61,7 @@ const BugGuideTree = (props) => {
|
|
},
|
|
},
|
|
},
|
|
},
|
|
];
|
|
];
|
|
|
|
+
|
|
const handleClickTableRow = (item) => {
|
|
const handleClickTableRow = (item) => {
|
|
dispatch({
|
|
dispatch({
|
|
type: 'editReport/getBugDetail',
|
|
type: 'editReport/getBugDetail',
|
|
@@ -90,36 +91,46 @@ const BugGuideTree = (props) => {
|
|
};
|
|
};
|
|
|
|
|
|
const getHeight = (items) => {
|
|
const getHeight = (items) => {
|
|
- items.forEach(item => {
|
|
|
|
- if (item.children) {
|
|
|
|
- getHeight(item.children);
|
|
|
|
- } else {
|
|
|
|
- setTreeHeightNum(treeHeightNum + 25);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+ if (items !== undefined) {
|
|
|
|
+ items.forEach(item => {
|
|
|
|
+ if (item.children) {
|
|
|
|
+ getHeight(item.children);
|
|
|
|
+ } else {
|
|
|
|
+ setTreeHeightNum(treeHeightNum + 25);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
};
|
|
};
|
|
|
|
|
|
- const setRecPage = (page)=> {
|
|
|
|
- let flag = 0;
|
|
|
|
- let style;
|
|
|
|
- timer = setInterval(() => {
|
|
|
|
- if (flag === 1) {
|
|
|
|
- style = 'image://' + require('../../assets/' + imgArr[0]);
|
|
|
|
- flag = 0;
|
|
|
|
- } else {
|
|
|
|
- style = 'image://' + require('../../assets/' + imgArr[3]);
|
|
|
|
- flag = 1;
|
|
|
|
|
|
+ const setRecPageFirst = () => {
|
|
|
|
+ timer = setTimeout(() => {
|
|
|
|
+ const dom = document.getElementById('myChart');
|
|
|
|
+ if(dom){
|
|
|
|
+ const myChart = echarts.init(dom);
|
|
|
|
+ let flag = 0;
|
|
|
|
+ let style;
|
|
|
|
+ if (flag === 1) {
|
|
|
|
+ style = 'image://' + require('../../assets/' + imgArr[0]);
|
|
|
|
+ flag = 0;
|
|
|
|
+ } else {
|
|
|
|
+ style = 'image://' + require('../../assets/' + imgArr[3]);
|
|
|
|
+ flag = 1;
|
|
|
|
+ }
|
|
|
|
+ initItemRecursionRecPage(jsonPath.children, page, style);
|
|
|
|
+ myChart.setOption({ series: [{ data: [jsonPath] }] });
|
|
}
|
|
}
|
|
- initItemRecursionRecPage(jsonPath.children, page, style);
|
|
|
|
- const myChart = echarts.init(document.getElementById('myChart'));
|
|
|
|
- // console.log(document.getElementById('myChart'))
|
|
|
|
- myChart.setOption({series: [{data: [jsonPath]}]});
|
|
|
|
- }, 2000);
|
|
|
|
- }
|
|
|
|
|
|
+ }, 500);
|
|
|
|
+ };
|
|
|
|
|
|
|
|
+ const setRecPage = (page) => {
|
|
|
|
|
|
|
|
+ timer = setTimeout(() => {
|
|
|
|
|
|
- const initItemRecursion = (items)=> {
|
|
|
|
|
|
+ }, 2000);
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ const initItemRecursion = (items) => {
|
|
if (items !== undefined) {
|
|
if (items !== undefined) {
|
|
items.forEach(item => {
|
|
items.forEach(item => {
|
|
item['value'] = 0;
|
|
item['value'] = 0;
|
|
@@ -148,12 +159,13 @@ const BugGuideTree = (props) => {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ initEcharts(info);
|
|
|
|
+ };
|
|
|
|
|
|
- const initItemRecursionRecPage = (items, page, style)=> {
|
|
|
|
|
|
+ const initItemRecursionRecPage = (items, page, style) => {
|
|
if (items !== undefined) {
|
|
if (items !== undefined) {
|
|
items.forEach(item => {
|
|
items.forEach(item => {
|
|
- for (let j = 0; j < (page&&page.length) || 0; j++) {
|
|
|
|
|
|
+ for (let j = 0; j < (page && page.length) || 0; j++) {
|
|
if (item.name === page[j]) {
|
|
if (item.name === page[j]) {
|
|
item['symbol'] = style;
|
|
item['symbol'] = style;
|
|
}
|
|
}
|
|
@@ -163,9 +175,9 @@ const BugGuideTree = (props) => {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ };
|
|
|
|
|
|
- const initEcharts = ()=>{
|
|
|
|
|
|
+ const initEcharts = () => {
|
|
let item_color = 'rgba(226,245,240,1)';
|
|
let item_color = 'rgba(226,245,240,1)';
|
|
let border_color = 'rgba(0,0,0,0.9)';
|
|
let border_color = 'rgba(0,0,0,0.9)';
|
|
let legendCategories = [
|
|
let legendCategories = [
|
|
@@ -338,18 +350,18 @@ const BugGuideTree = (props) => {
|
|
},
|
|
},
|
|
],
|
|
],
|
|
};
|
|
};
|
|
|
|
+
|
|
const chart = echarts.init(document.getElementById('myChart'));
|
|
const chart = echarts.init(document.getElementById('myChart'));
|
|
chart.setOption(option2);
|
|
chart.setOption(option2);
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ setRecPageFirst();
|
|
|
|
+ };
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
initChartData();
|
|
initChartData();
|
|
initItemRecursion(jsonPath.children);
|
|
initItemRecursion(jsonPath.children);
|
|
- initEcharts(info);
|
|
|
|
- setRecPage(page);
|
|
|
|
}, [pathInfo.all,pathInfo.self,jsonPath.children,info,page]);
|
|
}, [pathInfo.all,pathInfo.self,jsonPath.children,info,page]);
|
|
|
|
|
|
|
|
+
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
if (JSON.stringify(currDetail) !== '{}') {
|
|
if (JSON.stringify(currDetail) !== '{}') {
|
|
setShowTable(false);
|
|
setShowTable(false);
|