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

1736

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