From f21da8f3373d19045b05fe51a6eab3695dbe30f5 Mon Sep 17 00:00:00 2001
From: zhou zhou <3272660260@qq.com>
Date: 星期六, 07 三月 2026 14:13:42 +0800
Subject: [PATCH] #任务步骤

---
 rsf-admin/src/page/task/TaskList.jsx |  165 ++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 103 insertions(+), 62 deletions(-)

diff --git a/rsf-admin/src/page/task/TaskList.jsx b/rsf-admin/src/page/task/TaskList.jsx
index 5fdfbb1..445e8cd 100644
--- a/rsf-admin/src/page/task/TaskList.jsx
+++ b/rsf-admin/src/page/task/TaskList.jsx
@@ -7,7 +7,7 @@
     DatagridConfigurable,
     SearchInput,
     TopToolbar,
-    SelectColumnsButton,
+    ColumnsButton,
     FilterButton,
     BulkDeleteButton,
     WrapperField,
@@ -44,27 +44,10 @@
 import * as Common from '@/utils/common';
 import ColorizeOutlinedIcon from '@mui/icons-material/ColorizeOutlined';
 import GradingOutlinedIcon from '@mui/icons-material/GradingOutlined';
-
-const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({
-    '& .css-1vooibu-MuiSvgIcon-root': {
-        height: '.9em'
-    },
-    '& .RaDatagrid-row': {
-        cursor: 'auto'
-    },
-    '& .column-name': {
-    },
-    '& .opt': {
-        width: 248
-    },
-    '& .MuiTableCell-root': {
-    whiteSpace: 'nowrap',
-    overflow: 'visible',
-    textOverflow: 'unset'
-    }
-
-}));
-
+import StickyDataTable from "@/page/components/StickyDataTable";
+import useTableLayout from '@/utils/useTableLayout';
+import AccountTreeOutlinedIcon from '@mui/icons-material/AccountTreeOutlined';
+import FlowStepInstanceModal from './FlowStepInstanceModal';
 
 const TaskList = (props) => {
     const translate = useTranslate();
@@ -72,6 +55,10 @@
     const [drawerVal, setDrawerVal] = useState(false);
     const [autoExce, setAutoExce] = useState(false);
     const dict = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_warehouse_type')) || [];
+    
+    // state for FlowStepInstanceModal
+    const [flowStepModalOpen, setFlowStepModalOpen] = useState(false);
+    const [currentTaskRecord, setCurrentTaskRecord] = useState(null);
 
     useEffect(() => {
         getConfig()
@@ -125,7 +112,9 @@
     ]
 
     return (
-        <Box display="flex">
+        <Box display="flex" sx={{
+
+        }}>
             <List
                 queryOptions={{ refetchInterval: 5000 }}
                 sx={{
@@ -135,6 +124,9 @@
                             duration: theme.transitions.duration.enteringScreen,
                         }),
                     marginRight: !!drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0,
+                    '& .MuiTableCell-root': {
+                        whiteSpace: 'nowrap',
+                    },
                 }}
                 title={"menu.task"}
                 empty={false}
@@ -142,51 +134,21 @@
                 sort={{ field: "sort", order: "desc" }}
                 actions={(
                     <TopToolbar>
-                        <BulkAutoStartButton autoExce={autoExce} setAutoExce={setAutoExce}/>
+                        <BulkAutoStartButton autoExce={autoExce} setAutoExce={setAutoExce} />
                         <BulkAutoPauseButton autoExce={autoExce} setAutoExce={setAutoExce} />
                         <FilterButton />
-                        <SelectColumnsButton preferenceKey='task' />
+                        <ColumnsButton storeKey='task' />
                     </TopToolbar>
                 )}
                 perPage={DEFAULT_PAGE_SIZE}
             >
-                <StyledDatagrid
-                    preferenceKey='task'
-                    bulkActionButtons={false}
-                    rowClick={false}
-                    expand={<TaskPanel />}
-                    expandSingle={true}
-                    omit={['id', 'createTime', 'createBy$', 'memo', 'robotCode', 'exceStatus', 'expDesc', 'expCode', 'status','warehType$', 'orderType', 'order_type', 'orderType$']}
-                >
-                    <NumberField source="id" />
-                    <TextField source="taskCode" label="table.field.task.taskCode" />
-                    <NumberField source="taskStatus$" label="table.field.task.taskStatus" />
-                    <NumberField source="taskType$" label="table.field.task.taskType" />
-                    <NumberField source="warehType$" label="table.field.task.warehType" />
-                    <TextField source="orgLoc" label="table.field.task.orgLoc" />
-                    <TextField source="orgSite$" label="table.field.task.orgSite" />
-                    <TextField source="targLoc" label="table.field.task.targLoc" />
-                    <TextField source="targSite$" label="table.field.task.targSite" />
-                    <TextField source="barcode" label="table.field.task.barcode" />
-                    <TextField source="robotCode" label="table.field.task.robotCode" />
-                    <NumberField source="exceStatus" label="table.field.task.exceStatus" />
-                    <TextField source="expDesc" label="table.field.task.expDesc" />
-                    <NumberField source="sort" label="table.field.task.sort" />
-                    <TextField source="expCode" label="table.field.task.expCode" />
-                    <TextField source="updateBy$" label="common.field.updateBy" />
-                    <TextField source="createBy$" label="common.field.createBy" />
-                    <DateField source="updateTime" label="common.field.updateTime" showTime />
-                    <DateField source="createTime" label="common.field.createTime" showTime />
-                    <TextField source="memo" label="common.field.memo" sortable={false} />
-                    <WrapperField cellClassName="opt" label="common.field.opt" onClick={(e) => e.stopPropagation()} >
-                        <EditButton label="toolbar.detail" />
-                        <DoneButton sx={{ padding: '1px', fontSize: '.75rem' }} ></DoneButton>
-                        <CancelButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} />
-                        <CheckButton />
-                        <PickButton />
-                        <SetTopButton />
-                    </WrapperField>
-                </StyledDatagrid>
+                <TableItems 
+                    drawerVal={drawerVal} 
+                    onOpenFlowStep={(record) => {
+                        setCurrentTaskRecord(record);
+                        setFlowStepModalOpen(true);
+                    }} 
+                />
             </List>
             <PageDrawer
                 title='Task Detail'
