From eeb96ed3c9830f996dc85cc9d4a8113aba91692b Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期一, 30 六月 2025 12:41:39 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/devlop' into devlop
---
rsf-admin/src/page/orders/wave/WaveList.jsx | 124 +++++++++++++++++++++++++----------------
1 files changed, 76 insertions(+), 48 deletions(-)
diff --git a/rsf-admin/src/page/orders/wave/WaveList.jsx b/rsf-admin/src/page/orders/wave/WaveList.jsx
index 73596e2..f8576d0 100644
--- a/rsf-admin/src/page/orders/wave/WaveList.jsx
+++ b/rsf-admin/src/page/orders/wave/WaveList.jsx
@@ -8,46 +8,34 @@
SelectColumnsButton,
EditButton,
FilterButton,
- CreateButton,
- ExportButton,
- BulkDeleteButton,
WrapperField,
useRecordContext,
useTranslate,
useNotify,
useListContext,
- FunctionField,
TextField,
NumberField,
DateField,
BooleanField,
- ReferenceField,
TextInput,
- DateTimeInput,
DateInput,
SelectInput,
NumberInput,
- ReferenceInput,
- ReferenceArrayInput,
- AutocompleteInput,
- DeleteButton,
useRefresh,
useRedirect,
Button,
} from 'react-admin';
+import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE, DEFAULT_WAVE_AUTO_EXCE } from '@/config/setting';
+import PlayArrowOutlinedIcon from '@mui/icons-material/PlayArrowOutlined';
+import PauseCircleOutlineIcon from '@mui/icons-material/PauseCircleOutline';
import { Box, Typography, Card, Stack } from '@mui/material';
-import { styled } from '@mui/material/styles';
-import WaveCreate from "./WaveCreate";
-import WavePanel from "./WavePanel";
-import EmptyData from "../../components/EmptyData";
-import MyCreateButton from "../../components/MyCreateButton";
-import MyExportButton from '../../components/MyExportButton';
+import ConfirmButton from "../../components/ConfirmButton";
import PageDrawer from "../../components/PageDrawer";
-import MyField from "../../components/MyField";
-import request from '@/utils/request';
-import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting';
-import * as Common from '@/utils/common';
import PublicIcon from '@mui/icons-material/Public';
+import ItemToTaskModal from "./ItemToTaskModal";
+import { styled } from '@mui/material/styles';
+import request from '@/utils/request';
+import WaveCreate from "./WaveCreate";
const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({
@@ -60,7 +48,7 @@
'& .column-name': {
},
'& .opt': {
- width: 200
+ width: 260
},
}));
@@ -68,7 +56,6 @@
<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.wave.code" />,
<SelectInput source="type" label="table.field.wave.type"
choices={[
@@ -87,7 +74,6 @@
<NumberInput source="anfme" label="table.field.wave.anfme" />,
<NumberInput source="qty" label="table.field.wave.qty" />,
<NumberInput source="orderNum" label="table.field.wave.orderNum" />,
-
<TextInput label="common.field.memo" source="memo" />,
<SelectInput
label="common.field.status"
@@ -103,7 +89,21 @@
const WaveList = () => {
const translate = useTranslate();
const [createDialog, setCreateDialog] = useState(false);
+ const [autoExce, setAutoExce] = useState(false);
+ const [detailDialog, setDetailDialog] = useState(false);
+ const [select, setSelectIds] = useState({});
const [drawerVal, setDrawerVal] = useState(false);
+
+ useEffect(() => {
+ getConfig()
+ }, [])
+
+ const getConfig = async () => {
+ const { data: { code, data, msg } } = await request.get('/config/flag/' + DEFAULT_WAVE_AUTO_EXCE);
+ if (code === 200) {
+ setAutoExce(JSON.parse(data?.val))
+ }
+ }
return (
<Box display="flex">
@@ -122,6 +122,8 @@
sort={{ field: "create_time", order: "desc" }}
actions={(
<TopToolbar>
+ <BulkStartButton autoExce={autoExce} setAutoExce={setAutoExce} />
+ <BulkPauseButton autoExce={autoExce} setAutoExce={setAutoExce} />
<FilterButton />
<SelectColumnsButton preferenceKey='wave' />
</TopToolbar>
@@ -130,9 +132,7 @@
>
<StyledDatagrid
preferenceKey='wave'
- bulkActionButtons={
- <PublicTaskButton />
- }
+ bulkActionButtons={false}
rowClick={(id, resource, record) => false}
expand={false}
expandSingle={false}
@@ -143,6 +143,7 @@
<TextField source="type$" label="table.field.wave.type" sortable={false} />
<TextField source="exceStatus$" label="table.field.wave.exceStatus" sortable={false} />
<NumberField source="anfme" label="table.field.wave.anfme" />
+ <NumberField source="groupQty" label="table.field.wave.groupQty" />
<NumberField source="qty" label="table.field.wave.qty" />
<NumberField source="orderNum" label="table.field.wave.orderNum" />
<TextField source="updateBy$" label="common.field.updateBy" />
@@ -152,11 +153,16 @@
<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} />
+ <PublicTaskButton setSelectIds={setSelectIds} setDetailDialog={setDetailDialog} />
+ <EditButton label="toolbar.detail" sx={{ padding: '1px', fontSize: '.75rem' }} />
</WrapperField>
</StyledDatagrid>
</List>
+ <ItemToTaskModal
+ open={detailDialog}
+ record={select}
+ setOpen={setDetailDialog}
+ />
<WaveCreate
open={createDialog}
setOpen={setCreateDialog}
@@ -173,32 +179,54 @@
export default WaveList;
-const PublicTaskButton = () => {
+const PublicTaskButton = ({ setSelectIds, setDetailDialog }) => {
const record = useRecordContext();
- const { selectedIds, onUnselectItems } = useListContext();
const notify = useNotify();
const refresh = useRefresh();
const redirect = useRedirect();
const pubClick = async (event) => {
- event.stopPropagation();
- console.log('=========>');
-
- onUnselectItems();
- const res = await request.post(`/wave/public/task`, { ids: selectedIds });
- if (res?.data?.code === 200) {
- notify(res.data.msg);
- redirect("/task")
- } else {
- notify(res.data.msg);
- }
- refresh();
+ setSelectIds(record);
+ setDetailDialog(true);
}
-
return (
- <Button
- onClick={pubClick}
- label={"toolbar.createTask"}
- startIcon={<PublicIcon />}
- />);
+ record?.exceStatus == 0 ? <ConfirmButton label={"toolbar.createTask"} startIcon={<PublicIcon />} onConfirm={pubClick} size='small' /> : <></>
+ );
+}
+
+const BulkStartButton = ({ autoExce, setAutoExce }) => {
+ const { data, selectedIds, onUnselectItems } = useListContext();
+ const notify = useNotify();
+ const startClick = async () => {
+ onUnselectItems()
+ setAutoExce(true)
+ const { data: { code, data, msg } } = await request.post('/config/byFlag', { val: true, flag: 'WaveAutoExce' });
+ if (code === 200) {
+ notify(msg);
+ } else {
+ notify(msg);
+ }
+ }
+ return (
+ !autoExce ? <Button label="toolbar.start" onClick={startClick} startIcon={<PlayArrowOutlinedIcon />} /> : <></>
+ )
+}
+
+const BulkPauseButton = ({ autoExce, setAutoExce }) => {
+ const notify = useNotify();
+ const { data, selectedIds, onUnselectItems } = useListContext();
+
+ const pauseClick = async () => {
+ onUnselectItems()
+ const { data: { code, data, msg } } = await request.post('/config/byFlag', { val: false, flag: 'WaveAutoExce' });
+ if (code === 200) {
+ notify(msg);
+ setAutoExce(false)
+ } else {
+ notify(msg);
+ }
+ }
+ return (
+ autoExce ? <Button label="toolbar.pause" onClick={pauseClick} startIcon={<PauseCircleOutlineIcon />} /> : <></>
+ )
}
\ No newline at end of file
--
Gitblit v1.9.1