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';
|
||||
const EditableContext = React.createContext(null);
|
||||
const EditableRow = ({ index, ...props }) => {
|
||||
|
|
@ -60,8 +60,14 @@ const EditableCell = ({
|
|||
margin: 0,
|
||||
}}
|
||||
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>
|
||||
) : (
|
||||
<div
|
||||
|
|
|
|||
|
|
@ -1470,11 +1470,11 @@ export default function TestLine() {
|
|||
|
||||
}
|
||||
const save = async () => {
|
||||
const all = editData.some(item => !item.drp)
|
||||
if (all) {
|
||||
message.error("所有雨量不能为空")
|
||||
return
|
||||
}
|
||||
// const all = editData.some(item => !item.drp)
|
||||
// if (all) {
|
||||
// message.error("所有雨量不能为空")
|
||||
// return
|
||||
// }
|
||||
try {
|
||||
const newTabl = editData.map(item => ({
|
||||
...item,
|
||||
|
|
|
|||
Loading…
Reference in New Issue