import React, { useState, useEffect } from 'react'; import { Select, Card, Row, Col, Button, Spin, notification } from 'antd'; import PageContainer from '@/components/BasePageContainer'; 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); publishGetSolutionList({ _version: 9999, _dc: new Date().getTime(), }) .then(res => { if (res.code === 0) { const { currentSolution, solutions } = res.data; setCurrentData(currentSolution); setDataList(solutions); } }) .finally(() => { setLoading(false); }); }; // 切换解决方案 const handleSelect = e => { setCurrentData(e); }; // 提交配置信息 const submit = params => { setLoading(true); changeSolution({ solution: currentData, }) .then(res => { setLoading(false); if (res.code === 0) { notification.success({ message: '提示', description: '切换成功', duration: 3, }); } else { notification.error({ message: '提示', description: res.msg || '切换失败', duration: 15, }); } }) .catch(err => { setLoading(false); console.error(err); }); }; return ( <PageContainer> <Card className={styles.cardbox}> <Spin tip="Loading..." spinning={loading} className={styles.tAlign}> <Row> <Col span={2} className={styles.divbox}> <div>切换解决方案:</div> </Col> <Col span={22}> {currentData && ( <Select style={{ width: '100%' }} placeholder="请切换解决方案" defaultValue={currentData} onChange={e => { handleSelect(e); }} > {dataList && dataList.map((item, index) => ( <Option value={item} key={`item${index}`}> {item} </Option> ))} </Select> )} </Col> </Row> <div className={styles.textBox}> <p> <strong>友情提示:</strong> </p> <p> 熊猫智慧水务应用解决方案的管理,集成了数据库管理、用户权限管理、基础平台管理、应用中心管理、业务中心管理、系统日志管理等核心模块; </p> <p> 主要为客户项目经理在实施应用部署的过程中提供可视化配置系统,一站式交付用户需求的熊猫智慧水务相关产品; </p> <p>数据库支持SQL Server、Oracle、MongoDB、MySQL四大类常见数据库;</p> <p>平台中心涵盖GIS平台、物联网平台、消息平台等基础平台;</p> <p>业务中心涵盖表字段配置、台账管理、工单管理、巡维保等业务;</p> {/* 无线App端、微信小程序端 */} <p> 应用中心主要把客户应用按端分离,分为PCWeb端、移动应用端,结合应用界面与菜单权限配置完成; </p> <p> 用户中心负责管理用户与平台的关系、用户与端的关系、用户与功能菜单的关系、用户与设备的关系。 </p> </div> <div className={styles.btnBox}> <Button type="primary" onClick={() => submit()}> 提交 </Button> </div> </Spin> </Card> </PageContainer> ); }; export default CurrentSolution;