CurrentSolution.jsx 4.61 KB
Newer Older
1 2
import React, { useState, useEffect } from 'react';
import { Select, Card, Row, Col, Button, Spin, notification } from 'antd';
3
import PageContainer from '@/components/BasePageContainer';
4
import { getSolutionList, changeSolution, publishGetSolutionList } from '@/services/database/api';
5 6 7
import styles from './CurrentSolution.less';
const { Option } = Select;
const CurrentSolution = () => {
8 9
  const [currentData, setCurrentData] = useState(''); // 解决方案的值
  const [dataList, setDataList] = useState([]); // 下拉数组
10
  const [loading, setLoading] = useState(false);
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
  // 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);
  //     });
  // }, []);
29
  useEffect(() => {
30 31 32
    newGetSolution();
  }, []);
  const newGetSolution = () => {
33
    setLoading(true);
34
    publishGetSolutionList({
35 36 37 38
      _version: 9999,
      _dc: new Date().getTime(),
    })
      .then(res => {
39 40 41 42
        if (res.code === 0) {
          const { currentSolution, solutions } = res.data;
          setCurrentData(currentSolution);
          setDataList(solutions);
43 44
        }
      })
45
      .finally(() => {
46 47
        setLoading(false);
      });
48
  };
49
  // 切换解决方案
50 51 52
  const handleSelect = e => {
    setCurrentData(e);
  };
53
  // 提交配置信息
54 55 56 57 58 59 60
  const submit = params => {
    setLoading(true);
    changeSolution({
      solution: currentData,
    })
      .then(res => {
        setLoading(false);
61
        if (res.code === 0) {
62 63
          notification.success({
            message: '提示',
64
            description: '切换成功',
65 66 67 68 69
            duration: 3,
          });
        } else {
          notification.error({
            message: '提示',
70
            description: res.msg || '切换失败',
Maofei94's avatar
Maofei94 committed
71
            duration: 15,
72 73 74 75 76
          });
        }
      })
      .catch(err => {
        setLoading(false);
Maofei94's avatar
Maofei94 committed
77
        console.error(err);
78 79 80 81 82 83 84 85
      });
  };
  return (
    <PageContainer>
      <Card className={styles.cardbox}>
        <Spin tip="Loading..." spinning={loading} className={styles.tAlign}>
          <Row>
            <Col span={2} className={styles.divbox}>
Maofei94's avatar
Maofei94 committed
86
              <div>切换解决方案:</div>
87
            </Col>
Maofei94's avatar
Maofei94 committed
88
            <Col span={22}>
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
              {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>
Maofei94's avatar
Maofei94 committed
108 109 110 111 112
          <div className={styles.textBox}>
            <p>
              <strong>友情提示:</strong>
            </p>
            <p>
113
              熊猫智慧水务应用解决方案的管理,集成了数据库管理、用户权限管理、基础平台管理、应用中心管理、业务中心管理、系统日志管理等核心模块;
Maofei94's avatar
Maofei94 committed
114 115 116 117
            </p>
            <p>
              主要为客户项目经理在实施应用部署的过程中提供可视化配置系统,一站式交付用户需求的熊猫智慧水务相关产品;
            </p>
118
            <p>数据库支持SQL Server、Oracle、MongoDB、MySQL四大类常见数据库;</p>
119 120
            <p>平台中心涵盖GIS平台、物联网平台、消息平台等基础平台;</p>
            <p>业务中心涵盖表字段配置、台账管理、工单管理、巡维保等业务;</p>
Maofei94's avatar
Maofei94 committed
121 122 123 124 125 126 127 128
            {/* 无线App端、微信小程序端 */}
            <p>
              应用中心主要把客户应用按端分离,分为PCWeb端、移动应用端,结合应用界面与菜单权限配置完成;
            </p>
            <p>
              用户中心负责管理用户与平台的关系、用户与端的关系、用户与功能菜单的关系、用户与设备的关系。
            </p>
          </div>
129 130 131 132 133 134 135 136 137 138 139 140
          <div className={styles.btnBox}>
            <Button type="primary" onClick={() => submit()}>
              提交
            </Button>
          </div>
        </Spin>
      </Card>
    </PageContainer>
  );
};

export default CurrentSolution;