From 0d3a5be1512815a38f37ae81e7d9fc0948fd3f16 Mon Sep 17 00:00:00 2001 From: verou <857149855@qq.com> Date: 星期二, 25 三月 2025 13:54:57 +0800 Subject: [PATCH] 1 --- rsf-admin/src/page/basicInfo/matnrGroup/MatnrGroupEdit.jsx | 40 +++++++++++++++++++++++++++++++++++----- 1 files changed, 35 insertions(+), 5 deletions(-) diff --git a/rsf-admin/src/page/basicInfo/matnrGroup/MatnrGroupEdit.jsx b/rsf-admin/src/page/basicInfo/matnrGroup/MatnrGroupEdit.jsx index ad0a7d7..4fbd112 100644 --- a/rsf-admin/src/page/basicInfo/matnrGroup/MatnrGroupEdit.jsx +++ b/rsf-admin/src/page/basicInfo/matnrGroup/MatnrGroupEdit.jsx @@ -31,29 +31,57 @@ Stack, Grid, Box, + TextField } from '@mui/material'; import DialogCloseButton from "@/page/components/DialogCloseButton"; import TreeSelectInput from "@/page/components/TreeSelectInput"; -import { useWatch, useFormContext } from "react-hook-form"; +import { useWatch, useFormContext, useFieldArray } from "react-hook-form"; import * as Common from '@/utils/common'; import { EDIT_MODE, REFERENCE_INPUT_PAGESIZE } from '@/config/setting'; import EditBaseAside from "@/page/components/EditBaseAside"; import CustomerTopToolBar from "@/page/components/EditTopToolBar"; import MemoInput from "@/page/components/MemoInput"; import StatusSelectInput from "@/page/components/StatusSelectInput"; - +import request from '@/utils/request'; const EditContent = ({ editRecord }) => { const { resource } = useCreateContext(); + const translate = useTranslate(); + + const { update } = useFieldArray({ name: "parCode" }) + + const pChange = (val) => { + if (val > 0) { + http(val) + } + } + + + + const http = async (val) => { + const res = await request.post(`/matnrGroup/page`, { id: val }); + const code = res.data.data.records[0].code || '' + editRecord && (editRecord.parCode = code); + update(code) + } return ( <Grid container rowSpacing={2} columnSpacing={2}> <Grid item xs={6} display="flex" gap={1}> <TreeSelectInput label="table.field.matnrGroup.parentId" validate={[required()]} - value={editRecord?.parentId} isTranslate resource={resource} + onChange={(e) => pChange(e.target.value)} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.matnrGroup.parCode" + source="parCode" + value={editRecord?.parCode} + parse={v => v} + readOnly /> </Grid> <Grid item xs={6} display="flex" gap={1}> @@ -64,13 +92,14 @@ validate={required()} /> </Grid> - {/* <Grid item xs={6} display="flex" gap={1}> + <Grid item xs={6} display="flex" gap={1}> <TextInput label="table.field.matnrGroup.code" source="code" parse={v => v} + readOnly={!!editRecord} /> - </Grid> */} + </Grid> </Grid> ) } @@ -103,6 +132,7 @@ const onSubmit = (data) => { const _params = { ...data }; if (editRecord) { + debugger if (_params.parentId === editRecord.id) { notify('common.response.dataError', { type: 'error' }); return; -- Gitblit v1.9.1