React antd Table 组件上
{ title: ‘是否为小微企业‘, dataIndex: ‘isXw‘, align: ‘center‘, width: 150, onCell: (record, index) => ({ index, record, dataIndex: ‘isXw‘, inputType: ‘isRadio‘, handleOnChange: (dataIndex, value) => handleCellChange(index, dataIndex, value), }), }, { title: `属于小微企业产品价格合计`, dataIndex: ‘de181Xw‘, align: ‘center‘, onCell: (record, index) => ({ index, record, dataIndex: ‘de181Xw‘, inputType: ‘money‘, max: record.de181Bj, width: 230, handleOnChange: (dataIndex, value) => handleCellChange(index, dataIndex, value), }), },
React antd Table 组件上 Oncell 方式上 change 事件方法
// input选择变化
function handleCellChange(index, dataIndex, value) {
const newList = tableList.slice();
if (dataIndex === ‘isXw‘) {
if (value === 1) {
newList[index] = { ...newList[index], [dataIndex]: value, de181Xw: 9000 };
form.setFieldsValue(newList);
} else {
newList[index] = { ...newList[index], [dataIndex]: value, de181Xw: 0 };
form.setFieldsValue(newList);
}
} else {
form.setFieldsValue(newList);
newList[index] = { ...newList[index], [dataIndex]: value };
setTableList(newList);
}
setTableList(newList);
}