|
@@ -10,25 +10,34 @@ import {
|
|
|
EditOutlined,
|
|
|
EyeOutlined,
|
|
|
} from '@ant-design/icons';
|
|
|
-
|
|
|
+import * as echarts from 'echarts'
|
|
|
import { recurrent, severity, bug_categories } from './const';
|
|
|
+import { timeToString } from '../../utils';
|
|
|
|
|
|
const formItemLayout = {
|
|
|
labelCol: {
|
|
|
- span: 5,
|
|
|
+ span: 8,
|
|
|
},
|
|
|
wrapperCol: {
|
|
|
span: 19,
|
|
|
},
|
|
|
};
|
|
|
+const images = [
|
|
|
+ '../../assents/noArrived.png',
|
|
|
+ '../../assents/yellowFlag.png',
|
|
|
+ '../../assents/redFlag.png',
|
|
|
+ '../../assents/recPage.png',
|
|
|
+];
|
|
|
|
|
|
const Step2 = (props) => {
|
|
|
const [reportForm] = Form.useForm();
|
|
|
const [addCaseForm] = Form.useForm();
|
|
|
const [addBugForm] = Form.useForm();
|
|
|
- const { data, dispatch, reportCommonInfo, testCaseList, caseBugList, categories } = props;
|
|
|
|
|
|
- const [showTaskRecommendModal, setTaskRecommendModal] = useState(false);
|
|
|
+ const { data, dispatch, reportCommonInfo,
|
|
|
+ testCaseList, caseBugList, categories,pathInfo } = props;
|
|
|
+
|
|
|
+ const [showTaskRecommendModal, setTaskRecommendModal] = useState(true);
|
|
|
const [showAddTestCaseModal, setAddTestCaseModal] = useState(false);
|
|
|
const [showAddBugModal, setAddTestBugModal] = useState(false);
|
|
|
const currentTestCaseRef = useRef({});
|
|
@@ -37,10 +46,192 @@ const Step2 = (props) => {
|
|
|
const [page2List, setPage2List] = useState([]);
|
|
|
const [page3List, setPage3List] = useState([]);
|
|
|
|
|
|
+ const chartRef = useRef();
|
|
|
+
|
|
|
if (!data) {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ const handleEditReportInfo = ()=>{
|
|
|
+ console.log('sss')
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ const initEcharts = () => {
|
|
|
+ let item_color = 'rgba(226,245,240,1)';
|
|
|
+ let border_color = 'rgba(0,0,0,0.9)';
|
|
|
+ // let userPath = this.userPath;
|
|
|
+ let categories = [
|
|
|
+ {
|
|
|
+ 'name': '暂无Bug',
|
|
|
+ 'icon': images[0],
|
|
|
+ 'itemStyle': {'normal': {'color': item_color, 'borderColor': border_color}}
|
|
|
+ },
|
|
|
+ {
|
|
|
+ 'name': '已有Bug',
|
|
|
+ 'icon': images[1],
|
|
|
+ 'itemStyle': {'normal': {'color': item_color, 'borderColor': border_color}}
|
|
|
+ },
|
|
|
+ {
|
|
|
+ 'name': '我的Bug',
|
|
|
+ 'icon': images[2],
|
|
|
+ 'itemStyle': {'normal': {'color': item_color, 'borderColor': border_color}}
|
|
|
+ },
|
|
|
+ {
|
|
|
+ 'name': '推荐页面',
|
|
|
+ 'icon': images[3],
|
|
|
+ 'itemStyle': {'normal': {'color': item_color, 'borderColor': border_color}}
|
|
|
+ }
|
|
|
+ ];
|
|
|
+ let option2 = {
|
|
|
+ legend: { //配置legend,这里的data,要对应type为‘bar’的series数据项的‘name’名称,作为图例的说明
|
|
|
+ data: categories,
|
|
|
+ selecedMode: false, //图例禁止点击
|
|
|
+ top: '5%',
|
|
|
+ left: '3%',
|
|
|
+ itemWidth: 10,
|
|
|
+ itemHeight: 10,
|
|
|
+ orient: 'vertical',
|
|
|
+ },
|
|
|
+ tooltip: {
|
|
|
+ trigger: 'item',
|
|
|
+ triggerOn: 'mousemove',
|
|
|
+ formatter: function (params) {
|
|
|
+ if (params.data.category == 1) {
|
|
|
+ return params.name + '<br>' + '我发现/所有: 0/' + params.value;
|
|
|
+ } else {
|
|
|
+ return '还未有人在该页面发现Bug,努力寻找第一个Bug吧!';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ grid: {
|
|
|
+ z: 1, //grid作为柱状图的坐标系,其层级要和仪表图层级不同,同时隐藏
|
|
|
+ show: false,
|
|
|
+ left: '-30%',
|
|
|
+ right: '4%',
|
|
|
+ bottom: '3%',
|
|
|
+ containLabel: true,
|
|
|
+ splitLine: {
|
|
|
+ show: false //隐藏分割线
|
|
|
+ },
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ xAxis: [ //这里有很多的show,必须都设置成不显示
|
|
|
+ {
|
|
|
+ type: 'category',
|
|
|
+ data: [],
|
|
|
+ axisLine: {
|
|
|
+ show: false
|
|
|
+ },
|
|
|
+ splitLine: {
|
|
|
+ show: false
|
|
|
+ },
|
|
|
+ splitArea: {
|
|
|
+ interval: 'auto',
|
|
|
+ show: false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ],
|
|
|
+
|
|
|
+ yAxis: [ //这里有很多的show,必须都设置成不显示
|
|
|
+ {
|
|
|
+ type: 'value',
|
|
|
+ axisLine: {
|
|
|
+ show: false
|
|
|
+ },
|
|
|
+ splitLine: {
|
|
|
+ show: false
|
|
|
+ },
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ series: [
|
|
|
+ {
|
|
|
+ type: 'tree',
|
|
|
+ name: 'tree1',
|
|
|
+ data: [pathInfo],
|
|
|
+ //categories:categories,
|
|
|
+ top: '5%',
|
|
|
+ left: '9%',
|
|
|
+ bottom: '1%',
|
|
|
+ right: '15%',
|
|
|
+
|
|
|
+ symbolSize: 12,
|
|
|
+
|
|
|
+ label: {
|
|
|
+ normal: {
|
|
|
+ position: 'left',
|
|
|
+ verticalAlign: 'middle',
|
|
|
+ align: 'right',
|
|
|
+ fontSize: 9
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ leaves: {
|
|
|
+ label: {
|
|
|
+ normal: {
|
|
|
+ position: 'right',
|
|
|
+ verticalAlign: 'middle',
|
|
|
+ align: 'left'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ expandAndCollapse: true,
|
|
|
+ initialTreeDepth: 4,
|
|
|
+ animationDuration: 550,
|
|
|
+ animationDurationUpdate: 750
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: categories[0].name,
|
|
|
+ type: 'bar',
|
|
|
+ barWidth: '60%', //不显示,可以随便设置
|
|
|
+ data: [0],
|
|
|
+ itemStyle: {
|
|
|
+ normal: {
|
|
|
+ color: '#41C468', //这里的图例要注意,颜色设置和仪表盘的颜色对应起来
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: categories[1].name,
|
|
|
+ type: 'bar',
|
|
|
+ barWidth: '60%',
|
|
|
+ data: [0],
|
|
|
+ itemStyle: {
|
|
|
+ normal: {
|
|
|
+ color: '#70C1B3',
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: categories[2].name,
|
|
|
+ type: 'bar',
|
|
|
+ barWidth: '60%',
|
|
|
+ data: [0],
|
|
|
+ itemStyle: {
|
|
|
+ normal: {
|
|
|
+ color: '#00A1E9',
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: categories[3].name,
|
|
|
+ type: 'bar',
|
|
|
+ barWidth: '60%',
|
|
|
+ data: [0],
|
|
|
+ itemStyle: {
|
|
|
+ normal: {
|
|
|
+ color: '#00A1E9',
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ const chart = echarts.init(document.getElementById('myChart'));
|
|
|
+ chart.setOption(option2);
|
|
|
+ }
|
|
|
+
|
|
|
const handleAddOrEditTestCase = () => {
|
|
|
addCaseForm.validateFields().then((res) => {
|
|
|
let formData = new FormData();
|
|
@@ -137,6 +328,32 @@ const Step2 = (props) => {
|
|
|
setAddTestBugModal(true);
|
|
|
};
|
|
|
|
|
|
+ const handleClickRecommendBtn = () => {
|
|
|
+ dispatch({
|
|
|
+ type: 'editReport/getPathInfo',
|
|
|
+ payload: {
|
|
|
+ case_take_id: '1718-1718',
|
|
|
+ report_id: reportCommonInfo.id,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ dispatch({
|
|
|
+ type: 'editReport/getBugRecommendPath',
|
|
|
+ payload: {
|
|
|
+ case_take_id: '1718-1718',
|
|
|
+ report_id: reportCommonInfo.id,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ dispatch({
|
|
|
+ type: 'editReport/getBugRecommendList',
|
|
|
+ payload: {
|
|
|
+ case_take_id: '1718-1718',
|
|
|
+ report_id: reportCommonInfo.id,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ setTaskRecommendModal(true);
|
|
|
+ initEcharts();
|
|
|
+ }
|
|
|
+
|
|
|
const handleSelectPage1 = (val) =>{
|
|
|
let item = categories.find(x=>x.item === val);
|
|
|
setPage2List(item.children)
|
|
@@ -175,42 +392,51 @@ const Step2 = (props) => {
|
|
|
|
|
|
return (
|
|
|
<div>
|
|
|
- <Form
|
|
|
- {...formItemLayout}
|
|
|
- form={reportForm}
|
|
|
- layout="horizontal"
|
|
|
- className={styles.stepForm}
|
|
|
- hideRequiredMark
|
|
|
- initialValues={data}
|
|
|
- >
|
|
|
- <Row gutter={10}>
|
|
|
- <Col span={5}>
|
|
|
- <Form.Item label="创建日期" rules={[{ required: true, message: '请输入报告名称' }]}>
|
|
|
- {'2021.4.12'}
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- <Col span={5}>
|
|
|
- <Form.Item label="报告名称" rules={[{ required: true, message: '请输入报告名称' }]}>
|
|
|
- {reportCommonInfo.name}
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- <Col span={5}>
|
|
|
- <Form.Item label="设备名称" required>
|
|
|
- {reportCommonInfo.device_brand}
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- <Col span={5}>
|
|
|
- <Form.Item label="设备品牌" required>
|
|
|
- {reportCommonInfo.device_model}
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- <Col span={4}>
|
|
|
- <Form.Item label="操作系统" required>
|
|
|
- {reportCommonInfo.device_os}
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- </Row>
|
|
|
- </Form>
|
|
|
+ <Row gutter={10}>
|
|
|
+ <Col span={23}>
|
|
|
+ <Form
|
|
|
+ {...formItemLayout}
|
|
|
+ form={reportForm}
|
|
|
+ className={styles.stepForm}
|
|
|
+ hideRequiredMark
|
|
|
+ initialValues={data}
|
|
|
+ >
|
|
|
+ <Row gutter={10}>
|
|
|
+ <Col span={5}>
|
|
|
+ <Form.Item label="创建日期" rules={[{ required: true, message: '请输入报告名称' }]}>
|
|
|
+ {timeToString(reportCommonInfo.create_time_millis)}
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+ <Col span={5}>
|
|
|
+ <Form.Item label="报告名称" rules={[{ required: true, message: '请输入报告名称' }]}>
|
|
|
+ {reportCommonInfo.name}
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+ <Col span={5}>
|
|
|
+ <Form.Item label="设备名称" required>
|
|
|
+ {reportCommonInfo.device_brand}
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+ <Col span={5}>
|
|
|
+ <Form.Item label="设备品牌" required>
|
|
|
+ {reportCommonInfo.device_model}
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+ <Col span={4}>
|
|
|
+ <Form.Item label="操作系统" required>
|
|
|
+ {reportCommonInfo.device_os}
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+ </Form>
|
|
|
+ </Col>
|
|
|
+ <Col span={1}>
|
|
|
+ <EditOutlined className={styles.editReportInfoIcon}
|
|
|
+ onClick={() => handleEditReportInfo()}
|
|
|
+ />
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+
|
|
|
<Card>
|
|
|
<div className={styles.reportContainer}>
|
|
|
<Row gutter={10}>
|
|
@@ -260,16 +486,13 @@ const Step2 = (props) => {
|
|
|
</Button>
|
|
|
</Col>
|
|
|
<Col span={2}>
|
|
|
- <Button size="small" onClick={() => setTaskRecommendModal(true)}>
|
|
|
+ <Button size="small" onClick={() => handleClickRecommendBtn()}>
|
|
|
<ForkOutlined className={styles.addIcon} />
|
|
|
推荐
|
|
|
</Button>
|
|
|
</Col>
|
|
|
</Row>
|
|
|
<div className={styles.testBugList}>
|
|
|
- {/*{console.log(props)}*/}
|
|
|
- {/*{console.log(props.caseBugList)}*/}
|
|
|
- {/*{console.log(props.caseBugList.length)}*/}
|
|
|
{caseBugList && caseBugList.map((item) => {
|
|
|
return (
|
|
|
<div className={styles.testBugItem} key={item.detail.id}>
|
|
@@ -534,10 +757,16 @@ const Step2 = (props) => {
|
|
|
{/*</Form.Item>*/}
|
|
|
</Form>
|
|
|
</Modal>
|
|
|
+ {/*<Modal title="修改报告信息" visible={showTaskRecommendModal} onOk={() => setTaskRecommendModal(false)}*/}
|
|
|
+ {/* onCancel={() => setTaskRecommendModal(false)} className="addModal">*/}
|
|
|
+ {/* <div>*/}
|
|
|
+ {/* <div id="forceChart"></div>*/}
|
|
|
+ {/* </div>*/}
|
|
|
+ {/*</Modal>*/}
|
|
|
<Modal title="任务推荐" visible={showTaskRecommendModal} onOk={() => setTaskRecommendModal(false)}
|
|
|
onCancel={() => setTaskRecommendModal(false)} className="addModal">
|
|
|
<div>
|
|
|
- <div id="forceChart"></div>
|
|
|
+ <div id="myChart" ref={chartRef}></div>
|
|
|
</div>
|
|
|
</Modal>
|
|
|
</div>
|
|
@@ -551,4 +780,5 @@ export default connect(({ editReport, loading }) => ({
|
|
|
testCaseList: editReport.testCaseList,
|
|
|
caseBugList: editReport.caseBugList,
|
|
|
categories: editReport.categories,
|
|
|
+ pathInfo:editReport.pathInfo
|
|
|
}))(Step2);
|