All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.templates.sword.edit.js.vm Maven / Gradle / Ivy

#set($upperEntityPath=$table.entityPath.toUpperCase())
import React, { PureComponent } from 'react';
import { Form, Input, Card, Button } from 'antd';
import { connect } from 'dva';
import Panel from '../../../components/Panel';
import styles from '../../../layouts/Sword.less';
import { $!{upperEntityPath}_DETAIL, $!{upperEntityPath}_SUBMIT } from '../../../actions/$!{table.entityPath}';

const FormItem = Form.Item;

@connect(({ $!{table.entityPath}, loading }) => ({
  $!{table.entityPath},
  submitting: loading.effects['$!{table.entityPath}/submit'],
}))
@Form.create()
class $!{entity}Edit extends PureComponent {
  componentWillMount() {
    const {
      dispatch,
      match: {
        params: { id },
      },
    } = this.props;
    dispatch($!{upperEntityPath}_DETAIL(id));
  }

  handleSubmit = e => {
    e.preventDefault();
    const {
      dispatch,
      match: {
        params: { id },
      },
      form,
    } = this.props;
    form.validateFieldsAndScroll((err, values) => {
      if (!err) {
        const params = {
          id,
          ...values,
        };
        console.log(params);
        dispatch($!{upperEntityPath}_SUBMIT(params));
      }
    });
  };

  render() {
    const {
      form: { getFieldDecorator },
      $!{table.entityPath}: { detail },
      submitting,
    } = this.props;

    const formItemLayout = {
      labelCol: {
        xs: { span: 24 },
        sm: { span: 7 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 12 },
        md: { span: 10 },
      },
    };

    const action = (
      
    );

    return (
      
        
#foreach($field in $!{table.fields}) #if($!{field.name}!=$!{cfg.tenantColumn}) {getFieldDecorator('$!{field.propertyName}', { rules: [ { required: true, message: '请输入$!{field.comment}', }, ], initialValue: detail.$!{field.propertyName}, })()} #end #end
); } } export default $!{entity}Edit;




© 2015 - 2024 Weber Informatics LLC | Privacy Policy