fix(): 表单校验
parent
79d8a0d0a1
commit
c6fd00bb26
|
|
@ -1,4 +1,4 @@
|
||||||
import { Button, Form, Input, Popconfirm, Table } from 'antd';
|
import { Button, Form, Input, InputNumber, Popconfirm, Table } from 'antd';
|
||||||
import React, { useContext, useEffect, useRef, useState } from 'react';
|
import React, { useContext, useEffect, useRef, useState } from 'react';
|
||||||
const EditableContext = React.createContext(null);
|
const EditableContext = React.createContext(null);
|
||||||
const EditableRow = ({ index, ...props }) => {
|
const EditableRow = ({ index, ...props }) => {
|
||||||
|
|
@ -60,8 +60,14 @@ const EditableCell = ({
|
||||||
margin: 0,
|
margin: 0,
|
||||||
}}
|
}}
|
||||||
name={dataIndex}
|
name={dataIndex}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: `${title}必填`,
|
||||||
|
},
|
||||||
|
]}
|
||||||
>
|
>
|
||||||
<Input ref={inputRef} onPressEnter={save} onBlur={save} />
|
<InputNumber min={0} ref={inputRef} onPressEnter={save} onBlur={save} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
) : (
|
) : (
|
||||||
<div
|
<div
|
||||||
|
|
|
||||||
|
|
@ -1470,11 +1470,11 @@ export default function TestLine() {
|
||||||
|
|
||||||
}
|
}
|
||||||
const save = async () => {
|
const save = async () => {
|
||||||
const all = editData.some(item => !item.drp)
|
// const all = editData.some(item => !item.drp)
|
||||||
if (all) {
|
// if (all) {
|
||||||
message.error("所有雨量不能为空")
|
// message.error("所有雨量不能为空")
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
try {
|
try {
|
||||||
const newTabl = editData.map(item => ({
|
const newTabl = editData.map(item => ({
|
||||||
...item,
|
...item,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue