123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- /*
- * <<
- * Davinci
- * ==
- * Copyright (C) 2016 - 2017 EDP
- * ==
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * >>
- */
- import React from 'react'
- import classnames from 'classnames'
- import { connect } from 'react-redux'
- import { Form, Row, Col, Input, Radio, Steps, Transfer } from 'antd'
- import { FormComponentProps } from 'antd/lib/form/Form'
- const FormItem = Form.Item
- const RadioGroup = Radio.Group
- const Step = Steps.Step
- // import { checkNameAction } from '../App/actions'
- const utilStyles = require('assets/less/util.less')
- interface IRoleFormProps {
- type: string
- groupSource?: any[]
- groupTarget?: any[]
- onGroupChange?: (targets) => any
- organizationMembers?: any[]
- onCheckName?: (
- id: number,
- name: string,
- type: string,
- param?: any,
- resolve?: (res: any) => void,
- reject?: (err: any) => void
- ) => any
- }
- export class RoleForm extends React.PureComponent<IRoleFormProps & FormComponentProps, {}> {
- public render () {
- const {
- form,
- type
- } = this.props
- const { getFieldDecorator } = form
- const commonFormItemStyle = {
- labelCol: { span: 6 },
- wrapperCol: { span: 15 }
- }
- return (
- <Form>
- <Row>
- <Col span={24}>
- {type !== 'add' && (
- <FormItem className={utilStyles.hide}>
- {getFieldDecorator('id', {})(
- <Input />
- )}
- </FormItem>
- )}
- </Col>
- <Col span={24}>
- <FormItem label="名称" {...commonFormItemStyle}>
- {getFieldDecorator('name', {
- initialValue: '',
- rules: [{
- required: true,
- message: '名称 不能为空'
- }]
- })(
- <Input placeholder="名称" />
- )}
- </FormItem>
- </Col>
- <Col span={24}>
- <FormItem label="描述" {...commonFormItemStyle}>
- {getFieldDecorator('description', {
- initialValue: ''
- })(
- <Input.TextArea placeholder="描述" />
- )}
- </FormItem>
- </Col>
- </Row>
- </Form>
- )
- }
- }
- export default Form.create<IRoleFormProps & FormComponentProps>()(RoleForm)
|