Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bms-vue-obear
Project
Project
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
daywrite
bms-vue-obear
Commits
9c5d4ced
Commit
9c5d4ced
authored
Apr 22, 2019
by
huai.li
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'f_task' of 140.143.226.1:daywrite/bms-vue-obear into f_task
parents
f981a712
2b045290
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
187 additions
and
67 deletions
+187
-67
index.ejs
index.ejs
+9
-3
api.js
src/api.js
+2
-0
reimbursement.js
src/apis/reimbursement.js
+3
-0
app.scss
src/assets/css/app.scss
+1
-0
scheduleItem.vue
src/components/common/scheduleItem.vue
+1
-1
searchForm.vue
src/components/common/searchForm.vue
+2
-1
settingMixin.js
src/components/common/settingMixin.js
+29
-0
reimbursementForm.vue
src/components/reimbursement/reimbursementForm.vue
+32
-12
reimbursementModal.vue
src/components/reimbursement/reimbursementModal.vue
+16
-6
reimbursementHome.vue
src/components/reimbursement_list/reimbursementHome.vue
+27
-7
commonMixin.js
src/lib/commonMixin.js
+1
-0
request.js
src/lib/request.js
+42
-29
viewHelper.js
src/lib/viewHelper.js
+12
-5
route.js
src/route.js
+7
-0
reimbursement.js
src/routes/reimbursement.js
+1
-1
schedule.js
src/routes/schedule.js
+2
-2
No files found.
index.ejs
View file @
9c5d4ced
...
@@ -24,17 +24,23 @@
...
@@ -24,17 +24,23 @@
"isRouteShow"
:
1
,
"isRouteShow"
:
1
,
"title"
:
"首页"
,
"title"
:
"首页"
,
"appName"
:
portalName
,
"appName"
:
portalName
,
"url"
:
"/schedule
Home
"
"url"
:
"/schedule"
},
{
},
{
"icon"
:
"fa-home"
,
"icon"
:
"fa-home"
,
"isRouteShow"
:
1
,
"isRouteShow"
:
1
,
"title"
:
"费用报销"
,
"title"
:
"费用报销"
,
"appName"
:
'reimbursement'
,
"appName"
:
'reimbursement'
,
"url"
:
"/reimbursementHome"
"url"
:
"/reimbursement"
},
{
"icon"
:
"fa-home"
,
"isRouteShow"
:
1
,
"title"
:
"项目管理"
,
"appName"
:
'task'
,
"url"
:
"/task"
}],
}],
homePage
:
{
homePage
:
{
appName
:
'reimbursement'
,
appName
:
'reimbursement'
,
url
:
'/reimbursement
Home
'
url
:
'/reimbursement'
}
}
}
}
...
...
src/api.js
View file @
9c5d4ced
import
ScheduleApi
from
'./apis/schedule.js'
import
ScheduleApi
from
'./apis/schedule.js'
import
ReimburrsementApi
from
'./apis/reimbursement.js'
import
ReimburrsementApi
from
'./apis/reimbursement.js'
import
TaskApi
from
'./apis/task.js'
const
API_HOST
=
process
.
env
.
API_HOST
const
API_HOST
=
process
.
env
.
API_HOST
const
API_PORT
=
process
.
env
.
API_PORT
const
API_PORT
=
process
.
env
.
API_PORT
...
@@ -26,6 +27,7 @@ const option = {
...
@@ -26,6 +27,7 @@ const option = {
let
apis
=
{}
let
apis
=
{}
apis
=
Object
.
assign
(
apis
,
ScheduleApi
)
apis
=
Object
.
assign
(
apis
,
ScheduleApi
)
apis
=
Object
.
assign
(
apis
,
ReimburrsementApi
)
apis
=
Object
.
assign
(
apis
,
ReimburrsementApi
)
apis
=
Object
.
assign
(
apis
,
TaskApi
)
export
default
{
export
default
{
option
,
option
,
...
...
src/apis/reimbursement.js
View file @
9c5d4ced
...
@@ -16,5 +16,8 @@ export default {
...
@@ -16,5 +16,8 @@ export default {
},
},
saveEditReim
:
{
saveEditReim
:
{
url
:
'/vue/reimbursement/save-edit'
url
:
'/vue/reimbursement/save-edit'
},
deleteReim
:
{
url
:
'/vue/reimbursement/delete'
}
}
}
}
src/assets/css/app.scss
View file @
9c5d4ced
@import
'./schedule-app.scss'
;
@import
'./schedule-app.scss'
;
@import
'./reim-app.scss'
;
@import
'./reim-app.scss'
;
@import
'./task-app.scss'
src/components/common/scheduleItem.vue
View file @
9c5d4ced
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<el-col
:span=
"4"
:xs=
"24"
class=
"obear-schedule-left"
:style=
"
{background: item.bgcolor}">
<el-col
:span=
"4"
:xs=
"24"
class=
"obear-schedule-left"
:style=
"
{background: item.bgcolor}">
<el-row
:gutter=
"10"
>
<el-row
:gutter=
"10"
>
<el-col
:span=
"24"
>
<el-col
:span=
"24"
>
<router-link
:to=
"
{ path: '/
scheduleView
/' + item.client_id }">
<router-link
:to=
"
{ path: '/
ofClient
/' + item.client_id }">
<i
class=
"fa fa-star"
aria-hidden=
"true"
></i>
{{
isNullClient
?
'客户名称(未设置)'
:
item
.
client
.
name
}}
<i
class=
"fa fa-star"
aria-hidden=
"true"
></i>
{{
isNullClient
?
'客户名称(未设置)'
:
item
.
client
.
name
}}
</router-link>
</router-link>
</el-col>
</el-col>
...
...
src/components/common/searchForm.vue
View file @
9c5d4ced
...
@@ -2,7 +2,8 @@
...
@@ -2,7 +2,8 @@
<div>
<div>
<el-row
class=
"form-content"
>
<el-row
class=
"form-content"
>
<el-form
ref=
"clientForm"
size=
"mini"
:model=
"clientForm"
label-width=
"0"
label-position=
"top"
>
<el-form
ref=
"clientForm"
size=
"mini"
:model=
"clientForm"
label-width=
"0"
label-position=
"top"
>
<el-col
:span=
"4"
v-for=
"(item, key) in filter"
:key=
"key"
>
<slot
name=
"pre"
></slot>
<el-col
:span=
"4"
v-for=
"(item, key) in filter"
:key=
"key"
>
<el-form-item>
<el-form-item>
<span
slot=
"label"
v-if=
"item.key !== 'Filter[sort]'"
>
<span
slot=
"label"
v-if=
"item.key !== 'Filter[sort]'"
>
<a
@
click
.
prevent=
"timeSort"
v-if=
"item.key === 'Filter[name]'"
>
<a
@
click
.
prevent=
"timeSort"
v-if=
"item.key === 'Filter[name]'"
>
...
...
src/components/common/settingMixin.js
View file @
9c5d4ced
...
@@ -48,6 +48,21 @@ export default {
...
@@ -48,6 +48,21 @@ export default {
reimbursementCarbonCopyRels
()
{
reimbursementCarbonCopyRels
()
{
let
ret
=
this
.
getArrayByKey
(
'Reimbursements'
,
'form_reimbursementCarbonCopyRels'
)
let
ret
=
this
.
getArrayByKey
(
'Reimbursements'
,
'form_reimbursementCarbonCopyRels'
)
return
ret
&&
[].
concat
(
ret
.
value
)
return
ret
&&
[].
concat
(
ret
.
value
)
},
reimbursementSettleAccountsAt
()
{
let
ret
=
this
.
getArrayByKey
(
'Reimbursements'
,
'settle_accounts_at'
)
return
ret
&&
[].
concat
(
ret
.
value
)
},
taskGroupArray
()
{
let
ret
=
this
.
getArrayByKey
(
'Tasks'
,
'task_group_id'
)
return
ret
&&
[].
concat
(
ret
.
value
)
},
salesOrderRemindReceiversArray
()
{
let
ret
=
this
.
getArrayByKey
(
'SalesOrders'
,
'salesOrderRemindReceivers'
)
return
ret
&&
[].
concat
(
ret
.
value
)
}
}
},
},
...
@@ -71,6 +86,20 @@ export default {
...
@@ -71,6 +86,20 @@ export default {
})
})
},
},
getTaskGroupNew
()
{
requestAPI
(
api
.
getTaskGroupNew
)
.
then
((
res
)
=>
{
this
.
retNewArray
=
res
.
options
})
},
getTaskTask
()
{
requestAPI
(
api
.
getTaskNew
)
.
then
((
res
)
=>
{
this
.
retNewArray
=
res
.
options
})
},
getReimbursementNew
()
{
getReimbursementNew
()
{
requestAPI
(
api
.
getReimNew
)
requestAPI
(
api
.
getReimNew
)
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
...
...
src/components/reimbursement/reimbursementForm.vue
View file @
9c5d4ced
...
@@ -8,11 +8,11 @@
...
@@ -8,11 +8,11 @@
@
update:item=
"val =>
{model.form_type = val}">
@
update:item=
"val =>
{model.form_type = val}">
</single-radio>
</single-radio>
</el-form-item>
</el-form-item>
<el-form-item
label=
"费用类型:"
prop=
"
cost_t
ype"
class=
"ec-clear-left is-required"
>
<el-form-item
label=
"费用类型:"
prop=
"
form_costT
ype"
class=
"ec-clear-left is-required"
>
<single-radio
<single-radio
:form-item=
"model.
cost_t
ype"
:form-item=
"model.
form_costT
ype"
:options-list=
"reimCostTypeArray"
:options-list=
"reimCostTypeArray"
@
update:item=
"val =>
{model.
cost_t
ype = val}">
@
update:item=
"val =>
{model.
form_costT
ype = val}">
</single-radio>
</single-radio>
</el-form-item>
</el-form-item>
<el-form-item
label=
"发生时间:"
prop=
"occurrence_at"
class=
"ec-clear-left is-required"
>
<el-form-item
label=
"发生时间:"
prop=
"occurrence_at"
class=
"ec-clear-left is-required"
>
...
@@ -20,6 +20,18 @@
...
@@ -20,6 +20,18 @@
size=
"small"
size=
"small"
v-model=
"model.occurrence_at"
v-model=
"model.occurrence_at"
type=
"datetime"
type=
"datetime"
value-format=
"yyyy-MM-dd HH:mm:ss"
@
change=
"occurrenceAtChange"
placeholder=
"选择日期时间"
>
</el-date-picker>
</el-form-item>
<el-form-item
label=
"结算时间:"
prop=
"settle_accounts_at"
class=
"ec-clear-left is-required"
>
<el-date-picker
size=
"small"
v-model=
"model.settle_accounts_at"
type=
"datetime"
value-format=
"yyyy-MM-dd HH:mm:ss"
@
change=
"settleAccountsAtChange"
placeholder=
"选择日期时间"
>
placeholder=
"选择日期时间"
>
</el-date-picker>
</el-date-picker>
</el-form-item>
</el-form-item>
...
@@ -54,21 +66,23 @@
...
@@ -54,21 +66,23 @@
</el-select>
</el-select>
</el-form-item>
</el-form-item>
<el-form-item
label=
"审核人:"
prop=
"form_reimbursementVerifyRels"
class=
"ec-clear-left ec-form-item-lg is-required"
>
<el-form-item
label=
"审核人:"
prop=
"form_reimbursementVerifyRels"
class=
"ec-clear-left ec-form-item-lg is-required"
>
<el-select
v-model=
"model.form_reimbursementVerifyRels"
size=
"small"
multiple
placeholder=
"
请选择
"
>
<el-select
v-model=
"model.form_reimbursementVerifyRels"
size=
"small"
multiple
placeholder=
"
点击选择或输入关键字查询
"
>
<el-option
v-for=
"(option, optKey) in reimbursementVerifyRels"
<el-option
v-for=
"(option, optKey) in reimbursementVerifyRels"
:key=
"optKey"
:key=
"optKey"
:label=
"option.name"
:label=
"option.name"
:value=
"option.key"
></el-option>
:value=
"option.key"
></el-option>
</el-select>
</el-select>
</el-form-item>
</el-form-item>
<el-form-item
label=
"结算人:"
prop=
"actName"
class=
"ec-clear-left is-required"
>
<el-form-item
label=
"结算人:"
prop=
"settle_accounts_by"
class=
"ec-clear-left is-required"
>
<settle-account-select
<el-select
v-model=
"model.settle_accounts_by"
size=
"small"
filterable
placeholder=
"点击选择或输入关键字查询"
>
:query=
"model"
<el-option
v-for=
"(option, optKey) in reimbursementSettleAccountsAt"
:inputWidth=
"340"
:key=
"optKey"
:startLoadInitial=
"false"
/>
:label=
"option.name"
:value=
"option.key"
></el-option>
</el-select>
</el-form-item>
</el-form-item>
<el-form-item
label=
"抄送:"
prop=
"form_reimbursementCarbonCopyRels"
class=
"ec-clear-left ec-form-item-lg"
>
<el-form-item
label=
"抄送:"
prop=
"form_reimbursementCarbonCopyRels"
class=
"ec-clear-left ec-form-item-lg"
>
<el-select
v-model=
"model.form_reimbursementCarbonCopyRels"
size=
"small"
multiple
placeholder=
"
请选择
"
>
<el-select
v-model=
"model.form_reimbursementCarbonCopyRels"
size=
"small"
multiple
placeholder=
"
点击选择或输入关键字查询
"
>
<el-option
v-for=
"(option, optKey) in reimbursementCarbonCopyRels"
<el-option
v-for=
"(option, optKey) in reimbursementCarbonCopyRels"
:key=
"optKey"
:key=
"optKey"
:label=
"option.name"
:label=
"option.name"
...
@@ -87,7 +101,6 @@
...
@@ -87,7 +101,6 @@
</section>
</section>
</
template
>
</
template
>
<
script
>
<
script
>
import
settleAccountSelect
from
'./settleAccountSelect'
import
singleRadio
from
'../common/singleRadio'
import
singleRadio
from
'../common/singleRadio'
import
settingMixin
from
'../common/settingMixin'
import
settingMixin
from
'../common/settingMixin'
import
depSelect
from
'../schedule/depSelect'
import
depSelect
from
'../schedule/depSelect'
...
@@ -105,7 +118,6 @@ export default {
...
@@ -105,7 +118,6 @@ export default {
},
},
components
:
{
components
:
{
settleAccountSelect
,
singleRadio
,
singleRadio
,
depSelect
depSelect
},
},
...
@@ -139,6 +151,14 @@ export default {
...
@@ -139,6 +151,14 @@ export default {
},
},
methods
:
{
methods
:
{
occurrenceAtChange
(
val
)
{
this
.
model
.
occurrence_at
=
val
},
settleAccountsAtChange
(
val
)
{
this
.
model
.
settle_accounts_at
=
val
},
getProjectArray
(
id
)
{
getProjectArray
(
id
)
{
requestAPI
(
api
.
searchProjectByClientId
,
{
requestAPI
(
api
.
searchProjectByClientId
,
{
client_id
:
id
client_id
:
id
...
...
src/components/reimbursement/reimbursementModal.vue
View file @
9c5d4ced
...
@@ -30,13 +30,15 @@ export default {
...
@@ -30,13 +30,15 @@ export default {
diaVis
:
false
,
diaVis
:
false
,
model
:
{
model
:
{
form_type
:
''
,
form_type
:
''
,
cost_t
ype
:
''
,
form_costT
ype
:
''
,
occurrence_at
:
''
,
occurrence_at
:
''
,
settle_accounts_at
:
''
,
amount
:
''
,
amount
:
''
,
client_id
:
''
,
client_id
:
''
,
client_name
:
''
,
// 客户
client_name
:
''
,
// 客户
form_reimbursementVerifyRels
:
[],
form_reimbursementVerifyRels
:
[],
form_reimbursementCarbonCopyRels
:
[],
form_reimbursementCarbonCopyRels
:
[],
settle_accounts_by
:
''
,
description
:
''
,
description
:
''
,
project_id
:
''
,
project_id
:
''
,
attachmentFiles
:
[]
attachmentFiles
:
[]
...
@@ -46,14 +48,22 @@ export default {
...
@@ -46,14 +48,22 @@ export default {
methods
:
{
methods
:
{
show
(
model
)
{
show
(
model
)
{
model
&&
UTIL
.
flatten
(
this
.
model
,
model
)
if
(
model
)
{
UTIL
.
flatten
(
this
.
model
,
model
)
this
.
model
.
form_type
=
model
.
type
.
id
this
.
model
.
form_costType
=
model
.
costType
.
id
this
.
model
.
client_name
=
model
.
client
.
name
this
.
model
.
form_reimbursementVerifyRels
=
model
.
reimbursementVerifyRels
.
map
(
item
=>
item
.
user_id
)
this
.
model
.
form_reimbursementCarbonCopyRels
=
model
.
reimbursementCarbonCopyRels
.
map
(
item
=>
item
.
user_id
)
this
.
model
.
settle_accounts_by
=
model
.
settleAccountsBy
.
id
}
this
.
$refs
.
sidePopup
.
show
()
this
.
$refs
.
sidePopup
.
show
()
},
},
handleClose
()
{
handleClose
()
{
Object
.
keys
(
this
.
model
).
forEach
(
item
=>
{
Object
.
keys
(
this
.
model
).
forEach
(
item
=>
{
if
(
Array
.
isArray
(
item
)
)
{
if
(
item
===
'form_reimbursementVerifyRels'
||
item
===
'form_reimbursementCarbonCopyRels'
)
{
this
.
model
[
item
]
=
''
this
.
model
[
item
]
=
[]
}
else
{
}
else
{
this
.
model
[
item
]
=
''
this
.
model
[
item
]
=
''
}
}
...
@@ -62,13 +72,13 @@ export default {
...
@@ -62,13 +72,13 @@ export default {
},
},
save
()
{
save
()
{
console
.
log
(
this
.
model
)
let
_params
=
Object
.
assign
({},
setModule
(
this
.
model
,
'Reimbursements'
))
let
_params
=
Object
.
assign
({},
setModule
(
this
.
model
,
'Reimbursements'
))
let
_apiUrl
=
!
this
.
model
.
id
?
api
.
saveNewReim
:
api
.
saveEditReim
let
_apiUrl
=
!
this
.
model
.
id
?
api
.
saveNewReim
:
api
.
saveEditReim
!
this
.
model
.
id
&&
delete
_params
[
'Reimbursements[id]'
]
!
this
.
model
.
id
&&
delete
_params
[
'Reimbursements[id]'
]
console
.
log
(
_params
)
requestAPI
(
Object
.
assign
(
_apiUrl
,
{
method
:
'POST'
}),
_params
)
requestAPI
(
Object
.
assign
(
_apiUrl
,
{
method
:
'POST'
}),
_params
)
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
this
.
$refs
.
s
cheduleS
idePopup
.
close
()
this
.
$refs
.
sidePopup
.
close
()
this
.
$message
.
success
(
'操作成功'
)
this
.
$message
.
success
(
'操作成功'
)
})
})
}
}
...
...
src/components/reimbursement_list/reimbursementHome.vue
View file @
9c5d4ced
...
@@ -22,9 +22,9 @@
...
@@ -22,9 +22,9 @@
<div
class=
"page-body-content"
>
<div
class=
"page-body-content"
>
<div
class=
"mb10"
>
<div
class=
"mb10"
>
<singleRadioTool
<singleRadioTool
:form-item=
"
reimType
"
:form-item=
"
form['ReimbursementSearch[filter]']
"
:options-list=
"result.navCount"
:options-list=
"result.navCount"
@
update:item=
"val =>
{
reimType = val
}">
@
update:item=
"val =>
{
reimTypeChange(val)
}">
<el-radio-button
solt=
"default"
key=
"default"
label=
"default"
value=
"报销单"
>
报销单
</el-radio-button>
<el-radio-button
solt=
"default"
key=
"default"
label=
"default"
value=
"报销单"
>
报销单
</el-radio-button>
</singleRadioTool>
</singleRadioTool>
</div>
</div>
...
@@ -132,9 +132,9 @@ export default {
...
@@ -132,9 +132,9 @@ export default {
],
],
filter
:
[],
filter
:
[],
form
:
{
form
:
{
'ClientSearch[keyword]'
:
''
'ClientSearch[keyword]'
:
''
,
'ReimbursementSearch[filter]'
:
'all'
},
},
reimType
:
'default'
,
// reimTypeArray: [],
// reimTypeArray: [],
pagenation
:
{
pagenation
:
{
thispage
:
1
,
thispage
:
1
,
...
@@ -167,6 +167,22 @@ export default {
...
@@ -167,6 +167,22 @@ export default {
this
.
getFilter
()
this
.
getFilter
()
},
},
_reload
()
{
let
params
=
this
.
setParams
({
...
this
.
form
,
page
:
this
.
pagenation
.
thispage
},
{})
this
.
getList
(
params
)
},
reimTypeChange
(
val
)
{
let
params
=
this
.
setParams
({
...
this
.
form
,
page
:
this
.
pagenation
.
thispage
},
{
navCount
:
this
.
reimType
})
this
.
getList
(
params
)
},
timeSearchForm
(
search
)
{
timeSearchForm
(
search
)
{
let
params
=
this
.
setParams
({
let
params
=
this
.
setParams
({
...
this
.
form
,
...
this
.
form
,
...
@@ -192,8 +208,11 @@ export default {
...
@@ -192,8 +208,11 @@ export default {
},
},
updatePage
(
pager
)
{
updatePage
(
pager
)
{
Object
.
assign
(
this
.
pagenation
,
pager
)
let
ret
=
this
.
setParams
({
this
.
getList
()
...
this
.
form
,
page
:
this
.
pagenation
.
thispage
},
{
page
:
pager
.
thispage
})
this
.
getList
(
ret
)
},
},
getFilter
()
{
getFilter
()
{
...
@@ -230,8 +249,9 @@ export default {
...
@@ -230,8 +249,9 @@ export default {
cancelButtonText
:
'取消'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
type
:
'warning'
}).
then
(()
=>
{
}).
then
(()
=>
{
requestAPI
(
api
.
delete
Schedule
,
{
id
})
requestAPI
(
api
.
delete
Reim
,
{
id
})
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
this
.
_reload
()
this
.
$message
.
success
(
'删除成功'
)
this
.
$message
.
success
(
'删除成功'
)
})
})
}).
catch
(()
=>
{
}).
catch
(()
=>
{
...
...
src/lib/commonMixin.js
View file @
9c5d4ced
// request
// request
export
{
requestAPI
,
requestWithJsonAPI
}
from
'../ajax'
export
{
requestAPI
,
requestWithJsonAPI
}
from
'../ajax'
export
{
requestOAPI
}
from
'./request'
export
{
requestJanusAPI
}
from
'../ajax-janus'
export
{
requestJanusAPI
}
from
'../ajax-janus'
export
{
default
as
api
}
from
'@/api'
export
{
default
as
api
}
from
'@/api'
export
{
default
as
UTIL
}
from
'./util'
export
{
default
as
UTIL
}
from
'./util'
src/lib/request.js
View file @
9c5d4ced
import
api
from
'../api'
import
api
from
'../api
_old
'
import
$
from
'jquery'
import
$
from
'jquery'
import
Cookie
from
'browser-cookie'
//
import Cookie from 'browser-cookie'
let
globalOpt
=
api
.
option
let
globalOpt
=
api
.
option
const
SESSION_EXPIRED_CODE
=
globalOpt
.
sessionExpiredCode
const
SESSION_EXPIRED_CODE
=
globalOpt
.
sessionExpiredCode
const
SUCCESS_CODE
=
200
const
SUCCESS_CODE
=
200
0
const
HTTP_PROTOCOL
=
/^http
[
s
]?
:
\/\/
/
const
HTTP_PROTOCOL
=
/^http
[
s
]?
:
\/\/
/
// const usingJSONP = false
const
usingJSONP
=
process
.
env
.
NODE_ENV
!==
'production'
function
normalizeUrl
(
url
,
query
,
option
)
{
function
normalizeUrl
(
url
,
query
,
option
)
{
if
(
HTTP_PROTOCOL
.
test
(
url
))
return
url
if
(
HTTP_PROTOCOL
.
test
(
url
))
return
url
...
@@ -23,7 +24,6 @@ function normalizeUrl (url, query, option) {
...
@@ -23,7 +24,6 @@ function normalizeUrl (url, query, option) {
fullUrl
+=
url
fullUrl
+=
url
if
(
Object
.
keys
(
query
).
length
>
0
)
{
if
(
Object
.
keys
(
query
).
length
>
0
)
{
fullUrl
+=
'?'
+
$
.
param
(
query
)
fullUrl
+=
'?'
+
$
.
param
(
query
)
console
.
log
(
fullUrl
)
}
}
return
fullUrl
return
fullUrl
...
@@ -32,6 +32,7 @@ function normalizeUrl (url, query, option) {
...
@@ -32,6 +32,7 @@ function normalizeUrl (url, query, option) {
function
mergeAjaxOption
(...
options
)
{
function
mergeAjaxOption
(...
options
)
{
let
option1
=
options
.
shift
()
let
option1
=
options
.
shift
()
let
option2
=
options
.
shift
()
let
option2
=
options
.
shift
()
console
.
log
(
option1
,
option2
)
let
query
=
{...
option1
.
query
,
...
option2
.
query
}
let
query
=
{...
option1
.
query
,
...
option2
.
query
}
let
data
=
{...
option1
.
data
,
...
option2
.
data
}
let
data
=
{...
option1
.
data
,
...
option2
.
data
}
let
headers
=
{...
option1
.
headers
,
...
option2
.
headers
}
let
headers
=
{...
option1
.
headers
,
...
option2
.
headers
}
...
@@ -62,13 +63,13 @@ export function request (option) {
...
@@ -62,13 +63,13 @@ export function request (option) {
resolve
(
res
.
result
)
resolve
(
res
.
result
)
}
else
{
}
else
{
// 如果不执行 reject,可能加载中动画不被关闭
// 如果不执行 reject,可能加载中动画不被关闭
reject
(
res
.
result
,
xhr
,
null
)
reject
(
res
,
xhr
,
null
)
if
(
res
.
msg
)
{
if
(
res
.
msg
)
{
// 先让界面变化
// 先让界面变化
setTimeout
(
function
()
{
//
setTimeout(function () {
window
.
alert
(
res
.
msg
)
//
window.alert(res.msg)
},
300
)
//
}, 300)
}
}
}
}
},
function
(
xhr
,
status
,
error
)
{
},
function
(
xhr
,
status
,
error
)
{
...
@@ -93,13 +94,13 @@ export function request (option) {
...
@@ -93,13 +94,13 @@ export function request (option) {
})
})
}
}
function
getTokenFromCookie
()
{
//
function getTokenFromCookie () {
let
cookie
=
new
Cookie
()
//
let cookie = new Cookie()
return
cookie
.
get
(
'vup_token'
)
//
return cookie.get('vup_token')
}
//
}
let
isSessionExpired
=
false
let
isSessionExpired
=
false
export
function
requestAPI
(
api
,
option
=
{})
{
export
function
request
O
API
(
api
,
option
=
{})
{
// 第一个请求会放过期提示用户登录后,避免之后的其他请求再次弹消息
// 第一个请求会放过期提示用户登录后,避免之后的其他请求再次弹消息
if
(
isSessionExpired
)
{
if
(
isSessionExpired
)
{
window
.
location
.
href
=
globalOpt
.
loginUrl
window
.
location
.
href
=
globalOpt
.
loginUrl
...
@@ -107,7 +108,13 @@ export function requestAPI (api, option = {}) {
...
@@ -107,7 +108,13 @@ export function requestAPI (api, option = {}) {
resolve
({})
resolve
({})
})
})
}
}
let
setUrlK
=
(
ojson
)
=>
{
let
params
=
''
Object
.
keys
(
ojson
).
forEach
(
item
=>
{
params
+=
'&'
+
encodeURIComponent
(
item
)
+
'='
+
ojson
[
item
]
})
return
params
}
// merge option
// merge option
let
ajaxOption
=
mergeAjaxOption
(
let
ajaxOption
=
mergeAjaxOption
(
globalOpt
.
ajax
,
// global
globalOpt
.
ajax
,
// global
...
@@ -116,11 +123,17 @@ export function requestAPI (api, option = {}) {
...
@@ -116,11 +123,17 @@ export function requestAPI (api, option = {}) {
)
)
ajaxOption
.
url
=
normalizeUrl
(
ajaxOption
.
url
,
ajaxOption
.
query
,
globalOpt
)
ajaxOption
.
url
=
normalizeUrl
(
ajaxOption
.
url
,
ajaxOption
.
query
,
globalOpt
)
delete
ajaxOption
.
query
delete
ajaxOption
.
query
if
(
usingJSONP
)
{
ajaxOption
.
url
=
ajaxOption
.
url
+
ajaxOption
.
getQuery
if
(
ajaxOption
.
data
)
{
ajaxOption
.
url
+=
setUrlK
(
ajaxOption
.
data
)
delete
ajaxOption
.
data
}
}
// ajaxOption.contentType = 'application/json'
// ajaxOption.contentType = 'application/json'
// ajaxOption.dataType = 'json'
// ajaxOption.dataType = 'json'
// ajaxOption.data = JSON.stringify(ajaxOption.data)
// ajaxOption.data = JSON.stringify(ajaxOption.data)
ajaxOption
.
data
=
{
data
:
JSON
.
stringify
(
ajaxOption
.
data
)}
//
ajaxOption.data = {data: JSON.stringify(ajaxOption.data)}
// stringify object member of data
// stringify object member of data
let
data
=
ajaxOption
.
data
let
data
=
ajaxOption
.
data
...
@@ -132,20 +145,20 @@ export function requestAPI (api, option = {}) {
...
@@ -132,20 +145,20 @@ export function requestAPI (api, option = {}) {
}
}
// check is session expired
// check is session expired
let
token
=
getTokenFromCookie
()
//
let token = getTokenFromCookie()
if
(
!
token
&&
process
.
env
.
NODE_ENV
===
'production'
)
{
//
if (!token && process.env.NODE_ENV === 'production') {
console
.
info
(
'token expired'
)
//
console.info('token expired')
isSessionExpired
=
true
//
isSessionExpired = true
window
.
alert
(
'登录超时,请重新登录!'
)
//
window.alert('登录超时,请重新登录!')
window
.
location
.
href
=
globalOpt
.
loginUrl
//
window.location.href = globalOpt.loginUrl
return
new
Promise
(
function
(
resolve
,
reject
)
{
//
return new Promise(function (resolve, reject) {
resolve
({})
//
resolve({})
})
//
})
}
//
}
// append token to header
// append token to header
let
headers
=
ajaxOption
.
headers
||
(
ajaxOption
.
headers
=
{})
//
let headers = ajaxOption.headers || (ajaxOption.headers = {})
headers
[
'X-Token'
]
=
token
//
headers['X-Token'] = token
return
request
(
ajaxOption
)
return
request
(
ajaxOption
)
}
}
src/lib/viewHelper.js
View file @
9c5d4ced
...
@@ -21,15 +21,22 @@ export function removeEmptyMemberArray (arr) {
...
@@ -21,15 +21,22 @@ export function removeEmptyMemberArray (arr) {
})
})
return
newArr
return
newArr
}
}
export
let
setModule
=
(
obj
,
key
)
=>
{
export
let
setModule
=
(
obj
,
key
,
options
)
=>
{
let
ob
=
{}
let
ob
=
{}
console
.
log
(
options
)
Object
.
keys
(
obj
).
forEach
((
item
)
=>
{
Object
.
keys
(
obj
).
forEach
((
item
)
=>
{
if
(
Array
.
isArray
(
obj
[
item
]))
{
if
(
Array
.
isArray
(
obj
[
item
]))
{
obj
[
item
].
forEach
(
arr
=>
{
let
opt
=
options
&&
options
.
find
(
i
=>
key
+
'['
+
item
+
']'
===
i
.
key
)
if
(
arr
.
key
===
'new'
)
{
console
.
log
(
opt
)
ob
[
key
+
'['
+
item
+
']['
+
arr
.
key
+
'][]'
]
=
arr
.
name
obj
[
item
].
forEach
((
arr
,
index
)
=>
{
if
(
arr
.
key
)
{
if
(
arr
.
key
===
'new'
)
{
ob
[
key
+
'['
+
item
+
']['
+
arr
.
key
+
'][]'
]
=
arr
.
name
}
else
{
ob
[
key
+
'['
+
item
+
']['
+
arr
.
key
+
']'
]
=
arr
.
name
}
}
else
{
}
else
{
ob
[
key
+
'['
+
item
+
']['
+
arr
.
key
+
']'
]
=
arr
.
name
ob
[
key
+
'['
+
item
+
']['
+
index
+
']'
]
=
arr
}
}
})
})
}
else
{
}
else
{
...
...
src/route.js
View file @
9c5d4ced
...
@@ -2,13 +2,17 @@ import portal from 'vis-portal'
...
@@ -2,13 +2,17 @@ import portal from 'vis-portal'
import
ScheduleRoute
from
'./routes/schedule'
import
ScheduleRoute
from
'./routes/schedule'
import
ReimbursementRoute
from
'./routes/reimbursement'
import
ReimbursementRoute
from
'./routes/reimbursement'
import
TaskRoute
from
'./routes/task'
let
routes
=
[]
let
routes
=
[]
let
reimRoutes
=
[]
let
reimRoutes
=
[]
let
taskRoutes
=
[]
const
appName
=
'schedule'
const
appName
=
'schedule'
routes
=
[].
concat
(
ScheduleRoute
)
routes
=
[].
concat
(
ScheduleRoute
)
reimRoutes
=
[].
concat
(
ReimbursementRoute
)
reimRoutes
=
[].
concat
(
ReimbursementRoute
)
taskRoutes
=
[].
concat
(
TaskRoute
)
let
RouterInit
=
()
=>
{
let
RouterInit
=
()
=>
{
portal
.
createApp
(
appName
,
{},
app
=>
{
portal
.
createApp
(
appName
,
{},
app
=>
{
...
@@ -17,6 +21,9 @@ let RouterInit = () => {
...
@@ -17,6 +21,9 @@ let RouterInit = () => {
portal
.
createApp
(
'reimbursement'
,
{},
app
=>
{
portal
.
createApp
(
'reimbursement'
,
{},
app
=>
{
app
.
mapRoute
(
reimRoutes
)
app
.
mapRoute
(
reimRoutes
)
})
})
portal
.
createApp
(
'task'
,
{},
app
=>
{
app
.
mapRoute
(
taskRoutes
)
})
// portal.createApp('client', {}, app => {
// portal.createApp('client', {}, app => {
// app.mapRoute([
// app.mapRoute([
// {
// {
...
...
src/routes/reimbursement.js
View file @
9c5d4ced
import
ReimbursementHome
from
'../components/reimbursement_list/reimbursementHome'
import
ReimbursementHome
from
'../components/reimbursement_list/reimbursementHome'
const
routes
=
[{
const
routes
=
[{
path
:
'/reimbursement
Home
'
,
path
:
'/reimbursement'
,
name
:
'reimbursementHome'
,
name
:
'reimbursementHome'
,
component
:
ReimbursementHome
component
:
ReimbursementHome
}]
}]
...
...
src/routes/schedule.js
View file @
9c5d4ced
import
ScheduleHome
from
'../components/schedule_list/scheduleHome'
import
ScheduleHome
from
'../components/schedule_list/scheduleHome'
import
ScheduleView
from
'../components/common/scheduleView'
import
ScheduleView
from
'../components/common/scheduleView'
const
routes
=
[{
const
routes
=
[{
path
:
'/schedule
Home
'
,
path
:
'/schedule'
,
name
:
'scheduleHome'
,
name
:
'scheduleHome'
,
component
:
ScheduleHome
component
:
ScheduleHome
},
{
},
{
path
:
'/
scheduleView
/:id'
,
path
:
'/
ofClient
/:id'
,
name
:
'scheduleView'
,
name
:
'scheduleView'
,
component
:
ScheduleView
component
:
ScheduleView
}]
}]
...
...
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