|
@@ -2,20 +2,32 @@
|
|
|
<BaseBlockCom title="日历提醒">
|
|
|
<template #title>
|
|
|
<CusFormColumn
|
|
|
- link="dept"
|
|
|
- v-model:param="deptId"/>
|
|
|
+ :span="24"
|
|
|
+ class="dept-select"
|
|
|
+ link="select"
|
|
|
+ v-model:param="deptId"
|
|
|
+ :options="$store.state.dictionary.deptList"/>
|
|
|
<!-- <div class="more">查看更多》</div>-->
|
|
|
</template>
|
|
|
<div class="main">
|
|
|
<div class="week-head">
|
|
|
<div class="month-select">
|
|
|
<div class="show-block __hover" @click="ref_date.handleOpen()">
|
|
|
- <img class="select-last __hover" src="@/views/staging/common/title-triangle.png" @click.stop="switchMonth(false)"/>
|
|
|
+ <div class="select-last __hover" @click.stop="pageLastShowCpt ? switchMonth(false) : undefined">
|
|
|
+ <img v-if="pageLastShowCpt" src="@/views/staging/common/title-triangle.png"/>
|
|
|
+ </div>
|
|
|
<div class="month">{{new Date(selectMonth).getMonth() + 1}}</div>
|
|
|
<div class="unit">/月</div>
|
|
|
- <img class="select-next __hover" src="@/views/staging/common/title-triangle.png" @click.stop="switchMonth(true)"/>
|
|
|
+ <div class="select-next __hover" @click.stop="pageNextShowCpt ? switchMonth(true) : undefined">
|
|
|
+ <img v-if="pageNextShowCpt" src="@/views/staging/common/title-triangle.png"/>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- <el-date-picker ref="ref_date" v-model="selectMonth" type="month"/>
|
|
|
+ <el-date-picker
|
|
|
+ ref="ref_date"
|
|
|
+ v-model="selectMonth"
|
|
|
+ type="month"
|
|
|
+ :disabled-date="(d) => new Date($util.YM(d)).getTime() > new Date($store.state.app.timestamp).getTime() || new Date($util.YM(d)).getTime() < new Date($util.YM($store.state.app.projectFirstDate)).getTime()"
|
|
|
+ />
|
|
|
</div>
|
|
|
<div class="none"/>
|
|
|
<template v-for="item in getWeekCN(startWeek)">
|
|
@@ -94,6 +106,7 @@ import {useRouter, useRoute} from 'vue-router'
|
|
|
import BaseBlockCom from '../../common/base-block.vue'
|
|
|
import ButtonSwitchCom from '../../common/button-switch.vue'
|
|
|
import * as Handle from '../../common/handle'
|
|
|
+import {ElMessage} from "element-plus";
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: '',
|
|
@@ -137,6 +150,12 @@ export default defineComponent({
|
|
|
return weekArray
|
|
|
}
|
|
|
const ref_date = ref()
|
|
|
+ const pageLastShowCpt = computed(() => {
|
|
|
+ return new Date(that.$util.YM(state.selectMonth)).getTime() > new Date(that.$util.YM(store.state.app.projectFirstDate)).getTime()
|
|
|
+ })
|
|
|
+ const pageNextShowCpt = computed(() => {
|
|
|
+ return new Date(that.$util.YM(state.selectMonth)).getTime() < new Date(that.$util.YM(store.state.app.timestamp)).getTime()
|
|
|
+ })
|
|
|
const switchMonth = (isNext) => {
|
|
|
const sm = new Date(state.selectMonth)
|
|
|
const first = new Date(sm.getFullYear(), sm.getMonth(), 1)
|
|
@@ -148,8 +167,65 @@ export default defineComponent({
|
|
|
const last = new Date(first.getTime() - oneDayTime)
|
|
|
state.selectMonth = new Date(last.getFullYear(), last.getMonth(), 1)
|
|
|
}
|
|
|
+ }// 获取字典
|
|
|
+ const initDictionary = () => {
|
|
|
+ store.dispatch('dictionary/LOAD_DEPT')
|
|
|
+ }
|
|
|
+ const getCalendarInfo = () => {
|
|
|
+ state.loading = true
|
|
|
+ state.calendarInfo = {
|
|
|
+ signIn: new Map(),
|
|
|
+ signOut: new Map(),
|
|
|
+ daily: new Map(),
|
|
|
+ weekly: new Map(),
|
|
|
+ }
|
|
|
+ that.$api.zbyWorkbenchCheckCalendar({
|
|
|
+ deptId: store.state.app.userInfo.dept.id,
|
|
|
+ times: calendarCpt.value.map(v => {
|
|
|
+ return {
|
|
|
+ beginTime: v.calendar[0].dateStr,
|
|
|
+ endTime: v.calendar[v.calendar.length - 1].dateStr,
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }).then(res => {
|
|
|
+ if (res.code === 200 && res.data) {
|
|
|
+ res.data.dateList?.forEach(v => {
|
|
|
+ if (new Date(that.$util.YMD(v.date)) <= new Date(that.$util.YMD(store.state.app.timestamp)) && new Date(that.$util.YMD(v.date)) >= new Date(that.$util.YMD(store.state.app.projectFirstDate))) {
|
|
|
+ // 日志提交情况
|
|
|
+ state.calendarInfo.daily.set(v.date, v.logStatus)
|
|
|
+ // 签到情况
|
|
|
+ if (v.signInfoStatus?.inStatus) {
|
|
|
+ state.calendarInfo.signIn.set(v.date, v.signInfoStatus.inStatus)
|
|
|
+ }
|
|
|
+ // 签退情况
|
|
|
+ if (v.signInfoStatus?.outStatus) {
|
|
|
+ state.calendarInfo.signOut.set(v.date, v.signInfoStatus.outStatus)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // 周报提交情况
|
|
|
+ for (const [k, v] of Object.entries(res.data?.weekMap)) {
|
|
|
+ if (that.$util.isValue(v)) {
|
|
|
+ if (new Date(that.$util.YMD(k)) <= new Date(that.$util.YMD(store.state.app.timestamp)) && new Date(that.$util.YMD(k)) >= new Date(that.$util.YMD(store.state.app.projectFirstDate))) {
|
|
|
+ state.calendarInfo.weekly.set(k, v)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ ElMessage.error(res.message)
|
|
|
+ }
|
|
|
+ state.loading = false
|
|
|
+ }).catch(() => {
|
|
|
+ state.loading = false
|
|
|
+ })
|
|
|
}
|
|
|
+ watch(() => state.selectMonth, (n) => {
|
|
|
+ getCalendarInfo()
|
|
|
+ }, {
|
|
|
+ immediate: true
|
|
|
+ })
|
|
|
onMounted(() => {
|
|
|
+ initDictionary()
|
|
|
})
|
|
|
return {
|
|
|
...toRefs(state),
|
|
@@ -157,7 +233,9 @@ export default defineComponent({
|
|
|
ref_date,
|
|
|
switchMonth,
|
|
|
calendarCpt,
|
|
|
- calendarCptLength
|
|
|
+ calendarCptLength,
|
|
|
+ pageLastShowCpt,
|
|
|
+ pageNextShowCpt
|
|
|
}
|
|
|
},
|
|
|
})
|
|
@@ -171,6 +249,21 @@ export default defineComponent({
|
|
|
color: #2EB8FF;
|
|
|
margin-right: 10px;
|
|
|
}
|
|
|
+:deep(.dept-select) {
|
|
|
+ width: 100px;
|
|
|
+ height: 20px;
|
|
|
+ flex: unset;
|
|
|
+ .el-form-item {
|
|
|
+ height: 100%;
|
|
|
+ margin: 0;
|
|
|
+ .select-trigger {
|
|
|
+ height: 100%;
|
|
|
+ .el-input {
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
.main {
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
@@ -222,6 +315,10 @@ export default defineComponent({
|
|
|
position: absolute;
|
|
|
width: 7px;
|
|
|
height: 15px;
|
|
|
+ >img {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
}
|
|
|
.select-last {
|
|
|
left: -5px;
|