Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
Z
zentao-view
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
zentao
zentao-view
Commits
7086b316
Commit
7086b316
authored
Mar 03, 2021
by
王鑫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 节假日模块优化
parent
0d1e3a08
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
41 deletions
+71
-41
HolidaysDetail.vue
src/views/holidays/HolidaysDetail.vue
+35
-30
HolidaysList.vue
src/views/holidays/HolidaysList.vue
+36
-11
No files found.
src/views/holidays/HolidaysDetail.vue
View file @
7086b316
...
@@ -12,12 +12,12 @@
...
@@ -12,12 +12,12 @@
<a-row>
<a-row>
<a-col
:span=
"12"
>
<a-col
:span=
"12"
>
<a-form-item
label=
'假期名称'
:labelCol=
"
{ span: 5 }" :wrapperCol="{ span: 17 }">
<a-form-item
label=
'假期名称'
:labelCol=
"
{ span: 5 }" :wrapperCol="{ span: 17 }">
<a-input
v-model=
"
submit
Info.name"
placeholder=
"双休日请输入星期六或星期日"
/>
<a-input
v-model=
"
detail
Info.name"
placeholder=
"双休日请输入星期六或星期日"
/>
</a-form-item>
</a-form-item>
</a-col>
</a-col>
<a-col
:span=
"12"
>
<a-col
:span=
"12"
>
<a-form-item
label=
'假期类型'
:labelCol=
"
{ span: 5 }" :wrapperCol="{ span: 17 }">
<a-form-item
label=
'假期类型'
:labelCol=
"
{ span: 5 }" :wrapperCol="{ span: 17 }">
<a-select
:d
efault-value=
"(holidayTypes[0]||
{}).valueInt
" @change="handleChange">
<a-select
:d
isabled=
"isEdit"
v-model=
"detailInfo.dayCode
"
@
change=
"handleChange"
>
<a-select-option
v-for=
"item in holidayTypes"
:value=
"item.valueInt"
:key=
"item.id"
>
<a-select-option
v-for=
"item in holidayTypes"
:value=
"item.valueInt"
:key=
"item.id"
>
{{
item
.
name
}}
{{
item
.
name
}}
</a-select-option>
</a-select-option>
...
@@ -28,16 +28,18 @@
...
@@ -28,16 +28,18 @@
<a-row>
<a-row>
<a-col
:span=
"12"
>
<a-col
:span=
"12"
>
<a-form-item
v-if=
"durationInput"
label=
'假期时间'
:labelCol=
"
{ span: 5 }" :wrapperCol="{ span: 17 }">
<a-form-item
v-if=
"durationInput"
label=
'假期时间'
:labelCol=
"
{ span: 5 }" :wrapperCol="{ span: 17 }">
<a-date-picker
style=
"width: 100%"
/>
<a-date-picker
:disabled-date=
"disabledDate"
v-if=
"isEdit"
v-model=
"dateTime"
style=
"width: 100%"
/>
<a-date-picker
:disabled-date=
"disabledDate"
v-else
style=
"width: 100%"
/>
</a-form-item>
</a-form-item>
<a-form-item
v-else
label=
'假期范围'
:labelCol=
"
{ span: 5 }" :wrapperCol="{ span: 17 }">
<a-form-item
v-else
label=
'假期范围'
:labelCol=
"
{ span: 5 }" :wrapperCol="{ span: 17 }">
<a-range-picker
@
change=
"onChange"
/>
<a-range-picker
:disabled-date=
"disabledDate"
v-if=
"isEdit"
v-model=
"dateRange"
@
change=
"onChange"
/>
<a-range-picker
:disabled-date=
"disabledDate"
v-else
@
change=
"onChange"
/>
</a-form-item>
</a-form-item>
</a-col>
</a-col>
<a-col
:span=
"12"
>
<a-col
:span=
"12"
>
<a-form-item
label=
'假期时长'
:labelCol=
"
{ span: 5 }" :wrapperCol="{ span: 17 }">
<a-form-item
label=
'假期时长'
:labelCol=
"
{ span: 5 }" :wrapperCol="{ span: 17 }">
<a-input
disabled=
"disabled"
v-model=
"
submit
Info.duration"
/>
<a-input
disabled=
"disabled"
v-model=
"
detail
Info.duration"
/>
</a-form-item>
</a-form-item>
</a-col>
</a-col>
</a-row>
</a-row>
...
@@ -47,57 +49,60 @@
...
@@ -47,57 +49,60 @@
<
script
>
<
script
>
import
{
addHoliday
}
from
"@api/holidays/holidays"
;
import
{
addHoliday
}
from
"@api/holidays/holidays"
;
import
moment
from
'moment'
;
export
default
{
export
default
{
name
:
'SysBusinessDetail'
,
name
:
'SysBusinessDetail'
,
props
:[
props
:[
'holidayTypes'
,
'holidayTypes'
,
'year'
'detailData'
,
'isEdit'
],
],
data
()
{
data
()
{
return
{
return
{
parentName
:
""
,
//父业务名称
visible
:
true
,
optType
:
0
,
sysBusiness
:{},
isChildBusiness
:
false
,
visible
:
false
,
modalTitle
:
"新建假期"
,
modalTitle
:
"新建假期"
,
modalWidth
:
800
,
modalWidth
:
800
,
durationInput
:
false
,
durationInput
:
this
.
detailData
.
dayCode
===
SYS_CONST
.
HOLIDAY_TYPE
.
WEEKEND
,
submitInfo
:{
detailInfo
:
this
.
detailData
,
name
:
""
,
dateRange
:
[
moment
(
this
.
detailData
.
startDate
),
moment
(
this
.
detailData
.
endDate
)],
dayCode
:
(
this
.
holidayTypes
[
0
]
||
{}).
valueInt
,
dateTime
:
moment
(
this
.
detailData
.
startDate
)
startDate
:
null
,
}
endDate
:
null
,
},
duration
:
0
,
watch
:{
year
:
this
.
year
detailData
(){
}
this
.
detailInfo
=
this
.
detailData
this
.
dateRange
=
[
moment
(
this
.
detailData
.
startDate
),
moment
(
this
.
detailData
.
endDate
)]
this
.
durationInput
=
this
.
detailData
.
dayCode
===
SYS_CONST
.
HOLIDAY_TYPE
.
WEEKEND
this
.
dateTime
=
moment
(
this
.
detailData
.
startDate
)
}
}
},
},
methods
:
{
methods
:
{
handleOk
()
{
handleOk
()
{
addHoliday
(
this
.
submit
Info
).
then
(
response
=>
{
addHoliday
(
this
.
detail
Info
).
then
(
response
=>
{
if
(
response
&&
response
.
code
==
SYS_CONST
.
REQUEST
.
SUCCEED
)
{
if
(
response
&&
response
.
code
==
SYS_CONST
.
REQUEST
.
SUCCEED
)
{
this
.
visible
=
false
;
this
.
visible
=
false
;
this
.
loadData
();
this
.
$emit
(
'flushData'
)
}
}
});
});
},
},
onChange
(
date
,
dateStr
)
{
onChange
(
date
,
dateStr
)
{
this
.
submit
Info
.
duration
=
date
[
1
].
diff
(
date
[
0
],
'day'
)
+
1
;
this
.
detail
Info
.
duration
=
date
[
1
].
diff
(
date
[
0
],
'day'
)
+
1
;
this
.
submit
Info
.
startDate
=
dateStr
[
0
];
this
.
detail
Info
.
startDate
=
dateStr
[
0
];
this
.
submit
Info
.
endDate
=
dateStr
[
1
];
this
.
detail
Info
.
endDate
=
dateStr
[
1
];
},
},
handleChange
(
value
)
{
handleChange
(
value
)
{
this
.
submit
Info
.
dayCode
=
value
this
.
detail
Info
.
dayCode
=
value
if
(
value
===
SYS_CONST
.
HOLIDAY_TYPE
.
WEEKEND
){
if
(
value
===
SYS_CONST
.
HOLIDAY_TYPE
.
WEEKEND
){
this
.
durationInput
=
true
this
.
durationInput
=
true
this
.
submit
Info
.
duration
=
1
this
.
detail
Info
.
duration
=
1
}
else
{
}
else
{
this
.
durationInput
=
false
this
.
durationInput
=
false
this
.
submit
Info
.
duration
=
0
this
.
detail
Info
.
duration
=
0
}
}
},
disabledDate
(
current
){
return
(
current
.
year
()
!==
this
.
detailData
.
year
)
}
}
}
}
,
}
}
</
script
>
</
script
>
\ No newline at end of file
src/views/holidays/HolidaysList.vue
View file @
7086b316
...
@@ -13,9 +13,9 @@
...
@@ -13,9 +13,9 @@
</a-select>
</a-select>
</a-form-item>
</a-form-item>
</a-col>
</a-col>
<a-col
:span=
"2"
:offset=
"1"
>
<a-col
:span=
"2"
>
<a-form-item>
<a-form-item>
<a-button
type=
"primary"
:loading=
"loading"
@
click=
"synchronization"
>
<a-button
type=
"primary"
:loading=
"loading"
@
click=
"synchronization"
style=
"margin-left: 15px"
>
同步
同步
</a-button>
</a-button>
</a-form-item>
</a-form-item>
...
@@ -52,7 +52,7 @@
...
@@ -52,7 +52,7 @@
{{
text
}}
天
{{
text
}}
天
<
/span
>
<
/span
>
<
span
slot
=
"action"
slot
-
scope
=
"text, record"
>
<
span
slot
=
"action"
slot
-
scope
=
"text, record"
>
<
a
>
编辑
<
/a
>
<
a
@
click
=
"editRecord(record)"
>
编辑
<
/a
>
<
a
-
divider
type
=
"vertical"
/>
<
a
-
divider
type
=
"vertical"
/>
<
a
-
popconfirm
<
a
-
popconfirm
v
-
if
=
"dataSource.length"
v
-
if
=
"dataSource.length"
...
@@ -83,7 +83,7 @@
...
@@ -83,7 +83,7 @@
:
showTotal
=
"$showTotal"
/>
:
showTotal
=
"$showTotal"
/>
<
/div
>
<
/div
>
<
/a-table
>
<
/a-table
>
<
holidays
-
detail
ref
=
"holidayDetail"
:
holidayTypes
=
"holidayTypes"
:
year
=
"query.year
"
><
/holidays-detail
>
<
holidays
-
detail
v
-
if
=
"isShow"
ref
=
"holidayDetail"
:
holidayTypes
=
"holidayTypes"
:
detailData
=
"detailData"
:
isEdit
=
"isEdit"
@
flushData
=
"flushData
"
><
/holidays-detail
>
<
/a-card
>
<
/a-card
>
<
/template
>
<
/template
>
<
script
>
<
script
>
...
@@ -120,7 +120,10 @@ export default {
...
@@ -120,7 +120,10 @@ export default {
tableLoading
:
false
,
tableLoading
:
false
,
isFirstLoad
:
true
,
isFirstLoad
:
true
,
rowKey
:
"id"
,
rowKey
:
"id"
,
total
:
0
total
:
0
,
detailData
:
{
}
,
isShow
:
false
,
isEdit
:
false
}
}
}
,
}
,
computed
:
{
computed
:
{
...
@@ -154,10 +157,10 @@ export default {
...
@@ -154,10 +157,10 @@ export default {
}
)
}
)
}
,
}
,
timestampToTime
(
timestamp
)
{
timestampToTime
(
timestamp
)
{
var
date
=
new
Date
(
timestamp
);
//时间戳为10位需*1000,时间戳为13位的话不需乘1000
let
date
=
new
Date
(
timestamp
);
//时间戳为10位需*1000,时间戳为13位的话不需乘1000
var
Y
=
date
.
getFullYear
()
+
'-'
;
let
Y
=
date
.
getFullYear
()
+
'-'
;
var
M
=
(
date
.
getMonth
()
+
1
<
10
?
'0'
+
(
date
.
getMonth
()
+
1
):
date
.
getMonth
()
+
1
)
+
'-'
;
let
M
=
(
date
.
getMonth
()
+
1
<
10
?
'0'
+
(
date
.
getMonth
()
+
1
):
date
.
getMonth
()
+
1
)
+
'-'
;
var
D
=
(
date
.
getDate
()
<
10
?
'0'
+
date
.
getDate
():
date
.
getDate
())
+
' '
;
let
D
=
(
date
.
getDate
()
<
10
?
'0'
+
date
.
getDate
():
date
.
getDate
())
+
' '
;
return
Y
+
M
+
D
;
return
Y
+
M
+
D
;
}
,
}
,
pageChange
(
page
)
{
pageChange
(
page
)
{
...
@@ -216,7 +219,6 @@ export default {
...
@@ -216,7 +219,6 @@ export default {
let
date
=
new
Date
();
let
date
=
new
Date
();
let
baseyear
=
2020
;
let
baseyear
=
2020
;
let
current
=
date
.
getFullYear
();
//获取完整的年份(4位)
let
current
=
date
.
getFullYear
();
//获取完整的年份(4位)
console
.
log
(
current
)
for
(
let
i
=
baseyear
;
i
<
(
current
+
2
);
i
++
){
for
(
let
i
=
baseyear
;
i
<
(
current
+
2
);
i
++
){
this
.
yearList
.
push
({
this
.
yearList
.
push
({
id
:
i
,
id
:
i
,
...
@@ -226,7 +228,30 @@ export default {
...
@@ -226,7 +228,30 @@ export default {
this
.
query
.
year
=
current
this
.
query
.
year
=
current
}
,
}
,
addNew
(){
addNew
(){
this
.
$refs
.
holidayDetail
.
visible
=
true
this
.
isEdit
=
false
this
.
detailData
=
{
year
:
this
.
query
.
year
,
name
:
""
,
duration
:
0
,
dayCode
:
SYS_CONST
.
HOLIDAY_TYPE
.
HOLIDAY
}
if
(
!
this
.
isShow
){
this
.
isShow
=
true
}
else
{
this
.
$refs
.
holidayDetail
.
visible
=
true
}
}
,
editRecord
(
record
){
this
.
detailData
=
record
this
.
isEdit
=
true
if
(
!
this
.
isShow
){
this
.
isShow
=
true
}
else
{
this
.
$refs
.
holidayDetail
.
visible
=
true
}
}
,
flushData
(){
this
.
loadData
()
}
}
}
,
}
,
mounted
()
{
mounted
()
{
...
...
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