|
@@ -9,9 +9,11 @@ import {
|
|
|
UploadOutlined,
|
|
|
EditOutlined,
|
|
|
EyeOutlined,
|
|
|
+ ShareAltOutlined,
|
|
|
LeftOutlined,
|
|
|
RightOutlined,
|
|
|
} from '@ant-design/icons';
|
|
|
+const { Search } = Input;
|
|
|
import * as echarts from 'echarts';
|
|
|
import { recurrent, severity, bug_categories } from './const';
|
|
|
import { timeToString, getBase64 } from '../../utils';
|
|
@@ -34,7 +36,6 @@ const modalFormItemLayout = {
|
|
|
span: 19,
|
|
|
},
|
|
|
};
|
|
|
-
|
|
|
const uploadButton = (
|
|
|
<div>
|
|
|
<PlusOutlined />
|
|
@@ -43,7 +44,6 @@ const uploadButton = (
|
|
|
);
|
|
|
|
|
|
const Step2 = (props) => {
|
|
|
- console.log('step2')
|
|
|
const [reportForm] = Form.useForm();
|
|
|
const [addCaseForm] = Form.useForm();
|
|
|
const [addBugForm] = Form.useForm();
|
|
@@ -58,6 +58,7 @@ const Step2 = (props) => {
|
|
|
const [showAddBugModal, setAddTestBugModal] = useState(false);
|
|
|
const [showEditReportModal, setEditReportModal] = useState(false);
|
|
|
const currentTestCaseRef = useRef({});
|
|
|
+ const [currBugDetail,setCurrBugDetail] = useState({});
|
|
|
const [isAddCaseStatus, setIsAddCaseStatus] = useState(true);
|
|
|
// const [currActiveTestCase, setCurrActiveTestCase] = useState({});
|
|
|
|
|
@@ -268,6 +269,40 @@ const Step2 = (props) => {
|
|
|
setBugList(newList);
|
|
|
};
|
|
|
|
|
|
+ const searchBugToFork = value=>{
|
|
|
+ dispatch({
|
|
|
+ type: 'editReport/getBugDetail',
|
|
|
+ payload: { id: value},
|
|
|
+ }).then(res=>{
|
|
|
+ setCurrBugDetail(res.detail)
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ const handleInitThreePages = ()=>{
|
|
|
+ let detail = { ...currBugDetail };
|
|
|
+ detail['recurrent'] = recurrent[currBugDetail.recurrent];
|
|
|
+ detail['severity'] = severity[currBugDetail.severity];
|
|
|
+ if(JSON.stringify(detail)!=='{}') {
|
|
|
+ let pages = detail.bug_page.split("-");
|
|
|
+ detail.page1 = pages[0];
|
|
|
+ detail.page2 = pages[1];
|
|
|
+ detail.page3 = pages[2];
|
|
|
+ if (page2List && page2List.length) {
|
|
|
+ handleSelectPage2(pages[1]);
|
|
|
+ console.log(detail)
|
|
|
+ addBugForm.setFieldsValue(detail)
|
|
|
+ console.log(addBugForm.getFieldsValue())
|
|
|
+ }else{
|
|
|
+ handleSelectPage1(pages[0]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ useEffect(()=>{
|
|
|
+ handleInitThreePages();
|
|
|
+ },[currBugDetail,page2List])
|
|
|
+
|
|
|
+
|
|
|
useEffect(() => {
|
|
|
//能到第二步,说明是有报告信息的
|
|
|
//有报告,获取对应信息。没有就直接转去了第一步
|
|
@@ -415,7 +450,7 @@ const Step2 = (props) => {
|
|
|
className={styles.recommendBtn}
|
|
|
disabled={JSON.stringify(currentTestCaseRef.current) === '{}'}
|
|
|
onClick={() => handleClickRecommendBtn()}>
|
|
|
- <ForkOutlined className={styles.addIcon} />
|
|
|
+ <ShareAltOutlined className={styles.addIcon}/>
|
|
|
推荐
|
|
|
</Button>
|
|
|
</div>
|
|
@@ -545,8 +580,18 @@ const Step2 = (props) => {
|
|
|
</Form>
|
|
|
</Modal>
|
|
|
|
|
|
- <Modal title="添加用例缺陷" visible={showAddBugModal} width={720}
|
|
|
+ <Modal visible={showAddBugModal} width={720}
|
|
|
forceRender={true}
|
|
|
+ title={[
|
|
|
+ <span className={styles.modalTitle}>添加用例缺陷</span>,
|
|
|
+ <Search
|
|
|
+ placeholder="输入Bug标识进行fork"
|
|
|
+ allowClear
|
|
|
+ enterButton="fork"
|
|
|
+ onSearch={searchBugToFork}
|
|
|
+ className={styles.forkBtn}
|
|
|
+ />
|
|
|
+ ]}
|
|
|
footer={[
|
|
|
<Button key='submit' type="primary" htmlType="submit" onClick={handleAddBug}>确定</Button>,
|
|
|
<Button key='cancel' htmlType="button" style={{ marginLeft: '10px' }}
|
|
@@ -559,6 +604,7 @@ const Step2 = (props) => {
|
|
|
className={styles.bugForm}
|
|
|
>
|
|
|
<ExclamationCircleFilled className={styles.addModalInfo} />为了评分准确,请勿提交重复Bug
|
|
|
+ {currBugDetail&&currBugDetail.id}
|
|
|
<Form
|
|
|
form={addBugForm}
|
|
|
{...modalFormItemLayout}
|
|
@@ -591,13 +637,7 @@ const Step2 = (props) => {
|
|
|
</Form.Item>
|
|
|
<Form.Item
|
|
|
label="三级页面"
|
|
|
- name="page3"
|
|
|
- rules={[
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: '',
|
|
|
- },
|
|
|
- ]}
|
|
|
+ required={true}
|
|
|
>
|
|
|
<Row gutter={5} className={styles.pageSelect}>
|
|
|
<Col span={8}>
|
|
@@ -630,7 +670,8 @@ const Step2 = (props) => {
|
|
|
},
|
|
|
]}
|
|
|
>
|
|
|
- <Select disabled={!page2List.length}
|
|
|
+ <Select
|
|
|
+ disabled={!page2List.length&& !addBugForm.getFieldValue('page2')}
|
|
|
onSelect={(val) => {
|
|
|
handleSelectPage2(val);
|
|
|
}}>
|
|
@@ -649,8 +690,8 @@ const Step2 = (props) => {
|
|
|
message: '请输入三级页面',
|
|
|
},
|
|
|
]}
|
|
|
- >
|
|
|
- <Select disabled={!page3List.length}>
|
|
|
+ >
|
|
|
+ <Select disabled={!page3List.length&& !addBugForm.getFieldValue('page3')}>
|
|
|
{page3List.map((item) => {
|
|
|
return <Select.Option value={item.item} key={item.item}>{item.item}</Select.Option>;
|
|
|
})}
|