前端项目实战叁佰玖拾陆react-admin和material ui-Edit表格内编辑

const StepEdit = ({ id, record, resource }: { id: Identifier, record: any, resource: string }) => {
  const redirect = useRedirect()
  // const [expand,toggleExpanded]=useExpandAll(resource,id)
  return (
    <Edit resource={resource} id={id}>
      <SimpleForm toolbar={false}>
        <Stack direction={'row'}>
          <TextInput variant='outlined' sx={{ mr: 1 }} source='step_no' label='编号' />
          <TextInput variant='outlined' sx={{ mr: 1 }} source='stand_time' label='工时' />
          <TextInput variant='outlined' sx={{ mr: 1 }} source='stand_price' label='工价' />
          <TextInput variant='outlined' sx={{ mr: 1 }} source='step_desc' label='说明' />
        </Stack>
        <SaveButton sx={{ height: "36px", mt: '9px', mj: 2 }}
          type='button' mutationOptions={{
            onSuccess: () => {
              redirect(false)
              // if(expand){
              //   toggleExpanded()
              // }
            }
          }}
        >
        </SaveButton>
      </SimpleForm>
    </Edit>
  )
}

运行结果

 

posted @ 2023-09-08 08:50  前端导师歌谣  阅读(7)  评论(0)    收藏  举报  来源