text: import React, { Component } from 'react'
  import { Card, Button, Form, Icon, Col, Row, DatePicker, TimePicker, Input, Select, Popover,Switch } from 'antd'
  import { connect } from 'dva'
  import PageHeaderLayout from '../../layouts/PageHeaderLayout'
  import CandidateList from '../../components/CandidateList'
  import {ImageComponent} from '../../axios/tools'
  import FooterToolbar from '../../components/FooterToolbar'
  import styles from './RetailStoreOrderPaymentGroup.createform.less'
  import {mapBackToImageValues, mapFromImageValues} from '../../axios/tools'
  import GlobalComponents from '../../custcomponents';
  import RetailStoreOrderPaymentGroupBase from './RetailStoreOrderPaymentGroup.base'
  import appLocaleName from '../../common/Locale.tool'
  const { Option } = Select
  const { RangePicker } = DatePicker
  const { TextArea } = Input
  const {fieldLabels} = RetailStoreOrderPaymentGroupBase
  const testValues = {};
  /*
  const testValues = {
    name: '付款办法',
    cardNumber: '4111 1111 1111 - ',
    bizOrderId: 'RSO000001',
  }
  */
  
  const imageKeys = [
  ]
  
  
  class RetailStoreOrderPaymentGroupCreateFormBody extends Component {
    state = {
      previewVisible: false,
      previewImage: '',
      convertedImagesValues: {},
    }
  
    componentDidMount() {
  	
      
      
    }
  
    handlePreview = (file) => {
      console.log('preview file', file)
      this.setState({
        previewImage: file.url || file.thumbUrl,
        previewVisible: true,
      })
    }
  
   
  
  
    handleImageChange = (event, source) => {
  
      const {handleImageChange} = this.props
      if(!handleImageChange){
        console.log('FAILED GET PROCESS FUNCTION TO HANDLE IMAGE VALUE CHANGE', source)
        return 
      }
  
      const { convertedImagesValues } = this.state
      const { fileList } = event
      convertedImagesValues[source] = fileList
      this.setState({ convertedImagesValues })
      handleImageChange(event, source)
  	
   
    }
    
  
    render() {
      const { form, dispatch, submitting, role } = this.props
      const { convertedImagesValues } = this.state
  	const userContext = null
      const { getFieldDecorator, validateFieldsAndScroll, getFieldsError } = form
      const { owner } = this.props
      const {RetailStoreOrderPaymentGroupService} = GlobalComponents
      
      const capFirstChar = (value)=>{
      	//const upper = value.replace(/^\w/, c => c.toUpperCase());
    		const upper = value.charAt(0).toUpperCase() + value.substr(1);
    		return upper
    	}
      
      
      const tryinit  = (fieldName) => {
        
        if(!owner){
        	return null
        }
        const { referenceName } = owner
        if(referenceName!=fieldName){
          return null
        }
        return owner.id
      }
      
      const availableForEdit= (fieldName) =>{
       
        if(!owner){
        	return true
        }
        const { referenceName } = owner
        if(referenceName!=fieldName){
          return true
        }
        return false
      
      }
  	const formItemLayout = {
        labelCol: { span: 6 },
        wrapperCol: { span: 12 },
      }
      const switchFormItemLayout = {
  
        labelCol: { span: 6 },
        wrapperCol: { span: 12 },
  
      }
      
      const internalRenderTitle = () =>{
        const linkComp=<a onClick={goback}  > <Icon type="double-left" style={{marginRight:"10px"}} /> </a>
        return (<div>{linkComp}{appLocaleName(userContext,"CreateNew")}{window.trans('retail_store_order_payment_group')}</div>)
      }
  	
  	return (
        <div>
          <Card title={!this.props.hideTitle&&appLocaleName(userContext,"BasicInfo")} className={styles.card} bordered={false}>
            <Form >
            	<Row gutter={16}>
             
  
                <Col lg={24} md={24} sm={24}>
                  <Form.Item label={fieldLabels.name} {...formItemLayout}>
                    {getFieldDecorator('name', {
                      rules: [{ required: true, message: appLocaleName(userContext,"PleaseInput") }],
                    })(
                      <Input size="large"  placeHolder={fieldLabels.name} />
                    )}
                  </Form.Item>
                </Col>
  
                <Col lg={24} md={24} sm={24}>
                  <Form.Item label={fieldLabels.cardNumber} {...formItemLayout}>
                    {getFieldDecorator('cardNumber', {
                      rules: [{ required: true, message: appLocaleName(userContext,"PleaseInput") }],
                    })(
                      <Input size="large"  placeHolder={fieldLabels.cardNumber} />
                    )}
                  </Form.Item>
                </Col>
  
  
         
   
                <Col lg={24} md={24} sm={24}>
                  <Form.Item label={fieldLabels.bizOrder} {...formItemLayout}>
                    {getFieldDecorator('bizOrderId', {
                    	initialValue: tryinit('bizOrder'),
                      rules: [{ required: true, message: appLocaleName(userContext,"PleaseInput") }],
                    })(
                    
                    
                    <CandidateList 
  		                 disabled={!availableForEdit('bizOrder')}
  		                 ownerType={owner.type}
  		                 ownerId={owner.id}
  		                 scenarioCode={"assign"}
  		                 listType={"retail_store_order_payment_group"} 
  		                 targetType={"retail_store_order"} 
                   
                      requestFunction={RetailStoreOrderPaymentGroupService.queryCandidates}  />
                    	
                    
                    
                    )}
                  </Form.Item>
                </Col>
  
             
  
  
  
  			 </Row>
            </Form>
          </Card>
  
  
  
  
  
  
  
  
        
         </div>
      )
    }
  }
  
  export default connect(state => ({
    collapsed: state.global.collapsed,
  }))(Form.create()(RetailStoreOrderPaymentGroupCreateFormBody))
  
  
  
  
  
  