verou
2025-03-25 7a33c97d5741a5d8813035ccde1fa801ec30a179
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
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 Warehouse from "./warehouse";
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 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(() => {
    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)}
          />
        </div>
        <List>
          {map.map((record) => (
            <Warehouse key={record.id} record={record} />
          ))}
        </List>
      </CardContent>
    </Card>
  );
};
 
export default WhMatListAside;