Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
zhoubichuan committed Nov 12, 2023
1 parent 5114022 commit f4d5f46
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions src/pages/list/list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,16 +169,7 @@ const TableList: React.FC = () => {
};
const handleOnSearch = async () => {
const { data } = await requestList({ current: 1, pageSize: 1000 });
const targetArr = [],
obj = {};
for (let i = 0; i < data.length; i++) {
const { typeName = '' } = data[i];
if (!obj[typeName]) {
obj[typeName] = true;
targetArr.push({ label: typeName, value: typeName });
}
}
setOptions(targetArr);
setOptions(data);
};
useEffect(() => {
getTemplateData(params.id);
Expand Down Expand Up @@ -224,11 +215,17 @@ const TableList: React.FC = () => {
...item.table,
renderFormItem: () => {
if (item.search && item.search.type === 'select') {
// if(item.search.data){
// return <ProFormSelect name={item.dataIndex} options={item.search.data} />;
// }else{
return <ProFormSelect name={item.dataIndex} options={options} />;
// }
return (
<ProFormSelect
name={item.dataIndex}
options={[...new Set(options.map((o: any) => o[item.dataIndex]))].map(
(name: string) => ({
label: name,
value: name,
}),
)}
/>
);
} else {
return <ProFormText name={item.dataIndex} />;
}
Expand Down

0 comments on commit f4d5f46

Please sign in to comment.