caozhaorui 1 год назад
Родитель
Сommit
8b4364cd15
1 измененных файлов с 61 добавлено и 43 удалено
  1. 61 43
      src/views/staging/zbgly/left/calendar-com.vue

+ 61 - 43
src/views/staging/zbgly/left/calendar-com.vue

@@ -35,7 +35,7 @@
         </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">
               <div class="none"></div>
@@ -47,12 +47,12 @@
               <div class="label">签卡</div>
               <template v-for="item in week.calendar">
                 <div class="item">
-                  <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.signStatus)">
+                    <template v-if="item.signStatus == '1'">
+                      <SvgIcon name="true" color="#3EFFBB" size="14"/>
                     </template>
                     <template v-else>
-                      <SvgIcon name="tips" color="#E72524" size="14"/>
+                      <SvgIcon name="tips" color="#E5004F" size="14"/>
                     </template>
                   </template>
                 </div>
@@ -62,12 +62,12 @@
               <div class="label">日报</div>
               <template v-for="item in week.calendar">
                 <div class="item">
-                  <template v-if="$util.isValue(item.isDaily)">
-                    <template v-if="item.isDaily">
-                      <SvgIcon name="true" color="#01C869" size="14"/>
+                  <template v-if="$util.isValue(item.dailyStatus)">
+                    <template v-if="item.dailyStatus == '1'">
+                      <SvgIcon name="true" color="#3EFFBB" size="14"/>
                     </template>
                     <template v-else>
-                      <SvgIcon name="tips" color="#E72524" size="14"/>
+                      <SvgIcon name="tips" color="#E5004F" size="14"/>
                     </template>
                   </template>
                 </div>
@@ -75,9 +75,9 @@
             </div>
             <div class="week-block-weekly">
               <div class="label">周报</div>
-              <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>
@@ -127,8 +127,7 @@ export default defineComponent({
       selectMonth: JSON.parse(JSON.stringify(store.state.app.timestamp)),
       loading: false,
       calendarInfo: {
-        signIn: new Map(),
-        signOut: new Map(),
+        sign: new Map(),
         daily: new Map(),
         weekly: new Map(),
       }
@@ -136,6 +135,27 @@ export default defineComponent({
     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.sign.has(d.dateStr)) {
+            d.signStatus = state.calendarInfo.sign.get(d.dateStr)
+          }
+        })
+        arr.push(w)
+      })
+      return arr
+    })
     const calendarCptLength = computed(() => {
       return calendarCpt.value.length
     })
@@ -181,8 +201,7 @@ export default defineComponent({
     const getCalendarInfo = () => {
       state.loading = true
       state.calendarInfo = {
-        signIn: new Map(),
-        signOut: new Map(),
+        sign: new Map(),
         daily: new Map(),
         weekly: new Map(),
       }
@@ -195,32 +214,30 @@ export default defineComponent({
           }
         })
       }).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)
-        // }
+        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))) {
+              //  日志提交情况
+              if (that.$util.isValue(v.logStatus)) {
+                state.calendarInfo.daily.set(v.date, v.logStatus)
+              }
+              //  签卡情况
+              if (that.$util.isValue(v.signStatus)) {
+                state.calendarInfo.sign.set(v.date, v.signStatus)
+              }
+            }
+          })
+          //  周报提交情况
+          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
@@ -245,7 +262,8 @@ export default defineComponent({
       calendarCpt,
       calendarCptLength,
       pageLastShowCpt,
-      pageNextShowCpt
+      pageNextShowCpt,
+      calendarWithInfoCpt
     }
   },
 })