@@ -482,9 +482,36 @@ const BomConfig = (props) => { | |||
columns={columnsChoose} | |||
rowSelection={{ | |||
type: 'checkbox', | |||
onSelect: (record, selected) => { | |||
const currentSelectedRows = JSON.parse(JSON.stringify(selectedRows)); | |||
const currentSelectedRowKeys = JSON.parse(JSON.stringify(selectedRowKeys)); | |||
const findRowIndex = currentSelectedRows.findIndex(item => item.id === record.id); | |||
const findKeysIndex = currentSelectedRowKeys.findIndex(item => item === record.id); | |||
if (selected) { | |||
if (findRowIndex < 0) { | |||
currentSelectedRows.push(record); | |||
} | |||
if (findKeysIndex < 0) { | |||
currentSelectedRowKeys.push(record.id); | |||
} | |||
} else { | |||
if (findRowIndex > -1) { | |||
currentSelectedRows.splice(findRowIndex, 1); | |||
} | |||
if (findKeysIndex > -1) { | |||
currentSelectedRowKeys.splice(findKeysIndex, 1); | |||
} | |||
} | |||
setSetSelectedRows(currentSelectedRows); | |||
setSelectRowKeys(currentSelectedRowKeys); | |||
}, | |||
onChange: (selectedRowKeys, selectedRows) => { | |||
setSelectRowKeys(selectedRowKeys); | |||
setSetSelectedRows(selectedRows); | |||
if (selectedRowKeys.length === 0) { | |||
setSelectRowKeys([]); | |||
} | |||
if (selectedRows.length === 0) { | |||
setSetSelectedRows([]); | |||
} | |||
}, | |||
selectedRowKeys: selectedRowKeys | |||
}} | |||
@@ -745,9 +745,36 @@ const GoodsConfig = (props) => { | |||
columns={columnsChoose} | |||
rowSelection={{ | |||
type: 'checkbox', | |||
onSelect: (record, selected) => { | |||
const currentSelectedRows = JSON.parse(JSON.stringify(selectedRows)); | |||
const currentSelectedRowKeys = JSON.parse(JSON.stringify(selectedRowKeys)); | |||
const findRowIndex = currentSelectedRows.findIndex(item => item.id === record.id); | |||
const findKeysIndex = currentSelectedRowKeys.findIndex(item => item === record.id); | |||
if (selected) { | |||
if (findRowIndex < 0) { | |||
currentSelectedRows.push(record); | |||
} | |||
if (findKeysIndex < 0) { | |||
currentSelectedRowKeys.push(record.id); | |||
} | |||
} else { | |||
if (findRowIndex > -1) { | |||
currentSelectedRows.splice(findRowIndex, 1); | |||
} | |||
if (findKeysIndex > -1) { | |||
currentSelectedRowKeys.splice(findKeysIndex, 1); | |||
} | |||
} | |||
setSetSelectedRows(currentSelectedRows); | |||
setSelectRowKeys(currentSelectedRowKeys); | |||
}, | |||
onChange: (selectedRowKeys, selectedRows) => { | |||
setSelectRowKeys(selectedRowKeys); | |||
setSetSelectedRows(selectedRows); | |||
if (selectedRowKeys.length === 0) { | |||
setSelectRowKeys([]); | |||
} | |||
if (selectedRows.length === 0) { | |||
setSetSelectedRows([]); | |||
} | |||
}, | |||
selectedRowKeys: selectedRowKeys | |||
}} | |||
@@ -683,9 +683,36 @@ const MaterialConfig = (props) => { | |||
columns={columnsChoose} | |||
rowSelection={{ | |||
type: 'checkbox', | |||
onSelect: (record, selected) => { | |||
const currentSelectedRows = JSON.parse(JSON.stringify(selectedRows)); | |||
const currentSelectedRowKeys = JSON.parse(JSON.stringify(selectedRowKeys)); | |||
const findRowIndex = currentSelectedRows.findIndex(item => item.id === record.id); | |||
const findKeysIndex = currentSelectedRowKeys.findIndex(item => item === record.id); | |||
if (selected) { | |||
if (findRowIndex < 0) { | |||
currentSelectedRows.push(record); | |||
} | |||
if (findKeysIndex < 0) { | |||
currentSelectedRowKeys.push(record.id); | |||
} | |||
} else { | |||
if (findRowIndex > -1) { | |||
currentSelectedRows.splice(findRowIndex, 1); | |||
} | |||
if (findKeysIndex > -1) { | |||
currentSelectedRowKeys.splice(findKeysIndex, 1); | |||
} | |||
} | |||
setSetSelectedRows(currentSelectedRows); | |||
setSelectRowKeys(currentSelectedRowKeys); | |||
}, | |||
onChange: (selectedRowKeys, selectedRows) => { | |||
setSelectRowKeys(selectedRowKeys); | |||
setSetSelectedRows(selectedRows); | |||
if (selectedRowKeys.length === 0) { | |||
setSelectRowKeys([]); | |||
} | |||
if (selectedRows.length === 0) { | |||
setSetSelectedRows([]); | |||
} | |||
}, | |||
selectedRowKeys: selectedRowKeys | |||
}} | |||