| | |
| | | ReferenceArrayInput, |
| | | AutocompleteInput, |
| | | DeleteButton, |
| | | FunctionField, |
| | | } from 'react-admin'; |
| | | import { Box, Typography, Card, Stack } from '@mui/material'; |
| | | import { styled } from '@mui/material/styles'; |
| | |
| | | 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 ImportButton from '../components/ImportButton' |
| | | import { useCodeImport } from './useCodeImport'; |
| | | |
| | | import * as importTemp from './importTemp.csv?raw'; |
| | | const IMPORT_TEMP_URL = `data:text/csv;name=crm_contacts_sample.csv;charset=utf-8,${encodeURIComponent(importTemp.default)}`; |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | '& .css-1vooibu-MuiSvgIcon-root': { |
| | |
| | | <TextInput source="data" label="table.field.code.data" alwaysOn />, |
| | | <NumberInput source="x" label="table.field.code.x" />, |
| | | <NumberInput source="y" label="table.field.code.y" />, |
| | | <SelectInput source="concer" label="table.field.code.concer" |
| | | <SelectInput source="corner" label="table.field.code.corner" |
| | | choices={[ |
| | | { id: 1, name: '是' }, |
| | | { id: 0, name: '否' }, |
| | | { id: '1', name: 'common.enums.true' }, |
| | | { id: '0', name: 'common.enums.false' }, |
| | | ]} |
| | | alwaysOn |
| | | />, |
| | | <TextInput source="scale" label="table.field.code.scale" />, |
| | | |
| | | // <TextInput source="scale" label="table.field.code.scale" />, |
| | | <SelectInput source="spin" label="table.field.code.spin" |
| | | choices={[ |
| | | { id: 0, name: 'page.code.enums.spin.na' }, |
| | | { id: 1, name: 'page.code.enums.spin.cw' }, |
| | | { id: 2, name: 'page.code.enums.spin.ccw' }, |
| | | ]} |
| | | // alwaysOn |
| | | // emptyText={false} |
| | | />, |
| | | <TextInput label="common.field.memo" source="memo" />, |
| | | <SelectInput |
| | | label="common.field.status" |
| | |
| | | title={"menu.code"} |
| | | empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} |
| | | filters={filters} |
| | | sort={{ field: "create_time", order: "desc" }} |
| | | sort={{ field: "id", order: "asc" }} |
| | | actions={( |
| | | <TopToolbar> |
| | | <FilterButton /> |
| | | <MyCreateButton onClick={() => { setCreateDialog(true) }} /> |
| | | <SelectColumnsButton preferenceKey='code' /> |
| | | <ImportButton importTemp={IMPORT_TEMP_URL} useCodeImport={useCodeImport} onceBatch={10} /> |
| | | <MyExportButton /> |
| | | </TopToolbar> |
| | | )} |
| | | perPage={25} |
| | | perPage={DEFAULT_PAGE_SIZE} |
| | | > |
| | | <StyledDatagrid |
| | | preferenceKey='code' |
| | |
| | | rowClick={(id, resource, record) => false} |
| | | expand={() => <CodePanel />} |
| | | expandSingle={true} |
| | | omit={['id', 'createTime', 'memo']} |
| | | omit={['id', 'scale', 'createTime', 'createBy', 'memo']} |
| | | > |
| | | <NumberField source="id" /> |
| | | <TextField source="uuid" label="table.field.code.uuid" /> |
| | | <TextField source="data" label="table.field.code.data" /> |
| | | <NumberField source="x" label="table.field.code.x" /> |
| | | <NumberField source="y" label="table.field.code.y" /> |
| | | <BooleanField source="cornerBool" label="table.field.code.concer" sortable={false} /> |
| | | <BooleanField source="cornerBool" label="table.field.code.corner" sortable={false} /> |
| | | <TextField source="scale" label="table.field.code.scale" /> |
| | | |
| | | <FunctionField |
| | | label="table.field.code.spin" |
| | | sortable={false} |
| | | render={(record) => { |
| | | switch (record.spin) { |
| | | case 0: |
| | | return translate('page.code.enums.spin.na'); |
| | | case 1: |
| | | return translate('page.code.enums.spin.cw'); |
| | | case 2: |
| | | return translate('page.code.enums.spin.ccw'); |
| | | default: |
| | | return 'N/A'; |
| | | } |
| | | }} |
| | | /> |
| | | <ReferenceField source="updateBy" label="common.field.updateBy" reference="user" link={false} sortable={false}> |
| | | <TextField source="nickname" /> |
| | | </ReferenceField> |
| | | <DateField source="updateTime" label="common.field.updateTime" showTime /> |
| | | <ReferenceField source="createBy" label="common.field.createBy" reference="user" link={false} sortable={false}> |
| | | <TextField source="nickname" /> |
| | | </ReferenceField> |
| | | <DateField source="createTime" label="common.field.createTime" showTime /> |
| | | <BooleanField source="statusBool" label="common.field.status" sortable={false} /> |
| | | <TextField source="memo" label="common.field.memo" sortable={false} /> |