Commit e4cbf561 authored by 王康's avatar 王康

Merge branch 'master' of 115.28.80.125:softwarefactory/vueelementtemplate

parents 4dc29959 076db7c6
...@@ -228,6 +228,9 @@ ...@@ -228,6 +228,9 @@
* date:12212220000,//日期时间戳 * date:12212220000,//日期时间戳
* title:'xxxxxx',//行程标题 * title:'xxxxxx',//行程标题
* //更多其他字段,随意,事件发生时将全部回传。 * //更多其他字段,随意,事件发生时将全部回传。
* event:[{
*
* }]
* }, * },
* { * {
* date:12242220000,//日期时间戳 * date:12242220000,//日期时间戳
...@@ -240,7 +243,9 @@ ...@@ -240,7 +243,9 @@
*dateChange事件:用户点击一个带有日程安排的日期时触发(重复点击同一日期仅触发一次),将返回该日程数据; *dateChange事件:用户点击一个带有日程安排的日期时触发(重复点击同一日期仅触发一次),将返回该日程数据;
*monthChange事件,切换月份时触发,刷新日历显示,并传回当前月份的数组,包含该月第一天的0:0:0 和 该月最后一天的23:59:59 的时间戳,例如,7月,返回 [1498838400000,1501516799000] ,对应:Sat Jul 01 2017 00:00:00 GMT+0800 (中国标准时间) 和 Mon Jul 31 2017 23:59:59 GMT+0800 (中国标准时间) *monthChange事件,切换月份时触发,刷新日历显示,并传回当前月份的数组,包含该月第一天的0:0:0 和 该月最后一天的23:59:59 的时间戳,例如,7月,返回 [1498838400000,1501516799000] ,对应:Sat Jul 01 2017 00:00:00 GMT+0800 (中国标准时间) 和 Mon Jul 31 2017 23:59:59 GMT+0800 (中国标准时间)
*/ */
// import request from '@/utils/request' import request from '@/utils/request'
import _ from 'lodash'
import moment from 'moment'
export default{ export default{
data() { data() {
return { return {
...@@ -250,7 +255,8 @@ ...@@ -250,7 +255,8 @@
dialogTableVisible: false, dialogTableVisible: false,
show: false, show: false,
currentDate: '', currentDate: '',
event: '' event: '',
schedules: []
} }
}, },
props: { props: {
...@@ -265,8 +271,13 @@ ...@@ -265,8 +271,13 @@
initTime: { initTime: {
required: false required: false
}, },
schedules: { title: {
type: Array, required: false
},
events: {
required: false
},
date: {
required: false required: false
} }
}, },
...@@ -386,7 +397,7 @@ ...@@ -386,7 +397,7 @@
}, },
dateChange(dateItem) { dateChange(dateItem) {
this.show = true this.show = true
// console.log(dateItem) console.log(dateItem, '-=-=-=-=-=-=-=-=-')
var dateObj = new Date(this.showTimeData) var dateObj = new Date(this.showTimeData)
var year = dateObj.getFullYear() var year = dateObj.getFullYear()
var month = dateObj.getMonth() var month = dateObj.getMonth()
...@@ -398,10 +409,10 @@ ...@@ -398,10 +409,10 @@
schedule: dateItem.schedule schedule: dateItem.schedule
} }
if (!dateItem.schedule) { // 点击没有行程的,不作反应 if (!dateItem.schedule) { // 点击没有行程的,不作反应
console.log(result) // console.log(result,'-=-=-=-=')
if (result.schedule) { if (result.schedule) {
const currentTime = this.timestampToTime(result.schedule.date) const currentTime = this.timestampToTime(result.schedule.date)
console.log(currentTime) // console.log(currentTime)
this.currentDate = currentTime this.currentDate = currentTime
this.event = result.schedule.title this.event = result.schedule.title
} }
...@@ -435,12 +446,12 @@ ...@@ -435,12 +446,12 @@
dateItem.active = !dateItem.active dateItem.active = !dateItem.active
} }
// 向上发送本次点击的行程数据 // 向上发送本次点击的行程数据
console.log(result) console.log(result, '--------------------')
if (result.schedule) { if (result.schedule) {
const currentTime = this.timestampToTime(result.schedule.date) const currentTime = this.timestampToTime(result.schedule.date)
console.log(currentTime) console.log(currentTime)
this.currentDate = currentTime this.currentDate = currentTime
this.event = result.schedule.title this.event = result.schedule.event
} }
// this.$emit('dateChange', result) // this.$emit('dateChange', result)
} else { // 已激活行程提示的,不作反应 } else { // 已激活行程提示的,不作反应
...@@ -473,7 +484,29 @@ ...@@ -473,7 +484,29 @@
}, },
getDailyEvent() { getDailyEvent() {
const self = this const self = this
console.log(self.schema) var saveTime = ''
request(self.schema.modelUnderscorePlural, {
params: { 'sortItem': 'create_time', 'pageSize': 10000 }
}).then(resp => {
console.log(resp.data, '=========')
_.each(resp.data, function(item) {
item.time = moment(item[self.date]).format('YYYY-MM-DD')
item.date = moment(item[self.date]).format('X') * 1000
item.title = item[self.title]
item.allEvents = item[self.events]
if (saveTime === item.time) {
self.schedules[self.schedules.length - 1].allEvents.push(item.allEvents)
} else {
saveTime = item.time
self.schedules.push({
date: item.date,
title: item.title,
allEvents: [item.allEvents]
})
}
})
})
console.log(self.schedules, '+++++最终+++++++++')
} }
}, },
created() { created() {
......
...@@ -2,8 +2,10 @@ ...@@ -2,8 +2,10 @@
<div class="app-container calendar-list-container"> <div class="app-container calendar-list-container">
<hm-full-calendar <hm-full-calendar
:width="width" :width="width"
:schedules="schedules"
:schema="schema['HmUser']" :schema="schema['HmUser']"
:title="title"
:events="events"
:date="date"
@dateChange="datechange" @dateChange="datechange"
@monthChange="monthchange" @monthChange="monthchange"
></hm-full-calendar> ></hm-full-calendar>
...@@ -25,7 +27,10 @@ ...@@ -25,7 +27,10 @@
return { return {
show: false, show: false,
width: '300px', width: '300px',
schedules: [{ date: 1524043625000, title: '个梵蒂是的舞蹈服可接受的看似简单计算的话束带结发会计师对海口市记得回复是框架的看就好山东矿机会计师发送的甲方是看得见看见的说法开始冈地方' }, { date: 1523955299000, title: '个梵蒂冈地方' }] // title为需要传入的事件名所对应的的字段名,date为时间所对应的字段,events为事件所对应的字段,都不是必传
title: 'loginid',
date: 'createTime',
events: 'email'
} }
}, },
filters: { filters: {
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
<el-button v-if="operate.type == 'button'" :style="operate.style" class="filter-item" type="primary" v-waves :icon="operate.icon" @click="operate.func">{{operate.label}}</el-button> <el-button v-if="operate.type == 'button'" :style="operate.style" class="filter-item" type="primary" v-waves :icon="operate.icon" @click="operate.func">{{operate.label}}</el-button>
<!--自定义下拉选择--> <!--自定义下拉选择-->
<el-form-item v-if="operate.type == 'select'" :label="operate.label"> <el-form-item v-if="operate.type == 'select'" :label="operate.label">
<el-select v-model="operate.value" :placeholder="operate.placeholder" clearable> <el-select v-model="operate.value" :placeholder="operate.placeholder" @change="selectChange(operate.func, operate.value)" clearable>
<el-option v-for="o in operate.options" :label="o.label" :value="o.code"></el-option> <el-option v-for="o in operate.options" :label="o.label" :value="o.code"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
...@@ -538,6 +538,12 @@ ...@@ -538,6 +538,12 @@
self.definedOperation = self.userDefined.definedOperation self.definedOperation = self.userDefined.definedOperation
} }
}, },
// 自定义下拉选择执行函数
selectChange(func, value) {
if (typeof (func) === 'function') {
return func(value)
}
},
// 排序 // 排序
sortChange(row) { sortChange(row) {
this.listQuery.sortItem = row.prop.replace(/([A-Z])/g, '_$1').toLowerCase() this.listQuery.sortItem = row.prop.replace(/([A-Z])/g, '_$1').toLowerCase()
......
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