|
@@ -1,27 +1,52 @@
|
|
<script setup>
|
|
<script setup>
|
|
-import { ref, onMounted } from 'vue';
|
|
|
|
|
|
+import { ref, onMounted,watch } from 'vue';
|
|
|
|
+import { useRoute } from 'vue-router';
|
|
|
|
+import { Sticky,Popup } from 'vant';
|
|
|
|
+
|
|
import '@fullcalendar/core/vdom'; // solve problem with Vite
|
|
import '@fullcalendar/core/vdom'; // solve problem with Vite
|
|
import FullCalendar from '@fullcalendar/vue3';
|
|
import FullCalendar from '@fullcalendar/vue3';
|
|
import timeGridPlugin from '@fullcalendar/timegrid';
|
|
import timeGridPlugin from '@fullcalendar/timegrid';
|
|
import interactionPlugin from '@fullcalendar/interaction';
|
|
import interactionPlugin from '@fullcalendar/interaction';
|
|
|
|
|
|
import moment from 'moment';
|
|
import moment from 'moment';
|
|
-
|
|
|
|
|
|
+import 'moment/dist/locale/zh-cn';
|
|
|
|
+moment.locale('zh-cn');
|
|
import swiperCalendar from './swiperCalendar.vue';
|
|
import swiperCalendar from './swiperCalendar.vue';
|
|
-// import swiperCalendar from './swiper.vue';
|
|
|
|
|
|
|
|
-const emits = defineEmits(['dateChange','cellClick'])
|
|
|
|
|
|
+/* props */
|
|
|
|
+const props = defineProps({
|
|
|
|
+ eventList: {
|
|
|
|
+ type: Array,
|
|
|
|
+ required: true
|
|
|
|
+ }
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
+const emits = defineEmits(['dateChange','cellClick']);
|
|
|
|
|
|
|
|
+const route = useRoute();
|
|
const swiperCalendarRef = ref(null);
|
|
const swiperCalendarRef = ref(null);
|
|
|
|
|
|
|
|
+
|
|
|
|
+let isShowPopup = ref(false);//日程弹窗
|
|
|
|
+const selectEventInfo = ref(null)//日程信息
|
|
|
|
+
|
|
/* 点击表格日期 */
|
|
/* 点击表格日期 */
|
|
const handleDateClick = ({date}) => {
|
|
const handleDateClick = ({date}) => {
|
|
emits('cellClick',date)
|
|
emits('cellClick',date)
|
|
};
|
|
};
|
|
|
|
|
|
/* 点击日程 */
|
|
/* 点击日程 */
|
|
-const handleEventClick = () => {};
|
|
|
|
|
|
+const handleEventClick = (_) => {
|
|
|
|
+ let id = _.event.id; // 获取当前点击日程的ID
|
|
|
|
+
|
|
|
|
+ let event_item = props.eventList.find(item => item.id === Number(id));
|
|
|
|
|
|
|
|
+ //标题拼接
|
|
|
|
+ let title = setDynamicTitle(event_item);
|
|
|
|
+
|
|
|
|
+ selectEventInfo.value = {...event_item,title};
|
|
|
|
+ isShowPopup.value = true;
|
|
|
|
+};
|
|
|
|
|
|
let calendarOptions = ref({
|
|
let calendarOptions = ref({
|
|
height: 'auto',
|
|
height: 'auto',
|
|
@@ -41,17 +66,7 @@ let calendarOptions = ref({
|
|
weekends: true,
|
|
weekends: true,
|
|
dateClick: handleDateClick,
|
|
dateClick: handleDateClick,
|
|
eventClick: handleEventClick,
|
|
eventClick: handleEventClick,
|
|
- // eventsSet: handleEvents,
|
|
|
|
- // select: handleDateSelect,
|
|
|
|
- events: [
|
|
|
|
- {
|
|
|
|
- start: '2022-03-07T09:30:00',
|
|
|
|
- end: '2022-03-07T10:30:00',
|
|
|
|
- event_id: '10',
|
|
|
|
- id: '12',
|
|
|
|
- title: '454545',
|
|
|
|
- }
|
|
|
|
- ], //日程表
|
|
|
|
|
|
+ events: [], //日程表
|
|
eventTimeFormat: {
|
|
eventTimeFormat: {
|
|
// 格式化日程显示时间,如'14:30'
|
|
// 格式化日程显示时间,如'14:30'
|
|
hour: '2-digit',
|
|
hour: '2-digit',
|
|
@@ -97,19 +112,63 @@ const toogeCurrentWeek = () => {
|
|
swiperCalendarRef.value.selectDateHandle(moment().format('YYYY-MM-DD'),1)
|
|
swiperCalendarRef.value.selectDateHandle(moment().format('YYYY-MM-DD'),1)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// 处理数据结构
|
|
|
|
+const getReservationList = () => {
|
|
|
|
+ const arr = props.eventList.map((item) => {
|
|
|
|
+ // let title = (this.isSeller && item.ActivityType==='路演')
|
|
|
|
+ // ? `${item.CompanyName}${item.CompanyStatus ? '('+ item.CompanyStatus + ')' : ''}` : (this.isSeller && item.ActivityType==='公开会议')
|
|
|
|
+ // ? item.Theme : setDynamicTitle(item);
|
|
|
|
+ let title = item.ActivityType==='路演'
|
|
|
|
+ ? `${item.CompanyName}${item.CompanyStatus ? '('+ item.CompanyStatus + ')' : ''}` : item.ActivityType==='公开会议'
|
|
|
|
+ ? item.Theme : setDynamicTitle(item);
|
|
|
|
+
|
|
|
|
+ return {
|
|
|
|
+ start: item.StartDate+'T'+item.StartTime ,
|
|
|
|
+ end: item.EndDate+'T'+item.EndTime,
|
|
|
|
+ event_id: item.RsCalendarId || item.RsMattersId,
|
|
|
|
+ id: item.id,
|
|
|
|
+ title,
|
|
|
|
+ };
|
|
|
|
+ });
|
|
|
|
+ calendarOptions.value.events = arr
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 拼接标题 type 内部会议 公开会议 路演 报告电话会 事项
|
|
|
|
+const setDynamicTitle = ({ActivityType,RsMattersId,MatterContent,RoadshowType,RoadshowPlatform,Province,City,ActivityCategory,Source,Title}) => {
|
|
|
|
+
|
|
|
|
+ //第三方添加的日历活动
|
|
|
|
+ if(Source === 1) return Title;
|
|
|
|
+
|
|
|
|
+ switch(ActivityType || RsMattersId) {
|
|
|
|
+ case '内部会议': return ActivityType;
|
|
|
|
+ case '公开会议': return `${RoadshowType}${ActivityType}(${RoadshowType==='线上' ? RoadshowPlatform : Province+City})`;
|
|
|
|
+ case '路演': return `${RoadshowType}${ActivityType}(${RoadshowType==='线上' ? RoadshowPlatform : Province+City})`;
|
|
|
|
+ case '报告电话会': return `${ActivityCategory}电话会`;
|
|
|
|
+ case RsMattersId: return MatterContent;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+watch(
|
|
|
|
+ () => props.eventList,
|
|
|
|
+ (newval) => {
|
|
|
|
+ getReservationList();
|
|
|
|
+ }
|
|
|
|
+)
|
|
|
|
+
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
calendarApi.value = FullCalendarRef.value.getApi();
|
|
calendarApi.value = FullCalendarRef.value.getApi();
|
|
-
|
|
|
|
|
|
+ datechangeHandle(moment().format('YYYY-MM-DD'))
|
|
});
|
|
});
|
|
|
|
|
|
-defineExpose({ toogeCurrentWeek });
|
|
|
|
|
|
+defineExpose({ toogeCurrentWeek,calendarApi });
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<template>
|
|
<template>
|
|
- <div class="header">
|
|
|
|
- <swiperCalendar @dateChange="datechangeHandle" ref="swiperCalendarRef"/>
|
|
|
|
-
|
|
|
|
- </div>
|
|
|
|
|
|
+ <Sticky>
|
|
|
|
+ <div class="header">
|
|
|
|
+ <swiperCalendar @dateChange="datechangeHandle" ref="swiperCalendarRef"/>
|
|
|
|
+ </div>
|
|
|
|
+ </Sticky>
|
|
<FullCalendar :options="calendarOptions" ref="FullCalendarRef">
|
|
<FullCalendar :options="calendarOptions" ref="FullCalendarRef">
|
|
<template #eventContent="arg">
|
|
<template #eventContent="arg">
|
|
<div class="popper-content">
|
|
<div class="popper-content">
|
|
@@ -118,25 +177,64 @@ defineExpose({ toogeCurrentWeek });
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
</FullCalendar>
|
|
</FullCalendar>
|
|
|
|
+
|
|
|
|
+<!-- 弹窗层 -->
|
|
|
|
+ <Popup
|
|
|
|
+ v-model:show="isShowPopup"
|
|
|
|
+ closeable
|
|
|
|
+ >
|
|
|
|
+ <div class="dialog-cont">
|
|
|
|
+ <p>
|
|
|
|
+ {{
|
|
|
|
+ `${moment(selectEventInfo.StartDate).format("MM.DD")}
|
|
|
|
+ (${moment(selectEventInfo.StartDate).format('ddd')})
|
|
|
|
+ ${selectEventInfo.StartTime&&selectEventInfo.StartTime.substr(0,5)} -
|
|
|
|
+ ${selectEventInfo.EndTime&&selectEventInfo.EndTime.substr(0,5)}`
|
|
|
|
+ }}
|
|
|
|
+ </p>
|
|
|
|
+ <p v-if="isSeller">{{ selectEventInfo.ResearcherName }}</p>
|
|
|
|
+ <p>{{ selectEventInfo.title }}</p>
|
|
|
|
+ <p v-if="selectEventInfo.CompanyName" >{{ `${selectEventInfo.CompanyName}${selectEventInfo.CompanyStatus ? '('+ selectEventInfo.CompanyStatus + ')' : ''}` }}</p>
|
|
|
|
+ <p v-if="selectEventInfo.Theme">{{ selectEventInfo.Theme }}</p>
|
|
|
|
+ <p v-if="selectEventInfo.CooperationName">{{ selectEventInfo.CooperationName }}</p>
|
|
|
|
+ <p v-if="['公开会议','内部会议','路演'].includes(selectEventInfo.ActivityType)">发起人:{{selectEventInfo.SysUserRealName}}</p>
|
|
|
|
+ </div>
|
|
|
|
+ </Popup>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
.header {
|
|
.header {
|
|
- position: sticky;
|
|
|
|
- top: 0;
|
|
|
|
- left: 0;
|
|
|
|
- right: 0;
|
|
|
|
- z-index: 99;
|
|
|
|
background: #fff;
|
|
background: #fff;
|
|
- padding-top: 20px;
|
|
|
|
- padding: 10px 0 20px;
|
|
|
|
|
|
+ padding-bottom: 20px;
|
|
box-shadow: 0px 3px 6px rgba(172, 172, 172, 0.16);
|
|
box-shadow: 0px 3px 6px rgba(172, 172, 172, 0.16);
|
|
|
|
+ .tab-cont {
|
|
|
|
+ padding: 30px;
|
|
|
|
+ background: #fff;
|
|
|
|
+ box-shadow: 0px 3px 12px rgba(175, 175, 175, 0.16);
|
|
|
|
+ border-bottom: 6px solid #f6f6f6;
|
|
|
|
+ margin-bottom: 20px;
|
|
|
|
+ .tab-ul {
|
|
|
|
+ display: flex;
|
|
|
|
+ align-items: center;
|
|
|
|
+ li {
|
|
|
|
+ margin-right: 50px;
|
|
|
|
+ color: #666;
|
|
|
|
+ text-align: center;
|
|
|
|
+ .item-img {
|
|
|
|
+ width: 78px;
|
|
|
|
+ height: 78px;
|
|
|
|
+ display:block;
|
|
|
|
+ margin: 0 auto 10px;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
.fc {
|
|
.fc {
|
|
margin: 0 0 160px;
|
|
margin: 0 0 160px;
|
|
::v-deep(.fc-timegrid-slot) {
|
|
::v-deep(.fc-timegrid-slot) {
|
|
- height: 80px;
|
|
|
|
|
|
+ height: 120px;
|
|
}
|
|
}
|
|
|
|
|
|
::v-deep(.fc-timegrid-slot-label) {
|
|
::v-deep(.fc-timegrid-slot-label) {
|
|
@@ -147,16 +245,16 @@ defineExpose({ toogeCurrentWeek });
|
|
}
|
|
}
|
|
::v-deep(.fc-timegrid-event ) {
|
|
::v-deep(.fc-timegrid-event ) {
|
|
border-left: 8px solid #3385FF !important;
|
|
border-left: 8px solid #3385FF !important;
|
|
- /* border-left-color:#3385FF !important; */
|
|
|
|
- /* &::after {
|
|
|
|
- height: 100%;
|
|
|
|
- width: 6px;
|
|
|
|
- position: absolute;
|
|
|
|
- top: 0;
|
|
|
|
- content: '';
|
|
|
|
- background-color: #3385FF;
|
|
|
|
- } */
|
|
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+.dialog-cont {
|
|
|
|
+ /* min-width: 400px; */
|
|
|
|
+ width: 500px;
|
|
|
|
+ padding: 40px;
|
|
|
|
+ p {
|
|
|
|
+ color: #333;
|
|
|
|
+ }
|
|
|
|
+}
|
|
</style>
|
|
</style>
|