Browse Source

系统主结构调整

zhuth 6 years ago
parent
commit
1e1933c5c3

+ 10 - 3
src/components/admin/userManagement.jsx

@@ -35,16 +35,23 @@ class UserManagement extends React.Component {
     }
 
     render() {
-        const { user, dispatch } = this.props;
+        const { user, main, dispatch } = this.props;
         const { tableBodyHeight, pageSize } = this.state;
+        const { newOne } = user;
+        const { currentUser } = main;
 
         const moreOperatingMenu = (
             <Menu className='operationmenu' visible={true}>
                 <Menu.Item
+                    disabled={currentUser.code === newOne.code}
                     onClick={() => {
+                        // console.log();
+                        dispatch({ type: 'user/remoteModify', fields: {
+                            role: newOne.role === 'admin' ? 'normal' : 'admin'
+                        } });
                     }}
                 >
-                    <Icon type="key" />设为管理员
+                    <Icon type="key" />{ newOne.role === 'admin' ? '取消管理员' : '设为管理员'}
                 </Menu.Item>
             </Menu>
         );
@@ -141,4 +148,4 @@ class UserManagement extends React.Component {
     }
 }
 
-export default connect(({ present: { user } }) => ({ user }))(UserManagement);
+export default connect(({ present: { user, main } }) => ({ user, main }))(UserManagement);

+ 89 - 0
src/components/common/navigator1.jsx

@@ -0,0 +1,89 @@
+import React from 'react'
+import { Layout, Menu, Icon, Avatar, Dropdown } from 'antd'
+import { Link } from 'react-router-dom'
+import { connect } from 'dva'
+import './navigator.less'
+const { Header, Sider, Content } = Layout
+
+class Navigator extends React.Component {
+    constructor(props) {
+        super(props)
+        this.state = {
+        }
+    };
+    
+
+    render() {
+        const { main, dispatch } = this.props;
+        const { currentUser, currentPage, lastWorkshopPage, lastSettingPage } = main;
+
+        let page = currentPage.match(/\/(\w+)/g)[0].replace('/', '');
+
+        const userMenu = currentUser.code ? (
+            <Menu>
+                <Menu.Item key="0" onClick={() => {
+                    dispatch({ type: 'main/redirect', path: '/userinfo' });
+                }}>
+                    <Icon type="info-circle-o" /><span>账号信息</span>
+                </Menu.Item>
+                {/* {currentUser.role === 'admin' && <Menu.Item key="1" onClick={() => {
+                    dispatch({ type: 'main/redirect', path: '/admin' });
+                }}>
+                    <Icon type="setting" />用户管理
+                </Menu.Item>} */}
+                <Menu.Divider />
+                <Menu.Item key="3" onClick={() => {
+                    dispatch({ type: 'main/logout' });
+                    dispatch({ type: 'main/redirect', path: '/login' });
+                }}><Icon type="logout" />退出系统</Menu.Item>
+            </Menu>
+        ) : (
+            <Menu>
+                <Menu.Item key="0" onClick={() => {
+                    dispatch({ type: 'main/redirect', path: '/login' });
+                }}>
+                    <span>登录</span>
+                </Menu.Item>
+            </Menu>
+        );
+
+        return <div className='navigator'>
+            <div className='navigator-left'>
+                LOGO
+            </div>
+            <div className='navigator-content'>
+                <Menu
+                    className='navigator-menu'
+                    selectedKeys={[page]}
+                    mode="horizontal"
+                >     
+                    <Menu.Item className='nav-page' key="home">
+                        <Link to='/home'><Icon type="home" />首页</Link>
+                    </Menu.Item>
+                    <Menu.Item className='nav-page' key="workshop">
+                        <Link to={lastWorkshopPage}><Icon type="fund" />报表制作</Link>
+                    </Menu.Item>
+                    <Menu.Item className='nav-page' key="setting">
+                        <Link to={lastSettingPage}><Icon type="setting" />系统管理</Link>
+                    </Menu.Item>
+                </Menu>
+            </div>
+            <div className='navigator-right'>
+                <Dropdown overlay={userMenu} trigger={['click']}>
+                    <div>
+                        <Avatar className='user-icon' size="small" icon="user" />
+                        <span className='user-name'>{currentUser.code ? currentUser.name : '未登录'}</span>
+                    </div>
+                </Dropdown>
+            </div>
+        </div>
+    }
+}
+
+function mapStateToProps({ present: { main } }) {
+    return { main };
+}
+
+export default connect(mapStateToProps)(Navigator)
+
+

+ 49 - 0
src/components/setting/index.jsx

@@ -0,0 +1,49 @@
+import React from 'react'
+import { Link } from 'react-router-dom'
+import { Route, Switch, Redirect } from 'dva/router'
+import { Layout, Button } from 'antd'
+import { connect } from 'dva'
+import Loading from '../../components/common/loading/loading'
+import Admin from '../../components/admin/admin'
+import './index.less'
+const { Sider, Content } = Layout
+
+class Setting extends React.Component {
+    constructor(props) {
+        super(props);
+        this.state = {
+
+        }
+    }
+
+    render() {
+        const { main } = this.props;
+        const { currentPage } = main;
+
+        let paths = currentPage.match(/\/(\w+)/g).map(p => p.replace('/', ''));
+
+        return <Layout className='layout-setting'>
+            <Loading />
+            <Sider
+                width={100}
+                collapsible
+                collapsedWidth={0}
+                trigger={null}
+                theme='light'
+                className='sider-setting'
+            >
+                <Link to='/setting/admin'><Button className='ant-btn-block' type={(paths[1] === 'admin' || !paths[1]) ? 'primary' : 'default'} >用户管理</Button></Link>
+                <Link to=''><Button disabled className='ant-btn-block' type={paths[1] === 'datasource' ? 'primary' : 'default'} >权限管理</Button></Link>
+                <Link to=''><Button disabled className='ant-btn-block' type={paths[1] === 'chart' ? 'primary' : 'default'} >操作日志</Button></Link>
+            </Sider>
+            <Content className='main-content'>
+                <Switch>
+                    <Route sensitive path='/setting/admin' component={Admin}/>
+                    <Route path='/' component={() => (<Redirect to={{ pathname: '/setting/admin' }} ></Redirect>)}/>
+                </Switch>
+            </Content>
+        </Layout>
+    }
+}
+
+export default connect(({ present: { main } }) => ({ main }))(Setting)

+ 9 - 0
src/components/setting/index.less

@@ -0,0 +1,9 @@
+.layout-setting {
+    .sider-setting {
+        padding: 12px;
+        button {
+            padding: 0 8px;
+            margin: 0 0 12px 0;
+        }
+    }
+}

+ 56 - 0
src/components/workshop/index.jsx

