mirror of
https://github.com/zuiidea/antd-admin
synced 2026-11-27 08:14:06 +00:00
users
This commit is contained in:
@@ -80,3 +80,21 @@ body {
|
||||
border-radius: 0;
|
||||
box-shadow: 0 0 20px rgba(100, 100, 100, 0.2);
|
||||
}
|
||||
|
||||
:global .vertical-center-modal {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.ant-modal {
|
||||
top: 0;
|
||||
|
||||
.ant-modal-body {
|
||||
max-height: 500px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
:global .ant-form-item-control{
|
||||
vertical-align:middle;
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@ function list({
|
||||
return (
|
||||
<div>
|
||||
<Table size="small"
|
||||
className={styles.table}
|
||||
bordered
|
||||
columns={columns}
|
||||
dataSource={dataSource}
|
||||
|
||||
@@ -4,3 +4,8 @@
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
.table{
|
||||
td{
|
||||
height: 38px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { PropTypes } from 'react'
|
||||
import { Form, Input, Modal } from 'antd'
|
||||
import { Form, Input, InputNumber, Radio, Modal } from 'antd'
|
||||
const FormItem = Form.Item
|
||||
|
||||
const formItemLayout = {
|
||||
@@ -32,19 +32,12 @@ const modal = ({
|
||||
})
|
||||
}
|
||||
|
||||
function checkNumber(rule, value, callback) {
|
||||
if (!/^[\d]{1,2}$/.test(value)) {
|
||||
callback(new Error('年龄不合法'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
|
||||
const modalOpts = {
|
||||
title: '修改用户',
|
||||
visible,
|
||||
onOk: handleOk,
|
||||
onCancel,
|
||||
wrapClassName:"vertical-center-modal"
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -58,12 +51,29 @@ const modal = ({
|
||||
{getFieldDecorator('name', {
|
||||
initialValue: item.name,
|
||||
rules: [
|
||||
{ required: true, message: '名称未填写' },
|
||||
{ required: true, message: '姓名未填写' },
|
||||
],
|
||||
})(
|
||||
<Input type="text" />
|
||||
<Input/>
|
||||
)}
|
||||
</FormItem>
|
||||
<FormItem
|
||||
label="性别"
|
||||
hasFeedback
|
||||
{...formItemLayout}
|
||||
>
|
||||
{getFieldDecorator('isMale', {
|
||||
initialValue: item.isMale,
|
||||
rules: [
|
||||
{ required: true, message: '请选择性别' },
|
||||
],
|
||||
})(
|
||||
<Radio.Group>
|
||||
<Radio value={true}>男</Radio>
|
||||
<Radio value={false}>女</Radio>
|
||||
</Radio.Group>
|
||||
)}
|
||||
</FormItem>
|
||||
<FormItem
|
||||
label="年龄:"
|
||||
hasFeedback
|
||||
@@ -71,12 +81,41 @@ const modal = ({
|
||||
>
|
||||
{getFieldDecorator('age', {
|
||||
initialValue: item.age,
|
||||
rules: [
|
||||
{ required: true, message: '年龄未填写' },
|
||||
{ validator: checkNumber },
|
||||
rules: [{
|
||||
required: true,
|
||||
type:'number',
|
||||
message: '年龄未填写' },
|
||||
],
|
||||
})(
|
||||
<Input type="text" />
|
||||
<InputNumber min={18} max={100}/>
|
||||
)}
|
||||
</FormItem>
|
||||
<FormItem
|
||||
label="电话:"
|
||||
hasFeedback
|
||||
{...formItemLayout}
|
||||
>
|
||||
{getFieldDecorator('phone', {
|
||||
initialValue: item.phone,
|
||||
rules: [
|
||||
{ required: true, message: '不能为空' },
|
||||
],
|
||||
})(
|
||||
<Input/>
|
||||
)}
|
||||
</FormItem>
|
||||
<FormItem
|
||||
label="邮箱:"
|
||||
hasFeedback
|
||||
{...formItemLayout}
|
||||
>
|
||||
{getFieldDecorator('email', {
|
||||
initialValue: item.email,
|
||||
rules: [
|
||||
{ required: true, message: '不能为空' },
|
||||
],
|
||||
})(
|
||||
<Input/>
|
||||
)}
|
||||
</FormItem>
|
||||
<FormItem
|
||||
@@ -90,7 +129,7 @@ const modal = ({
|
||||
{ required: true, message: '不能为空' },
|
||||
],
|
||||
})(
|
||||
<Input type="address" />
|
||||
<Input/>
|
||||
)}
|
||||
</FormItem>
|
||||
</Form>
|
||||
|
||||
Reference in New Issue
Block a user