Commit e0302c82 by zhaochengxiang

去掉多余代码

parent 8cae8b87
......@@ -366,13 +366,10 @@ const UpdateField = (props) => {
form.setFieldsValue({...record, dataType: dataTypeJson});
setEditingKey(record?.name);
editingKeyRef.current = record?.name;
console.log('editing current', record?.name);
} catch {
form.setFieldsValue({...record, dataType: {}});
setEditingKey(record?.name);
editingKeyRef.current = record?.name;
console.log('editing current', record?.name);
}
}
......@@ -448,8 +445,8 @@ const UpdateField = (props) => {
const moveRow = useCallback(
(dragIndex, hoverIndex) => {
const dragRow = dataRef.current[dragIndex];
const newData = update(dataRef.current, {
const dragRow = data[dragIndex];
const newData = update(data, {
$splice: [
[dragIndex, 1],
[hoverIndex, 0, dragRow],
......@@ -460,7 +457,7 @@ const UpdateField = (props) => {
dataRef.current = newData;
onChange && onChange(newData);
//eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
}, [data]);
const onTableRow = (record, index) => {
let rowParams = {
......@@ -545,7 +542,26 @@ const UpdateField = (props) => {
row: (editable&&editingKey===null&&keyword==='')?DragableBodyRow:null,
},
}}
onRow={onTableRow}
onRow={(record, index) => {
let attr = {
index,
id: `field-${record.name}`,
};
if (!isEditing(record)) {
attr = {
index,
id: `field-${record.name}`,
onClick: (event) => {
event.stopPropagation();
editItem(record);
},
moveRow
};
}
return attr;
}}
/>
</Form>
</DndProvider>
......
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