Commit c89192a7 authored by TZW's avatar TZW

12011507

parent c906e5bc
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: Li Hanlin * @Author: Li Hanlin
* @Date: 2022-11-10 09:39:56 * @Date: 2022-11-10 09:39:56
* @Last Modified by: Li Hanlin * @Last Modified by: Li Hanlin
* @Last Modified time: 2022-12-01 13:59:27 * @Last Modified time: 2022-12-01 15:05:17
*/ */
import * as React from 'react'; import * as React from 'react';
...@@ -772,6 +772,7 @@ function Model(props) { ...@@ -772,6 +772,7 @@ function Model(props) {
break; break;
} }
}; };
const [request, setrequest] = useState();
useEffect(() => { useEffect(() => {
const fn = async () => { const fn = async () => {
let res = await doFetch({ let res = await doFetch({
...@@ -781,12 +782,7 @@ function Model(props) { ...@@ -781,12 +782,7 @@ function Model(props) {
}, },
}); });
if (res?.data?.dataList) { if (res?.data?.dataList) {
let column = [ let column = [];
{
title: '扩展字段',
valueType: 'split',
},
];
res?.data?.dataList?.forEach((el) => { res?.data?.dataList?.forEach((el) => {
column.push({ column.push({
...selectValueType(el.fieldChar, el.valueList), ...selectValueType(el.fieldChar, el.valueList),
...@@ -795,42 +791,41 @@ function Model(props) { ...@@ -795,42 +791,41 @@ function Model(props) {
key: el.id, key: el.id,
}); });
}); });
setnewfieldscolumns(columns.concat(column)); setnewfieldscolumns(column);
} }
}; },
fn(); fn2 = async () => {
}, []);
return (
<>
<ProDescriptions
request={async () => {
const res = await doFetch({ const res = await doFetch({
url: urlParams.detail, url: urlParams.detail,
params: { id: drawer?.item?.id }, params: { id: drawer?.item?.id },
}); });
console.log(res?.data?.data);
let obj = {}; let obj = {};
res?.data?.data[equipmentCharList]?.forEach((it) => { res?.data?.data['equipmentCharList']?.forEach((it) => {
obj[it?.fieldId] = it?.fieldRealValue; obj[it?.fieldId] = it?.fieldRealValue;
}); });
console.log('drawerpro:', { console.log('drawerpro:', {
...(res?.data?.data ?? {}), ...(res?.data?.data ?? {}),
...obj, ...obj,
}); });
setrequest(
return {
success: true,
data:
{ {
...(res?.data?.data ?? {}), ...(res?.data?.data ?? {}),
...obj, ...obj,
} ?? {}, } ?? {},
);
}; };
}} fn();
columns={newfieldscolumns} fn2();
/> }, []);
return (
<>
<ProDescriptions dataSource={request} columns={columns} />
<Divider /> <Divider />
<h3 className="page-title">扩展字段</h3> <h3 className="page-title" style={{ marginBottom: 16 }}>
扩展字段
</h3>
<ProDescriptions dataSource={request} columns={newfieldscolumns} />
</> </>
); );
}; };
......
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