Commit 0269a9e1 authored by XieZhiXiong's avatar XieZhiXiong

chore: 重命名

parent e362615e
@import '~antd/es/style/themes/default.less';
.add-btn {
width: 175px;
height: 120px;
text-align: center;
vertical-align: top;
background-color: @descriptions-bg;
border: 1px dashed @border-color-base;
border-radius: @border-radius-base;
cursor: pointer;
transition: border-color 0.3s;
&:hover {
background-color: @descriptions-bg;
}
}
\ No newline at end of file
/*
* @Author: XieZhiXiong
* @Date: 2021-06-01 16:13:35
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-07 14:56:46
* @Description: 资质证明上传组件
*/
import React from 'react';
import { Row, Col, Button } from 'antd';
import { PlusOutlined } from '@ant-design/icons';
import { ArrayList } from '@formily/react-shared-components';
import { Schema, SchemaField } from '@formily/antd';
import { toArr, FormPath } from '@formily/shared';
import {
UPLOAD_TYPE,
} from '@/constants';
import styles from './index.less';
const schema = new Schema({
type: 'object',
properties: {
MEGA_LAYOUT1: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
grid: true,
full: true,
columns: 2,
},
properties: {
file: {
type: 'string',
'x-component': 'QualitiesUpload',
'x-component-props': {
action: '/api/file/file/upload/prefix',
data: {
fileType: UPLOAD_TYPE,
prefix: 'member_qualifications_',
},
accept: '.doc, .docx, .xls, .xlsx, .pot, .pps, .vsd, .wps, .dps, .pdf, .txt, .png, .jpg, .rar, .zip',
},
},
MEGA_LAYOUT2: {
type: 'object',
'x-component': 'Mega-Layout',
properties: {
expireDay: {
type: 'string',
title: '到期日',
'x-component': 'DatePicker',
},
permanent: {
type: 'string',
title: '有效期',
'x-component': 'CheckboxGroup',
enum: [
{ label: '长期有效', value: 1 },
]
},
},
},
},
}
},
});
const Qualifications = (props) => {
const {
value,
className,
editable,
path,
mutators,
// schema,
} = props;
const { colSpan } = (props.props['x-component-props'] || {});
const onAdd = () => mutators.push(schema.getEmptyValue())
const span = colSpan ? {
span: colSpan,
} : {
sm: 12,
md: 8,
lg: 8,
};
return (
<ArrayList value={value}>
<Row
gutter={{ sm: 44, md: 88, lg: 88 }}
style={{
width: '100%',
}}
>
{toArr(value).map((item, index) => (
<Col key={index} {...span}>
<SchemaField
path={FormPath.parse(path).concat(index)}
schema={schema}
/>
</Col>
))}
{editable && (
<Col {...span}>
<Button
onClick={onAdd}
type="dashed"
className={styles['add-btn']}
>
<PlusOutlined />
</Button>
</Col>
)}
</Row>
</ArrayList>
);
};
Qualifications.isFieldComponent = true;
export default Qualifications;
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-06-01 16:13:35
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-07 14:56:46
* @LastEditTime: 2021-06-07 15:07:45
* @Description: 资质证明上传组件
*/
import React from 'react';
......@@ -64,7 +64,7 @@ const schema = new Schema({
},
});
const Qualifications = (props) => {
const QualitiesUploadFormItem = (props) => {
const {
value,
className,
......@@ -117,7 +117,7 @@ const Qualifications = (props) => {
);
};
Qualifications.isFieldComponent = true;
QualitiesUploadFormItem.isFieldComponent = true;
export default Qualifications;
export default QualitiesUploadFormItem;
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