import React from 'react' const styles = require('../Organization.less') import { Button, Input, Form, Row, Col, Radio, Modal } from 'antd' import {FormComponentProps} from 'antd/lib/form' const FormItem = Form.Item const RadioButton = Radio.Button import UploadAvatar from 'components/UploadAvatar' import { IOrganization } from '../types' const utilStyles = require('assets/less/util.less') interface ISettingProps { form: any currentOrganization: IOrganization editOrganization: (oranization: IOrganization) => () => any deleteOrganization: (id: number) => any } export class Setting extends React.PureComponent { public componentWillMount () { this.initData() } private initData = () => { const { currentOrganization } = this.props const { id, name, description, allowCreateProject, allowDeleteOrTransferProject, allowChangeVisibility, memberPermission } = currentOrganization this.forceUpdate(() => { this.props.form.setFieldsValue({ id, name, description, allowCreateProject, allowDeleteOrTransferProject, allowChangeVisibility, memberPermission }) }) } private confirmDelete = () => { const { form, deleteOrganization } = this.props const { id, name } = form.getFieldsValue() Modal.confirm({ title: `确定删除组织 “${name}”?`, onOk: () => { deleteOrganization(id) } }) } public render () { const { getFieldDecorator } = this.props.form const commonFormItemStyle = { labelCol: { span: 2 }, wrapperCol: { span: 18 } } const { name, avatar, id, description, allowCreateProject, memberPermission } = this.props.currentOrganization const currentValues = this.props.form.getFieldsValue() let isDisabled = true if (currentValues.name !== name || currentValues.description !== description || currentValues.allowCreateProject !== allowCreateProject || currentValues.memberPermission !== memberPermission ) { isDisabled = false } return (

{getFieldDecorator('id', {})( )} {getFieldDecorator('name', { initialValue: '', rules: [{ required: true }, { // validator: this.checkNameUnique }] })( )} {getFieldDecorator('description', { })( )} {getFieldDecorator('allowCreateProject', { initialValue: true })( 禁止 允许 )} {getFieldDecorator('memberPermission', { initialValue: 1 })( 不可见任何 只可见公开 )}
删除组织

删除后无法恢复,请确定此次操作

) } } export default Form.create()(Setting)