From 51ab2a3b14163fda513a356d684815fcf68bb156 Mon Sep 17 00:00:00 2001
From: verou <857149855@qq.com>
Date: 星期一, 24 三月 2025 16:58:52 +0800
Subject: [PATCH] fix:逻辑分区过滤
---
rsf-admin/src/page/basicInfo/whMat/WhMatListAside.jsx | 179 +++++++++++++++++++++++++++++++++--------------------------
1 files changed, 100 insertions(+), 79 deletions(-)
diff --git a/rsf-admin/src/page/basicInfo/whMat/WhMatListAside.jsx b/rsf-admin/src/page/basicInfo/whMat/WhMatListAside.jsx
index fc0c510..d8e4a5b 100644
--- a/rsf-admin/src/page/basicInfo/whMat/WhMatListAside.jsx
+++ b/rsf-admin/src/page/basicInfo/whMat/WhMatListAside.jsx
@@ -1,86 +1,107 @@
-import React, { useState, useRef, useEffect, useMemo, useCallback } from "react";
-import { Card, useTheme, List, CardContent, Input, InputAdornment, IconButton, TextField } from "@mui/material";
-import { useForm } from 'react-hook-form';
+import React, {
+ useState,
+ useRef,
+ useEffect,
+ useMemo,
+ useCallback,
+} from "react";
+import {
+ Card,
+ useTheme,
+ List,
+ CardContent,
+ Input,
+ InputAdornment,
+ IconButton,
+ TextField,
+} from "@mui/material";
+import { useForm } from "react-hook-form";
import Warehouse from "./warehouse";
-import { Filter, SearchInput, useListContext,useTranslate } from 'react-admin';
-import request from '@/utils/request';
+import {
+ Filter,
+ SearchInput,
+ useListContext,
+ useTranslate,
+ useNotify,
+} from "react-admin";
+import request from "@/utils/request";
const WhMatListAside = () => {
- const theme = useTheme();
- const translate = useTranslate();
- const [searchVal, setSearchVal] = useState('');
- const { control, getValues } = useForm();
- const [map, setMap] = useState([
- {
- id: 1,
- name: '浠撳簱1',
- code: 'WH1',
- icon: 'Warehouse',
- locCount: 350,
- },
- {
- id: 2,
- name: '浠撳簱2',
- code: 'WH1',
- icon: 'Warehouse',
- locCount: 237,
- },
- {
- id: 3,
- name: '浠撳簱3',
- code: 'WH1',
- icon: 'Warehouse',
- locCount: 590,
- }
- ]);
-
- const handleInput = (value) => {
- console.log(value);
- setSearchVal(value);
+ const theme = useTheme();
+ const translate = useTranslate();
+ const [searchVal, setSearchVal] = useState("");
+ const { control, getValues } = useForm();
+ const notify = useNotify();
+
+ const [map, setMap] = useState([
+ {
+ id: 1,
+ name: "浠撳簱1",
+ code: "WH1",
+ icon: "Warehouse",
+ locCount: 350,
+ },
+ {
+ id: 2,
+ name: "浠撳簱2",
+ code: "WH1",
+ icon: "Warehouse",
+ locCount: 237,
+ },
+ {
+ id: 3,
+ name: "浠撳簱3",
+ code: "WH1",
+ icon: "Warehouse",
+ locCount: 590,
+ },
+ ]);
+
+ const handleInput = (value) => {
+ console.log(value);
+ setSearchVal(value);
+ };
+
+ const getMatnrList = async () => {
+ const {
+ data: { code, data, msg },
+ } = await request.post("/warehouse/list", {}).then();
+ if (code === 200) {
+ console.log(data);
+ } else {
+ notify(msg);
}
- React.useEffect(() => {
- request.post('/matnrGroup/tree', {})
- .then(res => {
- if (res?.data?.code === 200) {
- let data = res.data.data;
- console.log(data);
+ };
- } else {
- notify(res.data.msg);
- }
- })
- .catch(error => {
- notify('Error fetching tree data');
- });
- }, [searchVal])
+ React.useEffect(() => {
+ getMatnrList();
+ }, [searchVal]);
- return (
- <Card
- sx={{
- order: -1,
- mr: 2,
- mt: 4,
- width: 250
- }}
- >
- <CardContent>
- <div>
- <TextField
- label={translate('ra.action.search')}
- value={searchVal}
- onChange={(e) => handleInput(e.target.value)}
+ return (
+ <Card
+ sx={{
+ order: -1,
+ mr: 2,
+ mt: 4,
+ width: 250,
+ }}
+ >
+ <CardContent>
+ <div>
+ <TextField
+ label={translate("ra.action.search")}
+ value={searchVal}
+ onChange={(e) => handleInput(e.target.value)}
+ />
+ </div>
+ <List>
+ {map.map((record) => (
+ <Warehouse key={record.id} record={record} />
+ ))}
+ </List>
+ </CardContent>
+ </Card>
+ );
+};
- />
- </div>
- <List>
- {map.map(record => (
- <Warehouse key={record.id} record={record} />
- ))}
- </List>
- </CardContent>
-
- </Card>
- )
-}
-
-export default WhMatListAside;
\ No newline at end of file
+export default WhMatListAside;
--
Gitblit v1.9.1