| | |
| | | import * as Common from '@/utils/common'; |
| | | import { useFormContext } from 'react-hook-form'; |
| | | |
| | | const TreeSelectInput = ({ value, onChange, label, isTranslate = false, resource, ...rest }) => { |
| | | const TreeSelectInput = ({ resource, label, source = 'parentId', value, isTranslate = false, ...rest }) => { |
| | | const translate = useTranslate(); |
| | | const { setValue } = useFormContext(); |
| | | const [filter, setFilter] = React.useState(""); |
| | |
| | | const handleChange = (event) => { |
| | | const val = event.target.value; |
| | | setProxyVal(val); |
| | | setValue('parentId', val, { |
| | | setValue(source, val, { |
| | | shouldValidate: true, |
| | | shouldDirty: true, |
| | | }); |
| | |
| | | import DialogCloseButton from "../components/DialogCloseButton"; |
| | | import StatusSelectInput from "../components/StatusSelectInput"; |
| | | import MemoInput from "../components/MemoInput"; |
| | | import TreeSelectInput from "../components/TreeSelectInput"; |
| | | |
| | | const UserCreate = (props) => { |
| | | const { open, setOpen } = props; |
| | |
| | | validate={required()} |
| | | /> |
| | | </Grid> |
| | | {/* <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.user.password" |
| | | source="password" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> */} |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.user.nickname" |
| | |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | {/* <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.user.avatar" |
| | | source="avatar" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> */} |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.user.code" |
| | |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | {/* <Grid item xs={6} display="flex" gap={1}> |
| | | <SelectInput |
| | | label="table.field.user.emailVerified" |
| | | source="emailVerified" |
| | | choices={[ |
| | | { id: 0, name: '否' }, |
| | | { id: 1, name: '是' }, |
| | | ]} |
| | | /> |
| | | </Grid> */} |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <ReferenceInput |
| | | source="deptId" |
| | | reference="dept" |
| | | > |
| | | <AutocompleteInput |
| | | <TreeSelectInput |
| | | resource="dept" |
| | | label="table.field.user.deptId" |
| | | optionText="name" |
| | | source="deptId" |
| | | /> |
| | | </ReferenceInput> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | |
| | | import * as Common from '@/utils/common'; |
| | | import UserListAside from "./UserListAside"; |
| | | import RolesField from './RolesField'; |
| | | import TreeSelectInput from "../components/TreeSelectInput"; |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | '& .css-1vooibu-MuiSvgIcon-root': { |