1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import React, { useState, useEffect } from 'react';
import { Tabs } from 'antd';
const TabPane = Tabs.TabPane;
import Apply from '@/webPublic/FormInsertDiy/AffairPage/ApplyPage';
import { isJSON } from '@/webPublic/one_stop_public/copy'; // 申请
export default function ApplyMerge(props) {
let settingJson = isJSON(props.routerConfig?.settingJson) ? JSON.parse(props.routerConfig?.settingJson) : [];
if(!settingJson || !Array.isArray(settingJson)){
console.log('settingJson 不是一个数组 无法渲染!');
return null;
}
const [activeKey, setActiveKey] = useState(settingJson[0].appId);
const changeActiveKey = (a) => {
setActiveKey(a);
};
useEffect(() => {
}, []);
if (!activeKey) {
return null;
}
return (
<Tabs activeKey={activeKey}
hideAdd={true}
style={{backgroundColor:'#fff'}}
onChange={changeActiveKey}
>
{
settingJson.map((g) => {
return (<TabPane tab={g.name} key={g.appId}>
{
activeKey === g.appId ?
<Apply workId={g.appId}
{...props}
/> : null
}
</TabPane>);
})
}
</Tabs>
);
}