@@ -194,12 +156,91 @@
                 setDrawerVal={setDrawerVal}
             >
             </PageDrawer>
+            <FlowStepInstanceModal 
+                open={flowStepModalOpen} 
+                setOpen={setFlowStepModalOpen} 
+                record={currentTaskRecord} 
+            />
         </Box>
     )
 }
 
 export default TaskList;
 
+
+const TableItems = ({ drawerVal, onOpenFlowStep }) => {
+    const omittedFields = ['id', 'createTime', 'createBy$', 'memo', 'robotCode', 'exceStatus', 'expDesc', 'expCode', 'status', 'warehType$', 'orderType', 'order_type', 'orderType$'];
+    const { boxMaxWidth, boxMaxHeight } = useTableLayout(drawerVal);
+    return (
+        <Box sx={{
+            position: 'relative',
+            maxHeight: boxMaxHeight,
+            maxWidth: boxMaxWidth,
+            overflowX: 'auto',
+            overflowY: 'auto',
+            '& .MuiTableCell-root': {
+                whiteSpace: 'nowrap',
+            }
+        }}>
+            <StickyDataTable
+                stickyRight={['opt']}
+                storeKey='task'
+                bulkActionButtons={false}
+                rowClick={false}
+                hiddenColumns={omittedFields}
+                expand={<TaskPanel />}
+                expandSingle={true}
+            >
+                <NumberField source="id" />
+                <TextField source="taskCode" label="table.field.task.taskCode" />
+                <NumberField source="taskStatus$" label="table.field.task.taskStatus" />
+                <NumberField source="taskType$" label="table.field.task.taskType" />
+                <NumberField source="warehType$" label="table.field.task.warehType" />
+                <TextField source="orgLoc" label="table.field.task.orgLoc" />
+                <TextField source="orgSite$" label="table.field.task.orgSite" />
+                <TextField source="targLoc" label="table.field.task.targLoc" />
+                <TextField source="targSite$" label="table.field.task.targSite" />
+                <TextField source="barcode" label="table.field.task.barcode" />
+                <TextField source="robotCode" label="table.field.task.robotCode" />
+                <NumberField source="exceStatus" label="table.field.task.exceStatus" />
+                <TextField source="expDesc" label="table.field.task.expDesc" />
+                <NumberField source="sort" label="table.field.task.sort" />
+                <TextField source="expCode" label="table.field.task.expCode" />
+                <TextField source="updateBy$" label="common.field.updateBy" />
+                <TextField source="createBy$" label="common.field.createBy" />
+                <DateField source="updateTime" label="common.field.updateTime" showTime />
+                <DateField source="createTime" label="common.field.createTime" showTime />
+                <TextField source="memo" label="common.field.memo" sortable={false} />
+                <WrapperField source="opt" cellClassName="opt" label="common.field.opt" onClick={(e) => e.stopPropagation()} >
+                    <EditButton label="toolbar.detail" />
+                    <DoneButton sx={{ padding: '1px', fontSize: '.75rem' }} ></DoneButton>
+                    <CancelButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} />
+                    <CheckButton />
+                    <PickButton />
+                    <SetTopButton />
+                    <FlowStepButton onClick={onOpenFlowStep} />
+                </WrapperField>
+            </StickyDataTable>
+        </Box>
+    )
+}
+
+
+const FlowStepButton = ({ onClick }) => {
+    const record = useRecordContext();
+    return (
+        <Button
+            label="toolbar.flowStep"
+            onClick={(e) => {
+                e.stopPropagation();
+                onClick(record);
+            }}
+        >
+            <AccountTreeOutlinedIcon />
+        </Button>
+    )
+}
+
 /**
  * 鐩樼偣
  * @returns te

--
Gitblit v1.9.1