@@ -0,0 +1,56 @@
+import React from 'react'
+import { Link } from 'react-router-dom'
+import { Route, Switch, Redirect } from 'dva/router'
+import { Layout, Button } from 'antd'
+import { connect } from 'dva'
+import Loading from '../../components/common/loading/loading'
+import DataConnect from '../../components/dataConnect/list'
+import DataSource from '../../components/dataSource/list'
+import Dashboard from '../../components/dashboard/list'
+import Chart from '../../components/chart/list'
+import './index.less'
+const { Sider, Content } = Layout
+
+class Workshop extends React.Component {
+    constructor(props) {
+        super(props);
+        this.state = {
+
+        }
+    }
+
+    render() {
+        const { main } = this.props;
+        const { currentPage } = main;
+
+        let paths = currentPage.match(/\/(\w+)/g).map(p => p.replace('/', ''));
+
+        return <Layout className='layout-workshop'>
+            <Loading />
+            <Sider
+                width={100}
+                collapsible
+                collapsedWidth={0}
+                trigger={null}
+                theme='light'
+                className='sider-workshop'
+            >
+                <Link to='/workshop/dataconnect'><Button className='ant-btn-block' type={(paths[1] === 'dataconnect' || !paths[1]) ? 'primary' : 'default'} >数据连接</Button></Link>
+                <Link to='/workshop/datasource'><Button className='ant-btn-block' type={paths[1] === 'datasource' ? 'primary' : 'default'} >数据源</Button></Link>
+                <Link to='/workshop/chart'><Button className='ant-btn-block' type={paths[1] === 'chart' ? 'primary' : 'default'} >图表</Button></Link>
+                <Link to='/workshop/dashboard'><Button className='ant-btn-block' type={paths[1] === 'dashboard' ? 'primary' : 'default'} >报表</Button></Link>
+            </Sider>
+            <Content className='main-content'>
+                <Switch>
+                    <Route sensitive path='/workshop/dataconnect' component={DataConnect}/>
+                    <Route sensitive path='/workshop/datasource' component={DataSource}/>
+                    <Route sensitive path='/workshop/chart' component={Chart} />
+                    <Route sensitive path='/workshop/dashboard' component={Dashboard} />
+                    <Route path='/' component={() => (<Redirect to={{ pathname: '/workshop/dataconnect' }} ></Redirect>)}/>
+                </Switch>
+            </Content>
+        </Layout>
+    }
+}
+
+export default connect(({ present: { main } }) => ({ main }))(Workshop)

+ 9 - 0
src/components/workshop/index.less

@@ -0,0 +1,9 @@
+.layout-workshop {
+    .sider-workshop {
+        padding: 12px;
+        button {
+            padding: 0 8px;
+            margin: 0 0 12px 0;
+        }
+    }
+}

+ 0 - 121
src/demo.jsx

@@ -1,121 +0,0 @@
-import React from 'react'
-import { Transfer, Button, Icon } from 'antd';
-
-
-class Demo extends React.Component {
-  state = {
-    mockData: [
-      {
-          "key": "0",
-          "title": "content1",
-          "description": "description of content1",
-          "chosen": false,
-      },
-      {
-          "key": "1",
-          "title": "content2",
-          "description": "description of content2",
-          "chosen": true
-      },
-      {
-          "key": "2",
-          "title": "content3",
-          "description": "description of content3",
-          "chosen": true
-      },
-      {
-          "key": "3",
-          "title": "content4",
-          "description": "description of content4",
-          "chosen": false
-      },
-      {
-          "key": "4",
-          "title": "content5",
-          "description": "description of content5",
-          "chosen": false
-      }
-  ],
-    targetKeys: [],
-  }
-  swapItems = (arr, index1, index2) => {
-    let arrClone = JSON.parse(JSON.stringify(arr))    //这里要使用一个深拷贝才能真正地改变state
-    let temp = arrClone[index1]
-    arrClone[index1] = arrClone[index2]
-    arrClone[index2] = temp
-    console.log("changedArrClone", arrClone)
-    this.setState({
-      targetKeys: arrClone
-    }, () => {console.log(`${this.state.targetKeys}`)}
-    );
-  }
-    
-
-  upSwap = (index) => {
-    let arr = this.state.targetKeys
-    if(index === 0) {
-        return;
-    }
-    this.swapItems(arr, index, index - 1)
-  }
-
-  downSwap = (index) => {
-    let arr = this.state.targetKeys
-    if(index === arr.length -1) {
-        return;
-    }
-    this.swapItems(arr, index, index + 1);
-  };
-
-  renderRow = (item) => {
-    let index = this.state.targetKeys.indexOf(item.key);
-    if (index === -1) {
-      return <span>{item.title}</span>
-    }
-    else {
-      return (
-      <span> {item.title} <Icon type="arrow-up" onClick={() => {
-        this.upSwap(index)
-      }}/> <Icon type="arrow-down" onClick={() => {
-        this.downSwap(index)
-      }}/></span>
-      );
-    }
-  }
-
-  handleChange = (targetKeys) => {
-    this.setState({ targetKeys });
-  }
-
-  renderFooter = () => {
-    return (
-      <Button
-        size="small"
-        style={{ float: 'right', margin: 5 }}
-        onClick={this.getMock}
-      >
-        reload
-      </Button>
-    );
-  }
-
-  render() {
-    return (
-      <Transfer
-        dataSource={this.state.mockData}
-        showSearch
-        listStyle={{
-          width: 250,
-          height: 300,
-        }}
-        operations={['to right', 'to left']}
-        targetKeys={this.state.targetKeys}
-        onChange={this.handleChange}
-        render={this.renderRow}
-        footer={this.renderFooter}
-      />
-    );
-  }
-}
-
-export default Demo

+ 1 - 1
src/index.js

@@ -1,6 +1,6 @@
 import dva from 'dva'
 import undoable, { includeAction } from 'redux-undo'
-import indexRouter from './routes/router'
+import indexRouter from './routes/router1'
 import mainModel from './models/main'
 import dataSource from './models/dataSource'
 import dataSourceDetail from './models/dataSourceDetail'

+ 32 - 83
src/models/dataConnect.js

