Kaynağa Gözat

值班管理员

CzRger 1 yıl önce
ebeveyn
işleme
a643f71990

+ 19 - 0
src/api/modules/workbench.ts

@@ -20,3 +20,22 @@ export const zbyWorkbenchCheckCalendar = (params: any) => handle({
   method: 'post',
   params
 })
+
+//  值班管理员 > 中间顶部统计
+export const zbglyWorkbenchAdminStatistics = (params: any) => handle({
+  url: `/${suffix}/workbench/admin/statistics`,
+  method: 'get',
+  params
+})
+//  值班管理员 > 右下考勤情况
+export const zbglyWorkbenchAdminCheck = (params: any) => handle({
+  url: `/${suffix}/workbench/admin/check`,
+  method: 'get',
+  params
+})
+//  值班管理员 > 左上日历
+export const zbglyWorkbenchAdminCalendar = (params: any) => handle({
+  url: `/${suffix}/workbench/admin/calendar`,
+  method: 'post',
+  params
+})

+ 9 - 0
src/views/staging/zbgly/center/index.vue

@@ -101,6 +101,7 @@ import {useStore} from 'vuex'
 import {useRouter, useRoute} from 'vue-router'
 import ButtonSwitchCom from '../../common/button-switch.vue'
 import SeatCom from './seat.vue'
+import {zbglyWorkbenchAdminStatistics} from "@/api/modules/workbench";
 
 export default defineComponent({
   name: '',
@@ -229,9 +230,17 @@ export default defineComponent({
       }
       state.seatData = arr
     }
+    const initStatisticData = () => {
+      that.$api.zbglyWorkbenchAdminStatistics({
+        type: state.dateType
+      })
+    }
     watch(() => state.seatType, () => {
       initSeatData()
     }, {immediate: true})
+    watch(() => state.dateType, () => {
+      initStatisticData()
+    }, {immediate: true})
     return {
       ...toRefs(state),
       seatOptions

+ 103 - 6
src/views/staging/zbgly/left/calendar-com.vue

@@ -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;

+ 14 - 5
src/views/staging/zbgly/right/attendance-com.vue

@@ -4,10 +4,10 @@
       <div class="more __hover" @click="$router.push({name: '7d1096ea-871a-4ab6-9909-29cce6c399fa'})">查看更多》</div>
     </template>
     <ButtonSwitchCom class="buttons" :options="[
-          {label: '昨日', value: '1'},
-          {label: '上周', value: '2'},
-          {label: '上月', value: '3'},
-          {label: '自定义', value: '4'},
+          {label: '昨日', value: 'day'},
+          {label: '上周', value: 'week'},
+          {label: '上月', value: 'month'},
+          // {label: '自定义', value: '4'},
       ]" padding="3px 12px" v-model:active="dateType" @buttonClick="handleButtonClick"/>
     <div class="list">
       <template v-for="(item, index) in list">
@@ -76,6 +76,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 {zbglyWorkbenchAdminCheck} from "@/api/modules/workbench";
 
 export default defineComponent({
   name: '',
@@ -111,7 +112,7 @@ export default defineComponent({
         {status: 2, title: '消防总队', type: 2},
         {status: 2, title: '消防总队', type: 2},
       ],
-      dateType: '1',
+      dateType: 'day',
       showTimeDialog: false,
       cusDate: ''
     })
@@ -120,6 +121,14 @@ export default defineComponent({
         state.showTimeDialog = true
       }
     }
+    const initStatisticData = () => {
+      that.$api.zbglyWorkbenchAdminCheck({
+        type: state.dateType
+      })
+    }
+    watch(() => state.dateType, () => {
+      initStatisticData()
+    }, {immediate: true})
     return {
       ...toRefs(state),
       handleButtonClick