Ver Fonte

部门考勤,天气组件修改

wuhongbo há 1 ano atrás
pai
commit
c9328e72f8

BIN
client/src/assets/imgs/OA/kq/gouzi.png


+ 73 - 27
client/src/views/OaSystem/attendanceCenter/attendAuth.ts

@@ -1,29 +1,26 @@
 import moment from 'moment'
-
+import { DICT_TYPE, getDictOptions } from '@/utils/dict'
 // 考勤时间判断
 
 /**
  * 考勤是否异常
  */
-export function isAttendNormal(data: any) {
-  const type = data.attendanceType //考勤类型(1:上午;2:下午)
-  const morningTime = data.date + ' 9:05' //上午考勤截止时间
-  const afternoonTime = data.date + ' 17:30' //下午考勤截止时间
-
-  const createTime = moment(data.date + ' ' + data.attendanceTime).unix()
-  if (type == 1) {
-    if (createTime < moment(morningTime).unix()) {
-      return '正常'
-    } else {
-      return '迟到'
-    }
-  } else if (type == 2) {
-    if (createTime > moment(afternoonTime).unix()) {
-      return '正常'
+export function isAttendNormal(data: any, restall: any) {
+  // const type = data.attendanceType //考勤类型(1:上午;2:下午)
+  // const morningTime = data.date + ' 9:05' //上午考勤截止时间
+  // const afternoonTime = data.date + ' 17:30' //下午考勤截止时间
+  const dictAttendAll: any = ref(getDictOptions(DICT_TYPE.ADM_ATTENDANCE_STATUS))
+  let s = ''
+  dictAttendAll.value.forEach((item) => {
+    if (restall[0].isworkday == 1) {
+      if (data.attendanceStatus == Number(item.value)) {
+        s = item.label
+      }
     } else {
-      return '早退'
+      s = '---'
     }
-  }
+  })
+  return s
 }
 
 /**
@@ -68,8 +65,10 @@ export function allArrayCalendar(workArr: any, dateArr: any) {
       if (item.date == l.date) {
         if (l.state) {
           item.state = l.state
+          item.attendanceTime = l.attendanceTime
         } else {
           item.state = '正常'
+          item.attendanceTime = l.attendanceTime
         }
       }
     })
@@ -114,6 +113,16 @@ export function dayOfWeekCall(index: any) {
 export function allDeptsArr(workArr: any, dateArr: any, namesArr: any) {
   const userList: any = []
   const monthArr: any = []
+
+  const dateArrCopy: any = JSON.parse(JSON.stringify(dateArr))
+
+  dateArrCopy.forEach((item) => {
+    workArr.forEach((l) => {
+      if (item.date == l.date) {
+        item.isworkday = l.isworkday
+      }
+    })
+  })
   workArr.forEach((l: any) => {
     const obj = {
       dayOfWeek: l.dayOfWeek,
@@ -131,19 +140,57 @@ export function allDeptsArr(workArr: any, dateArr: any, namesArr: any) {
       deptId: item.deptId,
       userId: item.userId,
       username: item.username,
+      kg: 0,
+      cd: 0,
+      zt: 0,
+      cc: 0,
+      sj: 0,
+      tx: 0,
+      bj: 0,
+      nj: 0,
+      cj: 0,
+      qt: 0,
       attendArray: [...monthArr]
     }
     userList.push(obj)
   })
-  console.log(userList)
-
   userList.forEach((item) => {
-    item.attendArray.forEach((k) => {
+    dateArrCopy.forEach((l) => {
+      if (item.nickName == l.nickname) {
+        if (l.isworkday == 1) {
+          if (l.attendanceStatus == 2) {
+            item.cd += 1
+          } else if (l.attendanceStatus == 3) {
+            item.zt += 1
+          } else if (l.attendanceStatus == 4) {
+            item.kg += 0.5
+          } else if (l.attendanceStatus == 5) {
+            item.cc += 0.5
+          } else if (l.attendanceStatus == 6) {
+            item.sj += 0.5
+          } else if (l.attendanceStatus == 7) {
+            item.bj += 0.5
+          } else if (l.attendanceStatus == 18) {
+            item.tx += 0.5
+          } else if (l.attendanceStatus == 17) {
+            item.nj += 0.5
+          } else if (l.attendanceStatus == 14) {
+            item.cj += 0.5
+          } else if (l.attendanceStatus == 20) {
+            item.qt += 0.5
+          }
+        }
+      }
+    })
+  })
+  userList.forEach((item) => {
+    item.attendArray.forEach((k, index) => {
       const obj: any = {
         swkq: '',
         swAttendanceStatus: '',
         xwkq: '',
-        xwAttendanceStatus: ''
+        xwAttendanceStatus: '',
+        date: ''
       }
       dateArr.forEach((l) => {
         if (k.date === l.date) {
@@ -151,21 +198,20 @@ export function allDeptsArr(workArr: any, dateArr: any, namesArr: any) {
             if (l.attendanceType === 1) {
               obj.swKq = moment(l.attendanceTime).format('HH:mm')
               obj.swAttendanceStatus = l.attendanceStatus
+              obj.date = l.date
             }
             if (l.attendanceType === 2) {
               obj.xwKq = moment(l.attendanceTime).format('HH:mm')
               obj.xwAttendanceStatus = l.attendanceStatus
+              obj.date = l.date
             }
           }
         }
       })
-      k.swkq = obj.swkq
-      k.swAttendanceStatus = obj.swAttendanceStatus
-      k.xwkq = obj.xwkq
-      k.xwAttendanceStatus = obj.xwAttendanceStatus
+
+      item.attendArray[index] = obj
     })
   })
-  console.log(userList)
 
   return userList
 }

+ 283 - 64
client/src/views/OaSystem/attendanceCenter/dep.vue

@@ -2,39 +2,75 @@
   <div class="attendanceCenterDep">
     <h1>考勤统计表</h1>
     <div class="depSearch">
-      <div class="searBox">
-        <span class="span">月份:</span>
-        <el-date-picker v-model="fromParams.month" type="month" placeholder="请选择月份" />
-      </div>
-      <div class="searBox">
-        <span class="span">部门:</span>
-        <el-tree-select
-          v-model="fromParams.deptId"
-          :data="deptList"
-          :props="defaultProps"
-          check-strictly
-          node-key="id"
-          placeholder="请选择部门"
-        />
-      </div>
-      <div class="searBox">
-        <span class="span">人员:</span>
-        <el-input v-model="fromParams.userName" placeholder="请输入人员名称" />
-      </div>
-      <div class="searBtns">
-        <el-button @click="querysClick" type="primary" style="background: #3485ff">
-          <img src="@/assets/imgs/OA/search.png" class="mr-8px" alt="" />
-          查询</el-button
-        >
-        <el-button type="primary">
-          <img src="@/assets/imgs/OA/open.png" class="mr-8px" alt="" />
-          导出</el-button
-        >
+      <div class="depSearchFlex">
+        <div class="searBox">
+          <span class="span">月份:</span>
+          <el-date-picker v-model="fromParams.month" type="month" placeholder="请选择月份" />
+        </div>
+        <div class="searBox">
+          <span class="span">部门:</span>
+          <el-tree-select
+            v-model="fromParams.deptId"
+            :data="deptList"
+            :props="defaultProps"
+            check-strictly
+            node-key="id"
+            placeholder="请选择部门"
+          />
+        </div>
+        <div class="searBox">
+          <span class="span">人员:</span>
+          <el-input v-model="fromParams.userName" placeholder="请输入人员名称" />
+        </div>
+        <div class="searBtns">
+          <el-button @click="querysClick" type="primary" style="background: #3485ff">
+            <img src="@/assets/imgs/OA/search.png" class="mr-8px" alt="" />
+            查询</el-button
+          >
+          <el-button type="primary">
+            <img src="@/assets/imgs/OA/open.png" class="mr-8px" alt="" />
+            导出</el-button
+          >
+        </div>
       </div>
+
+      <el-popover :width="50">
+        <template #reference>
+          <div class="depStateBox">
+            <p>?</p>
+          </div>
+        </template>
+        <template #default>
+          <div class="depStateContent">
+            <ul class="">
+              <li class="flex" v-for="(l, i) in depStateContentList" :key="i">
+                <div v-if="i == 0" class="flex">
+                  <img src="@/assets/imgs/OA/kq/gouzi.png" alt="" />:
+                  <p>{{ l.name }}</p>
+                </div>
+                <div v-else class="flex">
+                  <h4>{{ l.deps }}:</h4>
+                  <p>{{ l.name }}</p>
+                </div>
+              </li>
+            </ul>
+          </div>
+        </template>
+      </el-popover>
     </div>
     <div class="depTable">
-      <el-table :data="tableData" style="width: 100%">
-        <el-table-column prop="index" label="序号" width="40" />
+      <el-table
+        :data="
+          tableData.slice(
+            (pagesList.pageNo - 1) * pagesList.pageSize,
+            pagesList.pageSize * pagesList.pageNo
+          )
+        "
+        height="620"
+        style="width: 100%"
+        stripe
+      >
+        <!-- <el-table-column type="index" width="50" /> -->
         <el-table-column prop="deptName" label="部门" />
         <el-table-column prop="nickName" label="姓名" width="80" />
         <el-table-column
@@ -42,24 +78,86 @@
           :key="index"
           :label="item.dayOfWeek"
           width="30"
+          :label-class-name="item.isworkday == 1 ? '' : 'workday'"
         >
-          <el-table-column :label="item.day" width="30">
-            <template #default="scope">{{ sco(scope.row, item) }}</template>
+          <el-table-column
+            :label-class-name="item.isworkday == 1 ? '' : 'workday'"
+            :label="item.day"
+            width="30"
+          >
+            <template #default="scope">
+              <div class="iconsFlex" v-if="item.isworkday == 1">
+                <div class="sw">
+                  <img
+                    v-if="sco(scope.row, item, 1) == '1'"
+                    src="@/assets/imgs/OA/kq/gouzi.png"
+                    alt=""
+                  />
+                  <div class="spans" v-else-if="sco(scope.row, item, 1) == '2'"> 迟 </div>
+                  <div class="spans" v-else-if="sco(scope.row, item, 1) == '3'"> 早 </div>
+                  <div class="spans" v-else-if="sco(scope.row, item, 1) == '4'"> 旷 </div>
+                  <div class="spans" v-else-if="sco(scope.row, item, 1) == '5'"> 差 </div>
+                  <div class="spans" v-else-if="sco(scope.row, item, 1) == '6'"> 事 </div>
+                  <div class="spans" v-else-if="sco(scope.row, item, 1) == '7'"> 病 </div>
+                  <div class="spans" v-else-if="sco(scope.row, item, 1) == '8'"> 婚 </div>
+                  <div class="spans" v-else-if="sco(scope.row, item, 1) == '9'"> 产 </div>
+                  <div class="spans" v-else-if="sco(scope.row, item, 1) == '10'"> 陪 </div>
+                  <div class="spans" v-else-if="sco(scope.row, item, 1) == '11'"> 丧 </div>
+                  <div class="spans" v-else-if="sco(scope.row, item, 1) == '12'"> 伤 </div>
+                  <div class="spans" v-else-if="sco(scope.row, item, 1) == '13'"> 年 </div>
+                  <div class="spans" v-else-if="sco(scope.row, item, 1) == '14'"> 调 </div>
+                  <div class="spans" v-else-if="sco(scope.row, item, 1) == '20'"> 他 </div>
+                  <div class="spans" v-else> </div>
+                </div>
+                <div class="xw">
+                  <img
+                    v-if="sco(scope.row, item, 2) == '1'"
+                    src="@/assets/imgs/OA/kq/gouzi.png"
+                    alt=""
+                  />
+                  <div class="spans" v-else-if="sco(scope.row, item, 2) == '2'"> 迟 </div>
+                  <div class="spans" v-else-if="sco(scope.row, item, 2) == '3'"> 早 </div>
+                  <div class="spans" v-else-if="sco(scope.row, item, 2) == '4'"> 旷 </div>
+                  <div class="spans" v-else-if="sco(scope.row, item, 2) == '5'"> 差 </div>
+                  <div class="spans" v-else-if="sco(scope.row, item, 2) == '6'"> 事 </div>
+                  <div class="spans" v-else-if="sco(scope.row, item, 2) == '7'"> 病 </div>
+                  <div class="spans" v-else-if="sco(scope.row, item, 2) == '8'"> 婚 </div>
+                  <div class="spans" v-else-if="sco(scope.row, item, 2) == '9'"> 产 </div>
+                  <div class="spans" v-else-if="sco(scope.row, item, 2) == '10'"> 陪 </div>
+                  <div class="spans" v-else-if="sco(scope.row, item, 2) == '11'"> 丧 </div>
+                  <div class="spans" v-else-if="sco(scope.row, item, 2) == '12'"> 伤 </div>
+                  <div class="spans" v-else-if="sco(scope.row, item, 2) == '13'"> 年 </div>
+                  <div class="spans" v-else-if="sco(scope.row, item, 2) == '14'"> 调 </div>
+                  <div class="spans" v-else-if="sco(scope.row, item, 2) == '20'"> 他 </div>
+                  <div class="spans" v-else> </div>
+                </div>
+              </div>
+            </template>
           </el-table-column>
         </el-table-column>
 
-        <el-table-column prop="1" label="旷工" width="40" label-class-name="labelModeRl" />
-        <el-table-column prop="1" label="迟到" width="40" label-class-name="labelModeRl" />
-        <el-table-column prop="1" label="早退" width="40" label-class-name="labelModeRl" />
-        <el-table-column prop="1" label="出差" width="40" label-class-name="labelModeRl" />
-        <el-table-column prop="1" label="事假" width="40" label-class-name="labelModeRl" />
-        <el-table-column prop="1" label="调休" width="40" label-class-name="labelModeRl" />
-        <el-table-column prop="1" label="病假" width="40" label-class-name="labelModeRl" />
-        <el-table-column prop="1" label="年假" width="40" label-class-name="labelModeRl" />
-        <el-table-column prop="1" label="产假" width="40" label-class-name="labelModeRl" />
-        <el-table-column prop="1" label="其他" width="40" label-class-name="labelModeRl" />
+        <el-table-column prop="kg" label="旷工" width="40" label-class-name="labelModeRl" />
+        <el-table-column prop="cd" label="迟到" width="40" label-class-name="labelModeRl" />
+        <el-table-column prop="zt" label="早退" width="40" label-class-name="labelModeRl" />
+        <el-table-column prop="cc" label="出差" width="40" label-class-name="labelModeRl" />
+        <el-table-column prop="sj" label="事假" width="40" label-class-name="labelModeRl" />
+        <el-table-column prop="tx" label="调休" width="40" label-class-name="labelModeRl" />
+        <el-table-column prop="bj" label="病假" width="40" label-class-name="labelModeRl" />
+        <el-table-column prop="nj" label="年假" width="40" label-class-name="labelModeRl" />
+        <el-table-column prop="cj" label="产假" width="40" label-class-name="labelModeRl" />
+        <el-table-column prop="qt" label="其他" width="40" label-class-name="labelModeRl" />
       </el-table>
     </div>
+    <div class="depPages">
+      <el-pagination
+        :current-page="pagesList.pageNo"
+        :page-size="pagesList.pageSize"
+        background
+        layout="total, prev, pager, next, jumper"
+        :total="pagesList.total"
+        @current-change="handleCurrentChange"
+      />
+    </div>
   </div>
 </template>
 <script setup lang="ts">
@@ -69,6 +167,12 @@ import { defaultProps, handleTree } from '@/utils/tree'
 import * as MineApi from '@/api/oa/attendanceCenter'
 import { isArrayDelOrNickname, allDeptsArr, dayOfWeekCall } from './attendAuth'
 import moment from 'moment'
+import { depsState } from './depsState'
+const pagesList: any = ref({
+  pageNo: 1,
+  pageSize: 12,
+  total: 0
+})
 const fromParams: any = ref({
   deptId: '0a168fe9-2ba8-4302-b6b6-a524c1aef967',
   month: '',
@@ -79,6 +183,15 @@ const tableData = ref([])
 const initTreeDeps = async () => {
   deptList.value = handleTree(await DeptApi.getSimpleDeptList())
 }
+const depStateContentList = ref()
+depStateContentList.value = depsState
+const handleCurrentChange = async (page) => {
+  pagesList.value.pageNo = page
+  let toMoseMonths: any = []
+  toMoseMonths[0] = moment().startOf('months').format('YYYY-MM-DD') + ' 00:00:00'
+  toMoseMonths[1] = moment().endOf('months').format('YYYY-MM-DD') + ' 23:59:59'
+  initInsMouth(toMoseMonths)
+}
 const querysClick = async () => {
   // initInsMouth()
   let month = fromParams.value.month
@@ -89,7 +202,7 @@ const querysClick = async () => {
 }
 const initInsMouth = async (date: any) => {
   let params = {
-    attendanceTime: date, //	考勤时间
+    attendanceDate: date, //	考勤时间
     attendanceStatus: '', //	考勤状态,示例值(2)
     attendanceType: '', //	考勤类型(1:上午;2:下午),示例值(1)
     otherMinute: '', //	其他考勤状态分钟(除了出勤)
@@ -101,28 +214,38 @@ const initInsMouth = async (date: any) => {
       let namesArr: any = isArrayDelOrNickname(JSON.parse(JSON.stringify(res)))
       let resArr: any = res
       resArr.forEach((item: any) => {
-        item.date = moment(item.attendanceTime).format('YYYY-MM-DD')
+        if (item.attendanceTime) {
+          item.date = moment(item.attendanceTime).format('YYYY-MM-DD')
+        } else {
+          item.date = moment(item.attendanceDate).format('YYYY-MM-DD')
+        }
       })
       let arr = allDeptsArr(restall, resArr, namesArr)
       tableData.value = arr
+      pagesList.value.total = arr.length
     })
   })
 }
-const sco = (row, item) => {
-  let swkq = ''
-  let xwkq = ''
-  row.attendArray.forEach((k) => {
-    if (k.date == item.date) {
-      if (k.swAttendanceStatus) {
-        swkq = k.swAttendanceStatus
+const sco = (row, item, index) => {
+  let kq = ''
+  if (index == 1) {
+    row.attendArray.forEach((k) => {
+      if (k.date == item.date) {
+        if (k.swAttendanceStatus) {
+          kq = k.swAttendanceStatus
+        }
       }
-      if (k.xwAttendanceStatus) {
-        xwkq = k.xwAttendanceStatus
+    })
+  } else {
+    row.attendArray.forEach((k) => {
+      if (k.date == item.date) {
+        if (k.xwAttendanceStatus) {
+          kq = k.xwAttendanceStatus
+        }
       }
-    }
-  })
-
-  return swkq + '' + xwkq
+    })
+  }
+  return kq
 }
 const tableHeadList: any = ref([])
 const initWorkDay = async (date: any) => {
@@ -166,6 +289,7 @@ onMounted(() => {
   border-radius: 10px;
   margin-top: 15px;
   padding: 15px 30px;
+  position: relative;
   h1 {
     font-size: 20px;
     color: #121518;
@@ -176,34 +300,129 @@ onMounted(() => {
     width: 100%;
     display: flex;
     align-items: center;
+    justify-content: space-between;
     margin-bottom: 20px;
-    .searBox {
+    .depSearchFlex {
       display: flex;
       align-items: center;
-      margin-right: 25px;
-      .span {
-        white-space: nowrap;
+      .searBox {
+        display: flex;
+        align-items: center;
+        margin-right: 25px;
+        .span {
+          white-space: nowrap;
+          font-size: 16px;
+        }
+      }
+    }
+
+    .depStateBox {
+      width: 30px;
+      height: 30px;
+      border: 2px solid #e1e4ea;
+      border-radius: 50%;
+      display: flex;
+      align-items: center;
+      justify-content: center;
+      cursor: pointer;
+      p {
+        color: #e1e4ea;
         font-size: 16px;
+        font-weight: 600;
       }
     }
   }
+
   .depTable {
     width: 100%;
-    height: calc(100% - 100px);
-    overflow-y: auto;
+    height: calc(100% - 140px);
+  }
+  .depPages {
+    position: absolute;
+    right: 30px;
+    bottom: 10px;
   }
 }
 
 :deep(.depTable) {
   .el-table {
+    .workDayClass {
+      color: pink;
+    }
+    .is-group {
+      height: 80px;
+      tr {
+        background-color: #edf2fc;
+        th {
+          background-color: #edf2fc;
+          border-color: #fff;
+          color: #4c525b;
+        }
+      }
+    }
     .cell {
-      font-size: 14px !important;
+      font-size: 16px !important;
       padding: 0 !important;
       text-align: center;
+      width: 100%;
+      height: 100%;
+    }
+    .el-table__cell {
+      padding: 0px 0;
+    }
+
+    .el-table__body-wrapper {
+      tr {
+        td {
+          border: 0;
+        }
+      }
+      .el-table__row--striped {
+        td {
+          background-color: #e1e4ea;
+        }
+      }
+    }
+
+    .iconsFlex {
+      width: 100%;
+      height: 100%;
+      display: flex;
+      align-items: center;
+      flex-wrap: wrap;
+      .spans {
+        width: 100%;
+        height: 100%;
+        color: #f23c3c;
+        font-size: 14px !important;
+        font-weight: 800;
+        cursor: pointer;
+        user-select: none;
+      }
+
+      .sw {
+        width: 100%;
+        height: 50%;
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        user-select: none;
+      }
+      .xw {
+        width: 100%;
+        height: 50%;
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        user-select: none;
+      }
     }
   }
   .labelModeRl {
     writing-mode: vertical-rl;
   }
 }
+:deep(.workday) {
+  color: #989fa8 !important;
+}
 </style>

+ 88 - 0
client/src/views/OaSystem/attendanceCenter/depsState.ts

@@ -0,0 +1,88 @@
+import { DICT_TYPE, getDictOptions } from '@/utils/dict'
+let dictAttendAll: any = ref(getDictOptions(DICT_TYPE.ADM_ATTENDANCE_STATUS))
+dictAttendAll = JSON.parse(JSON.stringify(dictAttendAll))._value
+export const depsState = [
+  {
+    name: '出勤',
+    deps: '出勤',
+    value: ''
+  },
+  {
+    name: '迟到',
+    deps: '迟',
+    value: ''
+  },
+  {
+    name: '早退',
+    deps: '早',
+    value: ''
+  },
+  {
+    name: '旷工',
+    deps: '旷',
+    value: ''
+  },
+  {
+    name: '出差',
+    deps: '差',
+    value: ''
+  },
+  {
+    name: '事假',
+    deps: '事',
+    value: ''
+  },
+  {
+    name: '病假',
+    deps: '病',
+    value: ''
+  },
+  {
+    name: '婚假',
+    deps: '婚',
+    value: ''
+  },
+  {
+    name: '产假',
+    deps: '产',
+    value: ''
+  },
+  {
+    name: '陪产假',
+    deps: '陪',
+    value: ''
+  },
+  {
+    name: '丧假',
+    deps: '丧',
+    value: ''
+  },
+  {
+    name: '工伤',
+    deps: '伤',
+    value: ''
+  },
+  {
+    name: '年假',
+    deps: '年',
+    value: ''
+  },
+  {
+    name: '调休',
+    deps: '调',
+    value: ''
+  },
+  {
+    name: '其他',
+    deps: '他',
+    value: ''
+  }
+]
+
+for (let i = 0; i < depsState.length; i++) {
+  for (let j = 0; j < dictAttendAll.length; j++) {
+    if (depsState[i].name == dictAttendAll[j].label) {
+      depsState[i].value = dictAttendAll[j].value
+    }
+  }
+}

+ 113 - 73
client/src/views/OaSystem/attendanceCenter/mine.vue

@@ -16,30 +16,51 @@
             <div class="calendarContentBox">
               <li v-for="(item, index) in allTimeList1" :key="index">
                 <div v-if="data.day == item.date">
-                  <div v-if="item.state">
-                    <p class="pA1" :style="{ color: item.state == '正常' ? '#2E77E6' : 'red' }">
-                      {{ data.day.split('-').slice(2).join('-') }}
-                    </p>
-                    <p class="pA2" :style="{ color: item.state == '正常' ? '#2E77E6' : 'red' }">
-                      {{ item.state }}
-                    </p>
+                  <div v-if="item.state && item.attendanceTime">
+                    <div v-if="item.isworkday == 1">
+                      <p class="pA1" :style="{ color: item.state == '正常' ? '#2E77E6' : 'red' }">
+                        {{ data.day.split('-').slice(2).join('-') }}
+                      </p>
+                      <p class="pA2" :style="{ color: item.state == '正常' ? '#2E77E6' : 'red' }">
+                        {{ item.state }}
+                      </p>
+                    </div>
+                    <div v-else>
+                      <p class="pA1" :style="{ color: '#2E77E6' }">
+                        {{ data.day.split('-').slice(2).join('-') }}
+                      </p>
+                      <p class="pA2" :style="{ color: '#2E77E6' }">
+                        {{ '假期' }}
+                      </p>
+                    </div>
                   </div>
                   <div v-else>
-                    <p class="pA1" :style="{ color: item.isworkday == 1 ? '' : '#a8abb2' }">
-                      {{ data.day.split('-').slice(2).join('-') }}
-                    </p>
-                    <p
-                      class="pA2"
-                      v-if="item.holidayRemark"
-                      :style="{ color: item.isworkday == 1 ? '' : '#a8abb2' }"
-                      >{{ item.holidayRemark }}</p
-                    >
-                    <p
-                      class="pA2"
-                      v-else
-                      :style="{ color: item.isworkday == 1 ? '' : '#a8abb2' }"
-                      >{{ item.isworkday == 1 ? '工作日' : '假期' }}</p
-                    >
+                    <div v-if="item.state && item.isworkday == 1">
+                      <p class="pA1" :style="{ color: 'red' }">
+                        {{ data.day.split('-').slice(2).join('-') }}
+                      </p>
+                      <p class="pA2" v-if="item.holidayRemark" :style="{ color: 'red' }">{{
+                        item.holidayRemark
+                      }}</p>
+                      <p class="pA2" v-else :style="{ color: 'red' }">{{ '异常' }}</p>
+                    </div>
+                    <div v-else>
+                      <p class="pA1" :style="{ color: item.isworkday == 1 ? '' : '#a8abb2' }">
+                        {{ data.day.split('-').slice(2).join('-') }}
+                      </p>
+                      <p
+                        class="pA2"
+                        v-if="item.holidayRemark"
+                        :style="{ color: item.isworkday == 1 ? '' : '#a8abb2' }"
+                        >{{ item.holidayRemark }}</p
+                      >
+                      <p
+                        class="pA2"
+                        v-else
+                        :style="{ color: item.isworkday == 1 ? '' : '#a8abb2' }"
+                        >{{ item.isworkday == 1 ? '工作日' : '假期' }}</p
+                      >
+                    </div>
                   </div>
                 </div>
               </li>
@@ -84,9 +105,15 @@
                 <img :src="getAssetURL(item.icon)" />
                 <p>{{ item.name }}</p>
               </div>
-              <h4 :style="{ color: item.value == '迟到' || item.value == '早退' ? 'red' : '' }">{{
-                item.value
-              }}</h4>
+              <h4
+                :style="{
+                  color:
+                    item.value == '迟到' || (item.value == '早退' && item.value) || '旷工'
+                      ? 'red'
+                      : ''
+                }"
+                >{{ item.value }}</h4
+              >
             </div>
             <div class="li-bom-box" v-else>
               <div class="liLeft">
@@ -233,45 +260,49 @@ const attendState: any = ref(moment().format('YYYY年MM月DD日'))
 const calendarModel: any = ref('')
 const initAjax = async (date: String) => {
   let params = {
-    attendanceTime: date, //	考勤时间
+    attendanceDate: date, //	考勤时间
     attendanceStatus: '', //	考勤状态,示例值(2)
     attendanceType: '', //	考勤类型(1:上午;2:下午),示例值(1)
     otherMinute: '' //	其他考勤状态分钟(除了出勤)
   }
-  const res = await MineApi.getAttendanceSheetListMine(params)
 
-  if (res.length > 0) {
-    let arr = res
-    arr.forEach((item: any) => {
-      item.date = moment(item.attendanceTime).format('YYYY-MM-DD')
-      item.attendanceTime = formatDate(item.attendanceTime, 'HH:mm')
-    })
-    for (let i = 0; i < arr.length; i++) {
-      if (arr[i].attendanceType == 1) {
-        attendSteList.value[0].value = isAttendNormal(arr[i])
-      }
-      if (arr[i].attendanceType == 2) {
-        attendSteList.value[1].value = isAttendNormal(arr[i])
+  initWorkDay(date).then((restall) => {
+    MineApi.getAttendanceSheetListMine(params).then((res) => {
+      if (res.length > 0) {
+        let arr = res
+        arr.forEach((item: any) => {
+          item.date = moment(item.attendanceTime).format('YYYY-MM-DD')
+          item.attendanceTime = formatDate(item.attendanceTime, 'HH:mm')
+        })
+
+        for (let i = 0; i < arr.length; i++) {
+          if (arr[i].attendanceType == 1) {
+            attendSteList.value[0].value = isAttendNormal(arr[i], restall)
+          }
+          if (arr[i].attendanceType == 2) {
+            attendSteList.value[1].value = isAttendNormal(arr[i], restall)
+          }
+        }
+        if (res.length > 1) {
+          attendSteList.value[2].value = arr[1].attendanceTime || ''
+          attendSteList.value[3].value = arr[0].attendanceTime || ''
+        } else {
+          attendSteList.value[2].value = arr[0].attendanceTime || ''
+          attendSteList.value[3].value = ''
+          attendSteList.value[1].value = '未获取'
+        }
+      } else {
+        attendSteList.value[0].value = '未获取'
+        attendSteList.value[1].value = '未获取'
+        attendSteList.value[2].value = ''
+        attendSteList.value[3].value = ''
       }
-    }
-    if (res.length > 1) {
-      attendSteList.value[2].value = arr[1].attendanceTime || ''
-      attendSteList.value[3].value = arr[0].attendanceTime || ''
-    } else {
-      attendSteList.value[2].value = arr[0].attendanceTime || ''
-      attendSteList.value[3].value = ''
-      attendSteList.value[1].value = '未获取'
-    }
-  } else {
-    attendSteList.value[0].value = '未获取'
-    attendSteList.value[1].value = '未获取'
-    attendSteList.value[2].value = ''
-    attendSteList.value[3].value = ''
-  }
+    })
+  })
 }
 const initAllData = async (date: any) => {
   let params = {
-    attendanceTime: date, //	考勤时间
+    attendanceDate: date, //	考勤时间
     attendanceStatus: '', //	考勤状态,示例值(2)
     attendanceType: '', //	考勤类型(1:上午;2:下午),示例值(1)
     otherMinute: '' //	其他考勤状态分钟(除了出勤)
@@ -283,13 +314,13 @@ const initAllData = async (date: any) => {
         let newArr: any = []
         let setArr: any = res
         arr.forEach((item: any) => {
-          item.date = moment(item.attendanceTime).format('YYYY-MM-DD')
+          item.date = moment(item.attendanceDate).format('YYYY-MM-DD')
           if (item.attendanceStatus != 1) {
             newArr.push(item)
           }
         })
         setArr.forEach((item: any) => {
-          item.date = moment(item.attendanceTime).format('YYYY-MM-DD')
+          item.date = moment(item.attendanceDate).format('YYYY-MM-DD')
         })
         setArr = isArrayDelRepeat(setArr)
         newArr = isArrayDelRepeat(newArr)
@@ -328,7 +359,7 @@ const initWorkDay = async (date: any) => {
 
 const initToMonths = async (date: any) => {
   let params = {
-    attendanceTime: date, //	考勤时间
+    attendanceDate: date, //	考勤时间
     attendanceStatus: '', //	考勤状态,示例值(2)
     attendanceType: '', //	考勤类型(1:上午;2:下午),示例值(1)
     otherMinute: '' //	其他考勤状态分钟(除了出勤)
@@ -352,13 +383,14 @@ const initToMonths = async (date: any) => {
         let newArr: any = []
         let setArr: any = res
         arr.forEach((item: any) => {
-          item.date = moment(item.attendanceTime).format('YYYY-MM-DD')
+          item.date = moment(item.attendanceDate).format('YYYY-MM-DD')
           if (item.attendanceStatus != 1) {
             newArr.push(item)
           }
         })
+
         setArr.forEach((item: any) => {
-          item.date = moment(item.attendanceTime).format('YYYY-MM-DD')
+          item.date = moment(item.attendanceDate).format('YYYY-MM-DD')
         })
         setArr = isArrayDelRepeat(setArr)
         newArr = isArrayDelRepeat(newArr)
@@ -370,19 +402,27 @@ const initToMonths = async (date: any) => {
             }
           }
         }
-
-        setArr.forEach((item) => {
-          yicq += 1
-          if (item.attendanceStatus == 5) {
-            cz += 1
-          } else if (item.attendanceStatus == 2) {
-            cd += 1
-          } else if (item.attendanceStatus == 3) {
-            zt += 1
-          } else if (item.attendanceStatus == 4) {
-            kg += 1
-          }
+        restall.forEach((l) => {
+          setArr.forEach((item) => {
+            if (l.date == item.date) {
+              if (l.isworkday == 1) {
+                if (item.attendanceStatus == 1) {
+                  yicq += 1
+                }
+                if (item.attendanceStatus == 5) {
+                  cz += 1
+                } else if (item.attendanceStatus == 2) {
+                  cd += 1
+                } else if (item.attendanceStatus == 3) {
+                  zt += 1
+                } else if (item.attendanceStatus == 4) {
+                  kg += 1
+                }
+              }
+            }
+          })
         })
+
         calendInfoList.value[1].value = yicq
         calendInfoList.value[2].value = cz
         calendInfoList.value[3].value = cd
@@ -725,7 +765,7 @@ h1 {
         }
 
         .pA1 {
-          font-size: 14px;
+          font-size: 16px;
         }
         .pA2 {
           font-size: 12px;

+ 2 - 2
client/src/views/OaSystem/oaLayout/weather.vue

@@ -3,9 +3,9 @@
     <div class="tqBox">
       <img :src="getAssetsFile(iconPath)" alt="" />
       <div>
-        <div class="day">{{ moment().format('DD') }}</div>
+        <div class="day">{{ temperature }}</div>
         <div>
-          <p>/{{ temperature }}℃</p>
+          <p>℃</p>
           <p>{{ weather }}</p>
         </div>
       </div>