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",
......
...@@ -15,205 +15,202 @@ class DashboardIndexAdmin extends Component { // eslint-disable-line react/prefe ...@@ -15,205 +15,202 @@ class DashboardIndexAdmin extends Component { // eslint-disable-line react/prefe
{ type: 'customer', title: '客户列表' }, { type: 'customer', title: '客户列表' },
{ type: 'supplier', title: '供应商列表' }, { type: 'supplier', title: '供应商列表' },
{ type: 'product', title: '产品列表' }, { type: 'product', title: '产品列表' },
{ type: 'inventory', title: '库存查询' } { type: 'inventory', title: '库存查询' },
].chunk(4); ].chunk(4);
const props = $.extend({}, this.props); const props = $.extend({}, this.props);
let outlet = null; let outlet = null;
if (this.props.loading) { if (this.props.loading) {
outlet = (<Icon type='loading' className='search-loading' />); outlet = (<Icon type="loading" className="search-loading" />);
} else { } else {
if (props[`${props.activeTab}Documents`].length > 0) { if (props[`${props.activeTab}Documents`].length > 0) {
outlet = (<Row> outlet = (<Row>
<Col span='24'> <Col span="24">
{props[`${props.activeTab}Documents`].each((doc) => { {props[`${props.activeTab}Documents`].each((doc) => {
let key = `${doc.type}_${doc.id}`; let key = `${doc.type}_${doc.id}`;
<Document <Document key={key} document={doc} type="approving" />
key={key}
document={doc}
type='approving' />
})} })}
</Col> </Col>
</Row>); </Row>);
} else { } else {
let column = (<p className='ik-title-font ik-margin-top-20 ik-title-color'>还没有审批通过的单据哦~</p>); let column = (<p className="ik-title-font ik-margin-top-20 ik-title-color">还没有审批通过的单据哦~</p>);
if (props.activeTab ==='noapproval') { if (props.activeTab ==='noapproval') {
column = (<div> column = (<div>
<p className='ik-title-font ik-margin-top-20 ik-title-color'> <p className="ik-title-font ik-margin-top-20 ik-title-color">
还没有单据哦,快去新增吧 还没有单据哦,快去新增吧
</p> </p>
</div>); </div>);
} else if (props.activeTab === 'approving') { } else if (props.activeTab === 'approving') {
column = (<p className='ik-title-font ik-margin-top-20 ik-title-color'> column = (<p className="ik-title-font ik-margin-top-20 ik-title-color">
真棒!所有单据都审批完了 真棒!所有单据都审批完了
</p>); </p>);
} else if(!props.hasPermission) { } else if(!props.hasPermission) {
column = (<p className='ik-title-font ik-margin-top-20 ik-title-color'> column = (<p className="ik-title-font ik-margin-top-20 ik-title-color">
亲,你没有权限操作此功能哦 亲,你没有权限操作此功能哦
</p>); </p>);
} }
outlet = (<Row type='flex' justify='center' className='ik-width-percent-100 ik-padding-bottom-20'> outlet = (<Row type="flex" justify="center" className="ik-width-percent-100 ik-padding-bottom-20">
<Col span='16' className='ik-text-center'> <Col span="16" className="ik-text-center">
{column} {column}
</Col> </Col>
</Row>); </Row>);
} }
} }
return ( return (
<Row className='ik-container-background'> <Row className="ik-container-background">
<Row id='action-sheet-button-container'> <Row id="action-sheet-button-container">
<Col span='6' offset='18' className='ik-padding-top-20'> <Col span="6" offset="18" className="ik-padding-top-20">
<div <div
className='action-sheet-button' className="action-sheet-button"
onClick={props.openActionsheet.bind(null, 'new')}> onClick={props.openActionsheet.bind(null, 'new')}>
<Icon type='plus-circle' /> <Icon type="plus-circle" />
</div> </div>
</Col> </Col>
</Row> </Row>
<div id='action-sheet-wrapper'> <div id="action-sheet-wrapper">
<IKActionSheet <IKActionSheet
buttons={props.current_buttons} buttons={props.current_buttons}
visible={props.actionSheetVisible} visible={props.actionSheetVisible}
onHidden={props.actionSheetHidden} onHidden={props.actionSheetHidden}
onSearch={props.handleSearch}/> onSearch={props.handleSearch}/>
</div> </div>
<Col span='24'> <Col span="24">
<Row className='ik-background-white'> <Row className="ik-background-white">
<Col span='12' className='statistic-container ik-padding-vertical-20'> <Col span="12" className="statistic-container ik-padding-vertical-20">
<Col span='8'> <Col span="8">
<svg className='purchase-color'> <svg className="purchase-color">
<use xlinkHref={props.icons.purchase}/> <use xlinkHref={props.icons.purchase}/>
</svg> </svg>
</Col> </Col>
<Col span='16'> <Col span="16">
<p className='ik-content-font ik-content-color'> <p className="ik-content-font ik-content-color">
上周采购总额 上周采购总额
</p> </p>
<p className='ik-title-font if-title-color'> <p className="ik-title-font if-title-color">
{formatMoney(props.statistic.purchase_last_week)} {formatMoney(props.statistic.purchase_last_week)}
</p> </p>
</Col> </Col>
</Col> </Col>
<Col span='12' className='statistic-container ik-padding-vertical-20'> <Col span="12" className="statistic-container ik-padding-vertical-20">
<Col span='8'> <Col span="8">
<svg className='purchase-color'> <svg className="purchase-color">
<use xlinkHref={props.icons.purchase} /> <use xlinkHref={props.icons.purchase} />
</svg> </svg>
</Col> </Col>
<Col span='16'> <Col span="16">
<p className='ik-content-font ik-content-color'> <p className="ik-content-font ik-content-color">
本周采购总额 本周采购总额
</p> </p>
<p className='ik-title-font if-title-color'> <p className="ik-title-font if-title-color">
{formatMoney(props.statistic.purchase_current_week)} {formatMoney(props.statistic.purchase_current_week)}
</p> </p>
</Col> </Col>
</Col> </Col>
</Row> </Row>
<Row className='ik-background-white'> <Row className="ik-background-white">
<Col span='12' className='statistic-container ik-padding-vertical-20'> <Col span="12" className="statistic-container ik-padding-vertical-20">
<Col span='8'> <Col span="8">
<svg className='sale-color'> <svg className="sale-color">
<use xlinkHref={props.icons.sale} /> <use xlinkHref={props.icons.sale} />
</svg> </svg>
</Col> </Col>
<Col span='16'> <Col span="16">
<p className='ik-content-font ik-content-color'> <p className="ik-content-font ik-content-color">
上周销售总额 上周销售总额
</p> </p>
<p className='ik-title-font if-title-color'> <p className="ik-title-font if-title-color">
{formatMoney(props.statistic.sale_last_week)} {formatMoney(props.statistic.sale_last_week)}
</p> </p>
</Col> </Col>
</Col> </Col>
<Col span='12' className='statistic-container ik-padding-vertical-20'> <Col span="12" className="statistic-container ik-padding-vertical-20">
<Col span='8'> <Col span="8">
<svg className='sale-color'> <svg className="sale-color">
<use xlinkHref={props.icons.sale} /> <use xlinkHref={props.icons.sale} />
</svg> </svg>
</Col> </Col>
<Col span='16'> <Col span="16">
<p className='ik-content-font ik-content-color'> <p className="ik-content-font ik-content-color">
上周销售总额 上周销售总额
</p> </p>
<p className='ik-title-font if-title-color'> <p className="ik-title-font if-title-color">
{formatMoney(props.statistic.sale_current_week)} {formatMoney(props.statistic.sale_current_week)}
</p> </p>
</Col> </Col>
</Col> </Col>
</Row> </Row>
<Row className='ik-background-white'> <Row className="ik-background-white">
<Col span='12' className='statistic-container ik-padding-vertical-20'> <Col span="12" className="statistic-container ik-padding-vertical-20">
<Col span='8'> <Col span="8">
<svg className='inventory-color'> <svg className="inventory-color">
<use xlinkHref={props.icons.inventory} /> <use xlinkHref={props.icons.inventory} />
</svg> </svg>
</Col> </Col>
<Col span='16'> <Col span="16">
<p className='ik-content-font ik-content-color'> <p className="ik-content-font ik-content-color">
库存总量 库存总量
</p> </p>
<p className='ik-title-font if-title-color'> <p className="ik-title-font if-title-color">
{formatMoney(props.statistic.total_inventory)} {formatMoney(props.statistic.total_inventory)}
</p> </p>
</Col> </Col>
</Col> </Col>
<Col span='12' className='statistic-container ik-padding-vertical-20'> <Col span="12" className="statistic-container ik-padding-vertical-20">
<Col span='8'> <Col span="8">
<svg className='inventory-color'> <svg className="inventory-color">
<use xlinkHref={props.icons.inventory} /> <use xlinkHref={props.icons.inventory} />
</svg> </svg>
</Col> </Col>
<Col span='16'> <Col span="16">
<p className='ik-content-font ik-content-color'> <p className="ik-content-font ik-content-color">
库存种类 库存种类
</p> </p>
<p className='ik-title-font if-title-color'> <p className="ik-title-font if-title-color">
{formatMoney(props.statistic.total_variety)} {formatMoney(props.statistic.total_variety)}
</p> </p>
</Col> </Col>
</Col> </Col>
</Row> </Row>
<Row className='ik-background-white'> <Row className="ik-background-white">
<Col span='12' className='statistic-container ik-padding-vertical-20'> <Col span="12" className="statistic-container ik-padding-vertical-20">
<Col span='8'> <Col span="8">
<svg className='debt-color'> <svg className="debt-color">
<use xlinkHref={props.icons.customer_debt} /> <use xlinkHref={props.icons.customer_debt} />
</svg> </svg>
</Col> </Col>
<Col span='16'> <Col span="16">
<p className='ik-content-font ik-content-color'> <p className="ik-content-font ik-content-color">
客户欠款 客户欠款
</p> </p>
<p className='ik-title-font if-title-color'> <p className="ik-title-font if-title-color">
{formatMoney(props.statistic.customer_debt)} {formatMoney(props.statistic.customer_debt)}
</p> </p>
</Col> </Col>
</Col> </Col>
<Col span='12' className='statistic-container ik-padding-vertical-20'> <Col span="12" className="statistic-container ik-padding-vertical-20">
<Col span='8'> <Col span="8">
<svg className='debt-color'> <svg className="debt-color">
<use xlinkHref={props.icons.supplier_debt} /> <use xlinkHref={props.icons.supplier_debt} />
</svg> </svg>
</Col> </Col>
<Col span='16'> <Col span="16">
<p className='ik-content-font ik-content-color'> <p className="ik-content-font ik-content-color">
供应商欠款 供应商欠款
</p> </p>
<p className='ik-title-font if-title-color'> <p className="ik-title-font if-title-color">
{formatMoney(props.statistic.supplier_debt)} {formatMoney(props.statistic.supplier_debt)}
</p> </p>
</Col> </Col>
</Col> </Col>
</Row> </Row>
<Row className='shortcut-wrapper'> <Row className="shortcut-wrapper">
{allShortcuts.each((shortcuts) => { {allShortcuts.each((shortcuts) => {
shortcuts.each((shortcut) => { shortcuts.each((shortcut) => {
<Col span='6'> <Col span="6">
<a <a
href='javascript:void(0);' href="javascript:void(0);"
className='shortcut-item' className="shortcut-item"
onClick={props.openActionsheet.bind(null, shortcut.type)}> onClick={props.openActionsheet.bind(null, shortcut.type)}>
<svg> <svg>
<use xlinkHref={props.icons[shortcut.type]} /> <use xlinkHref={props.icons[shortcut.type]} />
...@@ -224,7 +221,7 @@ class DashboardIndexAdmin extends Component { // eslint-disable-line react/prefe ...@@ -224,7 +221,7 @@ class DashboardIndexAdmin extends Component { // eslint-disable-line react/prefe
}); });
})} })}
</Row> </Row>
<Row className='document-header'> <Row className="document-header">
{props.titles.each((tab)=> { {props.titles.each((tab)=> {
let active = 'document-header-item'; let active = 'document-header-item';
if (props.activeTab === tab.type) { if (props.activeTab === tab.type) {
...@@ -234,7 +231,7 @@ class DashboardIndexAdmin extends Component { // eslint-disable-line react/prefe ...@@ -234,7 +231,7 @@ class DashboardIndexAdmin extends Component { // eslint-disable-line react/prefe
span={(24 / props.titles.length)} span={(24 / props.titles.length)}
className={active} className={active}
onClick={props.toggleTab.bind(null, tab.type)}> onClick={props.toggleTab.bind(null, tab.type)}>
<p className='document-title'> <p className="document-title">
{tab.title} {tab.title}
</p> </p>
</Col> </Col>
......
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,108 +10,117 @@ class DashboardIndexMember extends Component { // eslint-disable-line react/pref ...@@ -10,108 +10,117 @@ 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>
{props.documents.each((doc) =>{ <Col span="24">
let key = `${doc.type}_${doc.id}`; {props.documents.each((doc) =>{
<Document key={key} document={doc}></Document> let key = `${doc.type}_${doc.id}`;
})} <Document key={key} document={doc} />
</Col> })}
</Row>); </Col>
</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">
{column} <Col span="16" className="ik-text-center">
</Col> {column}
</Row>); </Col>
</Row>
);
} }
} }
let fragments = null;
memberShortcuts.each((shortcuts, rowCount) => {
shortcuts.each((shortcut, colCount) => {
let className = ''
if ((colCount + 1) % 4 === 0 ) {
className = '';
} else {
className = 'ik-border-right';
}
if (rowCount < memberShortcuts.length - 1) {
className += 'ik-border-bottom';
}
let href = shortcut.path;
if (shortcut.onClick) {
href = 'javascript:void(0);';
}
fragments += (<Col span="6" className={className}>
<a className="shortcut-link" href={href} onClick={shortcut.onClick}>
<svg>
<use xlinkHref={props.icons[shortcut.type]} />
</svg>
<p className="ik-margin-top-5 ik-title-font ik-text-center">{shortcut.name}</p>
</a>
</Col>);
});
});
return (<Row> return (<Row>
<Row id="action-sheet-button-container"> <Row id="action-sheet-button-container">
<Col span='6' offset='18' className='ik-padding-top-20'> <Col span="6" offset="18" className="ik-padding-top-20">
<div <div
className='action-sheet-button' className="action-sheet-button"
onClick={props.onClick.bind(null, 'new')}> onClick={props.onClick.bind(null, 'new')}>
<Icon type='plus-circle'/> <Icon type="plus-circle" />
</div> </div>
</Col> </Col>
</Row> </Row>
<div id="action-sheet-wrapper"> <div id="action-sheet-wrapper">
<IKActionSheet <IKActionSheet buttons={props.current_buttons} visible={props.actionSheetVisible} onHidden={props.actionSheetHidden} onSearch={props.handleSearch} />
buttons={props.current_buttons}
visible={props.actionSheetVisible}
onHidden={props.actionSheetHidden}
onSearch={props.handleSearch}>
</IKActionSheet>
</div> </div>
<Row> <Row>
<Col span='24'>{memberShortcuts.each((shortcuts, rowCount) => { <Col span="24">
{shortcuts.each(shortcut, colCount => { { fragments }
let className = '' </Col>
if ((colCount + 1) % 4 == 0 ) {
className = '';
} else {
className = 'ik-border-right';
}
if (rowCount < memberShortcuts.length - 1) {
className += 'ik-border-bottom';
}
let href = shortcut.path;
if (shortcut.onClick) {
href = 'javascript:void(0);';
}
<Col span='6' className={className}>
<a className='shortcut-link' href={href} onClick={shortcut.onClick}>
<svg>
<use xlinkHref={props.icons[shortcut.type]}/>
</svg>
<p className='ik-margin-top-5 ik-title-font ik-text-center'>{shortcut.name}</p>
</a>
</Col>
})}
})}</Col>
</Row> </Row>
<Row> <Row>
<Col span='24' className='ik-container-background ik-height-40'> <Col span="24" className="ik-container-background ik-height-40">
<p className='document-title'>最近的单据</p> <p className="document-title">最近的单据</p>
</Col> </Col>
<Col span='24'> <Col span="24">
{outlet} { 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