Commit 5f0fc5d4 authored by Maofei94's avatar Maofei94

perf: 解决方案管理api替换

parent fc549f49
Pipeline #22607 passed with stages
in 17 minutes 0 seconds
import React, { useState, useEffect } from 'react';
import { Select, Card, Row, Col, Button, Spin, notification } from 'antd';
import PageContainer from '@/components/BasePageContainer';
import { getSolutionList, changeSolution } from '@/services/database/api';
import {
getSolutionList,
changeSolution,
publishGetSolutionList,
} from '@/services/database/api';
import styles from './CurrentSolution.less';
const { Option } = Select;
const CurrentSolution = () => {
const [currentData, setCurrentData] = useState(''); // 解决方案的值
const [dataList, setDataList] = useState([]); // 下拉数组
const [loading, setLoading] = useState(false);
// useEffect(() => {
// setLoading(true);
// getSolutionList({
// _version: 9999,
// _dc: new Date().getTime(),
// })
// .then(res => {
// setLoading(false);
// if (res.success) {
// setCurrentData(res.currentSolution);
// setDataList(res.solutions);
// }
// })
// .catch(err => {
// setLoading(false);
// console.error(err);
// });
// }, []);
useEffect(() => {
newGetSolution();
}, []);
const newGetSolution = () => {
setLoading(true);
getSolutionList({
publishGetSolutionList({
_version: 9999,
_dc: new Date().getTime(),
})
.then(res => {
setLoading(false);
if (res.success) {
setCurrentData(res.currentSolution);
setDataList(res.solutions);
if (res.code === 0) {
const { currentSolution, solutions } = res.data;
setCurrentData(currentSolution);
setDataList(solutions);
}
})
.catch(err => {
.finally(() => {
setLoading(false);
console.error(err);
});
}, []);
};
// 切换解决方案
const handleSelect = e => {
setCurrentData(e);
......
......@@ -70,6 +70,8 @@ export const deleteConn = params =>
export const getSolutionList = params =>
get(`${CITY_SERVICE}/OMS.svc/W4_GetSolutionList`, params);
export const publishGetSolutionList = params =>
get(`${PUBLISH_SERVICE}/PlatformCenter/GetSolutionList`, params);
// 切换解决方案
export const changeSolution = params =>
get(`${CITY_SERVICE}/OMS.svc/W4_ChangeSolution`, params);
......
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