diff --git a/src/pages/calendar/index.vue b/src/pages/calendar/index.vue index e51dd75..dd94457 100644 --- a/src/pages/calendar/index.vue +++ b/src/pages/calendar/index.vue @@ -13,6 +13,18 @@
+ + + + + + + + + + +
@@ -42,7 +54,8 @@ export default { drawerType: '', fullcalendar: ref(), nowDate: new Date(), - infoList: [] // 日历显示的列信息 + infoList: [], // 日历显示的列信息 + currentInfoList: [] // 当前 }) onMounted(() => { initCalendar() @@ -52,15 +65,16 @@ export default { state.Tcalendar = new Calendar(state.fullcalendar, { plugins: [dayGridPlugin, timeGridPlugin, listPlugin, interactionPlugin], initialView: 'dayGridMonth', - aspectRatio: 0.9, + aspectRatio: 1, locale: 'zh-cn', handleWindowResize: true, - editable: true, // 允许编辑表格 - droppable: true, + editable: false, // 允许编辑表格 + droppable: false, eventDisplay: 'block', // height: 'auto', // 限制事件最大数量 dayMaxEvents: 0, + eventLimit: false, // 事件数量超出时更多显示链接汉化 moreLinkContent: morLinkFunction, // 显示事件开始时间 @@ -69,13 +83,16 @@ export default { displayEventEnd: false, // 关闭全天区域显示 allDaySlot: true, + longPressDelay: 0, + selectLongPressDelay: 0, // 开始时间段 slotMinTime: '00:00:00', + // 结束时间段 slotMaxTime: '00:00:00', eventOrder: 'type,color,start', - eventDurationEditable: true, - eventResizableFromStart: true, + eventDurationEditable: false, + eventResizableFromStart: false, selectable: true, // 允许用户通过单击和拖动来突出显示多个日期或时间段 firstDay: 1, // 设置一周中显示的第一天是哪天,周日是0,周一是1,类推。 unselectAuto: true, // 当点击页面日历以外的位置时,是否自动取消当前的选中状态 @@ -111,6 +128,10 @@ export default { // 点击查看时触发 handleClick(info) }, + select: function (info) { + // 视图选择日期触发 + handleSelectDate(info) + } // select: function (info) {} }) state.Tcalendar.render() @@ -147,13 +168,57 @@ export default { state.loading = false if (res) { state.infoList = res.data - // state.infoList.forEach(item => { - - // }) + const today= dayjs(new Date()).format('YYYY-MM-DD') + state.infoList.forEach(item => { + if(today===item.start){ + state.currentInfoList.push(item) + } + }) state.Tcalendar.addEventSource(state.infoList) } }) } + + const enterDetails = (info) => { + const date = info.start + const type = info.type + const accountId = info.accountId + const billDatePeriod = info.billDatePeriod + //信用卡账单日 + if (type === 1) { + const _id = accountId + uni.navigateTo({ url: `/pages/calendar/list?accountId=${_id}&billDatePeriod=${billDatePeriod}` }) + } + //贷款已还 + if (type === 4) { + const _id = accountId + const billDatePeriod = date+'~'+date + uni.navigateTo({ url: `/pages/calendar/list?accountId=${_id}&billDatePeriod=${billDatePeriod}&dealType=1&dealCategory=9` }) + } + //日常支出 + if (type === 5) { + const billDatePeriod = date+'~'+date + uni.navigateTo({ url: `/pages/calendar/list?billDatePeriod=${billDatePeriod}&dealType=2&dealCategory=1` }) + } + + //投资收益 + if (type === 6) { + const billDatePeriod = date+'~'+date + uni.navigateTo({ url: `/pages/calendar/list?billDatePeriod=${billDatePeriod}&dealCategory=2` }) + } + //POS机刷卡 + if (type === 7) { + const billDatePeriod = date+'~'+date + uni.navigateTo({ url: `/pages/calendar/list?billDatePeriod=${billDatePeriod}&dealType=2&dealCategory=5` }) + } + + //工资收入 + if (type === 8) { + const billDatePeriod = date+'~'+date + uni.navigateTo({ url: `/pages/calendar/list?billDatePeriod=${billDatePeriod}&dealCategory=11` }) + + } + } // 点击计划查看 const handleClick = (info) => { const date = info.event.startStr @@ -195,11 +260,22 @@ const handleClick = (info) => { } } - +// 拖拽触发 +const handleSelectDate = (info) => { + const selectDate= info.startStr + state.currentInfoList=[] + state.infoList.forEach(item => { + if(selectDate==item.start){ + state.currentInfoList.push(item) + } + }) +} return { ...toRefs(state), getPrev, + handleSelectDate, + enterDetails, handleClick, getNext, morLinkFunction, @@ -210,6 +286,178 @@ const handleClick = (info) => { +