|
|
@@ -26,6 +26,8 @@
|
|
|
:alias="desktopColumn.alias"
|
|
|
:visible="componentVisible"
|
|
|
:full-screen="fullscreen"
|
|
|
+ @open="handleOpen"
|
|
|
+ @close="handleClose"
|
|
|
@action-event="actionEvent"
|
|
|
/>
|
|
|
|
|
|
@@ -33,13 +35,18 @@
|
|
|
<div v-if="!screen" slot="footer" class="el-dialog--center">
|
|
|
<el-button icon="el-icon-circle-close" @click="closeDialog()">关闭</el-button>
|
|
|
</div>
|
|
|
+ <schedule-add :visible="calendarDialogVisible" :form="calendarDialogForm" @close="handleClose" @saveData="handleSaveData" @delData="handleDelData" />
|
|
|
</el-dialog>
|
|
|
</template>
|
|
|
<script>
|
|
|
import Vue from 'vue'
|
|
|
import { get } from '@/api/platform/desktop/column'
|
|
|
import { buildComponent } from '@/views/system/dashboard/components/util'
|
|
|
+import ScheduleAdd from '@/views/system/dashboard/templates/scheduleAdd'
|
|
|
export default {
|
|
|
+ components: {
|
|
|
+ ScheduleAdd
|
|
|
+ },
|
|
|
props: {
|
|
|
visible: {
|
|
|
type: Boolean,
|
|
|
@@ -60,7 +67,10 @@ export default {
|
|
|
dialogLoading: false,
|
|
|
fullscreen: false,
|
|
|
init: false,
|
|
|
- desktopColumn: {}
|
|
|
+ desktopColumn: {},
|
|
|
+ calendarToolbar: this.fullScreen ? [{ key: 'refresh' }] : [{ key: 'refresh' }, { key: 'fullscreen' }, { key: 'collapse' }],
|
|
|
+ calendarDialogVisible: false,
|
|
|
+ calendarDialogForm: {}
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
@@ -117,6 +127,71 @@ export default {
|
|
|
}).catch(() => {
|
|
|
this.dialogLoading = false
|
|
|
})
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 关于预览日历日程组件的方法及属性,在homePage也有相同的逻辑
|
|
|
+ */
|
|
|
+ // 关闭指定弹框
|
|
|
+ handleClose (state) {
|
|
|
+ switch (state) {
|
|
|
+ case 'calendar':
|
|
|
+ this.calendarDialogVisible = false
|
|
|
+ break
|
|
|
+ default:
|
|
|
+ break
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 打开指定弹框
|
|
|
+ handleOpen (state, dateArr, events,clickId) {
|
|
|
+ const status = ['急', '重', '轻', '缓']
|
|
|
+ const eventTrees = []
|
|
|
+ switch (state) {
|
|
|
+ case 'calendar':
|
|
|
+ this.calendarDialogVisible = true
|
|
|
+ for (const i of events) {
|
|
|
+ // 根据指定日期A获取A在时间区间内的数据
|
|
|
+ if (!((this.compareDates(i.start, dateArr[1]) > 0) || (this.compareDates(i.jieShuShiJian, dateArr[0]) < 0))) {
|
|
|
+ i.label = i.zhuangTai ? `【${status[Number(i.zhuangTai) - 1] ? status[Number(i.zhuangTai) - 1] : ''}】` + i.title : i.title
|
|
|
+ eventTrees.push(i)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (eventTrees.length) {
|
|
|
+ this.calendarDialogForm = {
|
|
|
+ eventTrees
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.calendarDialogForm = {
|
|
|
+ eventTrees: []
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.calendarDialogForm.clickedDate = dateArr[0]
|
|
|
+ this.calendarDialogForm.clickId = clickId
|
|
|
+ break
|
|
|
+ default:
|
|
|
+ break
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * date1(2024-01-01) 大于 date2(2023-01-01) 返回 1
|
|
|
+ * date1 小于 date2 返回 -1
|
|
|
+ * date1 等于 date2 返回 0
|
|
|
+ */
|
|
|
+ compareDates (date1, date2) {
|
|
|
+ var time1 = new Date(date1).getTime()
|
|
|
+ var time2 = new Date(date2).getTime()
|
|
|
+ return Math.sign(time1 - time2) // 使用Math.sign()函数返回值为 -1, 0, 1
|
|
|
+ },
|
|
|
+ // 日历弹框组件保存时候的回调
|
|
|
+ handleSaveData (param) {
|
|
|
+ if (param.state === 'calendar') {
|
|
|
+ this.$refs.myCalendar.setCalendarEvents(param)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 日历弹框组件删除日程时候的回调
|
|
|
+ handleDelData (param) {
|
|
|
+ if (param.state === 'calendar') {
|
|
|
+ this.$refs.myCalendar.hanldeCalendardel(param)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|