Commit 9bbd944a authored by 武广's avatar 武广

fix: 修改规格保存延迟问题

parent 9a688b97
......@@ -87,7 +87,13 @@ export const CreateFormInput = props => {
{...options}
style={{ width: '100%' }}
placeholder={`请输入${title}`}
onBlur={e => onBlurEvent(e.target.value, dataIndex, rowIndex)}
onBlur={e => {
const inputTarget = e.target;
const timer = setTimeout(() => {
clearTimeout(timer);
onBlurEvent(inputTarget.value, dataIndex, rowIndex);
}, 10);
}}
/>
);
}
......@@ -140,6 +146,7 @@ export const CreateFormInput = props => {
const inputTarget = e.target;
const timer = setTimeout(() => {
clearTimeout(timer);
console.log('inputTarget.value :>> ', inputTarget.value);
onBlurEvent(inputTarget.value, dataIndex, rowIndex);
}, 10);
}}
......
......@@ -62,12 +62,6 @@ const EditFormTable = forwardRef((props, ref) => {
setDataSource([...initData]);
}, [initData]);
const handleSave = (value, dataIndex, rowIndex) => {
const dataList = [...dataSource];
dataList[rowIndex][dataIndex] = value;
setDataSource([...dataList]);
};
const getValues = () =>
[...dataSource].map(item => {
const { rowSpanCount, option, ...childItem } = item;
......@@ -88,6 +82,13 @@ const EditFormTable = forwardRef((props, ref) => {
props.onValuesChange();
}, 400);
const handleSave = (value, dataIndex, rowIndex) => {
const dataList = [...dataSource];
dataList[rowIndex][dataIndex] = value;
setDataSource([...dataList]);
getFormValues();
};
const rowOnClickEvent = row => {
setSkuVisble(true);
setSkuNameItem({
......
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