import React, { PureComponent } from 'react'; import { Form, Input, Card, Button, Row, Col, InputNumber } from 'antd'; import { connect } from 'dva'; import Panel from '../../../components/Panel'; import styles from '../../../layouts/Sword.less'; import { CLIENT_DETAIL, CLIENT_SUBMIT } from '../../../actions/client'; const FormItem = Form.Item; @connect(({ client, loading }) => ({ client, submitting: loading.effects['client/submit'], })) @Form.create() class ClientEdit extends PureComponent { componentWillMount() { const { dispatch, match: { params: { id }, }, } = this.props; dispatch(CLIENT_DETAIL(id)); } handleSubmit = e => { e.preventDefault(); const { dispatch, match: { params: { id }, }, form, } = this.props; form.validateFieldsAndScroll((err, values) => { if (!err) { const params = { id, ...values, }; dispatch(CLIENT_SUBMIT(params)); } }); }; render() { const { form: { getFieldDecorator }, client: { detail }, submitting, } = this.props; const formItemLayout = { labelCol: { span: 8, }, wrapperCol: { span: 16, }, }; const formAllItemLayout = { labelCol: { span: 4, }, wrapperCol: { span: 20, }, }; const action = ( ); return (
{getFieldDecorator('clientId', { rules: [ { required: true, message: '请输入客户端id', }, ], initialValue: detail.clientId, })()} {getFieldDecorator('clientSecret', { rules: [ { required: true, message: '请输入客户端密钥', }, ], initialValue: detail.clientSecret, })()} {getFieldDecorator('authorizedGrantTypes', { rules: [ { required: true, message: '请输入授权类型', }, ], initialValue: detail.authorizedGrantTypes, })()} {getFieldDecorator('scope', { rules: [ { required: true, message: '请输入授权范围', }, ], initialValue: detail.scope, })()} {getFieldDecorator('accessTokenValidity', { rules: [ { required: true, message: '请输入令牌过期秒数', }, ], initialValue: detail.accessTokenValidity, })()} {getFieldDecorator('refreshTokenValidity', { rules: [ { required: true, message: '请输入刷新令牌过期秒数', }, ], initialValue: detail.refreshTokenValidity, })()} {getFieldDecorator('webServerRedirectUri', { rules: [ { required: true, message: '请输入回调地址', }, ], initialValue: detail.webServerRedirectUri, })()} {getFieldDecorator('resourceIds', { initialValue: detail.resourceIds, })()} {getFieldDecorator('authorities', { initialValue: detail.authorities, })()} {getFieldDecorator('autoapprove', { initialValue: detail.autoapprove, })()} {getFieldDecorator('additionalInformation', { initialValue: detail.additionalInformation, })()}
); } } export default ClientEdit;