Commit de0ea244 authored by chenshouchao's avatar chenshouchao

Merge branch 'feat-20220801' of http://120.77.149.83/root/bkunyun into feat-20220801

parents 0808d488 55ec68d9
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com * @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-05-31 10:18:13 * @Date: 2022-05-31 10:18:13
* @LastEditors: 吴永生 15770852798@163.com * @LastEditors: 吴永生 15770852798@163.com
* @LastEditTime: 2022-08-30 18:42:45 * @LastEditTime: 2022-08-31 20:25:56
* @FilePath: /bkunyun/src/views/Project/ProjectSetting/index.tsx * @FilePath: /bkunyun/src/views/Project/ProjectSetting/index.tsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
...@@ -27,6 +27,8 @@ interface ITabList { ...@@ -27,6 +27,8 @@ interface ITabList {
} }
interface IProps { interface IProps {
value?: string;
onChange?: (val: string)=> void;
tabList: ITabList[]; tabList: ITabList[];
defaultValue?: string; defaultValue?: string;
tabPanelSx?: any; tabPanelSx?: any;
...@@ -71,11 +73,14 @@ const theme = createTheme({ ...@@ -71,11 +73,14 @@ const theme = createTheme({
const Tabs = (props: IProps) => { const Tabs = (props: IProps) => {
const { const {
tabList, tabList,
value,
defaultValue, defaultValue,
onChange,
allowNullValue = false, allowNullValue = false,
tabPanelSx = { padding: "24px 0 0 0" }, tabPanelSx = { padding: "24px 0 0 0" },
} = props; } = props;
const [value, setValue] = useState(
const [tabValue, setTabValue] = useState(
defaultValue defaultValue
? defaultValue ? defaultValue
: allowNullValue : allowNullValue
...@@ -85,8 +90,9 @@ const Tabs = (props: IProps) => { ...@@ -85,8 +90,9 @@ const Tabs = (props: IProps) => {
const [hoverValue, setHoverValue] = useState('') const [hoverValue, setHoverValue] = useState('')
const onChange = (val: string) => { const onTabChange = (val: string) => {
setValue(val); setTabValue(val)
onChange && onChange(val);
}; };
const getImgSrc = useCallback((item: ITabList)=>{ const getImgSrc = useCallback((item: ITabList)=>{
...@@ -128,11 +134,11 @@ const Tabs = (props: IProps) => { ...@@ -128,11 +134,11 @@ const Tabs = (props: IProps) => {
return ( return (
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<TabContext value={value}> <TabContext value={value || tabValue}>
<Box sx={{ borderBottom: 1, borderColor: "#EDEFF2" }}> <Box sx={{ borderBottom: 1, borderColor: "#EDEFF2" }}>
<TabList <TabList
onChange={(e: any, val: string) => { onChange={(e: any, val: string) => {
onChange(val); onTabChange(val);
}} }}
> >
{tabList {tabList
......
...@@ -647,7 +647,8 @@ const ParameterSetting = (props: IParameterSettingProps) => { ...@@ -647,7 +647,8 @@ const ParameterSetting = (props: IParameterSettingProps) => {
</div> </div>
<Tabs <Tabs
tabList={paramsTabList} tabList={paramsTabList}
defaultValue={activeParamsTab} value={activeParamsTab}
// defaultValue={activeParamsTab}
allowNullValue={true} allowNullValue={true}
tabPanelSx={{ padding: "7px 0" }} tabPanelSx={{ padding: "7px 0" }}
/> />
......
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