|
@@ -1,12 +1,21 @@
|
|
|
<template>
|
|
|
- <div class="calendar-main">
|
|
|
+ <div class="calendar-main" v-loading="loading">
|
|
|
<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).getFullYear()}}年{{new Date(selectMonth).getMonth() + 1}}月</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="week-head">
|
|
|
<template v-for="item in getWeekCN(startWeek)">
|
|
@@ -14,42 +23,40 @@
|
|
|
</template>
|
|
|
</div>
|
|
|
<div class="week-body">
|
|
|
- <template v-for="week in calendarCpt">
|
|
|
+ <template v-for="week in calendarWithInfoCpt">
|
|
|
<div class="week-block">
|
|
|
<div class="week-block-head">
|
|
|
<template v-for="item in week.calendar">
|
|
|
<div class="wbh-content">
|
|
|
<div class="day" :class="{last: item.last, will: item.will, today: item.today}">{{item.dayStr}}</div>
|
|
|
<div class="info" :class="{tom: item.tom}">
|
|
|
- <div>
|
|
|
+ <div class="sign">
|
|
|
签卡
|
|
|
- <template v-if="$util.isValue(item.isSign)">
|
|
|
- <template v-if="item.isSign">
|
|
|
- <SvgIcon name="true" color="#01C869" size="14"/>
|
|
|
+ <template v-if="$util.isValue(item.signInStatus)">
|
|
|
+ <template v-if="item.signInStatus === '1'">
|
|
|
+ <SvgIcon name="true" :color="$store.state.dictionary.signStatusColor.get(item.signInStatus)" size="14"/>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <SvgIcon name="tips" :color="$store.state.dictionary.signStatusColor.get(item.signInStatus)" size="14"/>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ <template v-if="$util.isValue(item.signOutStatus)">
|
|
|
+ <template v-if="item.signOutStatus === '1'">
|
|
|
+ <SvgIcon name="true" :color="$store.state.dictionary.signStatusColor.get(item.signOutStatus)" size="14"/>
|
|
|
</template>
|
|
|
<template v-else>
|
|
|
- <SvgIcon name="tips" :color="
|
|
|
- item.signType === '1' ?
|
|
|
- '#E72524' :
|
|
|
- (item.signType === '2' ?
|
|
|
- '#F9741B' :
|
|
|
- (item.signType === '3' ?
|
|
|
- '#F8EA9A' :
|
|
|
- (item.signType === '4' ?
|
|
|
- '#36485b' :
|
|
|
- '#E72524'))
|
|
|
- )" size="14"/>
|
|
|
+ <SvgIcon name="tips" :color="$store.state.dictionary.signStatusColor.get(item.signOutStatus)" size="14"/>
|
|
|
</template>
|
|
|
</template>
|
|
|
</div>
|
|
|
- <div>
|
|
|
+ <div class="daily">
|
|
|
日报
|
|
|
- <template v-if="$util.isValue(item.isDaily)">
|
|
|
- <template v-if="item.isDaily">
|
|
|
- <img src="@/assets/images/business/calendar-true.png"/>
|
|
|
+ <template v-if="$util.isValue(item.dailyStatus)">
|
|
|
+ <template v-if="item.dailyStatus === '1'">
|
|
|
+ <SvgIcon name="true" :color="$store.state.dictionary.dailyStatusColor.get(item.dailyStatus)" size="14"/>
|
|
|
</template>
|
|
|
<template v-else>
|
|
|
- <img src="@/assets/images/business/calendar-false.png"/>
|
|
|
+ <SvgIcon name="tips" :color="$store.state.dictionary.dailyStatusColor.get(item.dailyStatus)" size="14"/>
|
|
|
</template>
|
|
|
</template>
|
|
|
</div>
|
|
@@ -58,9 +65,9 @@
|
|
|
</template>
|
|
|
</div>
|
|
|
<div class="week-block-weekly">
|
|
|
- <div class="value" :style="`color: ${week.isWeekly ? '#01C869' : '#E72524'}`">
|
|
|
- <template v-if="$util.isValue(week.isWeekly)">
|
|
|
- {{week.isWeekly ? '周报已提交' : '周报未提交'}}
|
|
|
+ <div class="value" :style="`color: ${$store.state.dictionary.weeklyStatusColor.get(week.weeklyStatus)}`">
|
|
|
+ <template v-if="$util.isValue(week.weeklyStatus)">
|
|
|
+ {{week.weeklyStatus === '1' ? '周报已提交' : '周报未提交'}}
|
|
|
</template>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -70,21 +77,20 @@
|
|
|
<div class="week-tips">
|
|
|
<div class="sign">
|
|
|
签卡:
|
|
|
- <div class="green"/>正常
|
|
|
- <div class="red"/>缺勤
|
|
|
- <div class="orange"/>迟到
|
|
|
- <div class="yellow"/>早退
|
|
|
- <div class="gray"/>缺卡
|
|
|
+ <div :style="`background-color: ${$store.state.dictionary.signStatusColor.get('1')};`"/>正常
|
|
|
+ <div :style="`background-color: ${$store.state.dictionary.signStatusColor.get('2')};`"/>迟到
|
|
|
+ <div :style="`background-color: ${$store.state.dictionary.signStatusColor.get('3')};`"/>早退
|
|
|
+ <div :style="`background-color: ${$store.state.dictionary.signStatusColor.get('4')};`"/>缺卡
|
|
|
</div>
|
|
|
<div class="daily">
|
|
|
日志:
|
|
|
- <div class="green"/>已提交
|
|
|
- <div class="red"/>未提交
|
|
|
+ <div :style="`background-color: ${$store.state.dictionary.dailyStatusColor.get('1')};`"/>已提交
|
|
|
+ <div :style="`background-color: ${$store.state.dictionary.dailyStatusColor.get('2')};`"/>未提交
|
|
|
</div>
|
|
|
<div class="weekly">
|
|
|
周报:
|
|
|
- <div class="green"/>已提交
|
|
|
- <div class="red"/>未提交
|
|
|
+ <div :style="`background-color: ${$store.state.dictionary.weeklyStatusColor.get('1')};`"/>已提交
|
|
|
+ <div :style="`background-color: ${$store.state.dictionary.weeklyStatusColor.get('2')};`"/>未提交
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -106,6 +112,7 @@ import {
|
|
|
import {useStore} from 'vuex'
|
|
|
import {useRouter, useRoute} from 'vue-router'
|
|
|
import * as Handle from "@/views/staging/common/handle";
|
|
|
+import {ElMessage} from "element-plus";
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: '',
|
|
@@ -120,10 +127,42 @@ export default defineComponent({
|
|
|
startWeek: store.state.app.weekStart,
|
|
|
timestamp: JSON.parse(JSON.stringify(store.state.app.timestamp)),
|
|
|
selectMonth: JSON.parse(JSON.stringify(store.state.app.timestamp)),
|
|
|
+ loading: false,
|
|
|
+ calendarInfo: {
|
|
|
+ signIn: new Map(),
|
|
|
+ signOut: new Map(),
|
|
|
+ daily: new Map(),
|
|
|
+ weekly: new Map(),
|
|
|
+ }
|
|
|
})
|
|
|
const calendarCpt = computed(() => {
|
|
|
return Handle.getMonthCalendarData(state.timestamp, state.startWeek, state.selectMonth)
|
|
|
})
|
|
|
+ const calendarWithInfoCpt = computed(() => {
|
|
|
+ const arr: any = []
|
|
|
+ calendarCpt.value.forEach(w => {
|
|
|
+ w.calendar.forEach(d => {
|
|
|
+ // 周报提交状态
|
|
|
+ if (state.calendarInfo.weekly.has(d.dateStr)) {
|
|
|
+ w.weeklyStatus = state.calendarInfo.weekly.get(d.dateStr)
|
|
|
+ }
|
|
|
+ // 日志提交状态
|
|
|
+ if (state.calendarInfo.daily.has(d.dateStr)) {
|
|
|
+ d.dailyStatus = state.calendarInfo.daily.get(d.dateStr)
|
|
|
+ }
|
|
|
+ // 签到状态
|
|
|
+ if (state.calendarInfo.signIn.has(d.dateStr)) {
|
|
|
+ d.signInStatus = state.calendarInfo.signIn.get(d.dateStr)
|
|
|
+ }
|
|
|
+ // 签退状态
|
|
|
+ if (state.calendarInfo.signOut.has(d.dateStr)) {
|
|
|
+ d.signOutStatus = state.calendarInfo.signOut.get(d.dateStr)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ arr.push(w)
|
|
|
+ })
|
|
|
+ return arr
|
|
|
+ })
|
|
|
const calendarCptLength = computed(() => {
|
|
|
return calendarCpt.value.length
|
|
|
})
|
|
@@ -145,6 +184,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)
|
|
@@ -157,13 +202,69 @@ export default defineComponent({
|
|
|
state.selectMonth = new Date(last.getFullYear(), last.getMonth(), 1)
|
|
|
}
|
|
|
}
|
|
|
+ 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
|
|
|
+ })
|
|
|
return {
|
|
|
...toRefs(state),
|
|
|
getWeekCN,
|
|
|
ref_date,
|
|
|
switchMonth,
|
|
|
calendarCpt,
|
|
|
- calendarCptLength
|
|
|
+ calendarWithInfoCpt,
|
|
|
+ calendarCptLength,
|
|
|
+ pageLastShowCpt,
|
|
|
+ pageNextShowCpt,
|
|
|
}
|
|
|
},
|
|
|
})
|
|
@@ -198,6 +299,10 @@ export default defineComponent({
|
|
|
.select-last, .select-next {
|
|
|
width: 11px;
|
|
|
height: 23px;
|
|
|
+ >img {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
}
|
|
|
.select-last {
|
|
|
transform: rotate(180deg);
|
|
@@ -284,8 +389,15 @@ export default defineComponent({
|
|
|
padding-left: 6px;
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
- >img, .svg-icon {
|
|
|
- margin-left: 8px;
|
|
|
+ &.sign {
|
|
|
+ .svg-icon {
|
|
|
+ margin-left: 2px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ &.daily {
|
|
|
+ .svg-icon {
|
|
|
+ margin-left: 8px;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -323,27 +435,12 @@ export default defineComponent({
|
|
|
>div {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
- .green, .red, .orange, .yellow, .gray {
|
|
|
+ >div {
|
|
|
width: 6px;
|
|
|
height: 6px;
|
|
|
border-radius: 50%;
|
|
|
margin: 0 6px 0 10px;
|
|
|
}
|
|
|
- .green {
|
|
|
- background-color: #3EFFBB;
|
|
|
- }
|
|
|
- .red {
|
|
|
- background-color: #E5004F;
|
|
|
- }
|
|
|
- .orange {
|
|
|
- background-color: #F9741B;
|
|
|
- }
|
|
|
- .yellow {
|
|
|
- background-color: #F8EA9A;
|
|
|
- }
|
|
|
- .gray {
|
|
|
- background-color: #36485b;
|
|
|
- }
|
|
|
}
|
|
|
.daily {
|
|
|
margin: 0 52px;
|