|
@@ -13,6 +13,7 @@ import { BaseMenuEnum } from '@/pages/Schema/Base'
|
|
import { PageContainer } from '@ant-design/pro-layout'
|
|
import { PageContainer } from '@ant-design/pro-layout'
|
|
import CompanyDrawer from './components/CompanyDrawer'
|
|
import CompanyDrawer from './components/CompanyDrawer'
|
|
import { ModalType } from '@/utils/enum'
|
|
import { ModalType } from '@/utils/enum'
|
|
|
|
+import { generateColumns } from '@/utils/util'
|
|
|
|
|
|
type ListProps = ConnectProps & {
|
|
type ListProps = ConnectProps & {
|
|
pTypeList: { label: string; value: string }[]
|
|
pTypeList: { label: string; value: string }[]
|
|
@@ -134,23 +135,6 @@ const CompanyList: React.FC<ListProps> = ({ base, dispatch, pTypeList }) => {
|
|
}
|
|
}
|
|
]
|
|
]
|
|
|
|
|
|
- function generateColumns(c, s) {
|
|
|
|
- if (!s) return c
|
|
|
|
- // 新的列
|
|
|
|
- const nC = [...c]
|
|
|
|
- if (s) {
|
|
|
|
- const properties = JSON.parse(s).properties
|
|
|
|
- const keys = Object.keys(properties)
|
|
|
|
- keys.forEach(item => {
|
|
|
|
- const isExist = c.some(column => column.dataIndex === item)
|
|
|
|
- // 该列在columns中未定义
|
|
|
|
- if (!isExist) {
|
|
|
|
- nC.splice(-2, 0, { dataIndex: item, title: properties[item].title })
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- return nC
|
|
|
|
- }
|
|
|
|
return (
|
|
return (
|
|
<PageContainer title={false}>
|
|
<PageContainer title={false}>
|
|
<ProTable<API.InstitutionListItem>
|
|
<ProTable<API.InstitutionListItem>
|