Commit ed58f579 authored by 李晓静's avatar 李晓静

merge

parents 98d99938 32e2c45f
import React from 'react'; import React, { useRef } from 'react';
import { DatePicker } from 'antd'; import { DatePicker } from 'antd';
import styles from './styles.less'; import { onBlurFn } from '../onBlurFn';
import { antiAssign } from '../../../../utils/utils'; import { antiAssign } from '../../../../utils/utils';
import styles from './styles.less';
export const ApolloDate = (props: any) => { export const ApolloDate = (props: any) => {
const { onChange } = props; const { origin, onChange } = props;
const selfProps = antiAssign(props, ['onChange', 'columnConfig']); const selfProps = antiAssign(props, ['onChange', 'columnConfig']);
const isOpen = useRef();
const changeValue = (date, dateString) => { const changeValue = (date, dateString) => {
if (typeof onChange === 'function') { if (typeof onChange === 'function') {
if (typeof onBlurFn === 'function' && !isOpen.current) {
onBlurFn({ ...props, value: date });
}
onChange(date, dateString); onChange(date, dateString);
} }
}; };
return ( const inputOnBlurFn = (e: boolean) => {
isOpen.current = e;
};
return (origin === 'editForm' ?
<DatePicker
className={styles.date}
// value={inputVal}
dropdownClassName={styles.dropdownClassName}
popupStyle={{ width: '350px' }}
{...selfProps}
onChange={changeValue}
onOpenChange={inputOnBlurFn}
/> :
<DatePicker <DatePicker
className={styles.date} className={styles.date}
dropdownClassName={styles.dropdownClassName} dropdownClassName={styles.dropdownClassName}
......
import React from 'react'; import React, { useState, useEffect } from 'react';
import { Input } from 'antd'; import { Input } from 'antd';
import styles from './styles.less'; import styles from './styles.less';
import { onBlurFn } from '../onBlurFn';
import { antiAssign } from '../../../../utils/utils'; import { antiAssign } from '../../../../utils/utils';
import { ApolloInputProps } from '../editInterface'; import { ApolloInputProps } from '../editInterface';
import { Consumer } from '../../../context'; import { Consumer } from '../../../context';
export const ApolloInput = (props: ApolloInputProps) => { export const ApolloInput = (props: ApolloInputProps) => {
const { maxLength, onChange, value, style } = props; const { maxLength, onChange, value, style, origin } = props;
const selfProps = antiAssign(props, ['columnConfig', 'onChange', 'style', 'onEmitChange']); const selfProps = antiAssign(props, ['columnConfig', 'onChange', 'style', 'onEmitChange']);
const [inputVal, setInputVal] = useState(value)
useEffect(() => {
setInputVal(value);
}, [value]);
const changeValue = (value: any) => { const changeValue = (value: any) => {
if (typeof onChange === 'function') { if (typeof onChange === 'function') {
onChange(value); onChange(value);
} }
}; };
const inputOnBlurFn = () => {
if (typeof onBlurFn === 'function') {
onBlurFn(props);
}
};
const newStyle: any = { const newStyle: any = {
...style, ...style,
}; };
...@@ -33,18 +42,31 @@ export const ApolloInput = (props: ApolloInputProps) => { ...@@ -33,18 +42,31 @@ export const ApolloInput = (props: ApolloInputProps) => {
{({ locale }) => { {({ locale }) => {
return ( return (
<div className={styles.container}> <div className={styles.container}>
<Input {
className={styles.input} origin === 'editForm' ? <Input
style={newStyle} className={styles.input}
{...selfProps} style={newStyle}
onChange={(e) => { {...selfProps}
changeValue(e.target.value); value={inputVal}
}} onBlur={inputOnBlurFn}
/> onChange={(e) => {
changeValue(e.target.value);
setInputVal(e.target.value)
}}
/> : <Input
className={styles.input}
style={newStyle}
{...selfProps}
onChange={(e) => {
changeValue(e.target.value);
}}
/>
}
{!!maxLength && ( {!!maxLength && (
<span className={styles.wordNumber} style={wordNumStyle}>{`${locale.alreadyInput} ${ <span className={styles.wordNumber} style={wordNumStyle}>{`${locale.alreadyInput} ${
(value || '').length (value || '').length
}/${maxLength}`}</span> }/${maxLength}`}</span>
)} )}
</div> </div>
); );
......
import React from 'react'; import React, { useState, useEffect } from 'react';
import { InputNumber } from 'antd'; import { InputNumber } from 'antd';
import styles from './styles.less'; import styles from './styles.less';
import { onBlurFn } from '../onBlurFn';
import { ApolloNumberProps } from '../editInterface'; import { ApolloNumberProps } from '../editInterface';
import { antiAssign } from '../../../../utils/utils'; import { antiAssign } from '../../../../utils/utils';
export const ApolloNumber = (props: ApolloNumberProps) => { export const ApolloNumber = (props: ApolloNumberProps) => {
const { onChange, origin }: any = props; const { onChange, origin, value }: any = props;
const selfProps = antiAssign(props, ['columnConfig', 'onChange']); const selfProps = antiAssign(props, ['columnConfig', 'onChange']);
const [inputVal, setInputVal] = useState(value)
useEffect(() => {
setInputVal(value);
}, [value]);
const changeValue = (newValue: any) => { const changeValue = (newValue: any) => {
if (typeof onChange === 'function') { if (typeof onChange === 'function') {
onChange(newValue); onChange(newValue);
setInputVal(inputVal);
} }
}; };
const { onEmitChange, ...o } = selfProps; const { onEmitChange, ...o } = selfProps;
...@@ -17,5 +23,12 @@ export const ApolloNumber = (props: ApolloNumberProps) => { ...@@ -17,5 +23,12 @@ export const ApolloNumber = (props: ApolloNumberProps) => {
if (origin === 'editForm') { if (origin === 'editForm') {
style.height = '32px'; style.height = '32px';
} }
return <InputNumber className={styles.number} style={style} {...o} onChange={changeValue} />; const inputOnBlurFn = () => {
if (typeof onBlurFn === 'function') {
onBlurFn(props);
}
};
return origin === 'editForm' ?
<InputNumber value={inputVal} onBlur={inputOnBlurFn} className={styles.number} style={style} {...o} onChange={changeValue} />
: <InputNumber className={styles.number} style={style} {...o} onChange={changeValue} />;
}; };
import { setFormat } from '../index';
import { config } from '../config';
export const onBlurFn = (props: any) => {
const { columnConfig, rowId, onBlurFn, value } = props;
const { type } = columnConfig
const extraData: any[] = []
if (typeof onBlurFn === 'function') {
const newVal = setFormat(config[type], columnConfig, value)
extraData.push({
columnCode: columnConfig.columnName,
cellValueList: newVal,
});
onBlurFn({
rowId,
value: extraData,
}, newVal);
}
};
import React from 'react'; import React from 'react';
import { onBlurFn } from '../onBlurFn';
import { ApolloNumber } from '../number'; import { ApolloNumber } from '../number';
import { isNumber } from '../../../../utils/utils'; import { isNumber } from '../../../../utils/utils';
export const ApolloPercentage = (props) => { export const ApolloPercentage = (props: any) => {
const inputOnBlurFn = () => {
if (typeof onBlurFn === 'function') {
onBlurFn(props);
}
};
return ( return (
<ApolloNumber <ApolloNumber
{...props} {...props}
...@@ -18,6 +24,7 @@ export const ApolloPercentage = (props) => { ...@@ -18,6 +24,7 @@ export const ApolloPercentage = (props) => {
} }
return ''; return '';
}} }}
onBlur={inputOnBlurFn}
/> />
); );
}; };
import React from 'react'; import React, { useRef } from 'react';
import { message } from 'antd'; import { message } from 'antd';
import Search from '../../extra/associationSearch'; import Search from '../../extra/associationSearch';
import { ApolloSearchProps } from '../editInterface'; import { ApolloSearchProps } from '../editInterface';
import { antiAssign } from '../../../../utils/utils'; import { antiAssign } from '../../../../utils/utils';
import { onBlurFn } from '../onBlurFn';
import s from './index.less'; import s from './index.less';
export const ApolloSearch = (props: ApolloSearchProps) => { export const ApolloSearch = (props: ApolloSearchProps) => {
const { onChange, maxCount, isMultiple, request } = props; const { onChange, maxCount, isMultiple, request, origin } = props;
const selfProps = antiAssign(props, ['columnConfig', 'onChange', 'isMultiple', 'options', 'request', 'maxCount']); const selfProps = antiAssign(props, ['columnConfig', 'onChange', 'isMultiple', 'options', 'request', 'maxCount']);
const changeValue = (value) => { const isOpen = useRef();
if (isMultiple) {
selfProps.mode = 'multiple';
}
const changeValue = (value: any) => {
if (isMultiple && maxCount && maxCount < value.length) { if (isMultiple && maxCount && maxCount < value.length) {
message.warn(`最多选择${maxCount}个`); message.warn(`最多选择${maxCount}个`);
return; return;
} }
if (typeof onChange === 'function') { if (typeof onChange === 'function') {
if (typeof onBlurFn === 'function' && !isOpen.current) {
onBlurFn({ ...props, value });
}
onChange(value, value); onChange(value, value);
} }
}; };
if (isMultiple) { const singleBlurFn = (e: boolean) => {
selfProps.mode = 'multiple'; isOpen.current = e;
} };
const multipleBlurFn = (e: boolean) => {
isOpen.current = e;
if (typeof onBlurFn === 'function' && !e) {
onBlurFn(props);
}
};
return ( return (
<Search origin === 'editForm' ?
className={s.search} <Search
request={request} className={s.search}
fieldNames={{ value: 'fieldValueValue', label: 'fieldValueName' }} request={request}
{...selfProps} fieldNames={{ value: 'fieldValueValue', label: 'fieldValueName' }}
onChange={changeValue} {...selfProps}
initDataType="onfocus" onChange={changeValue}
/> onDropdownVisibleChange={selfProps.mode === 'multiple' ? multipleBlurFn : singleBlurFn}
initDataType="onfocus"
/> : <Search
className={s.search}
request={request}
fieldNames={{ value: 'fieldValueValue', label: 'fieldValueName' }}
{...selfProps}
onChange={changeValue}
initDataType="onfocus"
/>
); );
}; };
import React from 'react'; import React, { useRef } from 'react';
import { Select } from 'antd'; import { Select } from 'antd';
import { onBlurFn } from '../onBlurFn';
import { ApolloSelectProps } from '../editInterface'; import { ApolloSelectProps } from '../editInterface';
import { antiAssign } from '../../../../utils/utils'; import { antiAssign } from '../../../../utils/utils';
import styles from './styles.less'; import styles from './styles.less';
export const ApolloSelect = (props: ApolloSelectProps) => { export const ApolloSelect = (props: ApolloSelectProps) => {
const { options = [], onChange, isMultiple } = props; const { options = [], onChange, isMultiple, origin } = props;
const selfProps = antiAssign(props, ['columnConfig', 'onChange', 'isMultiple', 'options']); const selfProps = antiAssign(props, ['columnConfig', 'onChange', 'isMultiple', 'options']);
const isOpen = useRef();
if (isMultiple) {
selfProps.mode = 'multiple';
}
const changeValue = (value: any, option: any) => { const changeValue = (value: any, option: any) => {
if (typeof onChange === 'function') { if (typeof onChange === 'function') {
if (typeof onBlurFn === 'function' && !isOpen.current) {
onBlurFn({ ...props, value });
}
onChange(value, option); onChange(value, option);
} }
}; };
const singleBlurFn = (e: boolean) => {
if (isMultiple) { isOpen.current = e;
selfProps.mode = 'multiple'; };
} const multipleBlurFn = (e: boolean) => {
return ( isOpen.current = e;
if (typeof onBlurFn === 'function' && !e) {
onBlurFn(props);
}
};
return (origin === 'editForm' ?
<Select <Select
className={styles.select} className={styles.select}
{...selfProps} {...selfProps}
onChange={changeValue} onChange={changeValue}
onDropdownVisibleChange={selfProps.mode === 'multiple' ? multipleBlurFn : singleBlurFn}
>
{options.map((item) => {
return (
<Select.Option key={item.id} value={item.id}>
{item.name}
</Select.Option>
);
})}
</Select> : <Select
className={styles.select}
{...selfProps}
onChange={changeValue}
> >
{options.map((item) => { {options.map((item) => {
return ( return (
......
import React from 'react'; import React, { useRef } from 'react';
import InputSearch from '../../extra/dataEntry/textSelect'; import InputSearch from '../../extra/dataEntry/textSelect';
import { ApolloInputSearchProps } from '../editInterface'; import { ApolloInputSearchProps } from '../editInterface';
import { antiAssign } from '../../../../utils/utils'; import { antiAssign } from '../../../../utils/utils';
import { onBlurFn } from '../onBlurFn';
import s from './index.less'; import s from './index.less';
export const ApolloInputSearch = (props: ApolloInputSearchProps) => { export const ApolloInputSearch = (props: ApolloInputSearchProps) => {
const { onChange, request } = props; const { onChange, request } = props;
const selfProps = antiAssign(props, ['columnConfig', 'onChange', 'request']); const selfProps = antiAssign(props, ['columnConfig', 'onChange', 'request']);
const isOpen = useRef();
const changeValue = (value) => { const changeValue = (value: any) => {
if (typeof onChange === 'function') { if (typeof onChange === 'function') {
if (typeof onBlurFn === 'function' && !isOpen.current) {
onBlurFn({ ...props, value });
}
onChange(value, value); onChange(value, value);
} }
}; };
const singleBlurFn = (e: boolean) => {
isOpen.current = e;
};
return ( return (
<InputSearch <InputSearch
className={s.select} className={s.select}
request={request} request={request}
fieldNames={{ value: 'fieldValueValue', label: 'fieldValueName' }} fieldNames={{ value: 'fieldValueValue', label: 'fieldValueName' }}
{...selfProps} {...selfProps}
onDropdownVisibleChange={singleBlurFn}
onChange={changeValue} onChange={changeValue}
initDataType="onfocus" initDataType="onfocus"
/> />
......
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { Input, Modal } from 'antd'; import { Input, Modal } from 'antd';
import styles from './styles.less'; import styles from './styles.less';
import { onBlurFn } from '../onBlurFn';
import { antiAssign } from '../../../../utils/utils'; import { antiAssign } from '../../../../utils/utils';
import { ApolloTextAreaProps } from '../editInterface'; import { ApolloTextAreaProps } from '../editInterface';
import { Consumer } from '../../../context'; import { Consumer } from '../../../context';
export const ApolloTextArea = (props: ApolloTextAreaProps) => { export const ApolloTextArea = (props: ApolloTextAreaProps) => {
const { maxLength, onChange, value, cutLength, getDetail, rowData, onEmitChange, columnConfig, origin } = props; const { maxLength, onChange, value, getDetail, rowData, onEmitChange, columnConfig, origin } = props;
const { columnChsName } = columnConfig; const { columnChsName } = columnConfig;
const selfProps = antiAssign(props, ['columnConfig', 'onChange', 'value', 'cutLength', 'getDetail', 'rowData', 'onEmitChange']); const selfProps = antiAssign(props, ['columnConfig', 'onChange', 'value', 'cutLength', 'getDetail', 'rowData', 'onEmitChange']);
const [curValue, setCurValue] = useState(value); const [curValue, setCurValue] = useState(value);
...@@ -22,14 +23,21 @@ export const ApolloTextArea = (props: ApolloTextAreaProps) => { ...@@ -22,14 +23,21 @@ export const ApolloTextArea = (props: ApolloTextAreaProps) => {
// getMore(); // getMore();
// } // }
// }, []); // }, []);
const [inputVal, setInputVal] = useState(value)
const changeValue = (e) => { useEffect(() => {
setInputVal(value);
}, [value]);
const changeValue = (e: any) => {
if (typeof onChange === 'function') { if (typeof onChange === 'function') {
onChange(e.target.value); onChange(e.target.value);
} }
}; };
const inputOnBlurFn = () => {
const changeCurValue = (e) => { if (typeof onBlurFn === 'function') {
onBlurFn(props);
}
};
const changeCurValue = (e: any) => {
if (typeof onChange === 'function') { if (typeof onChange === 'function') {
setCurValue(e.target.value); setCurValue(e.target.value);
} }
...@@ -59,7 +67,6 @@ export const ApolloTextArea = (props: ApolloTextAreaProps) => { ...@@ -59,7 +67,6 @@ export const ApolloTextArea = (props: ApolloTextAreaProps) => {
} }
} }
}; };
if (origin === 'editForm') { if (origin === 'editForm') {
return ( return (
<Consumer> <Consumer>
...@@ -69,9 +76,14 @@ export const ApolloTextArea = (props: ApolloTextAreaProps) => { ...@@ -69,9 +76,14 @@ export const ApolloTextArea = (props: ApolloTextAreaProps) => {
<Input.TextArea <Input.TextArea
className={styles.inputForm} className={styles.inputForm}
{...selfProps} {...selfProps}
value={value} value={inputVal}
onChange={changeValue} onBlur={inputOnBlurFn}
onChange={(e) => {
changeValue(e)
setInputVal(e.target.value)
}}
/> />
{!!maxLength && ( {!!maxLength && (
<span className={styles.wordNumberForm}> <span className={styles.wordNumberForm}>
{`${locale.alreadyInput} ${(value || '').length}/${maxLength}`} {`${locale.alreadyInput} ${(value || '').length}/${maxLength}`}
......
...@@ -4,6 +4,7 @@ import classNames from 'classnames'; ...@@ -4,6 +4,7 @@ import classNames from 'classnames';
import { ApolloUploadProps } from '../editInterface'; import { ApolloUploadProps } from '../editInterface';
import { antiAssign } from '../../../../utils/utils'; import { antiAssign } from '../../../../utils/utils';
import s from './index.less'; import s from './index.less';
import { onBlurFn } from '../onBlurFn';
import Upload from '../../extra/upload'; import Upload from '../../extra/upload';
import addIcon from '../../../../assets/addIcon.png'; import addIcon from '../../../../assets/addIcon.png';
...@@ -53,6 +54,7 @@ export const ApolloUpload = (props: ApolloUploadProps) => { ...@@ -53,6 +54,7 @@ export const ApolloUpload = (props: ApolloUploadProps) => {
onChange(value); onChange(value);
} }
toggleUploadDialog(false); toggleUploadDialog(false);
onBlurFn({ ...props, value })
}; };
const onCancel = () => { const onCancel = () => {
if (typeof onEmitChange === 'function') { if (typeof onEmitChange === 'function') {
......
...@@ -20,9 +20,9 @@ interface Props { ...@@ -20,9 +20,9 @@ interface Props {
} }
enum Loaded { enum Loaded {
Init='init', Init = 'init',
Has='has', Has = 'has',
Empty='empty', Empty = 'empty',
} }
interface State { interface State {
...@@ -214,7 +214,7 @@ class AssociationSearch extends React.Component<Props, State> { ...@@ -214,7 +214,7 @@ class AssociationSearch extends React.Component<Props, State> {
} }
}; };
notFoundContent = (locale:any) => { notFoundContent = (locale: any) => {
const { fetching, loaded } = this.state; const { fetching, loaded } = this.state;
if (fetching) { if (fetching) {
return <Spin size="small" />; return <Spin size="small" />;
...@@ -230,7 +230,7 @@ class AssociationSearch extends React.Component<Props, State> { ...@@ -230,7 +230,7 @@ class AssociationSearch extends React.Component<Props, State> {
const { selfCom, autoFocus, onChange, ...rest } = this.props; const { selfCom, autoFocus, onChange, ...rest } = this.props;
return ( return (
<Consumer> <Consumer>
{({ locale }:any) => { {({ locale }: any) => {
return ( return (
<Select <Select
filterOption={false} filterOption={false}
......
...@@ -3,7 +3,7 @@ import React from 'react'; ...@@ -3,7 +3,7 @@ import React from 'react';
import { transferAttr } from './_utils/transferAttr'; import { transferAttr } from './_utils/transferAttr';
import { BaseComponentProps, BaseComponentState } from '../interface'; import { BaseComponentProps, BaseComponentState } from '../interface';
export const setFormat = (config:any, columnConfig: any, value: any, option?: any) => { export const setFormat = (config: any, columnConfig: any, value: any, option?: any) => {
const { columnAttrObj, columnType } = columnConfig || {}; const { columnAttrObj, columnType } = columnConfig || {};
const transferColumn = transferAttr(columnType, { const transferColumn = transferAttr(columnType, {
...(config.componentAttr || {}), ...(config.componentAttr || {}),
...@@ -13,7 +13,7 @@ export const setFormat = (config:any, columnConfig: any, value: any, option?: an ...@@ -13,7 +13,7 @@ export const setFormat = (config:any, columnConfig: any, value: any, option?: an
return value; return value;
}; };
export const getFormat = (config:any, columnConfig: any, value: any) => { export const getFormat = (config: any, columnConfig: any, value: any) => {
const { columnAttrObj, columnType } = columnConfig || {}; const { columnAttrObj, columnType } = columnConfig || {};
if (!value || !Array.isArray(value) || value.length <= 0) return undefined; if (!value || !Array.isArray(value) || value.length <= 0) return undefined;
const transferColumn = transferAttr(columnType, { const transferColumn = transferAttr(columnType, {
......
...@@ -8,6 +8,10 @@ ...@@ -8,6 +8,10 @@
* 监听表单值发生变化是的回掉:onValuesChange:Function * 监听表单值发生变化是的回掉:onValuesChange:Function
* *
* 样式:propClass:object * 样式:propClass:object
*
* 增加字段:hideOperateBtn,有该字段,隐藏表单底部操作按钮
*
* 失去焦点:onBlurFn
* */ * */
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Form, Button } from 'antd'; import { Form, Button } from 'antd';
...@@ -16,18 +20,20 @@ import { config } from '../component/base/config'; ...@@ -16,18 +20,20 @@ import { config } from '../component/base/config';
import { transferAttr } from '../component/base/_utils/transferAttr'; import { transferAttr } from '../component/base/_utils/transferAttr';
import { getFormat, setFormat } from '../component/base'; import { getFormat, setFormat } from '../component/base';
import { Provider } from '../component/context'; import { Provider } from '../component/context';
import { emptyModel } from '@/submodule/components/apolloTable/component/base/_utils/setFormatter';
import { defaultLocale } from '@/submodule/components/apolloTable/locale'; import { defaultLocale } from '@/submodule/components/apolloTable/locale';
import _ from 'lodash'; import _ from 'lodash';
const FormItem = Form.Item; const FormItem = Form.Item;
class FormWrap extends Component { class FormWrap extends Component {
wrapDom:any; wrapDom: any;
handleSubmit = (e) => { handleSubmit = (e) => {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
const { rowId, form, handleSubmit, data, rowData, detailType } = this.props; const { rowId, form, handleSubmit, data, rowData, detailType } = this.props;
form.validateFieldsAndScroll((err, values) => { form.validateFieldsAndScroll((err, values) => {
console.log(data, 8888)
if (!err) { if (!err) {
const newValues: any[] = []; const newValues: any[] = [];
_.keys(values).map((key) => { _.keys(values).map((key) => {
...@@ -85,7 +91,7 @@ class FormWrap extends Component { ...@@ -85,7 +91,7 @@ class FormWrap extends Component {
renderEditForm = (item) => { renderEditForm = (item) => {
const { getFieldDecorator } = this.props.form; const { getFieldDecorator } = this.props.form;
const { rowData, rowId, getInstanceDetail } = this.props; const { rowData, rowId, getInstanceDetail, onBlurFn } = this.props;
const { const {
columnType, columnType,
columnName, columnName,
...@@ -112,7 +118,20 @@ class FormWrap extends Component { ...@@ -112,7 +118,20 @@ class FormWrap extends Component {
}; };
const transferColumn = transferAttr(columnType, newProps); const transferColumn = transferAttr(columnType, newProps);
const disabled = readOnlyFlag || (dynamicCellConfigDTO && dynamicCellConfigDTO.readonlyFlag); const disabled = readOnlyFlag || (dynamicCellConfigDTO && dynamicCellConfigDTO.readonlyFlag);
const onBlurFn1 = (changedValue: any, newVal: any) => {
let temp: any[] = [];
value.map((item: any) => {
temp.push({ text: item.text, value: item.value });
});
if (temp.length === 0) {
temp = emptyModel;
}
if (_.isEqual(temp, newVal)) {
return;
}
onBlurFn(changedValue)
}
return ( return (
<FormItem key={columnName} label={this.renderLabel(item)}> <FormItem key={columnName} label={this.renderLabel(item)}>
{getFieldDecorator(columnName, { {getFieldDecorator(columnName, {
...@@ -136,7 +155,9 @@ class FormWrap extends Component { ...@@ -136,7 +155,9 @@ class FormWrap extends Component {
getPopupContainer={() => { getPopupContainer={() => {
return this.wrapDom; return this.wrapDom;
}} }}
/>, rowId={rowId}
onBlurFn={onBlurFn1}
/>
)} )}
</FormItem> </FormItem>
); );
...@@ -156,7 +177,7 @@ class FormWrap extends Component { ...@@ -156,7 +177,7 @@ class FormWrap extends Component {
}; };
render() { render() {
const { loading, isShowDelBtn, data, btnWrapStyle, name, colsNum, delLabel } = this.props; const { loading, isShowDelBtn, data, btnWrapStyle, name, colsNum, delLabel, hideOperateBtn } = this.props;
return ( return (
<Provider value={{ locale: this.getContext() }}> <Provider value={{ locale: this.getContext() }}>
...@@ -187,27 +208,32 @@ class FormWrap extends Component { ...@@ -187,27 +208,32 @@ class FormWrap extends Component {
})} })}
</Form> </Form>
</div> </div>
<div className={styles.buttonWrap} style={btnWrapStyle}> {
<div style={{ display: 'flex', justifyContent: 'center' }}> hideOperateBtn ? null : (
{isShowDelBtn ? ( <div className={styles.buttonWrap} style={btnWrapStyle}>
<Button onClick={this.handleDelete} type="link" className={styles.delBtnCls}> <div style={{ display: 'flex', justifyContent: 'center' }}>
{delLabel || '删除'} {isShowDelBtn ? (
<Button onClick={this.handleDelete} type="link" className={styles.delBtnCls}>
{delLabel || '删除'}
</Button>
) : null}
<Button onClick={this.handleCancel} className={styles.btnCls}>
取消
</Button> </Button>
) : null} <Button
<Button onClick={this.handleCancel} className={styles.btnCls}> onClick={this.handleSubmit}
取消 type="primary"
</Button> className={styles.btnCls}
<Button loading={loading}
onClick={this.handleSubmit} id="submitBtn" // 用于业务监听此dom节点
type="primary" >
className={styles.btnCls} 确定
loading={loading} </Button>
id="submitBtn" // 用于业务监听此dom节点 </div>
> </div>
确定 )
</Button> }
</div>
</div>
</div> </div>
</Provider> </Provider>
); );
...@@ -232,11 +258,8 @@ function mapPropsToFields(props) { ...@@ -232,11 +258,8 @@ function mapPropsToFields(props) {
}); });
return returnObj; return returnObj;
} }
function onValuesChange(props: any, changedValues: any, allValues: any) {
function onValuesChange(props, changedValues, allValues) { if (props.changeValue) { }
if (props.changeValue) {
props.changeValue(changedValues, allValues);
}
} }
export default Form.create({ name: 'form_view' })(FormWrap); export default Form.create({ name: 'form_view' })(FormWrap);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment