Commit a0f638f3 authored by zhangwenshuai's avatar zhangwenshuai

update apolloTable editform

parent 2663914e
...@@ -29,15 +29,14 @@ class FormWrap extends Component { ...@@ -29,15 +29,14 @@ class FormWrap extends Component {
form.validateFieldsAndScroll((err, values) => { form.validateFieldsAndScroll((err, values) => {
if (!err) { if (!err) {
const newValues: any[] = []; const newValues: any[] = [];
debugger
_.keys(values).map((key) => { _.keys(values).map((key) => {
const item = data.find((temp: any) => { const item = data.find((temp: any) => {
return temp.columnName === key; return temp.columnName === key;
}); });
const { columnType, renderEditForm, readOnlyFlag, dynamicCellConfigDTO } = item; const { columnType, renderEditForm, readOnlyFlag, dynamicCellConfigDTO } = item;
// if (readOnlyFlag || (dynamicCellConfigDTO && dynamicCellConfigDTO.readonlyFlag)) { if (readOnlyFlag || (dynamicCellConfigDTO && dynamicCellConfigDTO.readonlyFlag)) {
// return; return;
// } }
let detailConfig: any; let detailConfig: any;
if (typeof renderEditForm === 'function') { if (typeof renderEditForm === 'function') {
detailConfig = renderEditForm({ cellData: values[key], rowData, columnConfig: item }); detailConfig = renderEditForm({ cellData: values[key], rowData, columnConfig: item });
...@@ -81,29 +80,6 @@ class FormWrap extends Component { ...@@ -81,29 +80,6 @@ class FormWrap extends Component {
); );
}; };
validateRequired = (item, rule, value, callback) => {
const { columnAttrObj = {} } = item;
const { validator } = columnAttrObj;
if (!item.requiredFlag) {
callback();
return;
}
if (!value || value.length === 0) {
callback('必填项不能为空');
return;
}
const [first] = value;
if (!first.text && first.text !== 0 && !first.value && first.value !== 0) {
callback('必填项不能为空');
return;
}
if (validator && typeof validator === 'function') {
const values = this.props.form.getFieldsValue();
callback(validator({ value, values, item }));
}
callback();
};
renderEditForm = (item) => { renderEditForm = (item) => {
const { getFieldDecorator } = this.props.form; const { getFieldDecorator } = this.props.form;
const { rowData } = this.props; const { rowData } = this.props;
...@@ -158,7 +134,7 @@ class FormWrap extends Component { ...@@ -158,7 +134,7 @@ class FormWrap extends Component {
}; };
render() { render() {
const { loading, isShowDelBtn, data, btnWrapStyle, name, colsNum } = this.props; const { loading, isShowDelBtn, data, btnWrapStyle, name, colsNum, delLabel } = this.props;
return ( return (
<Provider value={{ locale: this.getContext() }}> <Provider value={{ locale: this.getContext() }}>
...@@ -193,7 +169,7 @@ class FormWrap extends Component { ...@@ -193,7 +169,7 @@ class FormWrap extends Component {
<div style={{ display: 'flex', justifyContent: 'center' }}> <div style={{ display: 'flex', justifyContent: 'center' }}>
{isShowDelBtn ? ( {isShowDelBtn ? (
<Button onClick={this.handleDelete} type="link" className={styles.delBtnCls}> <Button onClick={this.handleDelete} type="link" className={styles.delBtnCls}>
删除 {delLabel || '删除'}
</Button> </Button>
) : null} ) : null}
<Button onClick={this.handleCancel} className={styles.btnCls}> <Button onClick={this.handleCancel} className={styles.btnCls}>
......
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