悬浮关闭,从表单获取id,实时验证,下拉菜单,字符串转日期,页面自己定到错误的地方,按照词根进行分类,提示

1,悬浮关闭按钮

<div className="ant-drawer-footer"   style={
   {
    width: '600' }}>
    <Button style={
   {
    marginLeft: 8 }} onClick={
   this.props.onClose}>
    	关闭
    </Button>
</div>

2,抽屉的关闭按钮

closable={
   true}      // 小叉叉
maskClosable={
   true}
destroyOnClose={
   true}	

3,从表单获取id

一般回显的id给修改的id附不上值时,从表单里获取id的值

id:this.props.form.getFieldValue('id')
name: this.props.form.getFieldValue('name')
{
   getFieldDecorator('id', {
   
					initialValue: this.props.id || ''
				})(<Input type="hidden" />)}
				
				
4,实时验证
            <Form.Item>
                                    {
   getFieldDecorator('name', {
   
                                        validateTrigger: 'onBlur',
                                        rules: [
                                            {
   
                                                required: true,
                                                message: '请输入字典名称'
                                            },
                                            {
   
                                                pattern: /^[^\s]*$/,
                                                message: '不能输入空格'
                                            },
                                        	{
   
										pattern: /^[\u4e00-\u9fa5a-zA-Z0-9()()]+$/,
										message: '不能输入特殊字符,只可以输入括号'
									},
                                            {
   
                                                validator: this.inputOnBlurname
                                            }
                                        ],
                                        initialValue: this.props.name
                                    })(<Input placeholder="字典名称" />)}
        </Form.Item>




/**
	 * 校验字典名称是否重复
	 * @return {[type]} [description]
	 */
	inputOnBlurname = (rule, value, callback) => {
   
		POST(HTTP_DEP + '/dict/isnotname', {
   
			id: this.props.id,
			pid: this.props.pid,
			name: this.props.form.getFieldValue('name')
		}).then(function
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值