From 5fd28ccb34f808a634d66e6ff03078b36f9e745d Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期日, 29 九月 2024 10:15:36 +0800
Subject: [PATCH] #
---
zy-acs-flow/src/page/mission/MissionListContent.jsx | 52 ++++++++++++++++++++++++++++++++++++----------------
1 files changed, 36 insertions(+), 16 deletions(-)
diff --git a/zy-acs-flow/src/page/mission/MissionListContent.jsx b/zy-acs-flow/src/page/mission/MissionListContent.jsx
index bb8753f..64ce7b8 100644
--- a/zy-acs-flow/src/page/mission/MissionListContent.jsx
+++ b/zy-acs-flow/src/page/mission/MissionListContent.jsx
@@ -1,18 +1,40 @@
-import { DragDropContext } from '@hello-pangea/dnd';
-import { Box } from '@mui/material';
-import isEqual from 'lodash/isEqual';
import { useEffect, useState } from 'react';
-import { useDataProvider, useListContext } from 'react-admin';
-
+import { DragDropContext } from '@hello-pangea/dnd';
+import { Box, LinearProgress } from '@mui/material';
+import {
+ useDataProvider,
+ useListContext,
+ useNotify,
+ useRefresh,
+ useTranslate,
+} from 'react-admin';
import { MissionColumn } from './MissionColumn';
+import request from '@/utils/request';
export const MissionListContent = () => {
- const { data, isPending, refetch } = useListContext();
+ const translate = useTranslate();
+ const notify = useNotify();
+ const refresh = useRefresh();
const dataProvider = useDataProvider();
+ const { data, isPending, refetch } = useListContext();
- // const [dealsByStage, setDealsByStage] = useState(
- // getDealsByStage([], dealStages)
- // );
+ const [stages, setStages] = useState([]);
+
+ useEffect(() => {
+ const httpStages = async () => {
+ request.post('/mission/posType/list').then(res => {
+ const { code, msg, data } = res.data;
+ if (code === 200) {
+ setStages(data);
+ } else {
+ notify(msg || 'common.response.fail', { type: 'error', messageArgs: { _: msg } });
+ }
+ }).catch(error => {
+ notify(error.message || 'common.response.fail', { type: 'error', messageArgs: { _: error.message } });
+ })
+ }
+ httpStages();
+ }, []);
useEffect(() => {
// if (data) {
@@ -24,7 +46,7 @@
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [data]);
- if (isPending) return null;
+ if (isPending) return <LinearProgress />;
const onDragEnd = result => {
const { destination, source } = result;
@@ -66,16 +88,14 @@
// });
};
- const columns = ['a', 'b']
-
return (
<DragDropContext onDragEnd={onDragEnd}>
<Box display="flex">
- {columns.map(column => (
+ {stages.map(stage => (
<MissionColumn
- stage={column}
- missions={data}
- key={column}
+ key={stage}
+ stage={stage}
+ missions={data.filter(item => item.posType === stage)}
/>
))}
</Box>
--
Gitblit v1.9.1