/* * << * 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 { Form, Row, Col, Input, Tag, Button, Select } from 'antd' import { FormComponentProps } from 'antd/lib/form/Form' const TextArea = Input.TextArea const Option = Select.Option const FormItem = Form.Item const styles = require('../Project.less') import Avatar from 'components/Avatar' const utilStyles = require('assets/less/util.less') interface IProjectsFormProps { type?: string organizations?: any onTransfer?: () => any onModalOk?: () => any modalLoading: boolean onWidgetTypeChange?: () => any onCheckUniqueName?: (pathname: any, data: any, resolve: () => any, reject: (error: string) => any) => any } export class ProjectsForm extends React.PureComponent { constructor (props) { super(props) } public render () { const { type, organizations, modalLoading, onCheckUniqueName, onWidgetTypeChange } = this.props const { getFieldDecorator } = this.props.form const commonFormItemStyle = { labelCol: { span: 3 }, wrapperCol: { span: 24 } } const modalButtons = [( )] const transferButtons = [( )] const organizationOptions = organizations ? organizations.map((o) => { const orgId = this.props.form.getFieldValue('orgId_hc') if (this.props.type === 'transfer' && o.id === Number(orgId)) { return [] } const disabled = o.allowCreateProject === false return ( ) }) : '' const isShowOrganization = classnames({ [utilStyles.hide]: (this.props.type === 'organizationProject') || (this.props.type === 'edit') }) const isShowDesc = classnames({ [utilStyles.hide]: this.props.type === 'transfer' }) // const isShowVisibility = classnames({ // [utilStyles.hide]: this.props.type !== 'edit' // }) let modalTitle = '创建' if (type === 'edit') { modalTitle = '修改' } else if (type === 'transfer') { modalTitle = '移交' } return (
{modalTitle}项目
项目属于组织,可以在项目中连接数据源,生成可视化图表
{type !== 'add' && ( {getFieldDecorator('id', {})( )} )} {type === 'transfer' && ( {getFieldDecorator('orgId_hc', {})( )} )} {type !== 'organizationProject' && ( {getFieldDecorator('orgId', { rules: [{ required: true, message: '名称 不能为空' }] })( )} )} {type !== 'transfer' && ( {getFieldDecorator('name', { rules: [{ required: true, message: '名称 不能为空' }, { validator: onCheckUniqueName }], validateFirst: true })( )} )} {type !== 'transfer' && ( {getFieldDecorator('description', { initialValue: '' })(