Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
ik_invoicing
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ikcrm_frontend
ik_invoicing
Commits
43853cf7
Commit
43853cf7
authored
Dec 29, 2016
by
小明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整式作台代码符合jsx可编译文法,增加构建测试环境
parent
ea6d8909
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
122 additions
and
76 deletions
+122
-76
internals/webpack/webpack.prod.babel.js
+3
-3
internals/webpack/webpack.temp.babel.js
+35
-0
package.json
+1
-0
src/app.js
+2
-0
src/main.js
+12
-0
src/modules/dashboard/admin.js
+58
-63
src/modules/dashboard/index.js
+11
-10
No files found.
internals/webpack/webpack.prod.babel.js
View file @
43853cf7
...
@@ -6,9 +6,9 @@ const OfflinePlugin = require('offline-plugin');
...
@@ -6,9 +6,9 @@ const OfflinePlugin = require('offline-plugin');
module
.
exports
=
require
(
'./webpack.base.babel'
)({
module
.
exports
=
require
(
'./webpack.base.babel'
)({
// In production, we skip all hot-reloading stuff
// In production, we skip all hot-reloading stuff
entry
:
[
entry
:
{
path
.
join
(
process
.
cwd
(),
'src/app.js'
),
main
:
path
.
join
(
process
.
cwd
(),
'src/app.js'
),
]
,
}
,
// Utilize long-term caching by adding content hashes (not compilation hashes) to compiled assets
// Utilize long-term caching by adding content hashes (not compilation hashes) to compiled assets
output
:
{
output
:
{
...
...
internals/webpack/webpack.temp.babel.js
0 → 100644
View file @
43853cf7
// Important modules this config uses
const
path
=
require
(
'path'
);
const
webpack
=
require
(
'webpack'
);
const
HtmlWebpackPlugin
=
require
(
'html-webpack-plugin'
);
const
OfflinePlugin
=
require
(
'offline-plugin'
);
module
.
exports
=
require
(
'./webpack.base.babel'
)({
// In production, we skip all hot-reloading stuff
entry
:
{
main
:
path
.
join
(
process
.
cwd
(),
'src/app.js'
),
},
// Utilize long-term caching by adding content hashes (not compilation hashes) to compiled assets
output
:
{
filename
:
'[name].[chunkhash].js'
,
chunkFilename
:
'[name].[chunkhash].chunk.js'
,
library
:
'window'
,
libraryTarget
:
'this'
,
},
externals
:
{
react
:
'React'
},
plugins
:
[
new
webpack
.
optimize
.
CommonsChunkPlugin
({
name
:
'vendor'
,
children
:
true
,
minChunks
:
2
,
async
:
true
,
}),
// Merge all duplicate modules
new
webpack
.
optimize
.
DedupePlugin
(),
],
});
package.json
View file @
43853cf7
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
"postinstall"
:
"npm run build:dll"
,
"postinstall"
:
"npm run build:dll"
,
"prebuild"
:
"npm run build:clean && npm run test"
,
"prebuild"
:
"npm run build:clean && npm run test"
,
"build"
:
"cross-env NODE_ENV=production webpack --config internals/webpack/webpack.prod.babel.js --color -p --progress"
,
"build"
:
"cross-env NODE_ENV=production webpack --config internals/webpack/webpack.prod.babel.js --color -p --progress"
,
"temp"
:
"cross-env NODE_ENV=production webpack --config internals/webpack/webpack.temp.babel.js --color --progress"
,
"build:clean"
:
"npm run test:clean && rimraf ./build"
,
"build:clean"
:
"npm run test:clean && rimraf ./build"
,
"build:dll"
:
"node ./internals/scripts/dependencies.js"
,
"build:dll"
:
"node ./internals/scripts/dependencies.js"
,
"start"
:
"cross-env NODE_ENV=development node server"
,
"start"
:
"cross-env NODE_ENV=development node server"
,
...
...
src/app.js
View file @
43853cf7
...
@@ -102,3 +102,5 @@ if (!window.Intl) {
...
@@ -102,3 +102,5 @@ if (!window.Intl) {
// we do not want it installed
// we do not want it installed
import
{
install
}
from
'offline-plugin/runtime'
;
import
{
install
}
from
'offline-plugin/runtime'
;
install
();
install
();
System
.
import
(
'main.js'
);
src/main.js
0 → 100644
View file @
43853cf7
import
React
,
{
Component
}
from
'react'
;
export
default
class
TestPage
extends
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{};
}
render
()
{
return
(
<
p
>
Hello
World
!<
/p>
)
;
}
}
src/modules/dashboard/admin.js
View file @
43853cf7
...
@@ -8,17 +8,58 @@ class DashboardIndexAdmin extends Component { // eslint-disable-line react/prefe
...
@@ -8,17 +8,58 @@ class DashboardIndexAdmin extends Component { // eslint-disable-line react/prefe
render
()
{
render
()
{
const
allShortcuts
=
[
const
allShortcuts
=
[
{
type
:
'purchase'
,
title
:
'采购列表'
},
{
type
:
'purchase'
,
title
:
'采购列表'
},
{
type
:
'sale'
,
title
:
'销售列表'
},
{
type
:
'sale'
,
title
:
'销售列表'
},
{
type
:
'other'
,
title
:
'其他列表'
},
{
type
:
'other'
,
title
:
'其他列表'
},
{
type
:
'document'
,
title
:
'单据查询'
},
{
type
:
'document'
,
title
:
'单据查询'
},
{
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
;
if
(
this
.
props
.
loading
)
{
outlet
=
(
<
Icon
type
=
'loading'
className
=
'search-loading'
/>
);
}
else
{
if
(
props
[
`
${
props
.
activeTab
}
Documents`
].
length
>
0
)
{
outlet
=
(
<
Row
>
<
Col
span
=
'24'
>
{
props
[
`
${
props
.
activeTab
}
Documents`
].
each
((
doc
)
=>
{
let
key
=
`
${
doc
.
type
}
_
${
doc
.
id
}
`
;
<
Document
key
=
{
key
}
document
=
{
doc
}
type
=
'approving'
/>
})}
<
/Col
>
<
/Row>
)
;
}
else
{
let
column
=
(
<
p
className
=
'ik-title-font ik-margin-top-20 ik-title-color'
>
还没有审批通过的单据哦
~<
/p>
)
;
if
(
props
.
activeTab
===
'noapproval'
)
{
column
=
(
<
div
>
<
p
className
=
'ik-title-font ik-margin-top-20 ik-title-color'
>
还没有单据哦,快去新增吧
<
/p
>
<
/div>
)
;
}
else
if
(
props
.
activeTab
===
'approving'
)
{
column
=
(
<
p
className
=
'ik-title-font ik-margin-top-20 ik-title-color'
>
真棒!所有单据都审批完了
<
/p>
)
;
}
else
if
(
!
props
.
hasPermission
)
{
column
=
(
<
p
className
=
'ik-title-font ik-margin-top-20 ik-title-color'
>
亲,你没有权限操作此功能哦
<
/p>
)
;
}
outlet
=
(
<
Row
type
=
'flex'
justify
=
'center'
className
=
'ik-width-percent-100 ik-padding-bottom-20'
>
<
Col
span
=
'16'
className
=
'ik-text-center'
>
{
column
}
<
/Col
>
<
/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'
>
...
@@ -38,7 +79,6 @@ class DashboardIndexAdmin extends Component { // eslint-disable-line react/prefe
...
@@ -38,7 +79,6 @@ class DashboardIndexAdmin extends Component { // eslint-disable-line react/prefe
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'
>
...
@@ -58,7 +98,7 @@ class DashboardIndexAdmin extends Component { // eslint-disable-line react/prefe
...
@@ -58,7 +98,7 @@ class DashboardIndexAdmin extends Component { // eslint-disable-line react/prefe
<
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'
>
...
@@ -71,7 +111,6 @@ class DashboardIndexAdmin extends Component { // eslint-disable-line react/prefe
...
@@ -71,7 +111,6 @@ class DashboardIndexAdmin extends Component { // eslint-disable-line react/prefe
<
/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'
>
...
@@ -104,7 +143,6 @@ class DashboardIndexAdmin extends Component { // eslint-disable-line react/prefe
...
@@ -104,7 +143,6 @@ class DashboardIndexAdmin extends Component { // eslint-disable-line react/prefe
<
/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'
>
...
@@ -137,7 +175,6 @@ class DashboardIndexAdmin extends Component { // eslint-disable-line react/prefe
...
@@ -137,7 +175,6 @@ class DashboardIndexAdmin extends Component { // eslint-disable-line react/prefe
<
/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'
>
...
@@ -170,7 +207,6 @@ class DashboardIndexAdmin extends Component { // eslint-disable-line react/prefe
...
@@ -170,7 +207,6 @@ class DashboardIndexAdmin extends Component { // eslint-disable-line react/prefe
<
/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
)
=>
{
...
@@ -188,64 +224,23 @@ class DashboardIndexAdmin extends Component { // eslint-disable-line react/prefe
...
@@ -188,64 +224,23 @@ 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
=
''
;
let
active
=
'
document-header-item
'
;
if
(
props
.
activeTab
==
tab
.
type
)
{
if
(
props
.
activeTab
==
=
tab
.
type
)
{
active
=
'active'
;
active
=
'
document-header-item
active'
;
}
}
<
Col
<
Col
span
=
{(
24
/
props
.
titles
.
length
)}
span
=
{(
24
/
props
.
titles
.
length
)}
className
=
`document-header-item
${
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
>
})}
})
;
}
<
/Row
>
<
/Row
>
{
outlet
}
{
if
(
this
.
props
.
loading
)
{
<
Icon
type
=
'loading'
className
=
'search-loading'
/>
}
else
{
if
(
props
[
`
${
props
.
activeTab
}
Documents`
].
length
>
0
)
{
<
Row
>
<
Col
span
=
'24'
>
{
props
[
`
${
props
.
activeTab
}
Documents`
].
each
(()
=>
{
<
Document
key
=
`
${
document
.
type
}
_
${
document
.
id
}
`
document
=
{
doc
}
type
=
'approving'
/>
})}
<
/Col
>
<
/Row
>
}
else
{
<
Row
type
=
'flex'
justify
=
'center'
className
=
'ik-width-percent-100 ik-padding-bottom-20'
>
<
Col
span
=
'16'
className
=
'ik-text-center'
>
{
if
(
props
.
activeTab
==
'noapproval'
)
{
<
div
>
<
p
className
=
'ik-title-font ik-margin-top-20 ik-title-color'
>
还没有单据哦,快去新增吧
<
/p
>
<
/div
>
}
else
if
(
props
.
activeTab
==
'approving'
)
{
<
p
className
=
'ik-title-font ik-margin-top-20 ik-title-color'
>
真棒!所有单据都审批完了
<
/p
>
}
else
if
(
!
props
.
hasPermission
)
{
<
p
className
=
'ik-title-font ik-margin-top-20 ik-title-color'
>
亲,你没有权限操作此功能哦
<
/p
>
}
else
{
<
p
className
=
'ik-title-font ik-margin-top-20 ik-title-color'
>
还没有审批通过的单据哦
~
<
/p
>
}}
<
/Col
>
<
/Row
>
}
}}
<
/Col
>
<
/Col
>
<
/Row
>
<
/Row
>
);
);
...
...
src/modules/dashboard/index.js
View file @
43853cf7
...
@@ -11,7 +11,7 @@ class DashboardIndex extends Component { // eslint-disable-line react/prefer-sta
...
@@ -11,7 +11,7 @@ class DashboardIndex extends Component { // eslint-disable-line react/prefer-sta
const
store
=
IKDataStore
.
namespace
(
this
.
props
.
namespace
);
const
store
=
IKDataStore
.
namespace
(
this
.
props
.
namespace
);
this
.
setState
({
this
.
setState
({
logined
:
store
.
get
(
'logined'
)
||
this
.
props
.
logined
,
logined
:
store
.
get
(
'logined'
)
||
this
.
props
.
logined
,
is_admin
:
store
.
get
(
'is_admin'
)
||
this
.
props
.
is_admin
||
false
.
is_admin
:
store
.
get
(
'is_admin'
)
||
this
.
props
.
is_admin
||
false
,
icons
:
store
.
get
(
'icons'
)
||
this
.
props
.
icons
||
[],
icons
:
store
.
get
(
'icons'
)
||
this
.
props
.
icons
||
[],
new_buttons
:
store
.
get
(
'new_buttons'
)
||
this
.
props
.
new_buttons
||
[],
//新增按钮
new_buttons
:
store
.
get
(
'new_buttons'
)
||
this
.
props
.
new_buttons
||
[],
//新增按钮
purchase_buttons
:
store
.
get
(
'purchase_buttons'
)
||
this
.
props
.
purchase_buttons
||
[],
//采购列表按钮
purchase_buttons
:
store
.
get
(
'purchase_buttons'
)
||
this
.
props
.
purchase_buttons
||
[],
//采购列表按钮
...
@@ -44,7 +44,7 @@ class DashboardIndex extends Component { // eslint-disable-line react/prefer-sta
...
@@ -44,7 +44,7 @@ class DashboardIndex extends Component { // eslint-disable-line react/prefer-sta
case
'other'
:
case
'other'
:
case
'new'
:
case
'new'
:
this
.
setState
({
this
.
setState
({
current_buttons
:
@
state
[
`
${
type
}
_buttons`
],
current_buttons
:
this
.
state
[
`
${
type
}
_buttons`
],
actionSheetVisible
:
true
actionSheetVisible
:
true
});
});
break
;
break
;
...
@@ -69,11 +69,11 @@ class DashboardIndex extends Component { // eslint-disable-line react/prefer-sta
...
@@ -69,11 +69,11 @@ class DashboardIndex extends Component { // eslint-disable-line react/prefer-sta
if
(
getCurrentMember
().
token
)
{
if
(
getCurrentMember
().
token
)
{
if
(
this
.
state
.
is_admin
)
{
if
(
this
.
state
.
is_admin
)
{
$
.
getJSON
'/api/dashboard/statistic'
,
(
response
)
=>
{
$
.
getJSON
(
'/api/dashboard/statistic'
,
(
response
)
=>
{
globalHandleResponse
(
response
,
()
=>
{
globalHandleResponse
(
response
,
()
=>
{
this
.
setState
({
statistic
:
response
.
statistic
});
this
.
setState
({
statistic
:
response
.
statistic
});
});
});
}
}
);
$
.
getJSON
(
'/api/documents'
,
{
approving
:
true
},
(
response
)
=>
{
$
.
getJSON
(
'/api/documents'
,
{
approving
:
true
},
(
response
)
=>
{
globalHandleResponse
(
response
,
()
=>
{
globalHandleResponse
(
response
,
()
=>
{
...
@@ -114,7 +114,7 @@ class DashboardIndex extends Component { // eslint-disable-line react/prefer-sta
...
@@ -114,7 +114,7 @@ class DashboardIndex extends Component { // eslint-disable-line react/prefer-sta
documents
:
response
.
documents
,
documents
:
response
.
documents
,
loading
:
false
,
loading
:
false
,
});
});
}
}
);
});
});
}
}
}
}
...
@@ -125,7 +125,7 @@ class DashboardIndex extends Component { // eslint-disable-line react/prefer-sta
...
@@ -125,7 +125,7 @@ class DashboardIndex extends Component { // eslint-disable-line react/prefer-sta
}
}
componentDidMount
()
{
componentDidMount
()
{
if
!
(
Cookies
.
get
(
'checked_latest_notice'
))
{
if
(
!
Cookies
.
get
(
'checked_latest_notice'
))
{
$
.
getJSON
(
'/api/upgrades/get_latest'
,
(
response
)
=>
{
$
.
getJSON
(
'/api/upgrades/get_latest'
,
(
response
)
=>
{
if
(
response
.
status
.
code
==
200
)
{
if
(
response
.
status
.
code
==
200
)
{
Cookies
.
set
(
'checked_latest_notice'
,
'checked'
);
Cookies
.
set
(
'checked_latest_notice'
,
'checked'
);
...
@@ -186,16 +186,17 @@ class DashboardIndex extends Component { // eslint-disable-line react/prefer-sta
...
@@ -186,16 +186,17 @@ class DashboardIndex extends Component { // eslint-disable-line react/prefer-sta
'biz.util.previewImage'
,
'biz.util.previewImage'
,
'biz.chat.pickConversation'
,
'biz.chat.pickConversation'
,
'biz.ding.post'
,
'biz.ding.post'
,
'biz.telephone.call'
,
'biz.util.scan'
'biz.telephone.call'
,
'biz.util.scan'
,
'biz.contact.choose'
,
'biz.contact.choose'
,
'biz.contact.complexChoose'
,
'biz.contact.complexChoose'
,
'biz.contact.createGroup'
,
'biz.contact.createGroup'
,
'biz.navigation.setLeft
'
'biz.navigation.setLeft
'
,
'biz.navigation.setRight'
,
'biz.navigation.setRight'
,
'biz.navigation.setTitle'
,
'biz.navigation.setTitle'
,
'biz.navigation.close'
,
'biz.navigation.close'
,
'biz.navigation.setIcon'
,
'biz.navigation.setIcon'
,
'biz.util.openLink'
'biz.util.openLink'
,
]
]
const
configParams
=
{
const
configParams
=
{
agentId
:
config
.
agent_id
,
agentId
:
config
.
agent_id
,
...
@@ -233,7 +234,7 @@ class DashboardIndex extends Component { // eslint-disable-line react/prefer-sta
...
@@ -233,7 +234,7 @@ class DashboardIndex extends Component { // eslint-disable-line react/prefer-sta
setCurrentMember
(
data
.
token
,
data
.
uid
)
setCurrentMember
(
data
.
token
,
data
.
uid
)
if
!
(
isVipNocticeShown
(
data
.
org_id
))
{
if
(
!
isVipNocticeShown
(
data
.
org_id
))
{
showVipNotice
(
data
.
org_id
)
showVipNotice
(
data
.
org_id
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment