/** * 表格行事件 */ import React from 'react'; import Invoice from '../../../../..'; import IGood from '../../../../../InvoiceController/InvoiceControllerState/FreightListState/IGood'; export default () => { /** 控制器 */ const controller = Invoice.useInvoiceController(); const model = controller.useMemo(s => s.model, []); const onClick = React.useCallback( async (record: IGood) => { // if (model === 'prefab') return; if (model === 'readOnly') return; const editGood = controller.state.freightListState.editGood; if (editGood) { if (editGood.$index === record.$index) return; await controller.saveEditFreight(); await controller.wait(); await controller.pipeline(async s => { s.freightListState.editGood || (await controller.setEditFreight(record)) })(); } else { await controller.setEditFreight(record); } }, [controller, model], ); return { onClick, }; };