Commit fc911235 authored by gaochao's avatar gaochao

a

parent 6292ec46
<template>
<div class="calender">
<full-calendar :events="fcEvents" locale="en"></full-calendar>
</div>
</template>
<script>
import fullCalendar from 'vue-fullcalendar'
import request from '@/utils/request'
import _ from 'lodash'
import moment from 'moment'
export default {
name: 'calender',
// 继承其他组件
extends: {},
// 使用其它组件
components: {
'full-calendar': fullCalendar
},
props: {
schema: {
type: Object,
required: true
},
demoEvents: {
type: Object,
required: false
}
},
data() {
return {
fcEvents: []
}
},
computed: {
},
filters: {
},
created() {
this.getList()
},
methods: {
getList() {
const self = this
console.log(self.schema)
request(self.schema.modelUnderscorePlural).then(resp => {
// console.log(resp.data)
_.each(resp.data, function(item, index) {
const test = _.cloneDeep(self.demoEvents)
test.title = item[self.demoEvents.title]
test.start = moment(item[self.demoEvents.start]).format('YYYY-MM-DD')
test.end = moment(item[self.demoEvents.end]).format('YYYY-MM-DD')
self.fcEvents.push(test)
})
console.log(self.fcEvents)
})
}
}
}
</script>
<style scoped>
</style>
<template>
<div class="calender">
<full-calendar :events="fcEvents" locale="en"></full-calendar>
<div class="app-container calendar-list-container">
<hm-full-calendar :schema="schema['HmUser']" :demoEvents="demoEvents"></hm-full-calendar>
</div>
</template>
<script>
import fullCalendar from 'vue-fullcalendar'
import HmFullCalendar from './HmFullCalendar.vue'
import schema from '../../schemas/hm_org_schema'
export default {
name: 'calender',
name: 'HmFullCalendar',
// 继承其他组件
extends: {},
// 使用其它组件
components: {
'full-calendar': fullCalendar
'hm-full-calendar': HmFullCalendar
},
data() {
return {
fcEvents: [
{
title: 'Sunny Out of Office',
start: '2018-03-8',
end: '2018-03-8',
cssClass: 'aaa'
}
]
}
},
computed: {
return {}
},
filters: {
},
created() {
this.schema = schema
this.demoEvents = {
title: 'username',
start: 'createTime',
end: 'lastUpdateTime'
}
},
methods: {}
}
</script>
<style scoped>
</style>
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