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