mode
This commit is contained in:
parent
ea4d47dc48
commit
61fef82201
|
@ -2,13 +2,13 @@ import axios from 'axios'
|
|||
import { message } from 'antd'
|
||||
|
||||
axios.defaults.timeout = 3000;
|
||||
axios.defaults.baseURL = 'http://console.fecribd.com/'
|
||||
axios.defaults.baseURL = 'http://139.9.249.34:51013'
|
||||
|
||||
axios.interceptors.request.use(config => {
|
||||
const token = localStorage.getItem('token')
|
||||
if (token) {
|
||||
config.headers.Authorization = token
|
||||
}
|
||||
const secret = "EZgo9ykxrYuBMYnYmmKIh"
|
||||
// if (secret) {
|
||||
config.headers.secret = secret
|
||||
// }
|
||||
return config
|
||||
}, error => {
|
||||
Promise.reject(error)
|
||||
|
|
|
@ -1,134 +1,33 @@
|
|||
// import React, { Component } from 'react'
|
||||
// import { Table, Card, Form, Input, Select, Button, Row, Col } from 'antd'
|
||||
import React, { Component } from 'react'
|
||||
import { Table} from 'antd'
|
||||
|
||||
// class FecrTable extends Component {
|
||||
// constructor(props) {
|
||||
// super(props)
|
||||
// }
|
||||
class FeTable extends Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
}
|
||||
|
||||
// componentWillReceiveProps(props) {
|
||||
// this.setState({
|
||||
// url: props.url,
|
||||
// data: props.data,
|
||||
// retrieve: props.retrieve
|
||||
// })
|
||||
// }
|
||||
componentWillReceiveProps(props) {
|
||||
this.setState({
|
||||
data: props.data,
|
||||
columns: props.columns
|
||||
})
|
||||
}
|
||||
|
||||
// componentDidMount() {
|
||||
// this.init()
|
||||
// }
|
||||
render() {
|
||||
return (
|
||||
<React.Fragment>
|
||||
<Table bordered dataSource={this.state.targetData} columns={this.state.columns} pagination={
|
||||
{
|
||||
total: this.state.total,
|
||||
showSizeChanger: true,
|
||||
showTotal: () => `共 ${this.state.total} 条`,
|
||||
onChange: (current, pageSize) => this.getServiceList(current, pageSize),
|
||||
onShowSizeChange: (current, pageSize) => this.getServiceList(current, pageSize)
|
||||
}
|
||||
} />
|
||||
</React.Fragment>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// componentDidMount() {
|
||||
// this.getServiceList(1, 10)
|
||||
// }
|
||||
|
||||
// onFinish = (value) => {
|
||||
// Object.keys(value).forEach(key => {
|
||||
// if (value[key] === undefined) {
|
||||
// value[key] = ""
|
||||
// }
|
||||
// })
|
||||
// this.setState({
|
||||
// data: Object.assign(this.state.data, value)
|
||||
// })
|
||||
// React.$axios.post_json('/admin_tfse/service_statements/service_list', this.state.data)
|
||||
// .then(res => {
|
||||
// this.setState({
|
||||
// targetData: res.data,
|
||||
// columns: Object.keys(res.data[0]).map(key => {
|
||||
// return { title: key, dataIndex: key, align: 'center' }
|
||||
// }),
|
||||
// total: res.total
|
||||
// })
|
||||
// })
|
||||
// .catch(err => {
|
||||
// console.log(err)
|
||||
// })
|
||||
// }
|
||||
|
||||
// init() {
|
||||
// this.setState({
|
||||
// data: Object.assign(this.state.data, { "skip": (current - 1) * pageSize, "limit": pageSize })
|
||||
// })
|
||||
// React.$axios.post_json(this.state.url, this.state.data)
|
||||
// .then(res => {
|
||||
// this.setState({
|
||||
// targetData: res.data,
|
||||
// columns: Object.keys(res.data[0]).map(key => {
|
||||
// return { title: key, dataIndex: key, align: 'center' }
|
||||
// }),
|
||||
// total: res.total
|
||||
// })
|
||||
// })
|
||||
// .catch(err => {
|
||||
// console.log(err)
|
||||
// })
|
||||
// }
|
||||
|
||||
// render() {
|
||||
// return (
|
||||
// <React.Fragment>
|
||||
// <Form layout="inline" style={{ marginBottom: 20 }} onFinish={this.onFinish}>
|
||||
// <Row style={{ width: "100%" }}>
|
||||
// <Col span={5}>
|
||||
// <Form.Item label="服务ID" name="service_id">
|
||||
// <Input></Input>
|
||||
// </Form.Item>
|
||||
// </Col>
|
||||
// <Col span={5}>
|
||||
// <Form.Item label="用户ID" name="user_id">
|
||||
// <Input></Input>
|
||||
// </Form.Item>
|
||||
// </Col>
|
||||
// <Col span={3}>
|
||||
// <Form.Item label="服务状态" name="service_status">
|
||||
// <Select style={{ width: "100%" }}>
|
||||
// <Option value="进行中">进行中</Option>
|
||||
// <Option value="已结束">已结束</Option>
|
||||
// </Select>
|
||||
// </Form.Item>
|
||||
// </Col>
|
||||
// <Col span={3}>
|
||||
// <Form.Item label="付费状态" name="payment_status">
|
||||
// <Select style={{ width: "100%" }}>
|
||||
// <Option value="已付费">已付费</Option>
|
||||
// <Option value="未付费">未付费</Option>
|
||||
// </Select>
|
||||
// </Form.Item>
|
||||
// </Col>
|
||||
// <Col span={3}>
|
||||
// <Form.Item label="当前步骤" name="current_step">
|
||||
// <Select style={{ width: "100%" }}>
|
||||
// <Option value="步骤一">步骤一</Option>
|
||||
// <Option value="步骤二">步骤二</Option>
|
||||
// </Select>
|
||||
// </Form.Item>
|
||||
// </Col>
|
||||
// <Col span={3}>
|
||||
// <Form.Item label="分析师" name="analyst">
|
||||
// <Select style={{ width: "100%" }}>
|
||||
// </Select>
|
||||
// </Form.Item>
|
||||
// </Col>
|
||||
// <Col span={2}>
|
||||
// <Form.Item>
|
||||
// <Button type='primary' htmlType="submit" style={{ width: '100%' }}>查询</Button>
|
||||
// </Form.Item>
|
||||
// </Col>
|
||||
// </Row>
|
||||
// </Form>
|
||||
// <Table bordered dataSource={this.state.targetData} columns={this.state.columns} pagination={
|
||||
// {
|
||||
// total: this.state.total,
|
||||
// showSizeChanger: true,
|
||||
// showTotal: () => `共 ${this.state.total} 条`,
|
||||
// onChange: (current, pageSize) => this.getServiceList(current, pageSize),
|
||||
// onShowSizeChange: (current, pageSize) => this.getServiceList(current, pageSize)
|
||||
// }
|
||||
// } />
|
||||
// </React.Fragment>
|
||||
// )
|
||||
// }
|
||||
// }
|
||||
|
||||
// export default FecrTable
|
||||
export default FeTable
|
|
@ -0,0 +1,85 @@
|
|||
import React, { Component } from 'react'
|
||||
import { Card, Row, Col, Modal, Input, Form } from 'antd'
|
||||
import api from "../../../../api/request"
|
||||
|
||||
const { Meta } = Card
|
||||
|
||||
class TestCompany extends Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
this.state = {
|
||||
data: [
|
||||
{ imageUrl: "https://gw.alipayobjects.com/zos/basement_prod/51682163-e01a-46fe-810c-ac0062379717.svg", title: "企业认证", desc: "根据企业名称、统一社会信用代码、法人姓名进行企业认证", obj: { company: "远东资信评估有限公司", code: "91310101132508092K", legal_person: "杨秋岭", cid: "qwwAWUIm" }, url: "/admin/test/enterprise_certification" },
|
||||
{ imageUrl: "https://gw.alipayobjects.com/zos/basement_prod/c0c3852c-d245-4330-886b-cb02ef49eb6d.svg", title: "级联删除企业ID", desc: "根据cid,删除与其有关的所有记录", obj: { cid: "" }, url: "/admin/test/delete_cid_cascade" },
|
||||
{ imageUrl: "https://gw.alipayobjects.com/zos/basement_prod/d475d063-2754-4442-b9db-5d164e06acc9.svg", title: "级联删除评价ID", desc: "根据rid,删除与其有关的所有记录", obj: { rid: "" }, url: "/admin/test/delete_rid_cascade" },
|
||||
],
|
||||
setIsModalVisible: false,
|
||||
form: {},
|
||||
url: ""
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
|
||||
}
|
||||
|
||||
showModal = (val) => {
|
||||
this.setState({
|
||||
setIsModalVisible: true,
|
||||
form: val.obj,
|
||||
url: val.url
|
||||
})
|
||||
}
|
||||
|
||||
handleCancel = () => {
|
||||
this.setState({
|
||||
setIsModalVisible: false
|
||||
})
|
||||
}
|
||||
|
||||
handleOk = () => {
|
||||
api.post_json(this.state.url, this.state.form)
|
||||
.then(res => {
|
||||
console.log(res)
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err)
|
||||
})
|
||||
this.setState({
|
||||
setIsModalVisible: false
|
||||
})
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Card title="企业管理" className='card'>
|
||||
<Modal title="Basic Modal" visible={this.state.setIsModalVisible} onCancel={this.handleCancel} onOk={this.handleOk}>
|
||||
<Form labelCol={{ span: 5 }} wrapperCol={{ span: 16 }}>
|
||||
<Row style={{ width: "100%" }}>
|
||||
{
|
||||
Object.keys(this.state.form).map((key) => {
|
||||
return <Col span={24}>
|
||||
<Form.Item label={key} name={key} >
|
||||
<Input></Input>
|
||||
</Form.Item>
|
||||
</Col>
|
||||
})
|
||||
}
|
||||
</Row>
|
||||
</Form>
|
||||
</Modal>
|
||||
<Row style={{ width: "100%" }} justify="space-between">
|
||||
{this.state.data.map(item => {
|
||||
return <Col span={7}>
|
||||
<Card cover={<img src={item.imageUrl} alt="图片" onClick={this.showModal.bind(this, item)} />}>
|
||||
<Meta title={item.title} description={item.desc}></Meta>
|
||||
</Card>
|
||||
</Col>
|
||||
})}
|
||||
</Row>
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default TestCompany
|
|
@ -1,20 +1,92 @@
|
|||
import React, { Component } from 'react'
|
||||
import Dashboard from './branch/dashboard'
|
||||
import Dashboard from './branch/dashboard/dashboard'
|
||||
import ServiceList from './branch/service'
|
||||
import UserList from './branch/user'
|
||||
import FinancialList from './branch/financial'
|
||||
import TestCompany from "./branch/test/company"
|
||||
|
||||
import { Tabs } from 'antd';
|
||||
|
||||
const { TabPane } = Tabs;
|
||||
|
||||
class Main extends Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
this.state = {
|
||||
path: 0
|
||||
path: {},
|
||||
activeKey: "0",
|
||||
panes: [{ title: '面板', content: <Dashboard />, key: "0" }]
|
||||
}
|
||||
}
|
||||
|
||||
componentDidUpdate(props) {
|
||||
if (props.path.title !== this.state.path.title) {
|
||||
var statusArray = []
|
||||
this.state.panes.every(item => {
|
||||
return statusArray.push(item.title !== this.state.path.title ? true : false)
|
||||
})
|
||||
if (statusArray.every((item) => {
|
||||
return item ? true : false;
|
||||
})) {
|
||||
this.add(this.state.path)
|
||||
} else {
|
||||
for (let i in this.state.panes) {
|
||||
if (this.state.panes[i].title === this.state.path.title) {
|
||||
this.setState({
|
||||
activeKey: this.state.panes[i].key
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
newTabIndex = "1";
|
||||
|
||||
onChange = activeKey => {
|
||||
this.setState({ activeKey });
|
||||
};
|
||||
|
||||
onEdit = (targetKey, action) => {
|
||||
console.log(targetKey, action)
|
||||
this[action](targetKey);
|
||||
};
|
||||
|
||||
add = (props) => {
|
||||
const activeKey = this.newTabIndex++;
|
||||
const newPanes = [...this.state.panes]
|
||||
newPanes.push({ title: props.title, content: this.getBranch(props.path), key: activeKey.toString() });
|
||||
this.setState({
|
||||
panes: newPanes,
|
||||
activeKey: activeKey.toString()
|
||||
});
|
||||
};
|
||||
|
||||
remove = targetKey => {
|
||||
const { panes, activeKey } = this.state;
|
||||
let newActiveKey = activeKey;
|
||||
let lastIndex;
|
||||
panes.forEach((pane, i) => {
|
||||
if (pane.key === targetKey) {
|
||||
lastIndex = i - 1;
|
||||
}
|
||||
});
|
||||
const newPanes = panes.filter(pane => pane.key !== targetKey);
|
||||
if (newPanes.length && newActiveKey === targetKey) {
|
||||
if (lastIndex >= 0) {
|
||||
newActiveKey = newPanes[lastIndex].key;
|
||||
} else {
|
||||
newActiveKey = newPanes[0].key;
|
||||
}
|
||||
}
|
||||
this.setState({
|
||||
panes: newPanes,
|
||||
activeKey: newActiveKey,
|
||||
});
|
||||
};
|
||||
|
||||
getBranch = (props) => {
|
||||
const path = props.path
|
||||
switch (path) {
|
||||
switch (props) {
|
||||
case '/dashboard':
|
||||
return <Dashboard />
|
||||
case '/service':
|
||||
|
@ -23,6 +95,8 @@ class Main extends Component {
|
|||
return <UserList />
|
||||
case '/financial':
|
||||
return <FinancialList />
|
||||
case "/test/company":
|
||||
return <TestCompany />
|
||||
default:
|
||||
return <Dashboard />
|
||||
}
|
||||
|
@ -31,11 +105,33 @@ class Main extends Component {
|
|||
|
||||
render() {
|
||||
return (
|
||||
<div className="card-container" style={{height:'100%'}}>
|
||||
{this.getBranch(this.props)}
|
||||
<div className="card-container" style={{ height: '100%' }}>
|
||||
<Tabs
|
||||
hideAdd
|
||||
type="editable-card"
|
||||
onChange={this.onChange}
|
||||
activeKey={this.state.activeKey}
|
||||
onEdit={this.onEdit}
|
||||
>
|
||||
{this.state.panes.map(pane => (
|
||||
<TabPane tab={pane.title} key={pane.key} closable={pane.closable}>
|
||||
{pane.content}
|
||||
</TabPane>
|
||||
))}
|
||||
</Tabs>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
static getDerivedStateFromProps(props, state) {
|
||||
const { path } = props
|
||||
if (path !== state.path) {
|
||||
return {
|
||||
path,
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
export default Main
|
|
@ -9,13 +9,13 @@ class Home extends Component {
|
|||
constructor(props){
|
||||
super(props)
|
||||
this.state = {
|
||||
path:'/dashboard'
|
||||
menu:{ title: '面板', path:'/dashboard'},
|
||||
}
|
||||
}
|
||||
|
||||
getMenuItem = (value) => {
|
||||
this.setState({
|
||||
path: value
|
||||
menu: value
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ class Home extends Component {
|
|||
<Header className="site-layout-background" style={{ padding:'0px 0px 40px 0px',height:'auto' }}>
|
||||
<Head/>
|
||||
</Header>
|
||||
<Content><Main path={this.state.path} /></Content>
|
||||
<Content><Main path={this.state.menu} /></Content>
|
||||
</Layout>
|
||||
</Layout>
|
||||
)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Menu, PageHeader } from 'antd';
|
||||
import React, { Component } from 'react'
|
||||
import { AreaChartOutlined, BookOutlined, UsergroupDeleteOutlined } from '@ant-design/icons';
|
||||
import { AreaChartOutlined, BookOutlined, FundProjectionScreenOutlined,GlobalOutlined,BranchesOutlined,ApartmentOutlined,SettingOutlined } from '@ant-design/icons';
|
||||
|
||||
class Side extends Component {
|
||||
constructor(props) {
|
||||
|
@ -8,19 +8,27 @@ class Side extends Component {
|
|||
this.state = {
|
||||
data: [
|
||||
{ title: '面板', path: '/dashboard', icon: <AreaChartOutlined />, category: 'Board' },
|
||||
{ title: '服务管理', path: '/service', icon: <BookOutlined />, category: 'Manager' },
|
||||
{ title: '用户管理', path: '/user', icon: <UsergroupDeleteOutlined />, category: 'Manager' },
|
||||
{ title: '财报管理', path: '/financial', icon: <BookOutlined />, category: 'Manager' },
|
||||
{ title: '企业', path: '/user', icon: <FundProjectionScreenOutlined />, category: 'Manager' },
|
||||
{ title: '服务', path: '/service', icon: <GlobalOutlined />, category: 'Manager' },
|
||||
{ title: '行业宏观', path: '/financial', icon: <BookOutlined />, category: 'Manager' },
|
||||
{ title: '阈值', path: '/service', icon: <BranchesOutlined />, category: 'Model' },
|
||||
{ title: '行业分类', path: '/service', icon: <ApartmentOutlined />, category: 'Model' },
|
||||
{ title: '企业管理', path: '/test/company', icon: <FundProjectionScreenOutlined />, category: 'Test' },
|
||||
{ title: '服务管理', path: '/service', icon: <GlobalOutlined />, category: 'Test' },
|
||||
{ title: '设置', path: '/service', icon: <SettingOutlined />, category: 'Setting' },
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
handleClick = e => {
|
||||
this.props.parent.getMenuItem(this.state.data[e.key].path)
|
||||
this.props.parent.getMenuItem({
|
||||
title:this.state.data[e.key].title,
|
||||
path:this.state.data[e.key].path
|
||||
})
|
||||
}
|
||||
|
||||
render() {
|
||||
const menuItem = ['Board', 'Manager'].map((item,i) => {
|
||||
const menuItem = ['Board', 'Manager','Model','Test','Setting'].map((item,i) => {
|
||||
return <Menu.ItemGroup title={item} key={i}>
|
||||
{this.state.data.map((ele, index) => {
|
||||
return ele.category === item?<Menu.Item key={index} icon={ele.icon} onClick={this.handleClick}>{ele.title}</Menu.Item>:null
|
||||
|
|
Loading…
Reference in New Issue