Commit 7469d7b1 authored by XieZhiXiong's avatar XieZhiXiong

feat: 调价删除按钮相关

parent 3979a4b1
...@@ -14,4 +14,9 @@ ...@@ -14,4 +14,9 @@
&:hover { &:hover {
background-color: @descriptions-bg; background-color: @descriptions-bg;
} }
}
.del-btn {
position: relative;
top: -10px;
} }
\ No newline at end of file
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2021-06-01 16:13:35 * @Date: 2021-06-01 16:13:35
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-07 16:18:24 * @LastEditTime: 2021-06-15 11:53:20
* @Description: 资质证明上传组件 * @Description: 资质证明上传组件
*/ */
import React from 'react'; import React from 'react';
import { Row, Col, Button } from 'antd'; import { Row, Col, Button } from 'antd';
import { PlusOutlined } from '@ant-design/icons'; import { PlusOutlined, CloseCircleOutlined } from '@ant-design/icons';
import { ArrayList } from '@formily/react-shared-components'; import { ArrayList } from '@formily/react-shared-components';
import { Schema, SchemaField } from '@formily/antd'; import { Schema, SchemaField } from '@formily/antd';
import { toArr, FormPath } from '@formily/shared'; import { toArr, FormPath } from '@formily/shared';
...@@ -16,6 +16,12 @@ import { ...@@ -16,6 +16,12 @@ import {
} from '@/constants'; } from '@/constants';
import styles from './index.less'; import styles from './index.less';
const expireDayTitle = (
<span style={{ marginTop: 40 }}>
到期日
</span>
);
const schema = new Schema({ const schema = new Schema({
type: 'object', type: 'object',
properties: { properties: {
...@@ -39,6 +45,12 @@ const schema = new Schema({ ...@@ -39,6 +45,12 @@ const schema = new Schema({
}, },
accept: '.doc, .docx, .xls, .xlsx, .pot, .pps, .vsd, .wps, .dps, .pdf, .txt, .png, .jpg, .rar, .zip', accept: '.doc, .docx, .xls, .xlsx, .pot, .pps, .vsd, .wps, .dps, .pdf, .txt, .png, .jpg, .rar, .zip',
}, },
'x-rules': [
{
required: true,
message: '请上传资质证明',
},
],
}, },
MEGA_LAYOUT2: { MEGA_LAYOUT2: {
type: 'object', type: 'object',
...@@ -46,8 +58,13 @@ const schema = new Schema({ ...@@ -46,8 +58,13 @@ const schema = new Schema({
properties: { properties: {
expireDay: { expireDay: {
type: 'string', type: 'string',
title: '到期日', title: expireDayTitle,
'x-component': 'DatePicker', 'x-component': 'DatePicker',
'x-component-props': {
style: {
marginTop: 20,
},
},
}, },
permanent: { permanent: {
type: 'string', type: 'string',
...@@ -75,7 +92,8 @@ const QualitiesUploadFormItem = (props) => { ...@@ -75,7 +92,8 @@ const QualitiesUploadFormItem = (props) => {
} = props; } = props;
const { colSpan } = (props.props['x-component-props'] || {}); const { colSpan } = (props.props['x-component-props'] || {});
const onAdd = () => mutators.push(schema.getEmptyValue()) const onAdd = () => mutators.push(schema.getEmptyValue());
const onRemove = index => mutators.remove(index);
const span = colSpan ? { const span = colSpan ? {
span: colSpan, span: colSpan,
...@@ -89,16 +107,28 @@ const QualitiesUploadFormItem = (props) => { ...@@ -89,16 +107,28 @@ const QualitiesUploadFormItem = (props) => {
<ArrayList value={value}> <ArrayList value={value}>
<Row <Row
gutter={{ sm: 44, md: 88, lg: 88 }} gutter={{ sm: 44, md: 88, lg: 88 }}
style={{
width: '100%',
}}
> >
{toArr(value).map((item, index) => ( {toArr(value).map((item, index) => (
<Col key={index} {...span}> <Col key={index} {...span}>
<SchemaField <Row
path={FormPath.parse(path).concat(index)} gutter={50}
schema={schema} align="middle"
/> >
<Col flex={1}>
<SchemaField
path={FormPath.parse(path).concat(index)}
schema={schema}
/>
</Col>
<Col>
<Button
onClick={() => onRemove(index)}
type="link"
icon={<CloseCircleOutlined style={{ fontSize: 20 }} />}
className={styles['del-btn']}
/>
</Col>
</Row>
</Col> </Col>
))} ))}
{editable && ( {editable && (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment