From d6775a4b96a6a3ded3be9d3f2044ba3f91c070a1 Mon Sep 17 00:00:00 2001 From: DESKTOP-LMJ82IJ\Eno <creaycat@gmail.com> Date: 星期日, 13 四月 2025 15:07:59 +0800 Subject: [PATCH] #修改 编码规则修改 --- 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