Commit bb831ee4 authored by 张烨's avatar 张烨

style: fix lint

parent 7e3bce54
import React from 'react';
// import React from 'react';
const AuthorizedRoute = ({
component,
render,
authority,
redirectPath,
// eslint-disable-next-line no-unused-vars
...rest
}) => {};
......
......@@ -24,7 +24,7 @@ export default class PromiseRender extends React.Component {
}
setRenderComponent(props) {
const on = this.checkIsInstantiation(props.ok);
const ok = this.checkIsInstantiation(props.ok);
const error = this.checkIsInstantiation(props.error);
props.promise
.then(() => {
......
import React, { useState, useEffect } from 'react';
import axios from 'axios';
import React, { useState } from 'react';
import { matchRoutes, renderRoutes } from 'react-router-config';
import { Link } from 'react-router-dom';
import { GithubOutlined } from '@ant-design/icons';
import ProLayout, { DefaultFooter } from '@ant-design/pro-layout';
import logo from '../assets/logo.svg';
......@@ -22,27 +20,8 @@ import RightContent from '../components/GlobalHeader/RightContent';
const defaultFooterDom = (
<DefaultFooter
copyright={`${new Date().getFullYear()} 蚂蚁金服体验技术部出品`}
links={[
{
key: 'Ant Design Pro',
title: 'Ant Design Pro',
href: 'https://pro.ant.design',
blankTarget: true,
},
{
key: 'github',
title: <GithubOutlined />,
href: 'https://github.com/ant-design/ant-design-pro',
blankTarget: true,
},
{
key: 'Ant Design',
title: 'Ant Design',
href: 'https://ant.design',
blankTarget: true,
},
]}
copyright={`${new Date().getFullYear()} 熊猫智慧水务技术委员会出品`}
links={[]}
/>
);
......@@ -128,7 +107,7 @@ const BasicMenu = [
},
];
const userMode = localStorage.getItem('userMode');
if (userMode == 'common') {
if (userMode === 'common') {
BasicMenu.shift();
}
......
......@@ -21,7 +21,7 @@ const UserLayout = props => {
// const { formatMessage } = useIntl();
const { breadcrumb } = getMenuData(route.routes);
const title = getPageTitle({
pathname: location.pathname,
pathname: window.location.pathname,
// formatMessage,
breadcrumb,
...props,
......
import React,{ useEffect, useState } from 'react';
import React, { useEffect, useState } from 'react';
import { Card, Form, Input, Button, Select, Table, Tag, Space } from 'antd';
import { PageContainer } from '@ant-design/pro-layout';
import { connect } from 'react-redux';
import { get, post } from 'services';
const InitDataBase = (props) =>{
const [form] = Form.useForm()
const InitDataBase = () => {
const [form] = Form.useForm();
const { Option } = Select
const onFinish = (e) =>{
console.log(e)
}
const [dbForm,setDbForm] = useState({
ip:'',
dbName:'',
password:'',
userName:'',
inUse:'',
})
const [data, setData ] = useState([])
const url=window.location.host
console.log(window.location.host)
useEffect( () =>{
get(`/Cityinterface/rest/services/OMS.svc/S_GetConnRecord`,{
_version:9999,
dc:1603334559186
}).then(res =>{
if(res.length>0){
let arr = res.map( (item,index) =>{
item.key = index
return item
const { Option } = Select;
const onFinish = e => {
console.log(e);
};
const [dbForm, setDbForm] = useState({
ip: '',
dbName: '',
password: '',
userName: '',
inUse: '',
});
const [data, setData] = useState([]);
const url = window.location.host;
console.log(window.location.host);
useEffect(() => {
get(`/Cityinterface/rest/services/OMS.svc/S_GetConnRecord`, {
_version: 9999,
dc: 1603334559186,
})
setData(arr)
.then(res => {
if (res.length > 0) {
let arr = res.map((item, index) => {
item.key = index;
return item;
});
setData(arr);
}
}).catch(err =>{
console.error(err)
})
},[])
useEffect( () =>{
get(`/Cityinterface/rest/services/OMS.svc/S_GetDataBaseConfig`,{
_version:9999,
dc:1603334559186
}).then(res =>{
console.log(res)
if(res.success){
let obj ={}
for( let k in dbForm){
obj[k]=res[k]
}
form.setFieldsValue(obj)
setDbForm(obj)
}
}).catch(err =>{
console.error(err)
.catch(err => {
console.error(err);
});
}, []);
useEffect(() => {
get(`/Cityinterface/rest/services/OMS.svc/S_GetDataBaseConfig`, {
_version: 9999,
dc: 1603334559186,
})
},[])
const testChlick = () =>{
.then(res => {
// console.log(res);
if (res.success) {
const obj = {};
for (const k in dbForm) {
obj[k] = res[k];
}
const onValuesChange =(e)=>{
form.setFieldsValue(e)
form.setFieldsValue(obj);
setDbForm(obj);
}
const onChange = (e) => {
console.log(e)
form.setFieldsValue({
dbName:e
})
}
const onCheck = (e) =>{
console.log(dbForm)
console.log(form.getFieldValue())
}
.catch(err => {
console.error(err);
});
}, []);
const testChlick = () => {};
const onValuesChange = e => {
form.setFieldsValue(e);
};
const onChange = e => {
console.log(e);
form.setFieldsValue({
dbName: e,
});
};
const onCheck = e => {
console.log(dbForm);
console.log(form.getFieldValue());
};
const option = [
{
value:'jack',
value: 'jack',
},
{
value:'jack1',
value: 'jack1',
},
{
value:'jack2',
value: 'jack2',
},
]
];
const columns = [
{
title: '服务器名或IP地址',
......@@ -113,64 +114,63 @@ const InitDataBase = (props) =>{
title: '修改描述',
dataIndex: 'name',
key: 'name',
render: () =>{
return (
<button>修改描述</button>
)
}
render: () => {
return <button>修改描述</button>;
},
},
{
title: '删除',
dataIndex: 'name',
key: 'name',
render: () =>{
return (
<button>删除</button>
)
}
render: () => {
return <button>删除</button>;
},
},
]
];
return (
<>
<PageContainer>
<Card>
<Form
layout="horizontal"
labelAlign='left'
labelCol={{span:3}}
labelAlign="left"
labelCol={{ span: 3 }}
form={form}
onFinish={onFinish}
onValuesChange= {onValuesChange}
onValuesChange={onValuesChange}
>
<Form.Item label="服务器名或IP地址:" name='ip'>
<Form.Item label="服务器名或IP地址:" name="ip">
<Input placeholder="请输入" />
</Form.Item>
<Form.Item label="数据库用户名称:" name='userName'>
<Form.Item label="数据库用户名称:" name="userName">
<Input placeholder="请输入" />
</Form.Item>
<Form.Item label="数据库用户密码:" name = 'password'>
<Form.Item label="数据库用户密码:" name="password">
<Input placeholder="请输入" />
</Form.Item>
<Form.Item label="数据库名称:" name = 'dbName'>
<Form.Item label="数据库名称:" name="dbName">
<Select
showSearch
placeholder="请选择"
optionFilterProp="children"
onChange={onChange}
filterOption={(input, option) =>
option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
option.children.toLowerCase().indexOf(input.toLowerCase()) >=
0
}
>
{option.map( item =>{
return (<Option value={item.value}>{item.value}</Option>)
{option.map(item => {
return <Option value={item.value}>{item.value}</Option>;
})}
</Select>
</Form.Item>
<Form.Item >
<Space size='large'>
<Form.Item>
<Space size="large">
<Button onClick={onCheck}>测试连接</Button>
<Button htmlType='submit'>保存连接</Button>
<Button htmlType='reset' onClick = { testChlick}>数据库初始化</Button>
<Button htmlType="submit">保存连接</Button>
<Button htmlType="reset" onClick={testChlick}>
数据库初始化
</Button>
</Space>
<span>{dbForm.inUse}</span>
</Form.Item>
......@@ -183,11 +183,11 @@ const InitDataBase = (props) =>{
</Form>
</Card>
<Card>
<Table columns={columns} dataSource={data} bordered/>
<Table columns={columns} dataSource={data} bordered />
</Card>
</PageContainer>
</>
)
}
);
};
export default connect()(InitDataBase)
\ No newline at end of file
export default connect()(InitDataBase);
......@@ -3,6 +3,9 @@ import Login from '../pages/user/login';
import BasicLayout from '../layouts/BasicLayout';
import Welcome from '../pages/Welcome';
import RequestTest from '../pages/testPages/request';
import InitDataBase from '../pages/database/InitDataBase';
import ManagementDataBase from '../pages/database/ManagementDataBase';
export default {
routes: [
{
......@@ -34,12 +37,12 @@ export default {
{
path: '/dbm/dbInit',
name: '数据库初始化',
component: Welcome,
component: InitDataBase,
},
{
path: '/dbm/dbsm',
name: '数据库标准化管理',
component: Welcome,
component: ManagementDataBase,
},
{
path: '/ou/orgList',
......
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