From d458679502e679ff49446e2a69c9d4abbb5ecfd8 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期二, 08 四月 2025 20:47:19 +0800
Subject: [PATCH] 任务档显示优化
---
rsf-admin/src/page/task/TaskList.jsx | 18 ++------
rsf-admin/src/page/task/TaskPanel.jsx | 93 +++++++++++-----------------------------------
rsf-admin/src/page/task/index.jsx | 1
3 files changed, 27 insertions(+), 85 deletions(-)
diff --git a/rsf-admin/src/page/task/TaskList.jsx b/rsf-admin/src/page/task/TaskList.jsx
index 0df58a6..fc6657c 100644
--- a/rsf-admin/src/page/task/TaskList.jsx
+++ b/rsf-admin/src/page/task/TaskList.jsx
@@ -69,8 +69,8 @@
const filters = [
<SearchInput source="condition" alwaysOn />,
- <DateInput label='common.time.after' source="timeStart" alwaysOn />,
- <DateInput label='common.time.before' source="timeEnd" alwaysOn />,
+ <DateInput label='common.time.after' source="timeStart" />,
+ <DateInput label='common.time.before' source="timeEnd" />,
<TextInput source="taskCode" label="table.field.task.taskCode" />,
<NumberInput source="taskStatus" label="table.field.task.taskStatus" />,
<NumberInput source="taskType" label="table.field.task.taskType" />,
@@ -121,16 +121,13 @@
actions={(
<TopToolbar>
<FilterButton />
- {/* <MyCreateButton onClick={() => { setCreateDialog(true) }} /> */}
<SelectColumnsButton preferenceKey='task' />
- {/* <MyExportButton /> */}
</TopToolbar>
)}
perPage={DEFAULT_PAGE_SIZE}
>
<StyledDatagrid
preferenceKey='task'
- // bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />}
bulkActionButtons={
<>
<BulkResortButton />
@@ -138,7 +135,7 @@
<BulkDeleteButton mutationMode={OPERATE_MODE} />
</>
}
- rowClick={(id, resource, record) => false}
+ rowClick={false}
expand={() => <TaskPanel/>}
expandSingle={true}
omit={['id', 'createTime', 'createBy', 'memo', 'robotCode', 'exceStatus', 'expDesc', 'expCode', 'sort']}
@@ -157,18 +154,13 @@
<TextField source="expDesc" label="table.field.task.expDesc" />
<NumberField source="sort" label="table.field.task.sort" />
<TextField source="expCode" label="table.field.task.expCode" />
- <ReferenceField source="updateBy" label="common.field.updateBy" reference="user" link={false} sortable={false}>
- <TextField source="nickname" />
- </ReferenceField>
+ <TextField source="updateBy$" label="common.field.updateBy"/>
+ <TextField source="createBy$" label="common.field.createBy"/>
<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} />
<WrapperField cellClassName="opt" label="common.field.opt">
- {/* <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} /> */}
<DoneButton sx={{ padding: '1px', fontSize: '.75rem' }} ></DoneButton>
<CancelButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} />
<SetTopButton sx={{ padding: '1px', fontSize: '.75rem' }} ></SetTopButton>
diff --git a/rsf-admin/src/page/task/TaskPanel.jsx b/rsf-admin/src/page/task/TaskPanel.jsx
index bac8c60..a207d24 100644
--- a/rsf-admin/src/page/task/TaskPanel.jsx
+++ b/rsf-admin/src/page/task/TaskPanel.jsx
@@ -1,40 +1,15 @@
import React, { useState, useRef, useEffect, useMemo } from "react";
-import { Box, Card, CardContent, Grid, Typography, Tooltip, Pagination } from '@mui/material';
+import { Box } from '@mui/material';
import {
List,
DatagridConfigurable,
- SearchInput,
- TopToolbar,
- SelectColumnsButton,
- EditButton,
- FilterButton,
- CreateButton,
- ExportButton,
- BulkDeleteButton,
- useDataProvider,
- WrapperField,
- useGetList,
useRecordContext,
useTranslate,
- useNotify,
- useListContext,
- FunctionField,
TextField,
NumberField,
DateField,
BooleanField,
ReferenceField,
- TextInput,
- DateTimeInput,
- DateInput,
- SelectInput,
- NumberInput,
- ReferenceInput,
- ReferenceArrayInput,
- AutocompleteInput,
- DeleteButton,
- useList,
- ReferenceManyField,
} from 'react-admin';
import { styled } from '@mui/material/styles';
import PageDrawer from "../components/PageDrawer";
@@ -55,54 +30,34 @@
},
}));
-const filters = [
- <SearchInput source="condition" alwaysOn />,
- <DateInput label='common.time.after' source="timeStart" />,
- <DateInput label='common.time.before' source="timeEnd" />,
- <NumberInput source="taskId" label="table.field.taskItem.taskId" />,
- <NumberInput source="orderId" label="table.field.taskItem.orderId" />,
- <NumberInput source="orderType" label="table.field.taskItem.orderType" />,
- <NumberInput source="orderItemId" label="table.field.taskItem.orderItemId" />,
- <NumberInput source="matnrId" label="table.field.taskItem.matnrId" />,
- <TextInput source="maktx" label="table.field.taskItem.maktx" />,
- <TextInput source="matnrCode" label="table.field.taskItem.matnrCode" />,
- <TextInput source="unit" label="table.field.taskItem.unit" />,
- <NumberInput source="anfme" label="table.field.taskItem.anfme" />,
- <TextInput source="batch" label="table.field.taskItem.batch" />,
- <TextInput source="spec" label="table.field.taskItem.spec" />,
- <TextInput source="model" label="table.field.taskItem.model" />,
- <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 TaskPanel = () => {
+ const record = useRecordContext();
const translate = useTranslate();
const [createDialog, setCreateDialog] = useState(false);
const [drawerVal, setDrawerVal] = useState(false);
- // const { data, isPending, error } = useGetList('taskItem', { pagination: { page: 1, perPage: 10 } });
- // const listContext = useList({
- // data,
- // isPending,
- // perPage: 10,
- // sort: {field: 'create_time', order: 'DESC'}
- // })
return (
<>
<Box display="flex">
- <ReferenceManyField pagination={<Pagination />} reference="taskItem" target="task_id">
+ <List resource="taskItem"
+ sx={{
+ flexGrow: 1,
+ transition: (theme) =>
+ theme.transitions.create(['all'], {
+ duration: theme.transitions.duration.enteringScreen,
+ }),
+ marginRight: !!drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0,
+ }}
+ filter={{ taskId: record.id }}
+ title={"menu.taskItem"}
+ pagination={false}
+ empty={false}
+ actions={false}
+ >
<StyledDatagrid
preferenceKey='taskItem'
bulkActionButtons={false}
- rowClick={(id, resource, record) => false}
- expandSingle={true}
+ rowClick={false}
+ expandSingle
omit={['id', 'createTime', 'createBy', 'memo', 'taskId', 'orderId', 'orderItemId', 'matnrId']}
>
<NumberField source="id" />
@@ -118,18 +73,14 @@
<TextField source="batch" label="table.field.taskItem.batch" />
<TextField source="spec" label="table.field.taskItem.spec" />
<TextField source="model" label="table.field.taskItem.model" />
- <ReferenceField source="updateBy" label="common.field.updateBy" reference="user" link={false} sortable={false}>
- <TextField source="nickname" />
- </ReferenceField>
+ <TextField source="updateBy$" label="common.field.updateBy"/>
+ <TextField source="createBy$" label="common.field.createBy"/>
<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} />
</StyledDatagrid>
- </ReferenceManyField>
+ </List>
</Box>
</>
);
diff --git a/rsf-admin/src/page/task/index.jsx b/rsf-admin/src/page/task/index.jsx
index 85c3ffe..1a48e09 100644
--- a/rsf-admin/src/page/task/index.jsx
+++ b/rsf-admin/src/page/task/index.jsx
@@ -9,7 +9,6 @@
import TaskEdit from "./TaskEdit";
export default {
-
list: TaskList,
edit: TaskEdit,
show: ShowGuesser,
--
Gitblit v1.9.1