|
@@ -11,6 +11,8 @@ import {
|
|
EyeOutlined,
|
|
EyeOutlined,
|
|
} from '@ant-design/icons';
|
|
} from '@ant-design/icons';
|
|
|
|
|
|
|
|
+import {recurrent,severity} from './const'
|
|
|
|
+
|
|
const formItemLayout = {
|
|
const formItemLayout = {
|
|
labelCol: {
|
|
labelCol: {
|
|
span: 5,
|
|
span: 5,
|
|
@@ -23,14 +25,17 @@ const formItemLayout = {
|
|
const Step2 = (props) => {
|
|
const Step2 = (props) => {
|
|
const [form] = Form.useForm();
|
|
const [form] = Form.useForm();
|
|
const [addCaseForm] = Form.useForm();
|
|
const [addCaseForm] = Form.useForm();
|
|
- const { data, dispatch, submitting, reportCommonInfo, testCaseList } = props;
|
|
|
|
|
|
+ const { data, dispatch, reportCommonInfo, testCaseList ,caseBugList} = props;
|
|
// console.log(reportCommonInfo,props)
|
|
// console.log(reportCommonInfo,props)
|
|
const [showTaskRecommendModal, setTaskRecommendModal] = useState(false);
|
|
const [showTaskRecommendModal, setTaskRecommendModal] = useState(false);
|
|
const [showAddTestCaseModal, setAddTestCaseModal] = useState(false);
|
|
const [showAddTestCaseModal, setAddTestCaseModal] = useState(false);
|
|
const [showAddBugModal, setAddTestBugModal] = useState(false);
|
|
const [showAddBugModal, setAddTestBugModal] = useState(false);
|
|
- const [currTestCase , setCurrTestCase] = useState({});
|
|
|
|
|
|
+
|
|
const currentTestCaseRef = useRef({});
|
|
const currentTestCaseRef = useRef({});
|
|
- const [currTestBug , setCurrTestBug ] = useState({});
|
|
|
|
|
|
+
|
|
|
|
+ const [isAddCaseStatus , setIsAddCaseStatus ] = useState(true);
|
|
|
|
+ const [currActiveTestCase , setCurrActiveTestCase ] = useState({});
|
|
|
|
+
|
|
|
|
|
|
if (!data) {
|
|
if (!data) {
|
|
return null;
|
|
return null;
|
|
@@ -38,7 +43,8 @@ const Step2 = (props) => {
|
|
|
|
|
|
const { validateFields, getFieldsValue } = addCaseForm;
|
|
const { validateFields, getFieldsValue } = addCaseForm;
|
|
|
|
|
|
- const handleAddTestCase = () => {
|
|
|
|
|
|
+ const handleAddOrEditTestCase = () => {
|
|
|
|
+
|
|
addCaseForm.validateFields().then((res) => {
|
|
addCaseForm.validateFields().then((res) => {
|
|
let formData = new FormData();
|
|
let formData = new FormData();
|
|
// formData.append("id", values.reportName);
|
|
// formData.append("id", values.reportName);
|
|
@@ -47,22 +53,49 @@ const Step2 = (props) => {
|
|
formData.append('front', res.front);
|
|
formData.append('front', res.front);
|
|
formData.append('behind', res.behind);
|
|
formData.append('behind', res.behind);
|
|
formData.append('description', res.description);
|
|
formData.append('description', res.description);
|
|
- formData.append('if_execute', undefined);
|
|
|
|
- formData.append('if_bug', undefined);
|
|
|
|
- dispatch({
|
|
|
|
- type: 'editReport/createTestCase',
|
|
|
|
- payload: formData,
|
|
|
|
- });
|
|
|
|
- message.success('添加成功!');
|
|
|
|
- dispatch({
|
|
|
|
- type: 'editReport/getTestCaseList',
|
|
|
|
- payload: reportCommonInfo.id,
|
|
|
|
- });
|
|
|
|
|
|
+ if(!isAddCaseStatus){
|
|
|
|
+ //处理编辑用例
|
|
|
|
+ formData.append('id',currentTestCaseRef.current.id);
|
|
|
|
+ dispatch({
|
|
|
|
+ type: 'editReport/updateTestCase',
|
|
|
|
+ payload: {
|
|
|
|
+ formData,
|
|
|
|
+ report_id:reportCommonInfo.id
|
|
|
|
+ },
|
|
|
|
+ }).then((res)=>{
|
|
|
|
+ if(res&&res.status === 200){
|
|
|
|
+ message.success('修改成功!');
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }else{
|
|
|
|
+ //处理添加用例
|
|
|
|
+ dispatch({
|
|
|
|
+ type: 'editReport/createTestCase',
|
|
|
|
+ payload: {
|
|
|
|
+ formData,
|
|
|
|
+ report_id:reportCommonInfo.id
|
|
|
|
+ },
|
|
|
|
+ }).then((res)=>{
|
|
|
|
+ if(res&&res.id){
|
|
|
|
+ message.success('添加成功!');
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
setAddTestCaseModal(false);
|
|
setAddTestCaseModal(false);
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ const handleClickTestCase = (caseItem)=>{
|
|
|
|
+ setCurrActiveTestCase(caseItem)
|
|
|
|
+ dispatch({
|
|
|
|
+ type: 'editReport/getCaseBugList',
|
|
|
|
+ payload: caseItem.id,
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
const handleEditTestCase = (item) => {
|
|
const handleEditTestCase = (item) => {
|
|
|
|
+ setIsAddCaseStatus(false);
|
|
currentTestCaseRef.current = item;
|
|
currentTestCaseRef.current = item;
|
|
addCaseForm.setFieldsValue(currentTestCaseRef.current)
|
|
addCaseForm.setFieldsValue(currentTestCaseRef.current)
|
|
setAddTestCaseModal(true);
|
|
setAddTestCaseModal(true);
|
|
@@ -74,39 +107,13 @@ const Step2 = (props) => {
|
|
setAddTestCaseModal(true);
|
|
setAddTestCaseModal(true);
|
|
}
|
|
}
|
|
|
|
|
|
- const onPrev = () => {
|
|
|
|
- if (dispatch) {
|
|
|
|
- const values = getFieldsValue();
|
|
|
|
- dispatch({
|
|
|
|
- type: 'editReport/saveStepFormData',
|
|
|
|
- payload: { ...data, ...values },
|
|
|
|
- });
|
|
|
|
- dispatch({
|
|
|
|
- type: 'editReport/saveCurrentStep',
|
|
|
|
- payload: 'info',
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- const onValidateForm = async () => {
|
|
|
|
- const values = await validateFields();
|
|
|
|
-
|
|
|
|
- if (dispatch) {
|
|
|
|
- dispatch({
|
|
|
|
- type: 'formAndstepForm/submitStepForm',
|
|
|
|
- payload: { ...data, ...values },
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
dispatch({
|
|
dispatch({
|
|
type: 'editReport/getTestCaseList',
|
|
type: 'editReport/getTestCaseList',
|
|
- payload: reportCommonInfo.id,
|
|
|
|
|
|
+ payload: {report_id:reportCommonInfo.id},
|
|
});
|
|
});
|
|
- }, [dispatch]);
|
|
|
|
-
|
|
|
|
- const { payAccount, receiverAccount, receiverName, amount } = data;
|
|
|
|
|
|
+ }, [dispatch,reportCommonInfo]);
|
|
|
|
|
|
return (
|
|
return (
|
|
<div>
|
|
<div>
|
|
@@ -164,7 +171,11 @@ const Step2 = (props) => {
|
|
|
|
|
|
<div className={styles.testCaseList}>
|
|
<div className={styles.testCaseList}>
|
|
{testCaseList.length && testCaseList.map((item) => {
|
|
{testCaseList.length && testCaseList.map((item) => {
|
|
- return (<div className={styles.testCaseItem} key={item.id}>
|
|
|
|
|
|
+ return (
|
|
|
|
+ <div className={`${styles.testCaseItem} ${currActiveTestCase.id===item.id ? styles.activeCase :""}`}
|
|
|
|
+ key={item.id}
|
|
|
|
+ onClick={()=>{
|
|
|
|
+ handleClickTestCase(item)}}>
|
|
<Row gutter={10}>
|
|
<Row gutter={10}>
|
|
<Col span={21}><p>{item.name}</p></Col>
|
|
<Col span={21}><p>{item.name}</p></Col>
|
|
<Col span={3}>
|
|
<Col span={3}>
|
|
@@ -194,41 +205,35 @@ const Step2 = (props) => {
|
|
</Col>
|
|
</Col>
|
|
</Row>
|
|
</Row>
|
|
<div className={styles.testBugList}>
|
|
<div className={styles.testBugList}>
|
|
- <div className={styles.testBugItem}>
|
|
|
|
- <Row gutter={10}>
|
|
|
|
- <Col span={20}>
|
|
|
|
- <Form
|
|
|
|
- {...formItemLayout}
|
|
|
|
- form={form}
|
|
|
|
- layout="horizontal"
|
|
|
|
- className={styles.stepForm}
|
|
|
|
- hideRequiredMark
|
|
|
|
- initialValues={data}
|
|
|
|
- >
|
|
|
|
- <Form.Item label="Bug题目">{'不支持修改邮箱类型'}</Form.Item>
|
|
|
|
- <Form.Item label="复现程度">{'必现'}</Form.Item>
|
|
|
|
- <Form.Item label="严重程度">{'一般'}</Form.Item>
|
|
|
|
- <Form.Item label="缺陷分类">{'用户体验'}</Form.Item>
|
|
|
|
- </Form>
|
|
|
|
- </Col>
|
|
|
|
- <Col span={4}>
|
|
|
|
- <Button size='small' style={{ marginTop: 10 }}>
|
|
|
|
- <EyeOutlined />详情</Button>
|
|
|
|
- </Col>
|
|
|
|
- </Row>
|
|
|
|
- </div>
|
|
|
|
|
|
+ {caseBugList.map((item)=>{
|
|
|
|
+ return (<div className={styles.testBugItem} key={item.id}>
|
|
|
|
+ <Row gutter={10}>
|
|
|
|
+ <Col span={20}>
|
|
|
|
+ <div><span className={styles.bugItemTitle}>Bug标题:</span>{item.detail.title}</div>
|
|
|
|
+ <div><span className={styles.bugItemTitle}>复现程度:</span>{recurrent.get(item.detail.recurrent)}</div>
|
|
|
|
+ <div><span className={styles.bugItemTitle}>严重程度:</span>{item.detail.severity}</div>
|
|
|
|
+ <div><span className={styles.bugItemTitle}>缺陷分类:</span>{severity.get(item.detail.bug_category)}</div>
|
|
|
|
+ </Col>
|
|
|
|
+ <Col span={4}>
|
|
|
|
+ <Button size='small' style={{ marginTop: 10 }}>
|
|
|
|
+ <EyeOutlined />详情</Button>
|
|
|
|
+ </Col>
|
|
|
|
+ </Row>
|
|
|
|
+ </div>)
|
|
|
|
+ })}
|
|
|
|
+
|
|
</div>
|
|
</div>
|
|
</Col>
|
|
</Col>
|
|
|
|
|
|
</Row>
|
|
</Row>
|
|
</div>
|
|
</div>
|
|
</Card>
|
|
</Card>
|
|
- <Modal title="添加测试用例" width={720}
|
|
|
|
|
|
+ <Modal title={isAddCaseStatus ? '添加测试用例' : '编辑测试用例'} width={720}
|
|
visible={showAddTestCaseModal}
|
|
visible={showAddTestCaseModal}
|
|
forceRender={true}
|
|
forceRender={true}
|
|
className="addModal"
|
|
className="addModal"
|
|
footer={[
|
|
footer={[
|
|
- <Button key='submit' type="primary" htmlType="submit" onClick={handleAddTestCase}>添加</Button>,
|
|
|
|
|
|
+ <Button key='submit' type="primary" htmlType="submit" onClick={handleAddOrEditTestCase}>确定</Button>,
|
|
<Button key='cancel' htmlType="button" style={{ marginLeft: '10px' }}
|
|
<Button key='cancel' htmlType="button" style={{ marginLeft: '10px' }}
|
|
onClick={() => {
|
|
onClick={() => {
|
|
setAddTestCaseModal(false);
|
|
setAddTestCaseModal(false);
|
|
@@ -424,4 +429,5 @@ export default connect(({ editReport, loading }) => ({
|
|
data: editReport.step,
|
|
data: editReport.step,
|
|
reportCommonInfo: editReport.reportCommonInfo,
|
|
reportCommonInfo: editReport.reportCommonInfo,
|
|
testCaseList: editReport.testCaseList,
|
|
testCaseList: editReport.testCaseList,
|
|
|
|
+ caseBugList: editReport.caseBugList,
|
|
}))(Step2);
|
|
}))(Step2);
|