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
Show 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 @@
<
script
>
import
operationCalendar
from
'./operationCalendar'
import
{
requestAPI
,
api
}
from
'@/lib/commonMixin'
import
{
setModule
}
from
'../../../lib/viewHelper'
export
default
{
name
:
''
,
components
:
{
...
...
@@ -25,11 +30,27 @@
}
},
methods
:
{
init
()
{
this
.
$refs
.
operationCalendar
.
initAdd
()
init
(
info
,
type
)
{
this
.
$refs
.
operationCalendar
.
initAdd
(
info
,
type
)
},
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
)
{
this
.
$emit
(
'close'
,
getList
)
...
...
src/components/calendar/calendar/editCalendar.vue
View file @
00f2d362
...
...
@@ -7,6 +7,7 @@
<span
slot=
"operationBtn"
>
<el-button
type=
"primary"
@
click=
"saveCalendar"
size=
"mini"
>
保存
</el-button>
<el-button
@
click=
"close()"
size=
"mini"
>
关闭
</el-button>
<el-button
@
click=
"deleteCalendar()"
size=
"mini"
type=
"danger"
>
删除
</el-button>
</span>
</operation-calendar>
</section>
...
...
@@ -14,6 +15,11 @@
<
script
>
import
operationCalendar
from
'./operationCalendar'
import
{
requestAPI
,
api
}
from
'@/lib/commonMixin'
import
{
setModule
}
from
'../../../lib/viewHelper'
export
default
{
name
:
''
,
components
:
{
...
...
@@ -21,15 +27,55 @@
},
data
()
{
return
{
id
:
''
,
errorData
:
{}
}
},
methods
:
{
init
(
id
)
{
this
.
id
=
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
()
{
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
)
{
this
.
$emit
(
'close'
,
getList
)
...
...
src/components/calendar/calendar/operationCalendar.vue
View file @
00f2d362
...
...
@@ -102,6 +102,13 @@
import
singleSelect
from
'../../common/singleSelect'
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
{
name
:
''
,
components
:
{
...
...
@@ -152,7 +159,15 @@
getForm
()
{
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
=>
{
Object
.
keys
(
this
.
options
).
forEach
(
item
=>
{
this
.
options
[
item
]
=
res
.
options
[
item
]
...
...
src/components/calendar/fullCalendarGrid.vue
View file @
00f2d362
...
...
@@ -3,6 +3,8 @@
<FullCalendar
class=
'demo-app-calendar'
ref=
"fullCalendar"
first-day=
"1"
slotDuration=
"00:30:00"
:header=
"
{
left: 'prev,next today',
center: 'title',
...
...
@@ -26,9 +28,8 @@
scheduler-license-key="GPL-My-Project-Is-Open-Source"
next-day-threshold="00:00:00"
@select="selectDate"
@dateClick="handleDateClick"
@eventRender="eventRender"
@event
MouseEnter="eventMouseEnter
"
@event
DragStop="eventDragStop
"
@eventClick="eventClick"
@datesRender="datesRender"
/>
...
...
@@ -72,6 +73,12 @@
}
},
methods
:
{
eventDragStop
()
{
console
.
log
(
arguments
)
},
mouseenter
()
{
console
.
log
(
arguments
)
},
addNewCalendar
()
{
},
resetForm
()
{
...
...
@@ -89,13 +96,12 @@
},
eventMouseEnter
(
info
)
{
// $(info.el)
console
.
log
(
info
)
},
datesRender
(
info
)
{
console
.
log
(
info
)
$
(
'[data-toggle="tooltip"]'
).
tooltip
()
},
eventRender
(
info
)
{
console
.
log
(
info
)
// info.el = $('el-tooltip')
info
.
el
.
setAttribute
(
'data-id'
,
info
.
event
.
id
)
info
.
el
.
setAttribute
(
'data-model'
,
info
.
event
.
extendedProps
.
nonstandard
.
model
)
...
...
@@ -109,22 +115,20 @@
// console.log($(info.el))
},
selectDate
(
info
)
{
console
.
log
(
info
)
info
.
jsEvent
.
preventDefault
()
info
.
jsEvent
.
stopPropagation
()
info
.
jsEvent
.
cancelBubble
=
true
this
.
$message
({
message
:
'添加'
})
this
.
$emit
(
'update:add'
,
info
)
},
handleDateClick
(
info
)
{
info
.
jsEvent
.
preventDefault
()
// console.log(this.$refs.fullCalendar.getApi().view.type)
// info.jsEvent.preventDefault()
this
.
$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)
// },
eventClick
(
info
)
{
info
.
jsEvent
.
preventDefault
()
this
.
$message
({
...
...
@@ -133,7 +137,6 @@
this
.
$emit
(
'update:edit'
,
info
)
},
calendarEvents
(
info
,
successCallback
,
failureCallback
)
{
console
.
log
(
info
)
let
ids
=
{}
if
(
this
.
userId
)
{
ids
.
user_id
=
this
.
userId
...
...
@@ -152,16 +155,24 @@
successCallback
(
res
.
event
)
this
.
defaultDate
=
res
.
defaultDate
}).
catch
(
_
=>
{
}).
finally
(()
=>
{
$
(
'[data-toggle="tooltip"]'
).
tooltip
()
})
},
updateDate
()
{
this
.
$refs
.
fullCalendar
.
getApi
().
refetchEvents
()
}
},
created
()
{
// this.getFilter()
console
.
log
(
this
.
$refs
.
fullCalendar
)
},
mounted
()
{
},
props
:
[
'userId'
,
'departmentId'
]
props
:
[
'userId'
,
'departmentId'
],
watch
:
{
'userId'
(
val
)
{
this
.
$refs
.
fullCalendar
.
getApi
().
refetchEvents
()
}
}
}
</
script
>
...
...
src/components/calendar/fullCalendarLine.vue
View file @
00f2d362
...
...
@@ -41,7 +41,6 @@
scheduler-license-key="GPL-My-Project-Is-Open-Source"
next-day-threshold="00:00:00"
@eventRender="eventRender"
@dateClick="handleDateClick"
@eventClick="eventClick"
@datesRender="datesRender"
@select="selectTime"
...
...
@@ -127,15 +126,6 @@
$
(
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
)
{
info
.
jsEvent
.
preventDefault
()
this
.
$message
({
...
...
@@ -174,6 +164,9 @@
}).
finally
(()
=>
{
$
(
'[data-toggle="tooltip"]'
).
tooltip
()
})
},
updateDate
()
{
this
.
$refs
.
fullCalendar
.
getApi
().
refetchEvents
()
}
},
created
()
{
...
...
src/components/calendar/list.vue
View file @
00f2d362
...
...
@@ -52,17 +52,17 @@
</Pagenation>
</
template
>
<
template
v-else
>
<component
:is=
"calendarPage"
ref=
"calendarRef"
<component
:is=
"calendarPage"
:
ref=
"calendarRef"
:user-id=
"form['CalendarSearch[created_by]']"
:department-id=
"form['CalendarSearch[department_id]']"
:resources=
"resources"
@
update:add=
"
info =>
{addItem(
)}"
@update:edit="
info => {editItem(info
)}">
</component>
@
update:add=
"
(info, type) =>
{addItem(info, type
)}"
@update:edit="
(info, type) => {editItem(info, type
)}">
</component>
</
template
>
</div>
</div>
<side-popup
ref=
"sidePopup"
:title=
"operationTitle"
v-click-outside=
"popupClose"
>
<component
:is=
"operationPage"
:ref=
"operationPage"
@
close=
"
getList
=> {close(getList)}"
></component>
<side-popup
ref=
"sidePopup"
:title=
"operationTitle"
>
<component
:is=
"operationPage"
:ref=
"operationPage"
@
close=
"
(getList)
=> {close(getList)}"
></component>
</side-popup>
</section>
</template>
...
...
@@ -154,16 +154,21 @@
}).
catch
(
_
=>
{
})
},
addItem
(
info
)
{
addItem
(
info
,
type
)
{
this
.
operationPage
=
'addCalendar'
this
.
operationTitle
=
'添加日程'
// this.$router.push({name: 'editProject', params: {id: row.id}})
this
.
$nextTick
(()
=>
{
this
.
$refs
.
sidePopup
.
show
(
this
.
$refs
[
this
.
operationPage
].
init
())
this
.
$refs
.
sidePopup
.
show
(
this
.
$refs
[
this
.
operationPage
].
init
(
info
,
type
))
})
},
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
()
{
this
.
operationPage
=
'addCalendar'
...
...
@@ -201,9 +206,13 @@
},
close
(
getList
)
{
this
.
$refs
.
sidePopup
.
close
()
if
(
this
.
form
[
'Calendars[keyword]'
]
!==
''
)
{
if
(
getList
)
{
this
.
getList
()
}
}
else
{
this
.
$refs
[
this
.
calendarRef
].
updateDate
()
}
},
popupClose
()
{
this
.
$refs
.
sidePopup
&&
...
...
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