From 45b08e865615e1a6dcc152758c5c7d197ce6ea5a Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期四, 10 四月 2025 12:34:22 +0800
Subject: [PATCH] 组拖档历史修改
---
rsf-admin/src/page/qlyInspect/QlyInspectList.jsx | 135 ++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 126 insertions(+), 9 deletions(-)
diff --git a/rsf-admin/src/page/qlyInspect/QlyInspectList.jsx b/rsf-admin/src/page/qlyInspect/QlyInspectList.jsx
index a23f223..46b4912 100644
--- a/rsf-admin/src/page/qlyInspect/QlyInspectList.jsx
+++ b/rsf-admin/src/page/qlyInspect/QlyInspectList.jsx
@@ -31,6 +31,8 @@
ReferenceArrayInput,
AutocompleteInput,
DeleteButton,
+ Button,
+ useRefresh,
} from 'react-admin';
import { Box, Typography, Card, Stack } from '@mui/material';
import { styled } from '@mui/material/styles';
@@ -43,6 +45,13 @@
import MyField from "../components/MyField";
import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting';
import * as Common from '@/utils/common';
+import ConstructionIcon from "@mui/icons-material/Construction";
+import CloseIcon from "@mui/icons-material/Close";
+import TaskIcon from '@mui/icons-material/Task';
+import AddIcon from '@mui/icons-material/Add';
+import request from '@/utils/request';
+import AsnSelModal from "./AsnSelModal";
+import InspectModal from "./InspectModal";
const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({
'& .css-1vooibu-MuiSvgIcon-root': {
@@ -60,8 +69,6 @@
const filters = [
<SearchInput source="condition" alwaysOn />,
- <DateInput label='common.time.after' source="timeStart" alwaysOn />,
- <DateInput label='common.time.before' source="timeEnd" alwaysOn />,
<TextInput source="code" label="table.field.qlyInspect.code" />,
<TextInput source="wkType" label="table.field.qlyInspect.wkType" />,
@@ -100,13 +107,19 @@
marginRight: drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0,
}}
title={"menu.qlyInspect"}
- empty={<EmptyData onClick={() => { setCreateDialog(true) }} />}
+ empty={<EmptyData
+ children={
+ <Box sx={{ gap: 2, display: 'flex' }}>
+ <AsnCreatButton isInit={true} />
+ </Box>
+ }
+ onClick={() => { }} />}
filters={filters}
sort={{ field: "create_time", order: "desc" }}
actions={(
<TopToolbar>
+ <AsnCreatButton />
<FilterButton />
- <MyCreateButton onClick={() => { setCreateDialog(true) }} />
<SelectColumnsButton preferenceKey='qlyInspect' />
<MyExportButton />
</TopToolbar>
@@ -115,13 +128,18 @@
>
<StyledDatagrid
preferenceKey='qlyInspect'
- bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />}
+ bulkActionButtons={<BulkDeleteButton mutationMode={OPERATE_MODE} />}
rowClick={(id, resource, record) => false}
- omit={['id', 'createTime', 'createBy', 'memo']}
+ expand={() => <QlyInspectPanel />}
+ expandSingle={true}
+ omit={['id', 'createTime', 'createBy', 'memo', 'asnId', 'statusBool']}
>
<NumberField source="id" />
<TextField source="code" label="table.field.qlyInspect.code" />
- <TextField source="wkType" label="table.field.qlyInspect.wkType" />
+ <TextField source="isptStatus$" label="table.field.qlyInspect.isptStatus" />
+ <TextField source="wkType$" label="table.field.qlyInspect.wkType" />
+ <NumberField source="asnId" label="table.field.qlyInspect.asnId" />
+ <NumberField source="asnCode" label="table.field.qlyInspect.asnCode" />
<NumberField source="safeQty" label="table.field.qlyInspect.safeQty" />
<NumberField source="dlyQty" label="table.field.qlyInspect.dlyQty" />
<NumberField source="rcptQty" label="table.field.qlyInspect.rcptQty" />
@@ -138,8 +156,10 @@
<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' }} />
- <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} />
+ {/* <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> */}
+ <InspectionButton />
+ <CompleteButton />
+ <CloseButton />
</WrapperField>
</StyledDatagrid>
</List>
@@ -153,8 +173,105 @@
setDrawerVal={setDrawerVal}
>
</PageDrawer>
+
+
</Box>
)
}
export default QlyInspectList;
+
+const InspectionButton = () => {
+ const record = useRecordContext();
+ const notify = useNotify();
+ const refresh = useRefresh();
+ const [createDialog, setCreateDialog] = useState(false);
+
+
+ return (
+ <>
+ <Button onClick={() => setCreateDialog(true)} label={"toolbar.quality"}>
+ <ConstructionIcon />
+ </Button>
+
+ <InspectModal
+ open={createDialog}
+ setOpen={setCreateDialog}
+ ispectId={record.id}
+ />
+ </>
+ )
+}
+
+const CompleteButton = () => {
+ const record = useRecordContext();
+ const notify = useNotify();
+ const refresh = useRefresh();
+ const requestComplete = async () => {
+ const { data: { code, data, msg } } = await request.post(`/qlyInspect/update`, { ...record, isptStatus: '1' });
+
+ if (code === 200) {
+ notify(msg);
+ refresh()
+ } else {
+ notify(msg);
+ }
+ }
+
+
+ return (
+ <Button onClick={requestComplete} label={"toolbar.complete"}>
+ <TaskIcon />
+ </Button>
+ )
+}
+
+const CloseButton = () => {
+ const record = useRecordContext();
+ const notify = useNotify();
+ const refresh = useRefresh();
+
+ const requestClose = async () => {
+ const { data: { code, data, msg } } = await request.post(`/qlyInspect/update`, { ...record, isptStatus: '3' });
+
+ if (code === 200) {
+ notify(msg);
+ refresh()
+ } else {
+ notify(msg);
+ }
+ }
+
+
+ return (
+ <Button onClick={requestClose} label={"toolbar.close"}>
+ <CloseIcon />
+ </Button>
+ )
+}
+
+const AsnCreatButton = ({ isInit }) => {
+ const record = useRecordContext();
+ const notify = useNotify();
+ const refresh = useRefresh();
+ const [createDialog, setCreateDialog] = useState(false);
+
+ return (
+ <>
+ {
+ isInit ? <Button onClick={() => setCreateDialog(true)} label={"toolbar.asnCreate"} variant="contained"
+ color="primary">
+ <AddIcon />
+ </Button> : <Button onClick={() => setCreateDialog(true)} label={"toolbar.asnCreate"} >
+ <AddIcon />
+ </Button>
+ }
+
+
+ <AsnSelModal
+ open={createDialog}
+ setOpen={setCreateDialog}
+ />
+ </>
+ )
+}
--
Gitblit v1.9.1