|
@@ -0,0 +1,384 @@
|
|
|
+import React, { useState } from 'react';
|
|
|
+import { Form, Row, Col, Card, Modal, Input, Select, Upload, Button } from 'antd';
|
|
|
+import { connect } from 'umi';
|
|
|
+import styles from './index.less';
|
|
|
+import {
|
|
|
+ ForkOutlined,
|
|
|
+ PlusOutlined,
|
|
|
+ ExclamationCircleFilled,
|
|
|
+ UploadOutlined,
|
|
|
+ EditOutlined,
|
|
|
+} from '@ant-design/icons';
|
|
|
+
|
|
|
+const formItemLayout = {
|
|
|
+ labelCol: {
|
|
|
+ span: 5,
|
|
|
+ },
|
|
|
+ wrapperCol: {
|
|
|
+ span: 19,
|
|
|
+ },
|
|
|
+};
|
|
|
+
|
|
|
+const Step2 = (props) => {
|
|
|
+ const [form] = Form.useForm();
|
|
|
+ const { data, dispatch, submitting } = props;
|
|
|
+ const [showTaskRecommendModal, setTaskRecommendModal] = useState(false);
|
|
|
+ const [showAddTestCaseModal, setAddTestCaseModal] = useState(false);
|
|
|
+ const [showAddBugModal, setAddTestBugModal] = useState(false);
|
|
|
+
|
|
|
+ if (!data) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ const { validateFields, getFieldsValue } = form;
|
|
|
+
|
|
|
+ const handleOk = (type) => {
|
|
|
+ setAddTestCaseModal(false);
|
|
|
+ // type === 'case' ? setAddTestCaseModal(false) : setAddTestBugModal(false) ;
|
|
|
+ };
|
|
|
+
|
|
|
+ const handleCancel = (type) => {
|
|
|
+ // type === 'case' ? setAddTestCaseModal(false) : setAddTestBugModal(false) ;
|
|
|
+ };
|
|
|
+
|
|
|
+ const testApi = ()=>{
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ 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 },
|
|
|
+ });
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ const { payAccount, receiverAccount, receiverName, amount } = data;
|
|
|
+
|
|
|
+ return (
|
|
|
+ <div>
|
|
|
+ <Form
|
|
|
+ {...formItemLayout}
|
|
|
+ form={form}
|
|
|
+ layout="horizontal"
|
|
|
+ className={styles.stepForm}
|
|
|
+ hideRequiredMark
|
|
|
+ initialValues={data}
|
|
|
+ >
|
|
|
+ <Row gutter={10}>
|
|
|
+ <Col span={8}>
|
|
|
+ <Form.Item label="创建日期" rules={[{ required: true, message: '请输入报告名称' }]}>
|
|
|
+ {'2021.4.12'}
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+ <Col span={8}>
|
|
|
+ <Form.Item label="报告名称" rules={[{ required: true, message: '请输入报告名称' }]}>
|
|
|
+ {'测试报告名称'}
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+ <Row>
|
|
|
+ <Col span={8}>
|
|
|
+ <Form.Item label="设备名称" required>
|
|
|
+ {'PC'}
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+ <Col span={8}>
|
|
|
+ <Form.Item label="设备品牌" required>
|
|
|
+ {'DELL'}
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+ <Col span={8}>
|
|
|
+ <Form.Item label="操作系统" required>
|
|
|
+ {'Windows'}
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+ </Form>
|
|
|
+ <Card>
|
|
|
+ <div className={styles.reportContainer}>
|
|
|
+ <Row gutter={10}>
|
|
|
+ <Col span={8}>
|
|
|
+ <div>
|
|
|
+ <Row gutter={10} style={{ marginBottom: 10 }}>
|
|
|
+ <Col span={20}><h3>测试用例列表</h3></Col>
|
|
|
+ <Col span={4}>
|
|
|
+ <Button size="small" onClick={() => setAddTestCaseModal(true)} >
|
|
|
+ <PlusOutlined className={styles.addIcon}/>
|
|
|
+ 用例
|
|
|
+ </Button>
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div className={styles.testCaseList}>
|
|
|
+ <div className={styles.testCaseItem}>
|
|
|
+ <Row gutter={10}>
|
|
|
+ <Col span={21}><p>case1 case1</p></Col>
|
|
|
+ <Col span={3}>
|
|
|
+ <EditOutlined className={styles.testCaseEditIcon} />
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+ </div>
|
|
|
+ <div className={styles.testCaseItem}>
|
|
|
+ <Row gutter={10}>
|
|
|
+ <Col span={21}><p>case2 case2</p></Col>
|
|
|
+ <Col span={3}><EditOutlined /></Col>
|
|
|
+ </Row>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </Col>
|
|
|
+
|
|
|
+ <Col span={16} style={{ paddingLeft: 20 }}>
|
|
|
+ <Row gutter={10} style={{ marginBottom: 10 }}>
|
|
|
+ <Col span={20}><h3>缺陷列表</h3></Col>
|
|
|
+ <Col span={2}>
|
|
|
+ <Button size="small" onClick={() => setAddTestBugModal(true)} >
|
|
|
+ <PlusOutlined className={styles.addIcon} />
|
|
|
+ 缺陷
|
|
|
+ </Button>
|
|
|
+ </Col>
|
|
|
+ <Col span={2}>
|
|
|
+ <Button size="small" onClick={() => setTaskRecommendModal(true)}>
|
|
|
+ <ForkOutlined className={styles.addIcon} />
|
|
|
+ 推荐
|
|
|
+ </Button>
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+ <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}}>查看详情</Button>
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </Col>
|
|
|
+
|
|
|
+ </Row>
|
|
|
+ </div>
|
|
|
+ </Card>
|
|
|
+ <Modal title="添加测试用例" visible={showAddTestCaseModal} onOk={() => setAddTestCaseModal(false)}
|
|
|
+ onCancel={() => setAddTestCaseModal(false)} className="addModal">
|
|
|
+ <ExclamationCircleFilled className={styles.addModalInfo} />为了评分准确,请勿提交重复测试用例
|
|
|
+ <Form
|
|
|
+ {...formItemLayout}
|
|
|
+ form={form}
|
|
|
+ layout="horizontal"
|
|
|
+ className={styles.stepForm}
|
|
|
+ hideRequiredMark
|
|
|
+ initialValues={data}
|
|
|
+ >
|
|
|
+ <Form.Item
|
|
|
+ label="用例名称"
|
|
|
+ name="caseName"
|
|
|
+ rules={[
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请输入用例名称!',
|
|
|
+ },
|
|
|
+ ]}
|
|
|
+ >
|
|
|
+ <Input />
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item
|
|
|
+ label="前置条件"
|
|
|
+ name="precondition"
|
|
|
+ rules={[
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请输入前置条件!',
|
|
|
+ },
|
|
|
+ ]}
|
|
|
+ >
|
|
|
+ <Input.TextArea />
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item
|
|
|
+ label="测试步骤"
|
|
|
+ name="step"
|
|
|
+ rules={[
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请输入测试步骤!',
|
|
|
+ },
|
|
|
+ ]}
|
|
|
+ >
|
|
|
+ <Input.TextArea />
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item
|
|
|
+ label="预期结果"
|
|
|
+ name="result"
|
|
|
+ rules={[
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请输入预期结果!',
|
|
|
+ },
|
|
|
+ ]}
|
|
|
+ >
|
|
|
+ <Input.TextArea />
|
|
|
+ </Form.Item>
|
|
|
+ </Form>
|
|
|
+ </Modal>
|
|
|
+ <Modal title="添加用例缺陷" visible={showAddBugModal} onOk={() => setAddTestBugModal(false)}
|
|
|
+ onCancel={() => setAddTestBugModal(false)} className="addModal">
|
|
|
+ <ExclamationCircleFilled className={styles.addModalInfo} />为了评分准确,请勿提交重复Bug
|
|
|
+ <Form
|
|
|
+ labelCol={{ span: 4 }}
|
|
|
+ layout="horizontal"
|
|
|
+ >
|
|
|
+ <Form.Item
|
|
|
+ label="测试题目"
|
|
|
+ name="testName"
|
|
|
+ rules={[
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请输入测试题目!',
|
|
|
+ },
|
|
|
+ ]}
|
|
|
+ >
|
|
|
+ <Input />
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item
|
|
|
+ label="前置条件"
|
|
|
+ name="precondition"
|
|
|
+ rules={[
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请输入前置条件!',
|
|
|
+ },
|
|
|
+ ]}
|
|
|
+ >
|
|
|
+ <Input.TextArea />
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item
|
|
|
+ label="三级页面"
|
|
|
+ name="pages"
|
|
|
+ rules={[
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请确保输入了三级页面',
|
|
|
+ },
|
|
|
+ ]}
|
|
|
+ >
|
|
|
+ <Row gutter={5}>
|
|
|
+ <Col span={8}>
|
|
|
+ <Select>
|
|
|
+ <Select.Option value="demo">Demo1</Select.Option>
|
|
|
+ </Select>
|
|
|
+ </Col>
|
|
|
+ <Col span={8}>
|
|
|
+ <Select>
|
|
|
+ <Select.Option value="demo">Demo2</Select.Option>
|
|
|
+ </Select>
|
|
|
+ </Col>
|
|
|
+ <Col span={8}>
|
|
|
+ <Select>
|
|
|
+ <Select.Option value="demo">Demo3</Select.Option>
|
|
|
+ </Select>
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item
|
|
|
+ label="漏洞分类"
|
|
|
+ name="bugType"
|
|
|
+ rules={[
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请输入漏洞分类!',
|
|
|
+ },
|
|
|
+ ]}
|
|
|
+ >
|
|
|
+ <Select>
|
|
|
+ <Select.Option value="demo">Demo</Select.Option>
|
|
|
+ </Select>
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item
|
|
|
+ label="严重等级"
|
|
|
+ name="service"
|
|
|
+ rules={[
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请输入严重等级!',
|
|
|
+ },
|
|
|
+ ]}
|
|
|
+ >
|
|
|
+ <Select>
|
|
|
+ <Select.Option value="demo">Demo</Select.Option>
|
|
|
+ </Select>
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item
|
|
|
+ label="复现程度"
|
|
|
+ name="testName"
|
|
|
+ rules={[
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请输入测试题目!',
|
|
|
+ },
|
|
|
+ ]}
|
|
|
+ >
|
|
|
+ <Select>
|
|
|
+ <Select.Option value="demo">Demo</Select.Option>
|
|
|
+ </Select>
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item
|
|
|
+ label="上传截图"
|
|
|
+ name="testName"
|
|
|
+ >
|
|
|
+ <Upload
|
|
|
+ action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
|
|
|
+ listType="picture"
|
|
|
+ >
|
|
|
+ <Button icon={<UploadOutlined />}>Upload</Button>
|
|
|
+ </Upload>
|
|
|
+ </Form.Item>
|
|
|
+ </Form>
|
|
|
+ </Modal>
|
|
|
+ <Modal title="任务推荐" visible={showTaskRecommendModal} onOk={() => setTaskRecommendModal(false)}
|
|
|
+ onCancel={() => setTaskRecommendModal(false)} className="addModal">
|
|
|
+ <div>
|
|
|
+ <div id="forceChart" ></div>
|
|
|
+ </div>
|
|
|
+ </Modal>
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+};
|
|
|
+
|
|
|
+export default connect(({ editReport, loading }) => ({
|
|
|
+ submitting: loading.effects['editReport/submitStepForm'],
|
|
|
+ data: editReport.step,
|
|
|
+}))(Step2);
|