Commit c0d448fa authored by 高宇's avatar 高宇

完成日程管理;

parent 00f2d362
...@@ -43,13 +43,13 @@ ...@@ -43,13 +43,13 @@
message: '保存成功!', message: '保存成功!',
type: 'success' type: 'success'
}) })
this.close(true) this.close(true, from.Calendars)
this.errorData = {}
this.$refs.operationCalendar.resetForm()
}, error => { }, error => {
error.msg.forEach(item => { error.msg.forEach(item => {
this.$set(this.errorData, item.name, item.error) this.$set(this.errorData, item.name, item.error)
}) })
}).finally(() => {
this.close(true, from.Calendars)
}) })
}, },
close (getList) { close (getList) {
......
...@@ -68,13 +68,13 @@ ...@@ -68,13 +68,13 @@
message: '保存成功!', message: '保存成功!',
type: 'success' type: 'success'
}) })
this.close(true) this.close(true, from.Calendars)
this.errorData = {}
this.$refs.operationCalendar.resetForm()
}, error => { }, error => {
error.msg.forEach(item => { error.msg.forEach(item => {
this.$set(this.errorData, item.name, item.error) this.$set(this.errorData, item.name, item.error)
}) })
}).finally(() => {
this.close(true, from.Calendars)
}) })
}, },
close (getList) { close (getList) {
......
...@@ -161,12 +161,14 @@ ...@@ -161,12 +161,14 @@
}, },
initAdd (info, type) { initAdd (info, type) {
// this.Calendars.start_at = '' // this.Calendars.start_at = ''
if (type === 'dayGridMonth') { if (info) {
this.Calendars.start_at = info.startStr + ' 00:00:00' if (type === 'dayGridMonth') {
this.Calendars.end_at = dateFormatter(new Date(info.endStr).getTime() - 1000 * 60 * 60 * 24) + ' 23:59:59' this.Calendars.start_at = info.startStr + ' 00:00:00'
} else { this.Calendars.end_at = dateFormatter(new Date(info.endStr).getTime() - 1000 * 60 * 60 * 24) + ' 23:59:59'
this.Calendars.start_at = info.startStr } else {
this.Calendars.end_at = info.endStr 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 => {
...@@ -190,6 +192,11 @@ ...@@ -190,6 +192,11 @@
this.options[item] = res.options[item] this.options[item] = res.options[item]
}) })
}) })
},
resetForm () {
Object.keys(this.Calendars).forEach(item => {
this.Calendars[item] = ''
})
} }
}, },
props: ['errorData'] props: ['errorData']
......
...@@ -176,7 +176,7 @@ ...@@ -176,7 +176,7 @@
} }
</script> </script>
<style scoped lang="sass"> <style lang="sass">
@import '~@fullcalendar/core/main.css'; @import '~@fullcalendar/core/main.css';
@import '~@fullcalendar/daygrid/main.css'; @import '~@fullcalendar/daygrid/main.css';
@import '~@fullcalendar/timegrid/main.css'; @import '~@fullcalendar/timegrid/main.css';
......
...@@ -177,7 +177,7 @@ ...@@ -177,7 +177,7 @@
</script> </script>
<style scoped lang="sass"> <style lang="sass">
@import '~@fullcalendar/core/main.css'; @import '~@fullcalendar/core/main.css';
@import '~@fullcalendar/daygrid/main.css'; @import '~@fullcalendar/daygrid/main.css';
@import '~@fullcalendar/timegrid/main.css'; @import '~@fullcalendar/timegrid/main.css';
......
...@@ -53,11 +53,11 @@ ...@@ -53,11 +53,11 @@
</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, type) => {addItem(info, type)}" @update:add="(info, type) => {addItem(info, type)}"
@update:edit="(info, type) => {editItem(info, type)}"></component> @update:edit="(info, type) => {editItem(info, type)}"></component>
</template> </template>
</div> </div>
</div> </div>
...@@ -82,6 +82,7 @@ ...@@ -82,6 +82,7 @@
requestAPI, requestAPI,
api api
} from '@/lib/commonMixin' } from '@/lib/commonMixin'
import $ from 'jquery'
export default { export default {
name: '', name: '',
...@@ -244,8 +245,30 @@ ...@@ -244,8 +245,30 @@
}).finally(_ => { }).finally(_ => {
this.loading = false this.loading = false
}) })
},
handleBodyClick (e) {
if (e.target.contains(document.getElementsByClassName('portal-content')[0])) {
// console.log('包含')
this.popupClose()
} else {
if ($(e.target).parents('.portal-content').length === 0) {
if ($(e.target).parents('.fc-view-container').length > 0) {
return
}
this.popupClose()
}
// console.log('不包含')
}
} }
}, },
mounted () {
this.$nextTick(() => {
document.querySelector('body').addEventListener('click', this.handleBodyClick)
})
},
beforeDestroy () {
document.querySelector('body').removeEventListener('click', this.handleBodyClick)
},
created () { created () {
this.getFilter() this.getFilter()
}, },
......
...@@ -120,7 +120,13 @@ export default { ...@@ -120,7 +120,13 @@ export default {
deep: true deep: true
}, },
'timeItem' (val) { 'timeItem' (val) {
this.$emit('update:item', val) let times = ''
if (val.indexOf('T')) {
times = val.split('+')[0].split('T').join(' ')
} else {
times = val
}
this.$emit('update:item', times)
}, },
'inputSelectItem' (val) { 'inputSelectItem' (val) {
this.$emit('update:inputSelect', val) this.$emit('update:inputSelect', val)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment