From 3cd7db41473da40a73a0812797f9bf5834e56bc6 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期五, 13 六月 2025 15:05:14 +0800
Subject: [PATCH] 代码优化
---
rsf-admin/src/page/basicInfo/loc/LocList.jsx | 155 +++++++++++++++++++++++++++------------------------
1 files changed, 81 insertions(+), 74 deletions(-)
diff --git a/rsf-admin/src/page/basicInfo/loc/LocList.jsx b/rsf-admin/src/page/basicInfo/loc/LocList.jsx
index 8811f4d..3b945f5 100644
--- a/rsf-admin/src/page/basicInfo/loc/LocList.jsx
+++ b/rsf-admin/src/page/basicInfo/loc/LocList.jsx
@@ -47,9 +47,7 @@
import BatchModal from './BatchModal';
import SubzoneModal from './SubzoneModal';
import PageDrawer from "../../components/PageDrawer";
-import MyField from "../../components/MyField";
import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting';
-import * as Common from '@/utils/common';
import DashboardIcon from '@mui/icons-material/Dashboard';
import EditIcon from '@mui/icons-material/Edit';
import request from '@/utils/request';
@@ -68,84 +66,95 @@
'& .column-name': {
},
'& .opt': {
- width: 200
+ width: 180
},
- '& .RaDatagrid-headerCell': {
- textAlign: 'left'
- },
- '& .RaDatagrid-rowCell': {
- textAlign: 'left'
- },
+ // '& .RaDatagrid-headerCell': {
+ // textAlign: 'left'
+ // },
+ // '& .RaDatagrid-rowCell': {
+ // textAlign: 'left'
+ // },
'& .type .MuiTypography-root': {
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
display: 'block',
- width: '200px',
+ width: 'auto',
},
}));
-const filters = [
- <SearchInput source="condition" alwaysOn />,
- <ReferenceInput
- source="warehouseId"
- label="table.field.loc.warehouseId"
- reference="warehouse"
- >
- <AutocompleteInput
- label="table.field.loc.warehouseId"
- optionText="name"
- filterToQuery={(val) => ({ name: val })}
- />
- </ReferenceInput>,
- <ReferenceInput
- source="areaId"
- label="table.field.loc.areaId"
- reference="warehouseAreas"
- >
- <AutocompleteInput
- label="table.field.loc.areaId"
- optionText="name"
- filterToQuery={(val) => ({ name: val })}
- />
- </ReferenceInput>,
- <TextInput source="code" label="table.field.loc.code" />,
- <TextInput source="type" label="table.field.loc.type" />,
- <TextInput source="name" label="table.field.loc.name" />,
- <NumberInput source="flagLogic" label="table.field.loc.flagLogic" />,
- <TextInput source="fucAtrrs" label="table.field.loc.fucAtrrs" />,
- <TextInput source="barcode" label="table.field.loc.barcode" />,
- <TextInput source="unit" label="table.field.loc.unit" />,
- <TextInput source="size" label="table.field.loc.size" />,
- <NumberInput source="row" label="table.field.loc.row" />,
- <NumberInput source="col" label="table.field.loc.col" />,
- <NumberInput source="lev" label="table.field.loc.lev" />,
- <NumberInput source="channel" label="table.field.loc.channel" />,
- <NumberInput source="maxParts" label="table.field.loc.maxParts" />,
- <NumberInput source="maxPack" label="table.field.loc.maxPack" />,
- <NumberInput source="flagLabelMange" label="table.field.loc.flagLabelMange" />,
- <TextInput source="locAttrs" label="table.field.loc.locAttrs" />,
- <TextInput label="common.field.memo" source="memo" />,
- <SelectInput
- label="common.field.status"
- source="status"
- choices={[
- { id: '1', name: 'common.enums.statusTrue' },
- { id: '0', name: 'common.enums.statusFalse' },
- ]}
- resettable
- />,
-]
const LocList = () => {
const translate = useTranslate();
const notify = useNotify();
const refresh = useRefresh();
-
const [createDialog, setCreateDialog] = useState(false);
const [drawerVal, setDrawerVal] = useState(false);
const [initDialog, setInitDialog] = useState(false);
+ const dicts = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_loc_use_stas')) || [];
+
+ const filters = [
+ <SearchInput source="condition" alwaysOn />,
+ <ReferenceInput
+ source="warehouseId"
+ label="table.field.loc.warehouseId"
+ reference="warehouse"
+ >
+ <AutocompleteInput
+ label="table.field.loc.warehouseId"
+ optionText="name"
+ filterToQuery={(val) => ({ name: val })}
+ />
+ </ReferenceInput>,
+ <ReferenceInput
+ source="areaId"
+ label="table.field.loc.areaId"
+ reference="warehouseAreas"
+ >
+ <AutocompleteInput
+ label="table.field.loc.areaId"
+ optionText="name"
+ filterToQuery={(val) => ({ name: val })}
+ />
+ </ReferenceInput>,
+ <AutocompleteInput
+ choices={dicts}
+ optionText="label"
+ label="table.field.loc.useStatus"
+ source="useStatus"
+ optionValue="value"
+ parse={v => v}
+ alwaysOn
+ />,
+ <TextInput source="code" label="table.field.loc.code" />,
+ <TextInput source="type" label="table.field.loc.type" />,
+ <TextInput source="name" label="table.field.loc.name" />,
+ <NumberInput source="flagLogic" label="table.field.loc.flagLogic" />,
+ <TextInput source="fucAtrrs" label="table.field.loc.fucAtrrs" />,
+ <TextInput source="barcode" label="table.field.loc.barcode" />,
+ <TextInput source="unit" label="table.field.loc.unit" />,
+ <TextInput source="size" label="table.field.loc.size" />,
+ <NumberInput source="row" label="table.field.loc.row" />,
+ <NumberInput source="col" label="table.field.loc.col" />,
+ <NumberInput source="lev" label="table.field.loc.lev" />,
+ <NumberInput source="channel" label="table.field.loc.channel" />,
+ <NumberInput source="maxParts" label="table.field.loc.maxParts" />,
+ <NumberInput source="maxPack" label="table.field.loc.maxPack" />,
+ <NumberInput source="flagLabelMange" label="table.field.loc.flagLabelMange" />,
+ <TextInput source="locAttrs" label="table.field.loc.locAttrs" />,
+
+ <TextInput label="common.field.memo" source="memo" />,
+ <SelectInput
+ label="common.field.status"
+ source="status"
+ choices={[
+ { id: '1', name: 'common.enums.statusTrue' },
+ { id: '0', name: 'common.enums.statusFalse' },
+ ]}
+ resettable
+ />,
+ ]
return (
<Box display="flex">
@@ -224,31 +233,28 @@
{/* <TextField source="name" label="table.field.loc.name" /> */}
{/* <NumberField source="flagLogic" label="table.field.loc.flagLogic" />
<TextField source="fucAtrrs" label="table.field.loc.fucAtrrs" />
- <TextField source="barcode" label="table.field.loc.barcode" /> */}
+ */}
{/* <TextField source="unit" label="table.field.loc.unit" /> */}
+ <TextField source="barcode" label="table.field.loc.barcode" />
<TextField source="length" label="table.field.loc.length" />
<TextField source="width" label="table.field.loc.width" />
<TextField source="height" label="table.field.loc.height" />
<NumberField source="row" label="table.field.loc.row" />
<NumberField source="col" label="table.field.loc.col" />
<NumberField source="lev" label="table.field.loc.lev" />
+ <NumberField source="channel" label="table.field.loc.channel" />
{/* <NumberField source="channel" label="table.field.loc.channel" />
<NumberField source="maxParts" label="table.field.loc.maxParts" />
<NumberField source="maxPack" label="table.field.loc.maxPack" />
<NumberField source="flagLabelMange" label="table.field.loc.flagLabelMange" />
<TextField source="locAttrs" label="table.field.loc.locAttrs" /> */}
<TextField source="useStatus$" label="table.field.loc.useStatus" />
- <ReferenceField source="updateBy" label="common.field.updateBy" reference="user" link={false} sortable={false}>
- <TextField source="nickname" />
- </ReferenceField>
+ <TextField source="updateBy$" label="common.field.updateBy" />
<DateField source="updateTime" label="common.field.updateTime" showTime align="left" />
- <ReferenceField source="createBy" label="common.field.createBy" align="left" reference="user" link={false} sortable={false}>
- <TextField source="nickname" />
- </ReferenceField>
+ <TextField source="createBy$" label="common.field.createBy" />
<DateField source="createTime" label="common.field.createTime" showTime align="left" />
<BooleanField source="statusBool" label="common.field.status" sortable={false} align="left" />
<TextField source="memo" label="common.field.memo" sortable={false} />
-
<WrapperField cellClassName="opt" label="common.field.opt">
<EditButton sx={{ padding: '1px', fontSize: '.75rem' }} />
{/* <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> */}
@@ -256,6 +262,10 @@
</WrapperField>
</StyledDatagrid>
+ <InitModal
+ open={initDialog}
+ setOpen={setInitDialog}
+ />
</List>
<LocCreate
open={createDialog}
@@ -268,10 +278,7 @@
>
</PageDrawer>
- <InitModal
- open={initDialog}
- setOpen={setInitDialog}
- />
+
</Box>
)
}
--
Gitblit v1.9.1