Commit a0f638f3 authored by zhangwenshuai's avatar zhangwenshuai

update apolloTable editform

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