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

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

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