verou
2025-03-15 1e06ec3b91e1bca46f9f2a5b9718bbc346a30073
rsf-admin/src/page/asnOrder/AsnOrderList.jsx
@@ -49,6 +49,7 @@
import EditIcon from '@mui/icons-material/Edit';
const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({
  '& .css-1vooibu-MuiSvgIcon-root': {
    height: '.9em'
@@ -99,11 +100,13 @@
  const [createDialog, setCreateDialog] = useState(false);
  const [drawerVal, setDrawerVal] = useState(false);
  const [modalType, setmodalType] = useState(0);
  const navigate = useNavigate();
  const assign = (record) => {
    navigate(`/asnOrderItem?asnId=${record.id}`);
  };
  const inspection = () => { };
  const print = () => { };
@@ -121,7 +124,7 @@
          marginRight: drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0,
        }}
        title={"menu.asnOrder"}
        empty={<EmptyData onClick={() => { setCreateDialog(true) }} />}
        empty={<EmptyData onClick={() => { setCreateDialog(true); setmodalType(0) }} />}
        filters={filters}
        sort={{ field: "create_time", order: "desc" }}
        actions={(
@@ -131,7 +134,7 @@
              <ConstructionIcon />
            </Button>
            <FilterButton />
            <MyCreateButton onClick={() => { setCreateDialog(true) }} />
            <MyCreateButton onClick={() => { setCreateDialog(true); setmodalType(0) }} />
            <SelectColumnsButton preferenceKey='asnOrder' />
            <MyExportButton />
@@ -143,7 +146,7 @@
          preferenceKey='asnOrder'
          bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />}
          rowClick={(id, resource, record) => false}
          expand={() => <AsnOrderPanel />}
          expand={(e) => <AsnOrderPanel key={Math.floor(Math.random() * 100)} />}
          expandSingle={true}
          omit={['id', 'createTime', 'createBy', 'memo']}
        >
@@ -181,14 +184,15 @@
              <FileDownloadIcon />
            </Button>
            {/* <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} /> */}
            <Button
            <MyButton setCreateDialog={setCreateDialog} setmodalType={setmodalType} />
            {/* <Button
              color="primary"
              startIcon={<EditIcon />}
              onClick={() => { setCreateDialog(true) }}
              onClick={(event, record) => handleEditClick(record)}
              sx={{ ml: 1 }}
              label={'ra.action.edit'}
            >
            </Button>
            </Button> */}
            <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} />
          </WrapperField>
        </StyledDatagrid>
@@ -196,6 +200,7 @@
      <AsnOrderModal
        open={createDialog}
        setOpen={setCreateDialog}
        asnId={modalType}
      />
      <PageDrawer
        title='AsnOrder Detail'
@@ -207,3 +212,23 @@
  )
}
export default AsnOrderList;
const MyButton = ({ setCreateDialog, setmodalType }) => {
  const record = useRecordContext();
  const handleEditClick = () => {
    const id = record.id;
    setmodalType(id);
    setCreateDialog(true);
  };
  return (
    <Button
      color="primary"
      startIcon={<EditIcon />}
      onClick={() => handleEditClick()}
      sx={{ ml: 1 }}
      label={'ra.action.edit'}
    >
    </Button>
  )
}