@@ -194,56 +194,31 @@ export default {
 
                 // 设置validating为true
                 yield put({ type: 'setNewModelField', name: 'saving', value: true });
-                // 调用检测接口检测连接配置是否合法
-                let validBody = {
-                    id: model.code,
+
+                let body = {
                     name: model.name,
                     addrass: model.address,
                     port: model.port,
                     databaseType: model.dbType,
                     dataName: model.dbName,
                     userName: model.userName,
-                    passWord: model.password
+                    passWord: model.password,
+                    note: model.description
                 }
-                const validRes = yield call(service.fetch, {
-                    url: URLS.DATACONNECT_VALIDATE,
-                    body: validBody
+                const res = yield call(service.fetch, {
+                    url: URLS.DATACONNECT_ADD,
+                    body: body
                 });
-                let flag = !validRes.err && validRes.data.code > 0;
-                if(flag) {
-                    // 如果合法
-                    // 设置valid为true
-                    yield put({ type: 'setNewModelInvalid', name: 'invalid', value: false });
-
-                    // 继续执行保存
-                    let body = {
-                        name: model.name,
-                        addrass: model.address,
-                        port: model.port,
-                        databaseType: model.dbType,
-                        dataName: model.dbName,
-                        userName: model.userName,
-                        passWord: model.password,
-                        note: model.description
-                    }
-                    const res = yield call(service.fetch, {
-                        url: URLS.DATACONNECT_ADD,
-                        body: body
-                    });
-                    yield put({ type: 'setNewModelField', name: 'saving', value: false });
+                yield put({ type: 'setNewModelField', name: 'saving', value: false });
 
-                    if(!res.err && res.data.code > 0) {
-                        yield put({ type: 'fetchList', mandatory: true });
-                        message.success('新增成功');
-                        return true;
-                    }else {
-                        message.error('新增失败: ' + (res.err || res.data.msg));
-                        return false;
-                    }
+                if(!res.err && res.data.code > 0) {
+                    yield put({ type: 'setNewModelInvalid', name: 'invalid', value: false });
+                    yield put({ type: 'fetchList', mandatory: true });
+                    message.success('新增成功');
+                    return true;
                 }else {
-                    message.error('新增失败: ' + validRes.data.msg);
+                    message.error('新增失败: ' + (res.err || res.data.msg));
                     yield put({ type: 'setNewModelInvalid', name: 'invalid', value: true });
-                    yield put({ type: 'setNewModelField', name: 'saving', value: false });
                     return false;
                 }
             }catch(e) {
@@ -259,61 +234,35 @@ export default {
 
                 // 设置validating为true
                 yield put({ type: 'setNewModelField', name: 'saving', value: true });
-                // 调用检测接口检测连接配置是否合法
-                let validBody = {
-                    id: model.code,
+
+                const code = action.code;
+
+                let data = {
+                    id: code,
                     name: model.name,
                     addrass: model.address,
                     port: model.port,
                     databaseType: model.dbType,
                     dataName: model.dbName,
                     userName: model.userName,
-                    passWord: model.password
-                }
-                const validRes = yield call(service.fetch, {
-                    url: URLS.DATACONNECT_VALIDATE,
-                    body: validBody
+                    passWord: model.password,
+                    note: model.description
+                };
+                const res = yield call(service.fetch, {
+                    url: URLS.DATACONNECT_UPDATE,
+                    body: data
                 });
-                let flag = !validRes.err && validRes.data.code > 0;
 
-                if(flag) {
-                    // 如果合法
-                    // 设置valid为true
-                    yield put({ type: 'setNewModelInvalid', name: 'invalid', value: false });
-
-                    // 继续执行保存
-                    const code = action.code;
-
-                    let data = {
-                        id: code,
-                        name: model.name,
-                        addrass: model.address,
-                        port: model.port,
-                        databaseType: model.dbType,
-                        dataName: model.dbName,
-                        userName: model.userName,
-                        passWord: model.password,
-                        note: model.description
-                    };
-                    const res = yield call(service.fetch, {
-                        url: URLS.DATACONNECT_UPDATE,
-                        body: data
-                    });
-
-                    yield put({ type: 'setNewModelField', name: 'saving', value: false });
+                yield put({ type: 'setNewModelField', name: 'saving', value: false });
 
-                    if(!res.err && res.data.code > 0) {
-                        yield put({ type: 'fetchList', mandatory: true });
-                        message.success('修改成功');
-                        return true;
-                    }else {
-                        message.error('修改失败: ' + (res.err || res.data.msg));
-                        return false;
-                    }
+                if(!res.err && res.data.code > 0) {
+                    yield put({ type: 'setNewModelInvalid', name: 'invalid', value: false });
+                    yield put({ type: 'fetchList', mandatory: true });
+                    message.success('修改成功');
+                    return true;
                 }else {
-                    message.error('修改失败: ' + validRes.data.msg);
                     yield put({ type: 'setNewModelInvalid', name: 'invalid', value: true });
-                    yield put({ type: 'setNewModelField', name: 'saving', value: false });
+                    message.error('修改失败: ' + (res.err || res.data.msg));
                     return false;
                 }
             }catch(e) {

+ 19 - 5
src/models/main.js

@@ -37,16 +37,24 @@ export default {
             department,
             job,
         },
-        currentPage: ''
+        currentPage: '', // 当前页面路由
+        lastWorkshopPage: '/workshop/dataConnect', // 最后停留报表制作页面路由
+        lastSettingPage: '/setting/admin', // 最后停留系统设置页面路由
     },
     reducers: {
         setCurrentPage(state, action) {
-            return { ...state, currentPage: action.page || 'home' };
+            return { ...state, currentPage: action.page === '/' ? '/home' : action.page };
         },
         setCurrentUser(state, action) {
             const { user } = action;
             return { ...state, currentUser: user };
         },
+        setLastWorkshopPage(state, action) {
+            return { ...state, lastWorkshopPage: action.page === '/workshop' ? '/workshop/dataConnect' : action.page };
+        },
+        setLastSettingPage(state, action) {
+            return { ...state, lastSettingPage: action.page === '/setting' ? '/setting/admin' : action.page };
+        },
         setFields(state, action) {
             const { fields } = action;
             let obj = {};
@@ -177,6 +185,7 @@ export default {
                 maxCount: 3,
             });
 
+            /************************ 登录超时弹出重新登录框 **************************/
             let checkExpireTime = () => {
                 let expireTime = window.sessionStorage.getItem('expireTime');
                 let t = moment(+expireTime).diff(moment())
@@ -201,10 +210,15 @@ export default {
                 }
             }
             document.addEventListener(visibilityChangeEvent, onVisibilityChange);
-
+            
+            /************************ 记录当前页面 **************************/
             return history.listen(({ pathname, query }) => {
-                let page = pathname.match(/\/(\w*)/)[1];
-                dispatch({ type: 'setCurrentPage', page });
+                dispatch({ type: 'setCurrentPage', page: pathname });
+                if(pathname.startsWith('/workshop')) {
+                    dispatch({ type: 'setLastWorkshopPage', page: pathname });
+                }else if(pathname.startsWith('/setting')) {
+                    dispatch({ type: 'setLastSettingPage', page: pathname });
+                }
             })
         }
     }

+ 23 - 2
src/models/user.js

@@ -7,8 +7,10 @@ export default {
     state: {
         originData: {
             list: [],
+            newOne: {},
             filterLabel: ''
-        }
+        },
+        newOne: {}
     },
     reducers: {
         list(state, action) {
@@ -19,6 +21,15 @@ export default {
             const { label } = action;
             return { ...state, filterLabel: label}
         },
+        setNewModelFields(state, action) {
+            const { fields } = action;
+            let newOne = state.newOne;
+            for(let i = 0; i < fields.length; i++) {
+                newOne[fields[i]['name']] = fields[i]['value'];
+            }
+            delete newOne.invalid;
+            return Object.assign({}, state, {newOne});
+        },
         reset(state, action) {
             let newState = Object.assign({}, state, state.originData);
             return Object.assign({}, newState);
@@ -52,7 +63,17 @@ export default {
             }
         },
         *remoteModify(action, { put, call, select }) {
-            const body = {};
+            const user = yield select(state => state.present.user);
+            const { newOne } = user;
+            const { fields } = action;
+            const body = {
+                id: newOne.code
+            };
+            for(let k in fields) {
+                if(k !== 'id') {
+                    body[k] = fields[k]
+                }
+            }
             try {
                 const res = yield call(service.fetch({
                     url: URLS.USER_UPDATE,

+ 0 - 2
src/routes/mainLayout.jsx

@@ -9,7 +9,6 @@ import DataSource from '../components/dataSource/list'
 import Dashboard from '../components/dashboard/list'
 import Chart from '../components/chart/list'
 import './mainLayout.less'
-import Demo from '../demo'
 import Admin from '../components/admin/admin'
 import UserInfo from '../components/user/layout'
 const { Header, Content } = Layout
@@ -23,7 +22,6 @@ const MainLayout = ({ isAuthenticated }) => {
             </Header>
             <Content className='main-content'>
                 <Switch>
-                    <Route sensitive path='/demo' component={Demo}/>
                     <Route sensitive path='/home' component={HomePage}/>
                     <Route sensitive path='/dataconnect' component={DataConnect}/>
                     <Route sensitive path='/datasource' component={DataSource}/>

+ 4 - 2
src/routes/mainLayout.less

@@ -20,9 +20,11 @@ html,body,#root{
     }
     .main-content {
         height: 100%;
-        padding: 10px 5%;
         background-color: white;
-        overflow: auto;
+        overflow: hidden;
+        section {
+            height: 100%;
+        }
     }
 }
 .ant-input-number {

+ 36 - 0
src/routes/mainLayout1.jsx

@@ -0,0 +1,36 @@
+import React from 'react'
+import { Layout } from 'antd'
+import { Route, Switch, Redirect } from 'dva/router'
+import Navigator from '../components/common/navigator1'
+import HomePage from '../components/homePage/homePage'
+import Loading from '../components/common/loading/loading'
+import DataConnect from '../components/dataConnect/list'
+import DataSource from '../components/dataSource/list'
+import Dashboard from '../components/dashboard/list'
+import Chart from '../components/chart/list'
+import Workshop from '../components/workshop/index'
+import Setting from '../components/setting/index'
+import './mainLayout.less'
+import UserInfo from '../components/user/layout'
+const { Header, Content, Sider } = Layout
+
+const MainLayout = ({ isAuthenticated }) => {
+    return(
+        <Layout className='main-layout'>
+            <Loading />
+            <Header className='main-header'>
+                <Navigator />
+            </Header>
+            <Content className='main-content'>
+                <Switch>
+                    <Route sensitive path='/home' component={HomePage}/>
+                    <Route sensitive path='/workshop' component={Workshop}/>
+                    <Route sensitive path='/setting' component={Setting} />
+                    <Route sensitive path='/userinfo' component={UserInfo} />
+                    <Route path='/' component={() => (<Redirect to={{ pathname: '/home' }} ></Redirect>)}/>
+                </Switch>
+            </Content>
+        </Layout>
+    )
+}
+export default MainLayout;

+ 0 - 7
src/routes/router.js

@@ -12,10 +12,6 @@ import DashboardShareView from '../components/dashboard/shareView'
 import DashboardShareKeyView from '../components/dashboard/shareKeyView'
 // 由于 antd 组件的默认文案是英文,所以需要修改为中文
 import zhCN from 'antd/lib/locale-provider/zh_CN'
-import Demo from '../demo';
-import Xiaomi from '../xiaomi'
-import ShareQR from '../components/common/shareQR/shareQR'
-
 
 function RouterConfig({ history }) {
     return (
@@ -24,9 +20,6 @@ function RouterConfig({ history }) {
                 <Switch>
                     <Route sensitive path='/login' component={Login} />
                     <Route sensitive path='/register' component={Register} />
-                    <Route sensitive path='/demo' component={Demo} />
-                    <Route sensitive path='/xiaomi' component={Xiaomi} />
-                    <Route sensitive path='/sqr' component={ShareQR} />
                     <Route sensitive path='/dashboard/share/:code' component={DashboardShareView} />
                     <Route sensitive path='/dashboard/share_key/:code' component={DashboardShareKeyView} />
                     <PrivateRoute sensitive path='/datasource/:type/:code/:tab' component={DataSourceDetail}/>

+ 37 - 0
src/routes/router1.js

@@ -0,0 +1,37 @@
+import React from 'react'
+import { LocaleProvider } from 'antd'
+import { Router, Route, Switch } from 'dva/router'
+import PrivateRoute from './privateRoute'
+import Login from '../components/common/login/login'
+import Register from '../components/common/login/register'
+import MainLayout from './mainLayout1'
+import DataSourceDetail from '../components/dataSourceDetail/layout'
+import ChartDesigner from '../components/chartDesigner/layout'
+import DashboardDesigner from '../components/dashboardDesigner/layout'
+import DashboardShareView from '../components/dashboard/shareView'
+import DashboardShareKeyView from '../components/dashboard/shareKeyView'
+// 由于 antd 组件的默认文案是英文,所以需要修改为中文
+import zhCN from 'antd/lib/locale-provider/zh_CN'
+
+function RouterConfig({ history }) {
+    return (
+        <LocaleProvider locale={zhCN}>
+            <Router history={history}>
+                <Switch>
+                    <Route sensitive path='/login' component={Login} />
+                    <Route sensitive path='/register' component={Register} />
+                    <Route sensitive path='/dashboard/share/:code' component={DashboardShareView} />
+                    <Route sensitive path='/dashboard/share_key/:code' component={DashboardShareKeyView} />
+                    <PrivateRoute sensitive path='/datasource/:type/:code/:tab' component={DataSourceDetail}/>
+                    <PrivateRoute sensitive path='/chart/:code' component={ChartDesigner} />
+                    <PrivateRoute sensitive path='/dashboard/:code/' component={DashboardDesigner} />
+                    <PrivateRoute path='/' component={MainLayout} />
+                </Switch>
+            </Router>
+        </LocaleProvider>
+    );
+}
+
+export default RouterConfig;
+
+

+ 0 - 1325
src/xiaomi.jsx

@@ -1,1325 +0,0 @@
-import React from 'react'
-import { Table, Row } from 'antd'
-import Echarts from 'echarts-for-react'
-
-const columns = [
-    { title: '订单号', dataIndex: 'orderID', key: 'orderID', width:'100px' },
-    { title: '订单状态', dataIndex: 'status', key: 'status', width:'100px' },
-    { title: '客户名称', dataIndex: 'customerName', key: 'customerName', width:'100px'},
-    { title: '进度', dataIndex: 'progress', key: 'progress', render: (item, record) => { return (<Echarts style={{ height: '50px', width:'90%' }} option={record.progress}/>)} },
-];
-const orderColumns = [
-    { title: '工段', dataIndex: 'stage', key: 'orderID', width:'100px' },
-    { title: '工厂', dataIndex: 'status', key: 'status', width:'100px' },
-    { title: '工单号', dataIndex: 'taskID', key: 'taskID', width:'200px'},
-    { title: '数量', dataIndex: 'amount', key: 'amount', width:'100px'},
-    { title: '完工数', dataIndex: 'finished', key: 'finished', width:'100px'},
-    { title: '生产状态', dataIndex: 'status', key: 'status', width:'100px'},
-    { title: '发料数', dataIndex: 'amountSupplied', key: 'amountSupplied', width:'100px'},
-    { title: '齐套数', dataIndex: 'setComplete', key: 'setComplete', width:'100px'},
-    { title: '在途数', dataIndex: 'onWay', key: 'onWay', width:'100px'},
-    { title: '未下达数', dataIndex: 'notOrdered', key: 'notOrdered', width:'100px'},
-]
-const BOMColumns = [
-    { title: '序号', dataIndex: 'index', key: 'index', width:'100px' },
-    { title: '物料号', dataIndex: 'materialID', key: 'materialID', width:'100px' },
-    { title: '名称', dataIndex: 'name', key: 'name', width:'100px' },
-    { title: '单位用量', dataIndex: 'APU', key: 'APU', width:'100px' },
-    { title: '需求', dataIndex: 'demand', key: 'demand', width:'100px' },
-    { title: '已发数', dataIndex: 'distributed', key: 'distributed', width:'100px' },
-    { title: '未发数', dataIndex: 'notDistributed', key: 'notDistributed', width:'100px', render: (value, record) => {
-        let style; if(value>0 && value > record.availableInStock){style={backgroundColor:'#fdd5b5'}}else{style={}} return <span style={style}>{value}</span>}},
-    { title: '库存可用', dataIndex: 'availableInStock', key: 'availableInStock', width:'100px', render: (value, record) => {
-        let style; if(value>0 && value < record.notDistributed){style={backgroundColor:'#fdd5b5'}}else{style={}} return <span style={style}>{value}</span>} },
-    { title: '在途数', dataIndex: 'onWay', key: 'onWay', width:'100px' },
-    { title: '交期回复', dataIndex: 'response', key: 'response', width:'200px' },
-]
-
-const stageData = [
-    {
-        key:1,
-        stage:'包装',
-        factory:'代工厂A',
-        taskID:'MF18080031',
-        amount: 1000,
-        finished: 200,
-        status:'生产中',
-        amountSupplied: 500,
-        setComplete: 800,
-        onWay: 200,
-        notOrdered:0
-    },
-    {
-        key:2,
-        stage:'组装',
-        factory:'代工厂A',
-        taskID:'MF18080032',
-        amount: 1000,
-        finished: 500,
-        status:'生产中',
-        amountSupplied: 1000,
-        setComplete: 1000,
-        onWay: 0,
-        notOrdered:0
-    },    
-    {
-        key:3,
-        stage:'DIP',
-        factory:'代工厂A',
-        taskID:'MF18080033',
-        amount: 1000,
-        finished: 800,
-        status:'生产中',
-        amountSupplied: 1000,
-        setComplete: 1000,
-        onWay: 0,
-        notOrdered:0
-    },    {
-        key:4,
-        stage:'SMT',
-        factory:'代工厂A',
-        taskID:'MF18080034',
-        amount: 1000,
-        finished: 1000,
-        status:'已完工',
-        amountSupplied: 1000,
-        setComplete: 1000,
-        onWay: 0,
-        notOrdered:0
-    },
-]
-const data = [
-    { key: 1, orderID: '0000001', status: '包装中', customerName: '客户1', 
-        description: {
-            packagingStatus: {
-                silent: true,
-                grid: {
-                    top: 0,
-                    left: 0,
-                    right: 0,
-                    bottom: 0,
-                    width: '800px',
-                    containLabel: false
-                },
-                xAxis:  {
-                    type: 'value',
-                    show: false,
-                    max:'dataMax'
-                },
-                yAxis: {
-                    type: 'category',
-                    data: ['备料'],
-                    axisLine:{show: false},
-                    axisLabel: {show: false},
-                    axisTick: {show: false},
-                    max: 'dataMax'
-                },
-                series: [
-                    {
-                        name: '库存齐套',
-                        type: 'bar',
-                        stack: '总量',
-                        label: {
-                            normal: {
-                                show: true,
-                                position: 'insideRight',
-                                formatter:'{a}:{c}'
-                            }
-                        },
-                        data: [400],
-                        barWidth:40,
-                        color: '#2bd54d',
-                    },
-                    {
-                        name: '在途中',
-                        type: 'bar',
-                        stack: '总量',
-                        label: {
-                            normal: {
-                                show: true,
-                                position: 'insideRight',
-                                formatter:'{a}:{c}'
-                            }
-                        },
-                        color: '#e6b600',
-                        data: [200]
-                    },
-                    {
-                        name: '请购下达',
-                        type: 'bar',
-                        stack: '总量',
-                        label: {
-                            normal: {
-                                show: true,
-                                position: 'insideRight',
-                                formatter:'{a}:{c}'
-                            }
-                        },
-                        data: [100]
-                    },
-                ]
-            },
-            assemblingStatus: {
-                silent: true,
-                grid: {
-                    top: 0,
-                    left: 0,
-                    right: 0,
-                    bottom: 0,
-                    width: '800px',
-                    containLabel: false
-                },
-                xAxis:  {
-                    type: 'value',
-                    show: false
-                },
-                yAxis: {
-                    type: 'category',
-                    data: ['备料'],
-                    axisLine:{show: false},
-                    axisLabel: {show: false},
-                    axisTick: {show: false}
-                },
-                series: [
-                    {
-                        name: '工单齐套',
-                        type: 'bar',
-                        stack: '总量',
-                        label: {
-                            normal: {
-                                show: true,
-                                position: 'insideRight',
-                                formatter:'{a}:{c}'
-                            }
-                        },
-                        data: [360],
-                        barWidth:40,
-                        color: '#2bd54d',
-                    },
-            
-                    {
-                        name: '工单未齐套',
-                        type: 'bar',
-                        stack: '总量',
-                        label: {
-                            normal: {
-                                show: true,
-                                position: 'insideRight',
-                                formatter:'{a}:{c}'
-                            }
-                        },
-                        data: [840]
-                    },
-                ]
-            },
-            DIPStatus: {
-                silent: true,
-                grid: {
-                    top: 0,
-                    left: 0,
-                    right: 0,
-                    bottom: 0,
-                    width: '800px',
-                    containLabel: false
-                },
-                xAxis:  {
-                    type: 'value',
-                    show: false
-                },
-                yAxis: {
-                    type: 'category',
-                    data: ['备料'],
-                    axisLine:{show: false},
-                    axisLabel: {show: false},
-                    axisTick: {show: false}
-                },
-                series: [
-                    {
-                        name: '已完成',
-                        type: 'bar',
-                        stack: '总量',
-                        label: {
-                            normal: {
-                                show: true,
-                                position: 'insideRight',
-                                formatter:'{a}:{c}'
-                            }
-                        },
-                        data: [340],
-                        color: '#2bd54d',
-                        barWidth:40
-                    },
-            
-                    {
-                        name: '生产中',
-                        type: 'bar',
-                        stack: '总量',
-                        label: {
-                            normal: {
-                                show: true,
-                                position: 'insideRight',
-                                formatter:'{a}:{c}'
-                            }
-                        },
-                        color: '#e6b600',
-                        data: [860]
-                    },
-                    {
-                        name: '物料不足',
-                        type: 'bar',
-                        stack: '总量',
-                        label: {
-                            normal: {
-                                show: true,
-                                position: 'insideRight',
-                                formatter:'{a}:{c}'
-                            }
-                        },
-                        data: [300]
-                    },
-                ]
-            },
-            SMTStatus: {
-                silent: true,
-                grid: {
-                    top: 0,
-                    left: 0,
-                    right: 0,
-                    bottom: 0,
-                    width: '800px',
-                    containLabel: false
-                },
-                xAxis:  {
-                    type: 'value',
-                    show: false
-                },
-                yAxis: {
-                    type: 'category',
-                    data: ['备料'],
-                    axisLine:{show: false},
-                    axisLabel: {show: false},
-                    axisTick: {show: false}
-                },
-                series: [
-                    {
-                        name: '已出货',
-                        type: 'bar',
-                        stack: '总量',
-                        label: {
-                            normal: {
-                                show: true,
-                                position: 'insideRight',
-                                formatter:'{a}:{c}'
-                            }
-                        },
-                        data: [400],
-                        color: '#2bd54d',
-                        barWidth:40
-                    },
-            
-                    {
-                        name: '待出货',
-                        type: 'bar',
-                        stack: '总量',
-                        color: '#93b7e3',
-                        label: {
-                            normal: {
-                                show: true,
-                                position: 'insideRight',
-                                formatter:'{a}:{c}'
-                            }
-                        },
-                        data: [600]
-                    },
-                    {
-                        name: '未完成',
-                        type: 'bar',
-                        stack: '总量',
-                        label: {
-                            normal: {
-                                show: true,
-                                position: 'insideRight',
-                                formatter:'{a}:{c}'
-                            }
-                        },
-                        data: [200]
-                    },
-                ]
-            }
-        },
-        packingBOM: [
-            {
-                index:1,
-                materialID:'DE221324',
-                name:'电阻',
-                APU:1,
-                demand:1000,
-                distributed:0,
-                notDistributed:1000,
-                availableInStock:800,
-                onWay: 200,
-                response:'8月2号可交货1000'
-
-            },{
-                index:2,
-                materialID:'DE221325',
-                name:'电阻',
-                APU:1,
-                demand:1000,
-                distributed:1000,
-                notDistributed:0,
-                availableInStock:0,
-                onWay: 0,
-                response:'8月2号可交货1001'
-            },{
-                index:3,
-                materialID:'DE221326',
-                name:'电阻',
-                APU:1,
-                demand:1000,
-                distributed:1000,
-                notDistributed:0,
-                availableInStock:0,
-                onWay: 0,
-                response:'8月2号可交货1002'
-            },{
-                index: 4,
-                materialID: 'DE221327',
-                name: '电阻',
-                APU: 1,
-                demand: 1000,
-                distributed:0,
-                notDistributed: 1000,
-                availableInStock: 500,
-                onWay: 500,
-                response: '8月2号可交货1003'
-            }, {
-                index: 5,
-                materialID: 'DE221328',
-                name: '电阻',
-                APU: 1,
-                demand: 1000,
-                distributed:0,
-                notDistributed: 1000,
-                availableInStock: 500,
-                onWay: 500,
-                response: '8月2号可交货1004'
-            }          
-        ],
-        assemblingBOM: [],
-        DIPBOM: [],
-        SMTBOM: [],
-        progress: {
-            silent: true,
-            grid: {
-                top: 0,
-                left: 0,
-                right: 0,
-                bottom: 0,
-                width: '100%',
-                containLabel: false
-            },
-            xAxis:  {
-                type: 'value',
-                show: false,
-                max:'dataMax'
-            },
-            yAxis: {
-                type: 'category',
-                data: ['备料'],
-                axisLine:{show: false},
-                axisLabel: {show: false},
-                axisTick: {show: false},
-            },
-            series: [
-                {
-                    name: '已出货',
-                    type: 'bar',
-                    stack: '总量',
-                    label: {
-                        normal: {
-                            show: true,
-                            position: 'insideRight',
-                            formatter:'{a}:{c}'
-                        }
-                    },
-                    data: [400],
-                    color: '#2bd54d',
-                    barWidth:40
-                },
-                {
-                    name: '成品库存',
-                    type: 'bar',
-                    stack: '总量',
-                    color: '#93b7e3',
-                    label: {
-                        normal: {
-                            show: true,
-                            position: 'insideRight',
-                            formatter:'{a}:{c}'
-                        }
-                    },
-                    data: [300]
-                },
-                {
-                    name: '已投产',
-                    type: 'bar',
-                    stack: '总量',
-                    label: {
-                        normal: {
-                            show: true,
-                            position: 'insideRight',
-                            formatter:'{a}:{c}'
-                        }
-                    },
-                    color: '#e6b600',
-                    data: [100]
-                },
-                {
-                    name: '未生产',
-                    type: 'bar',
-                    stack: '总量',
-                    label: {
-                        normal: {
-                            show: true,
-                            position: 'insideRight',
-                            formatter:'{a}:{c}'
-                        }
-                    },
-                    data: [200]
-                },
-            ]
-        }
-    },
-    { key: 2, orderID: '0000002', status: '包装中', customerName: '客户1', 
-        description: {
-            packagingStatus: {
-                silent: true,
-                grid: {
-                    top: 0,
-                    left: 0,
-                    right: 0,
-                    bottom: 0,
-                    width: '800px',
-                    containLabel: false
-                },
-                xAxis:  {
-                    type: 'value',
-                    show: false,
-                    max:'dataMax'
-                },
-                yAxis: {
-                    type: 'category',
-                    data: ['备料'],
-                    axisLine:{show: false},
-                    axisLabel: {show: false},
-                    axisTick: {show: false},
-                    max: 'dataMax'
-                },
-                series: [
-                    {
-                        name: '库存齐套',
-                        type: 'bar',
-                        stack: '总量',
-                        label: {
-                            normal: {
-                                show: true,
-                                position: 'insideRight',
-                                formatter:'{a}:{c}'
-                            }
-                        },
-                        data: [380],
-                        barWidth:40,
-                        color: '#2bd54d',
-                    },
-                    {
-                        name: '在途中',
-                        type: 'bar',
-                        stack: '总量',
-                        label: {
-                            normal: {
-                                show: true,
-                                position: 'insideRight',
-                                formatter:'{a}:{c}'
-                            }
-                        },
-                        color: '#e6b600',
-                        data: [820]
-                    },
-                    {
-                        name: '请购下达',
-                        type: 'bar',
-                        stack: '总量',
-                        label: {
-                            normal: {
-                                show: true,
-                                position: 'insideRight',
-                                formatter:'{a}:{c}'
-                            }
-                        },
-                        data: [300]
-                    },
-                ]
-            },
-            assemblingStatus: {
-                silent: true,
-                grid: {
-                    top: 0,
-                    left: 0,
-                    right: 0,
-                    bottom: 0,
-                    width: '800px',
-                    containLabel: false
-                },
-                xAxis:  {
-                    type: 'value',
-                    show: false
-                },
-                yAxis: {
-                    type: 'category',
-                    data: ['备料'],
-                    axisLine:{show: false},
-                    axisLabel: {show: false},
-                    axisTick: {show: false}
-                },
-                series: [
-                    {
-                        name: '工单齐套',
-                        type: 'bar',
-                        stack: '总量',
-                        label: {
-                            normal: {
-                                show: true,
-                                position: 'insideRight',
-                                formatter:'{a}:{c}'
-                            }
-                        },
-                        data: [360],
-                        barWidth:40,
-                        color: '#2bd54d',
-                    },
-            
-                    {
-                        name: '工单未齐套',
-                        type: 'bar',
-                        stack: '总量',
-                        label: {
-                            normal: {
-                                show: true,
-                                position: 'insideRight',
-                                formatter:'{a}:{c}'
-                            }
-                        },
-                        data: [840]
-                    },
-                ]
-            },
-            DIPStatus: {
-                silent: true,
-                grid: {
-                    top: 0,
-                    left: 0,
-                    right: 0,
-                    bottom: 0,
-                    width: '800px',
-                    containLabel: false
-                },
-                xAxis:  {
-                    type: 'value',
-                    show: false
-                },
-                yAxis: {
-                    type: 'category',
-                    data: ['备料'],
-                    axisLine:{show: false},
-                    axisLabel: {show: false},
-                    axisTick: {show: false}
-                },
-                series: [
-                    {
-                        name: '已完成',
-                        type: 'bar',
-                        stack: '总量',
-                        label: {
-                            normal: {
-                                show: true,
-                                position: 'insideRight',
-                                formatter:'{a}:{c}'
-                            }
-                        },
-                        data: [340],
-                        color: '#2bd54d',
-                        barWidth:40
-                    },
-            
-                    {
-                        name: '生产中',
-                        type: 'bar',
-                        stack: '总量',
-                        label: {
-                            normal: {
-                                show: true,
-                                position: 'insideRight',
-                                formatter:'{a}:{c}'
-                            }
-                        },
-                        color: '#e6b600',
-                        data: [860]
-                    },
-                    {
-                        name: '物料不足',
-                        type: 'bar',
-                        stack: '总量',
-                        label: {
-                            normal: {
-                                show: true,
-                                position: 'insideRight',
-                                formatter:'{a}:{c}'
-                            }
-                        },
-                        data: [300]
-                    },
-                ]
-            },
-            SMTStatus: {
-                silent: true,
-                grid: {
-                    top: 0,
-                    left: 0,
-                    right: 0,
-                    bottom: 0,
-                    width: '800px',
-                    containLabel: false
-                },
-                xAxis:  {
-                    type: 'value',
-                    show: false
-                },
-                yAxis: {
-                    type: 'category',
-                    data: ['备料'],
-                    axisLine:{show: false},
-                    axisLabel: {show: false},
-                    axisTick: {show: false}
-                },
-                series: [
-                    {
-                        name: '已出货',
-                        type: 'bar',
-                        stack: '总量',
-                        label: {
-                            normal: {
-                                show: true,
-                                position: 'insideRight',
-                                formatter:'{a}:{c}'
-                            }
-                        },
-                        data: [400],
-                        color: '#2bd54d',
-                        barWidth:40
-                    },
-            
-                    {
-                        name: '待出货',
-                        type: 'bar',
-                        stack: '总量',
-                        color: '#93b7e3',
-                        label: {
-                            normal: {
-                                show: true,
-                                position: 'insideRight',
-                                formatter:'{a}:{c}'
-                            }
-                        },
-                        data: [600]
-                    },
-                    {
-                        name: '未完成',
-                        type: 'bar',
-                        stack: '总量',
-                        label: {
-                            normal: {
-                                show: true,
-                                position: 'insideRight',
-                                formatter:'{a}:{c}'
-                            }
-                        },
-                        data: [200]
-                    },
-                ]
-            }
-        },
-        packingBOM: [
-            {
-                index:1,
-                materialID:'DE221324',
-                name:'电阻',
-                APU:1,
-                demand:1000,
-                distributed:0,
-                notDistributed:1000,
-                availableInStock:800,
-                onWay: 200,
-                response:'8月2号可交货1000'
-
-            },{
-                index:2,
-                materialID:'DE221325',
-                name:'电阻',
-                APU:1,
-                demand:1000,
-                distributed:1000,
-                notDistributed:0,
-                availableInStock:0,
-                onWay: 0,
-                response:'8月2号可交货1001'
-            },{
-                index:3,
-                materialID:'DE221326',
-                name:'电阻',
-                APU:1,
-                demand:1000,
-                distributed:1000,
-                notDistributed:0,
-                availableInStock:0,
-                onWay: 0,
-                response:'8月2号可交货1002'
-            },{
-                index: 4,
-                materialID: 'DE221327',
-                name: '电阻',
-                APU: 1,
-                demand: 1000,
-                distributed:0,
-                notDistributed: 1000,
-                availableInStock: 500,
-                onWay: 500,
-                response: '8月2号可交货1003'
-            }, {
-                index: 5,
-                materialID: 'DE221328',
-                name: '电阻',
-                APU: 1,
-                demand: 1000,
-                distributed:0,
-                notDistributed: 1000,
-                availableInStock: 500,
-                onWay: 500,
-                response: '8月2号可交货1004'
-            }          
-        ],
-        assemblingBOM: [],
-        DIPBOM: [],
-        SMTBOM: [],
-        progress: {
-            silent: true,
-            grid: {
-                top: 0,
-                left: 0,
-                right: 0,
-                bottom: 0,
-                width: '100%',
-                containLabel: false
-            },
-            xAxis:  {
-                type: 'value',
-                show: false,
-                max:'dataMax'
-            },
-            yAxis: {
-                type: 'category',
-                data: ['备料'],
-                axisLine:{show: false},
-                axisLabel: {show: false},
-                axisTick: {show: false},
-            },
-            series: [
-                {
-                    name: '已出货',
-                    type: 'bar',
-                    stack: '总量',
-                    label: {
-                        normal: {
-                            show: true,
-                            position: 'insideRight',
-                            formatter:'{a}:{c}'
-                        }
-                    },
-                    data: [380],
-                    color: '#2bd54d',
-                    barWidth:40
-                },
-                {
-                    name: '成品库存',
-                    type: 'bar',
-                    stack: '总量',
-                    color: '#93b7e3',
-                    label: {
-                        normal: {
-                            show: true,
-                            position: 'insideRight',
-                            formatter:'{a}:{c}'
-                        }
-                    },
-                    data: [200]
-                },
-                {
-                    name: '已投产',
-                    type: 'bar',
-                    stack: '总量',
-                    label: {
-                        normal: {
-                            show: true,
-                            position: 'insideRight',
-                            formatter:'{a}:{c}'
-                        }
-                    },
-                    color: '#e6b600',
-                    data: [500]
-                },
-                {
-                    name: '未生产',
-                    type: 'bar',
-                    stack: '总量',
-                    label: {
-                        normal: {
-                            show: true,
-                            position: 'insideRight',
-                            formatter:'{a}:{c}'
-                        }
-                    },
-                    data: [300]
-                },
-            ]
-        }
-    },
-    { key: 3, orderID: '0000003', status: '包装中', customerName: '客户1', 
-        description: {
-            packagingStatus: {
-                silent: true,
-                grid: {
-                    top: 0,
-                    left: 0,
-                    right: 0,
-                    bottom: 0,
-                    width: '800px',
-                    containLabel: false
-                },
-                xAxis:  {
-                    type: 'value',
-                    show: false,
-                    max:'dataMax'
-                },
-                yAxis: {
-                    type: 'category',
-                    data: ['备料'],
-                    axisLine:{show: false},
-                    axisLabel: {show: false},
-                    axisTick: {show: false},
-                    max: 'dataMax'
-                },
-                series: [
-                    {
-                        name: '库存齐套',
-                        type: 'bar',
-                        stack: '总量',
-                        label: {
-                            normal: {
-                                show: true,
-                                position: 'insideRight',
-                                formatter:'{a}:{c}'
-                            }
-                        },
-                        data: [380],
-                        barWidth:40,
-                        color: '#2bd54d',
-                    },
-                    {
-                        name: '在途中',
-                        type: 'bar',
-                        stack: '总量',
-                        label: {
-                            normal: {
-                                show: true,
-                                position: 'insideRight',
-                                formatter:'{a}:{c}'
-                            }
-                        },
-                        color: '#e6b600',
-                        data: [820]
-                    },
-                    {
-                        name: '请购下达',
-                        type: 'bar',
-                        stack: '总量',
-                        label: {
-                            normal: {
-                                show: true,
-                                position: 'insideRight',
-                                formatter:'{a}:{c}'
-                            }
-                        },
-                        data: [300]
-                    },
-                ]
-            },
-            assemblingStatus: {
-                silent: true,
-                grid: {
-                    top: 0,
-                    left: 0,
-                    right: 0,
-                    bottom: 0,
-                    width: '800px',
-                    containLabel: false
-                },
-                xAxis:  {
-                    type: 'value',
-                    show: false
-                },
-                yAxis: {
-                    type: 'category',
-                    data: ['备料'],
-                    axisLine:{show: false},
-                    axisLabel: {show: false},
-                    axisTick: {show: false}
-                },
-                series: [
-                    {
-                        name: '工单齐套',
-                        type: 'bar',
-                        stack: '总量',
-                        label: {
-                            normal: {
-                                show: true,
-                                position: 'insideRight',
-                                formatter:'{a}:{c}'
-                            }
-                        },
-                        data: [360],
-                        barWidth:40,
-                        color: '#2bd54d',
-                    },
-            
-                    {
-                        name: '工单未齐套',
-                        type: 'bar',
-                        stack: '总量',
-                        label: {
-                            normal: {
-                                show: true,
-                                position: 'insideRight',
-                                formatter:'{a}:{c}'
-                            }
-                        },
-                        data: [840]
-                    },
-                ]
-            },
-            DIPStatus: {
-                silent: true,
-                grid: {
-                    top: 0,
-                    left: 0,
-                    right: 0,
-                    bottom: 0,
-                    width: '800px',
-                    containLabel: false
-                },
-                xAxis:  {
-                    type: 'value',
-                    show: false
-                },
-                yAxis: {
-                    type: 'category',
-                    data: ['备料'],
-                    axisLine:{show: false},
-                    axisLabel: {show: false},
-                    axisTick: {show: false}
-                },
-                series: [
-                    {
-                        name: '已完成',
-                        type: 'bar',
-                        stack: '总量',
-                        label: {
-                            normal: {
-                                show: true,
-                                position: 'insideRight',
-                                formatter:'{a}:{c}'
-                            }
-                        },
-                        data: [340],
-                        color: '#2bd54d',
-                        barWidth:40
-                    },
-            
-                    {
-                        name: '生产中',
-                        type: 'bar',
-                        stack: '总量',
-                        label: {
-                            normal: {
-                                show: true,
-                                position: 'insideRight',
-                                formatter:'{a}:{c}'
-                            }
-                        },
-                        color: '#e6b600',
-                        data: [860]
-                    },
-                    {
-                        name: '物料不足',
-                        type: 'bar',
-                        stack: '总量',
-                        label: {
-                            normal: {
-                                show: true,
-                                position: 'insideRight',
-                                formatter:'{a}:{c}'
-                            }
-                        },
-                        data: [300]
-                    },
-                ]
-            },
-            SMTStatus: {
-                silent: true,
-                grid: {
-                    top: 0,
-                    left: 0,
-                    right: 0,
-                    bottom: 0,
-                    width: '800px',
-                    containLabel: false
-                },
-                xAxis:  {
-                    type: 'value',
-                    show: false
-                },
-                yAxis: {
-                    type: 'category',
-                    data: ['备料'],
-                    axisLine:{show: false},
-                    axisLabel: {show: false},
-                    axisTick: {show: false}
-                },
-                series: [
-                    {
-                        name: '已出货',
-                        type: 'bar',
-                        stack: '总量',
-                        label: {
-                            normal: {
-                                show: true,
-                                position: 'insideRight',
-                                formatter:'{a}:{c}'
-                            }
-                        },
-                        data: [400],
-                        color: '#2bd54d',
-                        barWidth:40
-                    },
-            
-                    {
-                        name: '待出货',
-                        type: 'bar',
-                        stack: '总量',
-                        color: '#93b7e3',
-                        label: {
-                            normal: {
-                                show: true,
-                                position: 'insideRight',
-                                formatter:'{a}:{c}'
-                            }
-                        },
-                        data: [600]
-                    },
-                    {
-                        name: '未完成',
-                        type: 'bar',
-                        stack: '总量',
-                        label: {
-                            normal: {
-                                show: true,
-                                position: 'insideRight',
-                                formatter:'{a}:{c}'
-                            }
-                        },
-                        data: [200]
-                    },
-                ]
-            }
-        },
-        packingBOM: [
-            {
-                index:1,
-                materialID:'DE221324',
-                name:'电阻',
-                APU:1,
-                demand:1000,
-                distributed:0,
-                notDistributed:1000,
-                availableInStock:800,
-                onWay: 200,
-                response:'8月2号可交货1000'
-
-            },{
-                index:2,
-                materialID:'DE221325',
-                name:'电阻',
-                APU:1,
-                demand:1000,
-                distributed:1000,
-                notDistributed:0,
-                availableInStock:0,
-                onWay: 0,
-                response:'8月2号可交货1001'
-            },{
-                index:3,
-                materialID:'DE221326',
-                name:'电阻',
-                APU:1,
-                demand:1000,
-                distributed:1000,
-                notDistributed:0,
-                availableInStock:0,
-                onWay: 0,
-                response:'8月2号可交货1002'
-            },{
-                index: 4,
-                materialID: 'DE221327',
-                name: '电阻',
-                APU: 1,
-                demand: 1000,
-                distributed:0,
-                notDistributed: 1000,
-                availableInStock: 500,
-                onWay: 500,
-                response: '8月2号可交货1003'
-            }, {
-                index: 5,
-                materialID: 'DE221328',
-                name: '电阻',
-                APU: 1,
-                demand: 1000,
-                distributed:0,
-                notDistributed: 1000,
-                availableInStock: 500,
-                onWay: 500,
-                response: '8月2号可交货1004'
-            }          
-        ],
-        assemblingBOM: [],
-        DIPBOM: [],
-        SMTBOM: [],
-        progress: {
-            silent: true,
-            grid: {
-                top: 0,
-                left: 0,
-                right: 0,
-                bottom: 0,
-                width: '100%',
-                containLabel: false
-            },
-            xAxis:  {
-                type: 'value',
-                show: false,
-                max:'dataMax'
-            },
-            yAxis: {
-                type: 'category',
-                data: ['备料'],
-                axisLine:{show: false},
-                axisLabel: {show: false},
-                axisTick: {show: false},
-            },
-            series: [
-                {
-                    name: '已出货',
-                    type: 'bar',
-                    stack: '总量',
-                    label: {
-                        normal: {
-                            show: true,
-                            position: 'insideRight',
-                            formatter:'{a}:{c}'
-                        }
-                    },
-                    data: [800],
-                    color: '#2bd54d',
-                    barWidth:40
-                },
-                {
-                    name: '成品库存',
-                    type: 'bar',
-                    stack: '总量',
-                    color: '#93b7e3',
-                    label: {
-                        normal: {
-                            show: true,
-                            position: 'insideRight',
-                            formatter:'{a}:{c}'
-                        }
-                    },
-                    data: [600]
-                },
-                {
-                    name: '已投产',
-                    type: 'bar',
-                    stack: '总量',
-                    label: {
-                        normal: {
-                            show: true,
-                            position: 'insideRight',
-                            formatter:'{a}:{c}'
-                        }
-                    },
-                    color: '#e6b600',
-                    data: [200]
-                },
-                {
-                    name: '未生产',
-                    type: 'bar',
-                    stack: '总量',
-                    label: {
-                        normal: {
-                            show: true,
-                            position: 'insideRight',
-                            formatter:'{a}:{c}'
-                        }
-                    },
-                    data: [400]
-                },
-            ]
-        }
-    },
-];
-
-class Xiaomi extends React.Component {
-    render() {
-        return (
-            <Table
-                columns={columns}
-                expandedRowRender={record => 
-                    <div>
-                        <Row style={{marginBottom:'2px'}}>
-                                <Table 
-                                    columns={orderColumns} 
-                                    dataSource={stageData} 
-                                    pagination={false}
-                                    expandedRowRender={() =>
-                                        <Table size={'small'} pagination={false} columns={BOMColumns} dataSource={record.packingBOM} /> 
-                                    }
-                                />
-                        </Row>
-                    </div>
-                }
-                dataSource={data}
-            /> 
-        )
-    }
-}
-
-export default Xiaomi