/* * << * 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, { useImperativeHandle, useMemo, forwardRef } from 'react' import classnames from 'classnames' import { Form, Row, Col, Input, Tag, Button, Select } from 'antd' import { FormComponentProps } from 'antd/lib/form' const TextArea = Input.TextArea const Option = Select.Option const FormItem = Form.Item const styles = require('../../Organizations/Project.less') import Avatar from 'components/Avatar' const utilStyles = require('assets/less/util.less') import { IProjectFormFieldProps, IProjectsFormProps, FormType } from '../types' import {uuid} from 'utils/util' const EnhanceButton: React.FC> = ({ onModalOk, modalLoading, onTransfer, type }) => { const getType = useMemo(() => { if (type === 'transfer') { return '移 交' } return '保 存' }, [type]) return ( ) } const ProjectsForm: React.FC = ({ form, type, organizations, modalLoading, onCheckUniqueName, onModalOk, onTransfer, currentPro }, ref) => { const commonFormItemStyle = useMemo(() => ( { labelCol: { span: 3 }, wrapperCol: { span: 24 } } ), ['nf']) const isShowOrganization = useMemo(() => { return classnames({ [utilStyles.hide]: (type === 'organizationProject') || (type === 'edit') }) }, [type]) const isShowDesc = useMemo(() => { return classnames({ [utilStyles.hide]: type === 'transfer' }) }, [type]) const getModalTitle = useMemo(() => { return FormType[type] }, [type]) useImperativeHandle(ref, () => ({form})) return (
{getModalTitle}项目
项目属于组织,可以在项目中连接数据源,生成可视化图表
{type !== 'add' && ( {form.getFieldDecorator('id', { initialValue: currentPro.id })( )} )} {type === 'transfer' && ( {form.getFieldDecorator('orgId_hc', { initialValue: `${currentPro.orgId}` })( )} )} {type !== 'organizationProject' && ( {form.getFieldDecorator('orgId', { initialValue: `${type !== 'transfer' ? currentPro.orgId ? currentPro.orgId : '' : ''}`, rules: [{ required: true, message: '组织名称 不能为空' }] })( )} )} {type !== 'transfer' && ( {form.getFieldDecorator('name', { initialValue: currentPro.name, rules: [{ required: true, message: 'Name 不能为空' }, { validator: onCheckUniqueName }], validateFirst: true })( )} )} {type !== 'transfer' && ( {form.getFieldDecorator('description', { initialValue: currentPro.description })(