Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
W
work-log
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
高宇
work-log
Commits
00f2d362
Commit
00f2d362
authored
Apr 29, 2019
by
高宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成日程管理;
parent
ef160a3d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
140 additions
and
45 deletions
+140
-45
addCalendar.vue
src/components/calendar/calendar/addCalendar.vue
+24
-3
editCalendar.vue
src/components/calendar/calendar/editCalendar.vue
+47
-1
operationCalendar.vue
src/components/calendar/calendar/operationCalendar.vue
+16
-1
fullCalendarGrid.vue
src/components/calendar/fullCalendarGrid.vue
+31
-20
fullCalendarLine.vue
src/components/calendar/fullCalendarLine.vue
+3
-10
list.vue
src/components/calendar/list.vue
+19
-10
No files found.
src/components/calendar/calendar/addCalendar.vue
View file @
00f2d362
...
@@ -14,6 +14,11 @@
...
@@ -14,6 +14,11 @@
<
script
>
<
script
>
import
operationCalendar
from
'./operationCalendar'
import
operationCalendar
from
'./operationCalendar'
import
{
requestAPI
,
api
}
from
'@/lib/commonMixin'
import
{
setModule
}
from
'../../../lib/viewHelper'
export
default
{
export
default
{
name
:
''
,
name
:
''
,
components
:
{
components
:
{
...
@@ -25,11 +30,27 @@
...
@@ -25,11 +30,27 @@
}
}
},
},
methods
:
{
methods
:
{
init
()
{
init
(
info
,
type
)
{
this
.
$refs
.
operationCalendar
.
initAdd
()
this
.
$refs
.
operationCalendar
.
initAdd
(
info
,
type
)
},
},
saveCalendar
()
{
saveCalendar
()
{
console
.
log
(
this
.
$refs
.
operationCalendar
.
getForm
())
let
from
=
this
.
$refs
.
operationCalendar
.
getForm
()
let
subData
=
setModule
(
from
.
Calendars
,
'Calendars'
)
requestAPI
(
api
.
saveCalendarAdd
,
{
data
:
{...
subData
}
}).
then
(
res
=>
{
this
.
$message
({
message
:
'保存成功!'
,
type
:
'success'
})
this
.
close
(
true
)
},
error
=>
{
error
.
msg
.
forEach
(
item
=>
{
this
.
$set
(
this
.
errorData
,
item
.
name
,
item
.
error
)
})
}).
finally
(()
=>
{
this
.
close
(
true
,
from
.
Calendars
)
})
},
},
close
(
getList
)
{
close
(
getList
)
{
this
.
$emit
(
'close'
,
getList
)
this
.
$emit
(
'close'
,
getList
)
...
...
src/components/calendar/calendar/editCalendar.vue
View file @
00f2d362
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
<span
slot=
"operationBtn"
>
<span
slot=
"operationBtn"
>
<el-button
type=
"primary"
@
click=
"saveCalendar"
size=
"mini"
>
保存
</el-button>
<el-button
type=
"primary"
@
click=
"saveCalendar"
size=
"mini"
>
保存
</el-button>
<el-button
@
click=
"close()"
size=
"mini"
>
关闭
</el-button>
<el-button
@
click=
"close()"
size=
"mini"
>
关闭
</el-button>
<el-button
@
click=
"deleteCalendar()"
size=
"mini"
type=
"danger"
>
删除
</el-button>
</span>
</span>
</operation-calendar>
</operation-calendar>
</section>
</section>
...
@@ -14,6 +15,11 @@
...
@@ -14,6 +15,11 @@
<
script
>
<
script
>
import
operationCalendar
from
'./operationCalendar'
import
operationCalendar
from
'./operationCalendar'
import
{
requestAPI
,
api
}
from
'@/lib/commonMixin'
import
{
setModule
}
from
'../../../lib/viewHelper'
export
default
{
export
default
{
name
:
''
,
name
:
''
,
components
:
{
components
:
{
...
@@ -21,15 +27,55 @@
...
@@ -21,15 +27,55 @@
},
},
data
()
{
data
()
{
return
{
return
{
id
:
''
,
errorData
:
{}
errorData
:
{}
}
}
},
},
methods
:
{
methods
:
{
init
(
id
)
{
init
(
id
)
{
this
.
id
=
id
this
.
$refs
.
operationCalendar
.
initEdit
(
id
)
this
.
$refs
.
operationCalendar
.
initEdit
(
id
)
},
},
deleteCalendar
()
{
this
.
$confirm
(
'确认删除吗?'
,
'提示'
).
then
(()
=>
{
requestAPI
(
api
.
delCalendar
,
{
data
:
{
id
:
this
.
id
}
}).
then
(()
=>
{
this
.
$message
(
'删除成功!'
)
this
.
close
(
true
)
},
error
=>
{
if
(
Array
.
isArray
(
error
.
msg
))
{
error
.
msg
.
forEach
(
item
=>
{
this
.
$notify
.
error
({
title
:
'错误'
,
message
:
item
.
error
})
})
}
})
}).
catch
(
_
=>
{
})
},
saveCalendar
()
{
saveCalendar
()
{
console
.
log
(
this
.
$refs
.
operationCalendar
.
getForm
())
let
from
=
this
.
$refs
.
operationCalendar
.
getForm
()
let
subData
=
setModule
(
from
.
Calendars
,
'Calendars'
)
requestAPI
(
api
.
saveCalendarEdit
,
{
data
:
{...
subData
}
}).
then
(
res
=>
{
this
.
$message
({
message
:
'保存成功!'
,
type
:
'success'
})
this
.
close
(
true
)
},
error
=>
{
error
.
msg
.
forEach
(
item
=>
{
this
.
$set
(
this
.
errorData
,
item
.
name
,
item
.
error
)
})
}).
finally
(()
=>
{
this
.
close
(
true
,
from
.
Calendars
)
})
},
},
close
(
getList
)
{
close
(
getList
)
{
this
.
$emit
(
'close'
,
getList
)
this
.
$emit
(
'close'
,
getList
)
...
...
src/components/calendar/calendar/operationCalendar.vue
View file @
00f2d362
...
@@ -102,6 +102,13 @@
...
@@ -102,6 +102,13 @@
import
singleSelect
from
'../../common/singleSelect'
import
singleSelect
from
'../../common/singleSelect'
import
singleRadio
from
'../../common/singleRadio'
import
singleRadio
from
'../../common/singleRadio'
let
dateFormatter
=
(
time
)
=>
{
time
=
time
||
''
const
date
=
new
Date
(
time
)
const
month
=
(
date
.
getMonth
()
+
1
).
toString
().
padStart
(
2
,
'0'
)
const
strDate
=
date
.
getDate
().
toString
().
padStart
(
2
,
'0'
)
return
`
${
date
.
getFullYear
()}
-
${
month
}
-
${
strDate
}
`
}
export
default
{
export
default
{
name
:
''
,
name
:
''
,
components
:
{
components
:
{
...
@@ -152,7 +159,15 @@
...
@@ -152,7 +159,15 @@
getForm
()
{
getForm
()
{
return
{
Calendars
:
this
.
Calendars
}
return
{
Calendars
:
this
.
Calendars
}
},
},
initAdd
()
{
initAdd
(
info
,
type
)
{
// this.Calendars.start_at = ''
if
(
type
===
'dayGridMonth'
)
{
this
.
Calendars
.
start_at
=
info
.
startStr
+
' 00:00:00'
this
.
Calendars
.
end_at
=
dateFormatter
(
new
Date
(
info
.
endStr
).
getTime
()
-
1000
*
60
*
60
*
24
)
+
' 23:59:59'
}
else
{
this
.
Calendars
.
start_at
=
info
.
startStr
this
.
Calendars
.
end_at
=
info
.
endStr
}
requestAPI
(
api
.
getCalendarNewOptions
).
then
(
res
=>
{
requestAPI
(
api
.
getCalendarNewOptions
).
then
(
res
=>
{
Object
.
keys
(
this
.
options
).
forEach
(
item
=>
{
Object
.
keys
(
this
.
options
).
forEach
(
item
=>
{
this
.
options
[
item
]
=
res
.
options
[
item
]
this
.
options
[
item
]
=
res
.
options
[
item
]
...
...
src/components/calendar/fullCalendarGrid.vue
View file @
00f2d362
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
<FullCalendar
<FullCalendar
class=
'demo-app-calendar'
class=
'demo-app-calendar'
ref=
"fullCalendar"
ref=
"fullCalendar"
first-day=
"1"
slotDuration=
"00:30:00"
:header=
"
{
:header=
"
{
left: 'prev,next today',
left: 'prev,next today',
center: 'title',
center: 'title',
...
@@ -26,9 +28,8 @@
...
@@ -26,9 +28,8 @@
scheduler-license-key="GPL-My-Project-Is-Open-Source"
scheduler-license-key="GPL-My-Project-Is-Open-Source"
next-day-threshold="00:00:00"
next-day-threshold="00:00:00"
@select="selectDate"
@select="selectDate"
@dateClick="handleDateClick"
@eventRender="eventRender"
@eventRender="eventRender"
@event
MouseEnter="eventMouseEnter
"
@event
DragStop="eventDragStop
"
@eventClick="eventClick"
@eventClick="eventClick"
@datesRender="datesRender"
@datesRender="datesRender"
/>
/>
...
@@ -72,6 +73,12 @@
...
@@ -72,6 +73,12 @@
}
}
},
},
methods
:
{
methods
:
{
eventDragStop
()
{
console
.
log
(
arguments
)
},
mouseenter
()
{
console
.
log
(
arguments
)
},
addNewCalendar
()
{
addNewCalendar
()
{
},
},
resetForm
()
{
resetForm
()
{
...
@@ -89,13 +96,12 @@
...
@@ -89,13 +96,12 @@
},
},
eventMouseEnter
(
info
)
{
eventMouseEnter
(
info
)
{
// $(info.el)
// $(info.el)
console
.
log
(
info
)
},
},
datesRender
(
info
)
{
datesRender
(
info
)
{
console
.
log
(
info
)
$
(
'[data-toggle="tooltip"]'
).
tooltip
()
$
(
'[data-toggle="tooltip"]'
).
tooltip
()
},
},
eventRender
(
info
)
{
eventRender
(
info
)
{
console
.
log
(
info
)
// info.el = $('el-tooltip')
// info.el = $('el-tooltip')
info
.
el
.
setAttribute
(
'data-id'
,
info
.
event
.
id
)
info
.
el
.
setAttribute
(
'data-id'
,
info
.
event
.
id
)
info
.
el
.
setAttribute
(
'data-model'
,
info
.
event
.
extendedProps
.
nonstandard
.
model
)
info
.
el
.
setAttribute
(
'data-model'
,
info
.
event
.
extendedProps
.
nonstandard
.
model
)
...
@@ -109,22 +115,20 @@
...
@@ -109,22 +115,20 @@
// console.log($(info.el))
// console.log($(info.el))
},
},
selectDate
(
info
)
{
selectDate
(
info
)
{
console
.
log
(
info
)
// console.log(this.$refs.fullCalendar.getApi().view.type)
info
.
jsEvent
.
preventDefault
()
// info.jsEvent.preventDefault()
info
.
jsEvent
.
stopPropagation
()
info
.
jsEvent
.
cancelBubble
=
true
this
.
$message
({
this
.
$message
({
message
:
'添加'
message
:
'添加'
})
})
this
.
$emit
(
'update:add'
,
info
)
this
.
$emit
(
'update:add'
,
info
,
this
.
$refs
.
fullCalendar
.
getApi
().
view
.
type
)
},
handleDateClick
(
info
)
{
info
.
jsEvent
.
preventDefault
()
this
.
$message
({
message
:
'添加'
})
this
.
$emit
(
'update:add'
,
info
)
},
},
// handleDateClick (info) {
// // info.jsEvent.preventDefault()
// this.$message({
// message: '添加'
// })
// this.$emit('update:add', info)
// },
eventClick
(
info
)
{
eventClick
(
info
)
{
info
.
jsEvent
.
preventDefault
()
info
.
jsEvent
.
preventDefault
()
this
.
$message
({
this
.
$message
({
...
@@ -133,7 +137,6 @@
...
@@ -133,7 +137,6 @@
this
.
$emit
(
'update:edit'
,
info
)
this
.
$emit
(
'update:edit'
,
info
)
},
},
calendarEvents
(
info
,
successCallback
,
failureCallback
)
{
calendarEvents
(
info
,
successCallback
,
failureCallback
)
{
console
.
log
(
info
)
let
ids
=
{}
let
ids
=
{}
if
(
this
.
userId
)
{
if
(
this
.
userId
)
{
ids
.
user_id
=
this
.
userId
ids
.
user_id
=
this
.
userId
...
@@ -152,16 +155,24 @@
...
@@ -152,16 +155,24 @@
successCallback
(
res
.
event
)
successCallback
(
res
.
event
)
this
.
defaultDate
=
res
.
defaultDate
this
.
defaultDate
=
res
.
defaultDate
}).
catch
(
_
=>
{
}).
catch
(
_
=>
{
}).
finally
(()
=>
{
$
(
'[data-toggle="tooltip"]'
).
tooltip
()
})
})
},
updateDate
()
{
this
.
$refs
.
fullCalendar
.
getApi
().
refetchEvents
()
}
}
},
},
created
()
{
created
()
{
// this.getFilter()
console
.
log
(
this
.
$refs
.
fullCalendar
)
},
},
mounted
()
{
mounted
()
{
},
},
props
:
[
'userId'
,
'departmentId'
]
props
:
[
'userId'
,
'departmentId'
],
watch
:
{
'userId'
(
val
)
{
this
.
$refs
.
fullCalendar
.
getApi
().
refetchEvents
()
}
}
}
}
</
script
>
</
script
>
...
...
src/components/calendar/fullCalendarLine.vue
View file @
00f2d362
...
@@ -41,7 +41,6 @@
...
@@ -41,7 +41,6 @@
scheduler-license-key="GPL-My-Project-Is-Open-Source"
scheduler-license-key="GPL-My-Project-Is-Open-Source"
next-day-threshold="00:00:00"
next-day-threshold="00:00:00"
@eventRender="eventRender"
@eventRender="eventRender"
@dateClick="handleDateClick"
@eventClick="eventClick"
@eventClick="eventClick"
@datesRender="datesRender"
@datesRender="datesRender"
@select="selectTime"
@select="selectTime"
...
@@ -127,15 +126,6 @@
...
@@ -127,15 +126,6 @@
$
(
info
.
el
).
find
(
'.fc-sticky'
).
removeAttr
(
'style'
)
$
(
info
.
el
).
find
(
'.fc-sticky'
).
removeAttr
(
'style'
)
})
})
},
},
handleDateClick
(
info
)
{
console
.
log
(
info
)
info
.
jsEvent
.
preventDefault
()
this
.
$message
({
message
:
'添加'
})
$
(
'.fc-sticky'
).
removeAttr
(
'style'
)
this
.
$emit
(
'update:add'
,
info
)
},
selectTime
(
info
)
{
selectTime
(
info
)
{
info
.
jsEvent
.
preventDefault
()
info
.
jsEvent
.
preventDefault
()
this
.
$message
({
this
.
$message
({
...
@@ -174,6 +164,9 @@
...
@@ -174,6 +164,9 @@
}).
finally
(()
=>
{
}).
finally
(()
=>
{
$
(
'[data-toggle="tooltip"]'
).
tooltip
()
$
(
'[data-toggle="tooltip"]'
).
tooltip
()
})
})
},
updateDate
()
{
this
.
$refs
.
fullCalendar
.
getApi
().
refetchEvents
()
}
}
},
},
created
()
{
created
()
{
...
...
src/components/calendar/list.vue
View file @
00f2d362
...
@@ -52,17 +52,17 @@
...
@@ -52,17 +52,17 @@
</Pagenation>
</Pagenation>
</
template
>
</
template
>
<
template
v-else
>
<
template
v-else
>
<component
:is=
"calendarPage"
ref=
"calendarRef"
<component
:is=
"calendarPage"
:
ref=
"calendarRef"
:user-id=
"form['CalendarSearch[created_by]']"
:user-id=
"form['CalendarSearch[created_by]']"
:department-id=
"form['CalendarSearch[department_id]']"
:department-id=
"form['CalendarSearch[department_id]']"
:resources=
"resources"
:resources=
"resources"
@
update:add=
"
info =>
{addItem(
)}"
@
update:add=
"
(info, type) =>
{addItem(info, type
)}"
@update:edit="
info => {editItem(info
)}">
</component>
@update:edit="
(info, type) => {editItem(info, type
)}">
</component>
</
template
>
</
template
>
</div>
</div>
</div>
</div>
<side-popup
ref=
"sidePopup"
:title=
"operationTitle"
v-click-outside=
"popupClose"
>
<side-popup
ref=
"sidePopup"
:title=
"operationTitle"
>
<component
:is=
"operationPage"
:ref=
"operationPage"
@
close=
"
getList
=> {close(getList)}"
></component>
<component
:is=
"operationPage"
:ref=
"operationPage"
@
close=
"
(getList)
=> {close(getList)}"
></component>
</side-popup>
</side-popup>
</section>
</section>
</template>
</template>
...
@@ -154,16 +154,21 @@
...
@@ -154,16 +154,21 @@
}).
catch
(
_
=>
{
}).
catch
(
_
=>
{
})
})
},
},
addItem
(
info
)
{
addItem
(
info
,
type
)
{
this
.
operationPage
=
'addCalendar'
this
.
operationPage
=
'addCalendar'
this
.
operationTitle
=
'添加日程'
this
.
operationTitle
=
'添加日程'
// this.$router.push({name: 'editProject', params: {id: row.id}})
// this.$router.push({name: 'editProject', params: {id: row.id}})
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
this
.
$refs
.
sidePopup
.
show
(
this
.
$refs
[
this
.
operationPage
].
init
())
this
.
$refs
.
sidePopup
.
show
(
this
.
$refs
[
this
.
operationPage
].
init
(
info
,
type
))
})
})
},
},
editItem
(
info
)
{
editItem
(
info
)
{
console
.
log
(
info
)
this
.
operationPage
=
'editCalendar'
this
.
operationTitle
=
'编辑日程'
// this.$router.push({name: 'editProject', params: {id: row.id}})
this
.
$nextTick
(()
=>
{
this
.
$refs
.
sidePopup
.
show
(
this
.
$refs
[
this
.
operationPage
].
init
(
info
.
event
.
id
))
})
},
},
addNewCalendar
()
{
addNewCalendar
()
{
this
.
operationPage
=
'addCalendar'
this
.
operationPage
=
'addCalendar'
...
@@ -201,8 +206,12 @@
...
@@ -201,8 +206,12 @@
},
},
close
(
getList
)
{
close
(
getList
)
{
this
.
$refs
.
sidePopup
.
close
()
this
.
$refs
.
sidePopup
.
close
()
if
(
getList
)
{
if
(
this
.
form
[
'Calendars[keyword]'
]
!==
''
)
{
this
.
getList
()
if
(
getList
)
{
this
.
getList
()
}
}
else
{
this
.
$refs
[
this
.
calendarRef
].
updateDate
()
}
}
},
},
popupClose
()
{
popupClose
()
{
...
...
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