CzRger 1 anno fa
parent
commit
c0138a2449

+ 1 - 1
src/api/modules/daily.ts

@@ -26,7 +26,7 @@ export const getDailyReport = (id: any) => handle({
   method: 'get',
 })
 //  日志管理 > 查询日志提交情况
-export const getDailyReportSearch = (id: any) => handle({
+export const getDailyReportSearch = () => handle({
   url: `/${suffix}/daily/report/search`,
   method: 'get',
 })

+ 1 - 1
src/api/modules/weekly.ts

@@ -26,7 +26,7 @@ export const getWeekReport = (id: any) => handle({
   method: 'get',
 })
 //  周报管理 > 查询周报提交情况
-export const getWeekReportSearch = (id: any) => handle({
+export const getWeekReportSearch = () => handle({
   url: `/${suffix}/week/report/search`,
   method: 'get',
 })

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

@@ -0,0 +1,10 @@
+import { handle } from '../index'
+
+const suffix = 'api'
+
+//  值班员 > 中间统计(日)
+export const zbyWorkbenchCheckDay = (params: any) => handle({
+  url: `/${suffix}/workbench/check/day`,
+  method: 'get',
+  params
+})

+ 1 - 1
src/out/git_info.json

@@ -1 +1 @@
-{"提交ID:":"f3f8b82a162772f01a640a349266e2bfc8fceacd","提交用户:":"CzRger","提交分支:":"(HEAD -> master, origin/master)","提交时间:":"2023-11-01 11:38:06","打包用户:":"CzRger","打包时间:":"2023-11-01 15:33:42"}
+{"提交ID:":"77e557b0b2c89cd3a811b3bb2dd57fb8c3518164","提交用户:":"CzRger","提交分支:":"(HEAD -> master, origin/master, origin/HEAD)","提交时间:":"2023-11-30 11:00:25","打包用户:":"CzRger","打包时间:":"2023-11-30 16:13:21"}

+ 2 - 0
src/router/index.ts

@@ -101,6 +101,8 @@ export const initMainRouter = async () => {
                 store.dispatch('app/LOAD_PUBLIC_CONFIG', {key: 'week.submit.time'})
                 store.dispatch('app/LOAD_PUBLIC_CONFIG', {key: 'week.remind.time'})
                 store.dispatch('app/LOAD_SIGN_INFO')
+                store.dispatch('app/LOAD_DAILY_INFO')
+                store.dispatch('app/LOAD_WEEKLY_INFO')
             } else {
                 ElMessage({
                     duration: 0,

+ 35 - 1
src/store/modules/app.ts

@@ -5,6 +5,8 @@ import {getSeatDutyPersonSearch} from "@/api/modules/seat";
 import {getConfigConfigKey, editConfigEditConfigKey} from "@/api/modules/config";
 import * as Handle from "@/views/staging/common/handle";
 import {YMD, YMDHms} from '@/utils/util'
+import {getDailyReportSearch} from "@/api/modules/daily";
+import {getWeekReportSearch} from "@/api/modules/weekly";
 
 const state = {
 	apiProxy: {
@@ -27,7 +29,9 @@ const state = {
 		'week.submit.time': '',
 		'week.remind.time': '',
 	},
-	signInfo: null
+	signInfo: null,
+	dailyInfo: null,
+	weeklyInfo: null,
 }
 
 const getters = {
@@ -103,6 +107,12 @@ const mutations = {
 	SET_SIGN_INFO(state: any, data) {
 		state.signInfo = data
 	},
+	SET_DAILY_INFO(state: any, data) {
+		state.dailyInfo = data
+	},
+	SET_WEEKLY_INFO(state: any, data) {
+		state.weeklyInfo = data
+	},
 }
 
 const actions = {
@@ -185,6 +195,30 @@ const actions = {
 			})
 		})
 	},
+	LOAD_DAILY_INFO({ commit }: any) {
+		return new Promise((resolve, reject) => {
+			getDailyReportSearch().then((res) => {
+				if (res.code === 200) {
+					commit('SET_DAILY_INFO', res.data)
+					resolve(res.message)
+				} else {
+					ElMessage.error(res.message)
+				}
+			})
+		})
+	},
+	LOAD_WEEKLY_INFO({ commit }: any) {
+		return new Promise((resolve, reject) => {
+			getWeekReportSearch().then((res) => {
+				if (res.code === 200) {
+					commit('SET_WEEKLY_INFO', res.data)
+					resolve(res.message)
+				} else {
+					ElMessage.error(res.message)
+				}
+			})
+		})
+	},
 }
 
 export default {

+ 25 - 7
src/views/staging/zby/center/index.vue

@@ -28,7 +28,7 @@
       </div>
     </div>
     <div class="clock">
-      <div class="tips">您还未签到/未提交日志/未提交周报,请尽快完成签到</div>
+      <div class="tips">{{tipsCpt}}</div>
       <div class="datetime">
         <div class="label">北京时间:</div>
         <div class="value">
@@ -98,6 +98,11 @@ export default defineComponent({
       transferDaily: {},
       showWeeklyDetail: false,
       transferWeekly: {},
+      tools: {
+        signStart: new Date(`${that.$util.YMD(store.state.app.timestamp)} ${store.state.app.publicConfig["sign.begin.time"]}`).getTime(),
+        signEnd: new Date(`${that.$util.YMD(store.state.app.timestamp)} ${store.state.app.publicConfig["sign.end.time"]}`).getTime(),
+        now: new Date(store.state.app.timestamp).getTime()
+      }
     })
     const onDaily = () => {
       state.transferDaily = {
@@ -126,11 +131,8 @@ export default defineComponent({
         }).catch(() => {
         })
       }
-      const signStart = new Date(`${that.$util.YMD(store.state.app.timestamp)} ${store.state.app.publicConfig["sign.begin.time"]}`).getTime()
-      const signEnd = new Date(`${that.$util.YMD(store.state.app.timestamp)} ${store.state.app.publicConfig["sign.end.time"]}`).getTime()
-      const now = new Date(store.state.app.timestamp).getTime()
       if (!isSignCpt.value) {
-        if (now > signStart) {
+        if (state.tools.now > state.tools.signStart) {
           ElMessageBox.confirm(`当前已过签到时间,是否继续签到?`, "提示", {
             confirmButtonText: "确定",
             cancelButtonText: "取消",
@@ -142,7 +144,7 @@ export default defineComponent({
           sign('签到成功!')
         }
       } else {
-        if (now < signEnd) {
+        if (state.tools.now < state.tools.signEnd) {
           ElMessageBox.confirm(`当前未到签退时间,是否继续签退?`, "提示", {
             confirmButtonText: "确定",
             cancelButtonText: "取消",
@@ -155,12 +157,28 @@ export default defineComponent({
         }
       }
     }
+    const tipsCpt = computed(() => {
+      let str: Array<string> = []
+      if (!store.state.app.signInfo?.id) {
+        str.push('未签到')
+      } else if (store.state.app.signInfo.type !== '2' && state.tools.now >= state.tools.signEnd) {
+        str.push('未签退')
+      }
+      if (!store.state.app.dailyInfo?.id) {
+        str.push('未提交日志')
+      }
+      if (store.getters['app/isWeeklyDay'] && !store.state.app.weeklyInfo?.id) {
+        str.push('未提交周报')
+      }
+      return `您还${str.join('/')},请尽快完成操作`
+    })
     return {
       ...toRefs(state),
       onDaily,
       onWeekly,
       isSignCpt,
-      onSign
+      onSign,
+      tipsCpt
     }
   },
 })

+ 70 - 26
src/views/staging/zby/center/statistic.vue

@@ -86,7 +86,13 @@
               <div class="day-item-label">签到打卡<span>{{dataInfoCpt.sign.signStartTime}}</span></div>
               <div class="day-item-value">
                 <template v-if="dataInfoCpt.sign.signStartTimeReal">
-                  <SvgIcon name="true" color="#02fff1"/><span>{{dataInfoCpt.sign.signStartTimeReal}}</span><span>已打卡</span>
+                  <template v-if="dataInfoCpt.sign.signStartStatus === '1'">
+                    <SvgIcon name="true" :color="$store.state.dictionary.signStatusColor.get(dataInfoCpt.sign.signStartStatus)"/>
+                  </template>
+                  <template v-else>
+                    <SvgIcon name="tips" :color="$store.state.dictionary.signStatusColor.get(dataInfoCpt.sign.signStartStatus)"/>
+                  </template>
+                  <span>{{$util.Hms(dataInfoCpt.sign.signStartTimeReal)}}</span><span :style="`color: ${$store.state.dictionary.signStatusColor.get(dataInfoCpt.sign.signStartStatus)};`">{{$store.state.dictionary.signStatusMap.get(dataInfoCpt.sign.signStartStatus) || dataInfoCpt.sign.signStartStatus}}</span>
                 </template>
                 <template v-else>
                   <SvgIcon name="true" color="#04495c"/><span>未打卡</span>
@@ -174,30 +180,41 @@
           </div>
         </template>
       </div>
-      <div class="content-item">
+      <div class="content-item" :style="`opacity: ${$store.getters['app/isWeeklyDay'] ? 1 : 0.3};`">
         <div class="label">
           <img src="@/assets/images/business/center-statistics-icon.png"/>
           周报
         </div>
         <template v-if="dateType === 'day'">
           <div class="value value-day">
-            <div class="block day-item">
-              <div class="day-item-label">{{dataInfoCpt.weekly.submitTime ? '已提交' : '未提交'}}<img v-if="dataInfoCpt.weekly.submitTime" class="download" src="@/assets/images/business/download.png"/></div>
-              <div class="day-item-value">
-                <template v-if="dataInfoCpt.weekly.submitTime">
-                  <SvgIcon name="true" color="#02fff1"/>
-                  <span>{{$util.Hms(dataInfoCpt.weekly.submitTime)}}</span>
-                  <span class="blue">{{dataInfoCpt.weekly.username}}</span>
-                  <span>已提交</span>
-                </template>
-                <template v-else>
+            <template v-if="$store.getters['app/isWeeklyDay']">
+              <div class="block day-item">
+                <div class="day-item-label">{{dataInfoCpt.weekly.submitTime ? '已提交' : '未提交'}}<img v-if="dataInfoCpt.weekly.submitTime" class="download" src="@/assets/images/business/download.png"/></div>
+                <div class="day-item-value">
+                  <template v-if="dataInfoCpt.weekly.submitTime">
+                    <SvgIcon name="true" color="#02fff1"/>
+                    <span>{{$util.Hms(dataInfoCpt.weekly.submitTime)}}</span>
+                    <span class="blue">{{dataInfoCpt.weekly.username}}</span>
+                    <span>已提交</span>
+                  </template>
+                  <template v-else>
+                    <SvgIcon name="true" color="#04495c"/>
+                    <span>请于</span>
+                    <span class="blue">{{dataInfoCpt.weekly.submitEndTime}}</span>
+                    <span>前尽快提交</span>
+                  </template>
+                </div>
+              </div>
+            </template>
+            <template v-else>
+              <div class="block day-item">
+                <div class="day-item-label">无需提交</div>
+                <div class="day-item-value">
                   <SvgIcon name="true" color="#04495c"/>
-                  <span>请于</span>
-                  <span class="blue">{{dataInfoCpt.weekly.submitEndTime}}</span>
-                  <span>前尽快提交</span>
-                </template>
+                  <span>未提交</span>
+                </div>
               </div>
-            </div>
+            </template>
           </div>
         </template>
         <template v-else>
@@ -238,6 +255,8 @@ import {useStore} from 'vuex'
 import {useRouter, useRoute} from 'vue-router'
 import ButtonSwitchCom from '../../common/button-switch.vue'
 import * as Handle from '../../common/handle'
+import {zbyWorkbenchCheckDay} from "@/api/modules/workbench";
+import {ElMessage} from "element-plus";
 
 export default defineComponent({
   name: '',
@@ -254,21 +273,21 @@ export default defineComponent({
       dataInfo: {
         day: {
           sign: {
-            signStartTime: '8:30',
-            signStartTimeReal: '07:59',
-            signStartStatus: '1',
-            signEndTime: '15:30',
+            signStartTime: '',
+            signStartTimeReal: '',
+            signStartStatus: '',
+            signEndTime: '',
             signEndTimeReal: '',
-            signEndStatus: '0',
+            signEndStatus: '',
           },
           daily: {
-            username: '陈述婷',
-            submitTime: '2023-11-01 13:22:01',
-            submitEndTime: '23:12:35'
+            username: '',
+            submitTime: '',
+            submitEndTime: ''
           },
           weekly: {
             submitTime: '',
-            submitEndTime: '23:12:35'
+            submitEndTime: ''
           }
         },
         week: {
@@ -454,6 +473,7 @@ export default defineComponent({
     }
     const onDayClick = (item) => {
       state.dateValue.selectDay = item.selectValue
+      getDayInfo()
     }
     const onWeekClick = (item) => {
       state.dateValue.selectWeek = item.id
@@ -476,8 +496,32 @@ export default defineComponent({
       const ld = new Date(new Date(d).getFullYear(), new Date(d).getMonth() + diff, 1)
       initStaticMonth(ld)
     }
+    const getDayInfo = () => {
+      that.$api.zbyWorkbenchCheckDay({
+        deptId: store.state.app.userInfo.dept.id,
+        time: state.dateValue.selectDay
+      }).then(res => {
+        if (res.code === 200) {
+          const signCome = res.data.signInRecords?.filter(v => v.type === '1')?.[0]
+          const signExit = res.data.signInRecords?.filter(v => v.type === '2')?.[0]
+          if (signCome) {
+            state.dataInfo.day.sign.signStartTime = signCome.signTime
+            state.dataInfo.day.sign.signStartTimeReal = signCome.time
+            state.dataInfo.day.sign.signStartStatus = signCome.status
+          }
+        } else {
+          ElMessage.error(res.message)
+        }
+      })
+    }
+    const initDictionary = () => {
+      store.dispatch('dictionary/LOAD_DICT_LIST', 'sign_type')
+      store.dispatch('dictionary/LOAD_DICT_LIST', 'sign_status')
+    }
     onMounted(() => {
+      initDictionary()
       initStatic()
+      getDayInfo()
     })
     return {
       ...toRefs(state),