|  |  |  | 
|---|
|  |  |  | import MyExportButton from '../components/MyExportButton'; | 
|---|
|  |  |  | import PageDrawer from "../components/PageDrawer"; | 
|---|
|  |  |  | import MyField from "../components/MyField"; | 
|---|
|  |  |  | import { PAGE_DRAWER_WIDTH, OPERATE_MODE } from '@/config/setting'; | 
|---|
|  |  |  | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; | 
|---|
|  |  |  | import * as Common from '@/utils/common'; | 
|---|
|  |  |  | import AssignPermissions from "./AssignPermissions"; | 
|---|
|  |  |  | import request from '@/utils/request'; | 
|---|
|  |  |  | 
|---|
|  |  |  | '& .column-name': { | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | '& .opt': { | 
|---|
|  |  |  | width: 300 | 
|---|
|  |  |  | width: 260 | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | })); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | <MyExportButton /> | 
|---|
|  |  |  | </TopToolbar> | 
|---|
|  |  |  | )} | 
|---|
|  |  |  | perPage={25} | 
|---|
|  |  |  | perPage={DEFAULT_PAGE_SIZE} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <StyledDatagrid | 
|---|
|  |  |  | preferenceKey='role' | 
|---|
|  |  |  | 
|---|
|  |  |  | onClick={(event, record, val) => { | 
|---|
|  |  |  | event.stopPropagation(); | 
|---|
|  |  |  | assign(record); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }} | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | <TextField source="code" label="table.field.role.code" /> | 
|---|
|  |  |  | 
|---|
|  |  |  | <BooleanField source="statusBool" label="common.field.status" sortable={false} /> | 
|---|
|  |  |  | <TextField source="memo" label="common.field.memo" sortable={false} /> | 
|---|
|  |  |  | <WrapperField cellClassName="opt" label="common.field.opt"> | 
|---|
|  |  |  | <ScopeButton sx={{ padding: '1px', fontSize: '.75rem' }} /> | 
|---|
|  |  |  | <ScopeButton sx={{ padding: '1px', fontSize: '.75rem' }} assign={assign} /> | 
|---|
|  |  |  | <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} /> | 
|---|
|  |  |  | <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> | 
|---|
|  |  |  | </WrapperField> | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const ScopeButton = (props) => { | 
|---|
|  |  |  | const record = useRecordContext(); | 
|---|
|  |  |  | console.log(record); | 
|---|
|  |  |  | const { ...rest } = props; | 
|---|
|  |  |  | const { assign, ...rest } = props; | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | <Button | 
|---|
|  |  |  | variant="text" | 
|---|
|  |  |  | color="primary" | 
|---|
|  |  |  | startIcon={<AssignmentIndIcon />} | 
|---|
|  |  |  | label="common.action.scope" | 
|---|
|  |  |  | onClick={(event, record) => { | 
|---|
|  |  |  | console.log(record); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | onClick={(event) => { | 
|---|
|  |  |  | event.stopPropagation(); | 
|---|
|  |  |  | assign(record); | 
|---|
|  |  |  | }} | 
|---|
|  |  |  | {...rest} | 
|---|
|  |  |  | /> | 
|---|