Commit 8156e622 authored by 左玲玲's avatar 左玲玲 😬

1736

parent 145f9b29
......@@ -15,14 +15,15 @@ const App = ({
onFinish,
drawer,
formRef,
columns,
columns = [],
urlParams,
formId,
defaultFormValue,
onValuesChange,
}) => {
const [value, setValue] = useState('');
const [fieldscolumns, setfieldscolumns] = useState(columns);
const [fieldscolumns, setfieldscolumns] = useState([]);
const [otherFields, cot] = useState([]);
const selectValueType = (type, options) => {
switch (type) {
case 1:
......@@ -52,7 +53,6 @@ const App = ({
break;
}
};
useEffect(() => {
const fn = async () => {
let res = await doFetch({
......@@ -76,11 +76,14 @@ const App = ({
key: el.id,
});
});
setfieldscolumns(fieldscolumns.concat(column));
cot(column);
}
};
fn();
}, []);
useEffect(() => {
setfieldscolumns(columns.concat(otherFields));
}, [columns, otherFields])
const selectextendField = (type) => {
switch (Number(type)) {
......
......@@ -14,6 +14,7 @@ function getcolumns(setDrawer, ifs, formRef, isLease) {
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
fieldProps: {
placeholder: '请输入',
disabled: ifs
},
valueType: 'MyAutoComplete',
onSelect: (value, option) => {
......@@ -22,7 +23,7 @@ function getcolumns(setDrawer, ifs, formRef, isLease) {
formRef.current.setFieldValue('mailNo', option?.mailbox);
formRef.current.setFieldValue('status', option?.enabled);
},
disabled: ifs,
},
{
title: '用户名',
......@@ -250,6 +251,9 @@ function getcolumns(setDrawer, ifs, formRef, isLease) {
value: 2,
},
],
fieldProps: {
disabled: ifs,
},
hideInForm: isLease == 1 ? false : true,
hideInTable: isLease == 1 ? false : true,
hideInDescriptions: isLease == 1 ? false : true,
......
......@@ -128,9 +128,9 @@ function User(props) {
}, [currentUser?.isLease]);
useEffect(() => {
if (drawer.type == 'add') {
cfc(getcolumns(setDrawer, false, formRef, currentUser?.isLease))
cfc(...[(getcolumns(setDrawer, false, formRef, currentUser?.isLease) ?? [])])
} else if (drawer.type == 'edit') {
cfc(getcolumns(setDrawer, true, formRef, currentUser?.isLease))
cfc([...getcolumns(setDrawer, true, formRef, currentUser?.isLease ?? [])])
}
}, [drawer.type]);
const valuechange = (changedValues, allValues) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment