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

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

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