Commit bd539dc4 by 小明

工作台代码风格调整

parent c2997fed
...@@ -70,6 +70,7 @@ ...@@ -70,6 +70,7 @@
] ]
}, },
"dependencies": { "dependencies": {
"antd": "^2.5.3",
"babel-polyfill": "6.16.0", "babel-polyfill": "6.16.0",
"chalk": "1.1.3", "chalk": "1.1.3",
"compression": "1.6.2", "compression": "1.6.2",
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Col, Row, Icon } from 'antd';
class DashboardIndex extends Component { // eslint-disable-line react/prefer-stateless-function class DashboardIndex extends Component { // eslint-disable-line react/prefer-stateless-function
static defaultProps = { static defaultProps = {
...@@ -305,8 +304,7 @@ class DashboardIndex extends Component { // eslint-disable-line react/prefer-sta ...@@ -305,8 +304,7 @@ class DashboardIndex extends Component { // eslint-disable-line react/prefer-sta
hasPermission = {this.state.hasPermission} hasPermission = {this.state.hasPermission}
icons = {this.state.icons} icons = {this.state.icons}
loading = {this.state.loading} loading = {this.state.loading}
logined = {this.state.logined} logined = {this.state.logined}/>);
/>);
} }
renderAdmin() { renderAdmin() {
...@@ -326,7 +324,7 @@ class DashboardIndex extends Component { // eslint-disable-line react/prefer-sta ...@@ -326,7 +324,7 @@ class DashboardIndex extends Component { // eslint-disable-line react/prefer-sta
statistic = {this.state.statistic} statistic = {this.state.statistic}
hasPermission = {this.state.hasPermission} hasPermission = {this.state.hasPermission}
icons = {this.state.icons} icons = {this.state.icons}
loading = {this.state.loading}/>) loading = {this.state.loading}/>);
} }
render() { render() {
......
...@@ -10,77 +10,69 @@ class DashboardIndexMember extends Component { // eslint-disable-line react/pref ...@@ -10,77 +10,69 @@ class DashboardIndexMember extends Component { // eslint-disable-line react/pref
const props = $.extend({}, this.props); const props = $.extend({}, this.props);
const memberShortcuts = [ const memberShortcuts = [
{type: 'purchase', name: '采购列表', onClick: props.onClick.bind(null, 'purchase')}, { type: 'purchase', name: '采购列表', onClick: props.onClick.bind(null, 'purchase') },
{type: 'sale', name: '销售列表', onClick: props.onClick.bind(null, 'sale')}, { type: 'sale', name: '销售列表', onClick: props.onClick.bind(null, 'sale') },
{type: 'other', name: '其他列表', onClick: props.onClick.bind(null, 'other')}, { type: 'other', name: '其他列表', onClick: props.onClick.bind(null, 'other') },
{type: 'document', name: '单据查询', path: '/mobile/documents'}, { type: 'document', name: '单据查询', path: '/mobile/documents' },
{type: 'customer', name: '客户列表', path: '/mobile/customers'}, { type: 'customer', name: '客户列表', path: '/mobile/customers' },
{type: 'supplier', name: '供应商列表', path: '/mobile/suppliers'}, { type: 'supplier', name: '供应商列表', path: '/mobile/suppliers' },
{type: 'product', name: '产品列表', path: '/mobile/products'}, { type: 'product', name: '产品列表', path: '/mobile/products' },
{type: 'inventory', name: '库存查询', path: '/mobile/inventories'}, { type: 'inventory', name: '库存查询', path: '/mobile/inventories' },
].chunk(4); ].chunk(4);
let outlet = null; let outlet = null;
if (this.props.loading) { if (this.props.loading) {
if (this.props.logined) { if (this.props.logined) {
outlet = (<Icon type='loading' className='search-loading'/>); outlet = (<Icon type="loading" className="search-loading"/>);
} }
} else { } else {
if (this.props.documents.length > 0) { if (this.props.documents.length > 0) {
outlet = (<Row> outlet = (
<Col span='24'> <Row>
<Col span="24">
{props.documents.each((doc) =>{ {props.documents.each((doc) =>{
let key = `${doc.type}_${doc.id}`; let key = `${doc.type}_${doc.id}`;
<Document key={key} document={doc}></Document> <Document key={key} document={doc} />
})} })}
</Col> </Col>
</Row>); </Row>
);
} else { } else {
let column = (<div> let column = null;
<p className='ik-title-font ik-margin-top-20 ik-title-color'>
还没有单据哦,快去新增吧
</p>
</div>);
if (!props.hasPermission) { if (!props.hasPermission) {
column = (<div> column = (
<svg className='file-color'> <div>
<use xlinkHref={props.icons.document}/> <svg className="file-color">
<use xlinkHref={props.icons.document} />
</svg> </svg>
<p className='ik-title-font ik-margin-top-20 ik-title-color'> 亲,你没有权限操作此功能哦</p> <p className="ik-title-font ik-margin-top-20 ik-title-color"> 亲,你没有权限操作此功能哦</p>
</div>); </div>
);
} else {
column = (
<div>
<p className="ik-title-font ik-margin-top-20 ik-title-color">
还没有单据哦,快去新增吧
</p>
</div>
);
} }
outlet = (<Row type='flex' justify='center' className='document-list ik-padding-bottom-20'> outlet = (
<Col span='16' className='ik-text-center'> <Row type="flex" justify="center" className="document-list ik-padding-bottom-20">
<Col span="16" className="ik-text-center">
{column} {column}
</Col> </Col>
</Row>); </Row>
);
} }
} }
return (<Row> let fragments = null;
<Row id="action-sheet-button-container"> memberShortcuts.each((shortcuts, rowCount) => {
<Col span='6' offset='18' className='ik-padding-top-20'> shortcuts.each((shortcut, colCount) => {
<div
className='action-sheet-button'
onClick={props.onClick.bind(null, 'new')}>
<Icon type='plus-circle'/>
</div>
</Col>
</Row>
<div id="action-sheet-wrapper">
<IKActionSheet
buttons={props.current_buttons}
visible={props.actionSheetVisible}
onHidden={props.actionSheetHidden}
onSearch={props.handleSearch}>
</IKActionSheet>
</div>
<Row>
<Col span='24'>{memberShortcuts.each((shortcuts, rowCount) => {
{shortcuts.each(shortcut, colCount => {
let className = '' let className = ''
if ((colCount + 1) % 4 == 0 ) { if ((colCount + 1) % 4 === 0 ) {
className = ''; className = '';
} else { } else {
className = 'ik-border-right'; className = 'ik-border-right';
...@@ -92,26 +84,43 @@ class DashboardIndexMember extends Component { // eslint-disable-line react/pref ...@@ -92,26 +84,43 @@ class DashboardIndexMember extends Component { // eslint-disable-line react/pref
if (shortcut.onClick) { if (shortcut.onClick) {
href = 'javascript:void(0);'; href = 'javascript:void(0);';
} }
fragments += (<Col span="6" className={className}>
<Col span='6' className={className}> <a className="shortcut-link" href={href} onClick={shortcut.onClick}>
<a className='shortcut-link' href={href} onClick={shortcut.onClick}>
<svg> <svg>
<use xlinkHref={props.icons[shortcut.type]}/> <use xlinkHref={props.icons[shortcut.type]} />
</svg> </svg>
<p className='ik-margin-top-5 ik-title-font ik-text-center'>{shortcut.name}</p> <p className="ik-margin-top-5 ik-title-font ik-text-center">{shortcut.name}</p>
</a> </a>
</Col>);
});
});
return (<Row>
<Row id="action-sheet-button-container">
<Col span="6" offset="18" className="ik-padding-top-20">
<div
className="action-sheet-button"
onClick={props.onClick.bind(null, 'new')}>
<Icon type="plus-circle" />
</div>
</Col> </Col>
})}
})}</Col>
</Row> </Row>
<div id="action-sheet-wrapper">
<IKActionSheet buttons={props.current_buttons} visible={props.actionSheetVisible} onHidden={props.actionSheetHidden} onSearch={props.handleSearch} />
</div>
<Row> <Row>
<Col span='24' className='ik-container-background ik-height-40'> <Col span="24">
<p className='document-title'>最近的单据</p> { fragments }
</Col> </Col>
<Col span='24'> </Row>
{outlet} <Row>
<Col span="24" className="ik-container-background ik-height-40">
<p className="document-title">最近的单据</p>
</Col>
<Col span="24">
{ outlet }
</Col> </Col>
</Row> </Row>
</Row>) </Row>);
} }
} }
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