diff --git a/components/apolloTable/component/Table.tsx b/components/apolloTable/component/Table.tsx index 51cbd62611bae348befd07dba609adf36680d64c..5ce3d7eb9b1952106257dc6509745212cc673bda 100644 --- a/components/apolloTable/component/Table.tsx +++ b/components/apolloTable/component/Table.tsx @@ -368,8 +368,10 @@ export default class AirTable extends Component { // totalHeight = tableHeight + scrollbarWidth; // } let realWidth = tableWidth; + let paddingRight = 0; if (rowCount > 0 && rowCount * rowHeight > totalHeight) { realWidth = tableWidth + scrollbarWidth; + paddingRight = scrollbarWidth; } return ( @@ -383,6 +385,9 @@ export default class AirTable extends Component { ? classNames(styles.tableContainer, styles.scroll) : styles.tableContainer } + style={{ + paddingRight: this.props.onScroll ? paddingRight : 0, + }} > {totalWidth > tableWidth && leftCount > 0 && (
{ - const { onChange, maxCount, isMultiple, request, type } = props; + const { onChange, maxCount, isMultiple, request } = props; const selfProps = antiAssign(props, ['columnConfig', 'onChange', 'isMultiple', 'options', 'request', 'maxCount']); const changeValue = (value) => { - if (maxCount && maxCount < value.length) { + if (isMultiple && maxCount && maxCount < value.length) { message.warn(`最多选择${maxCount}个`); return; } diff --git a/components/apolloTable/editFormV3/index.tsx b/components/apolloTable/editFormV3/index.tsx index 588129e0ba8e235e818059121f71471354c48da2..3560dffdccd7c6a8ffc06832d91bb334fa21601d 100644 --- a/components/apolloTable/editFormV3/index.tsx +++ b/components/apolloTable/editFormV3/index.tsx @@ -83,6 +83,30 @@ class FormWrap extends Component { ); }; + validateRequired = (item, rule, value, callback) => { + const { columnAttrObj = {} } = item; + const { validator } = columnAttrObj; + debugger; + 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; @@ -117,7 +141,7 @@ class FormWrap extends Component { {getFieldDecorator(columnName, { validateFirst, validateTrigger, - rules: [{ required: !!item.requiredFlag }, ...rules], + rules: [{ required: !!item.requiredFlag, message: '必填项不能为空' }, ...rules], initialValue: getFormat(detailConfig, item, value), })()}