Commit c5efa399 authored by 周宏民's avatar 周宏民

fix: 修改集成登录配置获取 不到数据的问题

parent 95e6307f
Pipeline #92420 waiting for manual action with stages
...@@ -156,7 +156,7 @@ const Master = props => { ...@@ -156,7 +156,7 @@ const Master = props => {
.then(res => { .then(res => {
if (res.code === 0) { if (res.code === 0) {
onCancel(); onCancel();
callBackSubmit(); callBackSubmit(obj);
notification.success({ notification.success({
message: '提示', message: '提示',
duration: 3, duration: 3,
......
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect, useRef } from 'react';
import { Tooltip, Spin, Modal, Input, Space, Button, Popconfirm, Table, Image, Tag, message, Popover } from 'antd'; import { Tooltip, Spin, Modal, Input, Space, Button, Popconfirm, Table, Image, Tag, message, Popover } from 'antd';
import { appService } from '@/api'; import { appService } from '@/api';
import { SaveIntegrationIndex } from '@/api/service/base'; import { SaveIntegrationIndex } from '@/api/service/base';
...@@ -21,6 +21,7 @@ const path = require('path'); ...@@ -21,6 +21,7 @@ const path = require('path');
const IntegratedLogin = props => { const IntegratedLogin = props => {
let isPanda = props.params?.isPanda || 'false'; let isPanda = props.params?.isPanda || 'false';
isPanda = isPanda === 'true'; isPanda = isPanda === 'true';
const configSetting = useRef({});
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [tableData, setTableData] = useState([]); const [tableData, setTableData] = useState([]);
const [showSearchStyle, setShowSearchStyle] = useState(false); // 是否显示模糊查询样式 const [showSearchStyle, setShowSearchStyle] = useState(false); // 是否显示模糊查询样式
...@@ -205,7 +206,7 @@ const IntegratedLogin = props => { ...@@ -205,7 +206,7 @@ const IntegratedLogin = props => {
id: e.id, id: e.id,
}) })
.then(res => { .then(res => {
if (res.code == 0) { if (res.code === 0) {
getData(); getData();
message.success('设置成功'); message.success('设置成功');
} else { } else {
...@@ -227,24 +228,28 @@ const IntegratedLogin = props => { ...@@ -227,24 +228,28 @@ const IntegratedLogin = props => {
const getData = () => { const getData = () => {
setLoading(true); setLoading(true);
appService.GetIntegrationConfig().then(res => { appService
setLoading(false); .GetIntegrationConfig({
if (res.code === 0) { client: configSetting.current?.client || 'city',
const _allName = []; })
const _groupList = []; .then(res => {
setLoading(false);
if (res.code === 0) {
const _allName = [];
const _groupList = [];
res.data.forEach(item => { res.data.forEach(item => {
const _name = item.name; const _name = item.name;
_allName.push(_name); _allName.push(_name);
_groupList.push({ value: _name, label: _name }); _groupList.push({ value: _name, label: _name });
}); });
setGroupList(_groupList); setGroupList(_groupList);
setKeepSystemName(_allName); setKeepSystemName(_allName);
setTableData(res.data.sort((a, b) => a.index - b.index)); setTableData(res.data.sort((a, b) => a.index - b.index));
} else { } else {
res.msg && message.error(res.msg); res.msg && message.error(res.msg);
} }
}); });
}; };
const add = e => { const add = e => {
...@@ -350,8 +355,22 @@ const IntegratedLogin = props => { ...@@ -350,8 +355,22 @@ const IntegratedLogin = props => {
const handleMenuClick = e => { const handleMenuClick = e => {
add(e.key); add(e.key);
}; };
const onMasterBack = data => {
if (data) configSetting.current = data;
};
const getConfig = () => {
appService
.GetIntegratedloginSetting()
.then(res => {
configSetting.current = res.data || {};
getData();
})
.catch(err => {
getData();
});
};
useEffect(() => { useEffect(() => {
getData(); getConfig();
}, []); }, []);
return ( return (
<div className={styles.Integrate}> <div className={styles.Integrate}>
...@@ -439,7 +458,13 @@ const IntegratedLogin = props => { ...@@ -439,7 +458,13 @@ const IntegratedLogin = props => {
'' ''
)} )}
{masterVisible ? ( {masterVisible ? (
<Master visible={masterVisible} onCancel={() => setMasterVisible(false)} type={type} isPanda={isPanda} /> <Master
visible={masterVisible}
onCancel={() => setMasterVisible(false)}
type={type}
isPanda={isPanda}
callBackSubmit={onMasterBack}
/>
) : ( ) : (
'' ''
)} )}
......
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