From 2bf88e36a2fa93d7818dd2984414c3b5d43aea2a Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期三, 09 四月 2025 12:49:32 +0800
Subject: [PATCH] #修改 1. 任务档列表样式修改 2. 任务档Edit样式修改
---
rsf-admin/src/page/task/TaskList.jsx | 14 +-
rsf-admin/src/page/task/TaskEdit.jsx | 238 +++++++++++++++++-----------------------------
rsf-admin/src/page/taskItem/TaskItemList.jsx | 8 +
rsf-admin/src/page/purchase/PurchaseList.jsx | 2
4 files changed, 104 insertions(+), 158 deletions(-)
diff --git a/rsf-admin/src/page/purchase/PurchaseList.jsx b/rsf-admin/src/page/purchase/PurchaseList.jsx
index adc1921..ffdb648 100644
--- a/rsf-admin/src/page/purchase/PurchaseList.jsx
+++ b/rsf-admin/src/page/purchase/PurchaseList.jsx
@@ -123,7 +123,7 @@
<StyledDatagrid
preferenceKey='purchase'
bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />}
- rowClick={(id, resource, record) => false}
+ rowClick={'edit'}
expand={() => <PurchasePanel />}
expandSingle={true}
omit={['id', 'createTime', 'createBy', 'memo']}
diff --git a/rsf-admin/src/page/task/TaskEdit.jsx b/rsf-admin/src/page/task/TaskEdit.jsx
index ab88ff1..bca87b3 100644
--- a/rsf-admin/src/page/task/TaskEdit.jsx
+++ b/rsf-admin/src/page/task/TaskEdit.jsx
@@ -2,180 +2,120 @@
import {
Edit,
SimpleForm,
- FormDataConsumer,
useTranslate,
TextInput,
NumberInput,
- BooleanInput,
- DateInput,
- SelectInput,
- ReferenceInput,
- ReferenceArrayInput,
- AutocompleteInput,
SaveButton,
Toolbar,
- Labeled,
- NumberField,
- required,
- useRecordContext,
- DeleteButton,
} from 'react-admin';
-import { useWatch, useFormContext } from "react-hook-form";
-import { Stack, Grid, Box, Typography } from '@mui/material';
+import { useWatch, useFormContext, useForm } from "react-hook-form";
+import { Stack, Grid, Box, Typography, Card } from '@mui/material';
import * as Common from '@/utils/common';
import { EDIT_MODE, REFERENCE_INPUT_PAGESIZE } from '@/config/setting';
import EditBaseAside from "../components/EditBaseAside";
import CustomerTopToolBar from "../components/EditTopToolBar";
-import MemoInput from "../components/MemoInput";
-import StatusSelectInput from "../components/StatusSelectInput";
+import TaskItemList from "./TaskItemList";
const FormToolbar = () => {
const { getValues } = useFormContext();
-
return (
- <Toolbar sx={{ justifyContent: 'space-between' }}>
+ <Toolbar sx={{ justifyContent: 'end' }}>
<SaveButton />
- <DeleteButton mutationMode="optimistic" />
+ {/* <DeleteButton mutationMode="optimistic" /> */}
</Toolbar>
)
}
const TaskEdit = () => {
const translate = useTranslate();
-
return (
- <Edit
- redirect="list"
- mutationMode={EDIT_MODE}
- actions={<CustomerTopToolBar />}
- aside={<EditBaseAside />}
- >
- <SimpleForm
- shouldUnregister
- warnWhenUnsavedChanges
- toolbar={<FormToolbar />}
- mode="onTouched"
- defaultValues={{}}
- // validate={(values) => { }}
+ <>
+ <Edit
+ redirect="list"
+ mutationMode={EDIT_MODE}
+ actions={<CustomerTopToolBar />}
+ aside={<EditBaseAside />}
>
- <Grid container width={{ xs: '100%', xl: '80%' }} rowSpacing={3} columnSpacing={3}>
- <Grid item xs={12} md={8}>
- <Typography variant="h6" gutterBottom>
- {translate('common.edit.title.main')}
- </Typography>
- <Stack direction='row' gap={2}>
- <TextInput
- label="table.field.task.taskCode"
- source="taskCode"
- parse={v => v}
- autoFocus
- />
- </Stack>
- <Stack direction='row' gap={2}>
- <NumberInput
- label="table.field.task.taskStatus"
- source="taskStatus"
- />
- </Stack>
- <Stack direction='row' gap={2}>
- <NumberInput
- label="table.field.task.taskType"
- source="taskType"
- />
- </Stack>
- <Stack direction='row' gap={2}>
- <TextInput
- label="table.field.task.orgLoc"
- source="orgLoc"
- parse={v => v}
- />
- </Stack>
- <Stack direction='row' gap={2}>
- <TextInput
- label="table.field.task.orgSite"
- source="orgSite"
- parse={v => v}
- />
- </Stack>
- <Stack direction='row' gap={2}>
- <TextInput
- label="table.field.task.targLoc"
- source="targLoc"
- parse={v => v}
- />
- </Stack>
- <Stack direction='row' gap={2}>
- <TextInput
- label="table.field.task.targSite"
- source="targSite"
- parse={v => v}
- />
- </Stack>
- <Stack direction='row' gap={2}>
- <TextInput
- label="table.field.task.barcode"
- source="barcode"
- parse={v => v}
- />
- </Stack>
- <Stack direction='row' gap={2}>
- <TextInput
- label="table.field.task.robotCode"
- source="robotCode"
- parse={v => v}
- />
- </Stack>
- <Stack direction='row' gap={2}>
- <NumberInput
- label="table.field.task.exceStatus"
- source="exceStatus"
- />
- </Stack>
- <Stack direction='row' gap={2}>
- <TextInput
- label="table.field.task.expDesc"
- source="expDesc"
- parse={v => v}
- />
- </Stack>
- <Stack direction='row' gap={2}>
- <NumberInput
- label="table.field.task.sort"
- source="sort"
- />
- </Stack>
- <Stack direction='row' gap={2}>
- <TextInput
- label="table.field.task.expCode"
- source="expCode"
- parse={v => v}
- />
- </Stack>
- <Stack direction='row' gap={2}>
- <DateInput
- label="table.field.task.startTime"
- source="startTime"
- />
- </Stack>
- <Stack direction='row' gap={2}>
- <DateInput
- label="table.field.task.endTime"
- source="endTime"
- />
- </Stack>
-
+ <SimpleForm
+ shouldUnregister
+ warnWhenUnsavedChanges
+ toolbar={<FormToolbar />}
+ mode="onTouched"
+ defaultValues={{}}
+ >
+ <Grid container width={{ xs: '100%', xl: '80%' }} rowSpacing={3} columnSpacing={3}>
+ <Grid item xs={24} md={16}>
+ <Typography variant="h6" gutterBottom>
+ {translate('common.edit.title.main')}
+ </Typography>
+ <Stack direction='row' gap={2}>
+ <TextInput
+ label="table.field.task.taskCode"
+ source="taskCode"
+ readOnly
+ parse={v => v}
+ autoFocus
+ />
+ <TextInput
+ label="table.field.task.taskStatus"
+ readOnly
+ source="taskStatus$"
+ />
+ <TextInput
+ label="table.field.task.taskType"
+ source="taskType$"
+ readOnly
+ />
+ <TextInput
+ label="table.field.task.orgLoc"
+ source="orgLoc"
+ readOnly
+ parse={v => v}
+ />
+ <TextInput
+ label="table.field.task.targLoc"
+ source="targLoc"
+ readOnly
+ parse={v => v}
+ />
+ <TextInput
+ label="table.field.task.orgSite"
+ source="orgSite"
+ readOnly
+ parse={v => v}
+ />
+ </Stack>
+ <Stack direction='row' gap={2}>
+ <TextInput
+ label="table.field.task.targSite"
+ source="targSite"
+ readOnly
+ parse={v => v}
+ />
+ <TextInput
+ label="table.field.task.barcode"
+ source="barcode"
+ readOnly
+ parse={v => v}
+ />
+ <NumberInput
+ label="table.field.task.sort"
+ source="sort"
+ />
+ </Stack>
+ </Grid>
</Grid>
- <Grid item xs={12} md={4}>
- <Typography variant="h6" gutterBottom>
- {translate('common.edit.title.common')}
- </Typography>
- <StatusSelectInput />
- <Box mt="2em" />
- <MemoInput />
- </Grid>
+ </SimpleForm>
+ </Edit >
+ <Card sx={{ marginTop: '1em', }}>
+ <Grid item xs={24} md={16} sx={{ margin: '1em' }}>
+ <Typography variant="h6" gutterBottom >
+ {translate('common.edit.title.common')}
+ </Typography>
+ <TaskItemList />
</Grid>
- </SimpleForm>
- </Edit >
+ </Card>
+ </>
)
}
diff --git a/rsf-admin/src/page/task/TaskList.jsx b/rsf-admin/src/page/task/TaskList.jsx
index fc6657c..dc8eceb 100644
--- a/rsf-admin/src/page/task/TaskList.jsx
+++ b/rsf-admin/src/page/task/TaskList.jsx
@@ -37,7 +37,7 @@
DeleteButton,
Button,
} from 'react-admin';
-import { Box, Typography, Card, Stack } from '@mui/material';
+import { Box, Typography, Card, Stack, Drawer } from '@mui/material';
import { styled } from '@mui/material/styles';
import TaskCreate from "./TaskCreate";
import TaskPanel from "./TaskPanel";
@@ -63,7 +63,7 @@
'& .column-name': {
},
'& .opt': {
- width: 200
+ width: 248
},
}));
@@ -135,10 +135,10 @@
<BulkDeleteButton mutationMode={OPERATE_MODE} />
</>
}
- rowClick={false}
- expand={() => <TaskPanel/>}
+ rowClick={'edit'}
+ expand={false}
expandSingle={true}
- omit={['id', 'createTime', 'createBy', 'memo', 'robotCode', 'exceStatus', 'expDesc', 'expCode', 'sort']}
+ omit={['id', 'createTime', 'createBy', 'memo', 'robotCode', 'exceStatus', 'expDesc', 'expCode', 'status', 'sort']}
>
<NumberField source="id" />
<TextField source="taskCode" label="table.field.task.taskCode" />
@@ -158,7 +158,7 @@
<TextField source="createBy$" label="common.field.createBy"/>
<DateField source="updateTime" label="common.field.updateTime" showTime />
<DateField source="createTime" label="common.field.createTime" showTime />
- <BooleanField source="statusBool" label="common.field.status" sortable={false} />
+ {/* <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">
<DoneButton sx={{ padding: '1px', fontSize: '.75rem' }} ></DoneButton>
@@ -178,6 +178,8 @@
}
export default TaskList;
+
+
/**
* 瀹屾垚鎿嶄綔
* @returns
diff --git a/rsf-admin/src/page/taskItem/TaskItemList.jsx b/rsf-admin/src/page/taskItem/TaskItemList.jsx
index d146e6d..e137031 100644
--- a/rsf-admin/src/page/taskItem/TaskItemList.jsx
+++ b/rsf-admin/src/page/taskItem/TaskItemList.jsx
@@ -38,6 +38,8 @@
import MyField from "../components/MyField";
import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting';
import * as Common from '@/utils/common';
+import MyCreateButton from "../components/MyCreateButton";
+import TaskItemCreate from "../task/TaskItemCreate";
const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({
'& .css-1vooibu-MuiSvgIcon-root': {
@@ -104,7 +106,7 @@
actions={(
<TopToolbar>
<FilterButton />
- {/* <MyCreateButton onClick={() => { setCreateDialog(true) }} /> */}
+ <MyCreateButton onClick={() => { setCreateDialog(true) }} />
<SelectColumnsButton preferenceKey='taskItem' />
{/* <MyExportButton /> */}
</TopToolbar>
@@ -132,7 +134,6 @@
<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>
@@ -145,6 +146,9 @@
<TextField source="memo" label="common.field.memo" sortable={false} />
</StyledDatagrid>
</List>
+ <TaskItemCreate
+ open={createDialog}
+ setOpen={setCreateDialog} />
<PageDrawer
title='TaskItem Detail'
drawerVal={drawerVal}
--
Gitblit v1.9.1