Pārlūkot izejas kodu

Merge branch 'master' of http://114.55.67.98:8070/Natural_p1/zjugis_OA

songxy 1 gadu atpakaļ
vecāks
revīzija
5fd717a26f

+ 1 - 0
client/package.json

@@ -58,6 +58,7 @@
     "nprogress": "^0.2.0",
     "pinia": "^2.1.6",
     "qrcode": "^1.5.3",
+    "js-cookie": "^2.2.0",
     "qs": "^6.11.2",
     "steady-xml": "^0.1.0",
     "tinymce": "^5.10.2",

BIN
client/src/assets/imgs/OA/offLogin.png


BIN
client/src/assets/imgs/OA/xxts.png


+ 2 - 1
client/src/utils/auth.ts

@@ -60,7 +60,8 @@ export const setLoginForm = (loginForm: LoginFormType) => {
 export const getAssetURL = (image: string) => {
   // 参数一: 相对路径
   // 参数二: 当前路径的URL
-  return new URL(`${image}`, 'http://localhost/src/assets/imgs/OA/').href + '.png'
+  const url = window.location.origin
+  return new URL(`${image}`, url + '/src/assets/imgs/OA/').href + '.png'
 }
 export const removeLoginForm = () => {
   wsCache.delete(LoginFormKey)

+ 60 - 3
client/src/views/OaSystem/attendanceCenter/attendAuth.ts

@@ -77,6 +77,37 @@ export function allArrayCalendar(workArr: any, dateArr: any) {
   return workArr
 }
 
+/**
+ * 星期汉字转换
+ */
+export function dayOfWeekCall(index: any) {
+  let name = ''
+  switch (index) {
+    case 1:
+      name = '一'
+      break
+    case 2:
+      name = '二'
+      break
+    case 3:
+      name = '三'
+      break
+    case 4:
+      name = '四'
+      break
+    case 5:
+      name = '五'
+      break
+    case 6:
+      name = '六'
+      break
+    default:
+      name = '日'
+      break
+  }
+  return name
+}
+
 /**
  * 返回部门数组
  */
@@ -100,15 +131,41 @@ export function allDeptsArr(workArr: any, dateArr: any, namesArr: any) {
       deptId: item.deptId,
       userId: item.userId,
       username: item.username,
-      attendArray: { monthArr }
+      attendArray: [...monthArr]
     }
     userList.push(obj)
   })
+  console.log(userList)
+
   userList.forEach((item) => {
-    dateArr.forEach((l) => {
-      if (item.date == l.date) {
+    item.attendArray.forEach((k) => {
+      const obj: any = {
+        swkq: '',
+        swAttendanceStatus: '',
+        xwkq: '',
+        xwAttendanceStatus: ''
       }
+      dateArr.forEach((l) => {
+        if (k.date === l.date) {
+          if (item.nickName === l.nickname) {
+            if (l.attendanceType === 1) {
+              obj.swKq = moment(l.attendanceTime).format('HH:mm')
+              obj.swAttendanceStatus = l.attendanceStatus
+            }
+            if (l.attendanceType === 2) {
+              obj.xwKq = moment(l.attendanceTime).format('HH:mm')
+              obj.xwAttendanceStatus = l.attendanceStatus
+            }
+          }
+        }
+      })
+      k.swkq = obj.swkq
+      k.swAttendanceStatus = obj.swAttendanceStatus
+      k.xwkq = obj.xwkq
+      k.xwAttendanceStatus = obj.xwAttendanceStatus
     })
   })
   console.log(userList)
+
+  return userList
 }

+ 66 - 45
client/src/views/OaSystem/attendanceCenter/dep.vue

@@ -2,6 +2,10 @@
   <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
@@ -13,10 +17,6 @@
           placeholder="请选择部门"
         />
       </div>
-      <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-input v-model="fromParams.userName" placeholder="请输入人员名称" />
@@ -34,29 +34,30 @@
     </div>
     <div class="depTable">
       <el-table :data="tableData" style="width: 100%">
-        <el-table-column prop="index" label="序号" width="80" />
-        <el-table-column prop="dep" label="部门" />
-        <el-table-column prop="name" label="姓名" />
-        <!-- <el-table-column label="Delivery Info">
-          <el-table-column prop="name" label="Name" width="120" />
-          <el-table-column label="Address Info">
-            <el-table-column prop="state" label="State" width="120" />
-            <el-table-column prop="city" label="City" width="120" />
-            <el-table-column prop="address" label="Address" />
-            <el-table-column prop="zip" label="Zip" width="120" />
+        <el-table-column prop="index" label="序号" width="40" />
+        <el-table-column prop="deptName" label="部门" />
+        <el-table-column prop="nickName" label="姓名" width="80" />
+        <el-table-column
+          v-for="(item, index) in tableHeadList"
+          :key="index"
+          :label="item.dayOfWeek"
+          width="30"
+        >
+          <el-table-column :label="item.day" width="30">
+            <template #default="scope">{{ sco(scope.row, item) }}</template>
           </el-table-column>
-        </el-table-column> -->
+        </el-table-column>
 
-        <el-table-column prop="1" label="旷工" />
-        <el-table-column prop="1" label="迟到" />
-        <el-table-column prop="1" label="早退" />
-        <el-table-column prop="1" label="出差" />
-        <el-table-column prop="1" label="事假" />
-        <el-table-column prop="1" label="调休" />
-        <el-table-column prop="1" label="病假" />
-        <el-table-column prop="1" label="年假" />
-        <el-table-column prop="1" label="产假" />
-        <el-table-column prop="1" label="其他" />
+        <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>
     </div>
   </div>
@@ -66,30 +67,15 @@ defineOptions({ name: 'AttendanceDep' })
 import * as DeptApi from '@/api/system/dept'
 import { defaultProps, handleTree } from '@/utils/tree'
 import * as MineApi from '@/api/oa/attendanceCenter'
-import {
-  isAttendNormal,
-  isArrayDelRepeat,
-  allArrayCalendar,
-  isArrayDelOrNickname,
-  allDeptsArr
-} from './attendAuth'
+import { isArrayDelOrNickname, allDeptsArr, dayOfWeekCall } from './attendAuth'
 import moment from 'moment'
 const fromParams: any = ref({
-  deptId: '',
+  deptId: '0a168fe9-2ba8-4302-b6b6-a524c1aef967',
   month: '',
   userName: ''
 })
 const deptList = ref<Tree[]>([]) // 树形结构
-const tableData = ref([
-  {
-    date: '2016-05-03',
-    name: 'Tom',
-    state: 'California',
-    city: 'Los Angeles',
-    address: 'No. 189, Grove St, Los Angeles',
-    zip: 'CA 90036'
-  }
-])
+const tableData = ref([])
 const initTreeDeps = async () => {
   deptList.value = handleTree(await DeptApi.getSimpleDeptList())
 }
@@ -112,16 +98,33 @@ const initInsMouth = async (date: any) => {
   }
   initWorkDay(date).then((restall) => {
     MineApi.getWorkdaySheetList(params).then((res) => {
-      let namesArr: any = isArrayDelOrNickname(res)
+      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')
       })
       let arr = allDeptsArr(restall, resArr, namesArr)
-      // console.log(arr)
+      tableData.value = arr
     })
   })
 }
+const sco = (row, item) => {
+  let swkq = ''
+  let xwkq = ''
+  row.attendArray.forEach((k) => {
+    if (k.date == item.date) {
+      if (k.swAttendanceStatus) {
+        swkq = k.swAttendanceStatus
+      }
+      if (k.xwAttendanceStatus) {
+        xwkq = k.xwAttendanceStatus
+      }
+    }
+  })
+
+  return swkq + '' + xwkq
+}
+const tableHeadList: any = ref([])
 const initWorkDay = async (date: any) => {
   let params = {
     dateDay: date, //		日期(数组)
@@ -136,7 +139,11 @@ const initWorkDay = async (date: any) => {
   let arr = res
   arr.forEach((item: any) => {
     item.date = moment(item.dateDay).format('YYYY-MM-DD')
+    item.prop = item.dayOfWeek
+    item.dayOfWeek = dayOfWeekCall(item.dayOfWeek)
+    item.day = moment(item.dateDay).format('DD')
   })
+  tableHeadList.value = arr
 
   return await arr
 }
@@ -183,6 +190,20 @@ onMounted(() => {
   .depTable {
     width: 100%;
     height: calc(100% - 100px);
+    overflow-y: auto;
+  }
+}
+
+:deep(.depTable) {
+  .el-table {
+    .cell {
+      font-size: 14px !important;
+      padding: 0 !important;
+      text-align: center;
+    }
+  }
+  .labelModeRl {
+    writing-mode: vertical-rl;
   }
 }
 </style>

+ 47 - 0
client/src/views/OaSystem/oaLayout/header.vue

@@ -6,16 +6,51 @@
     </div>
     <div class="header-right">
       <Weather />
+      <div class="hx"></div>
+      <div class="message">
+        <el-badge :value="3" class="item">
+          <img src="@/assets/imgs/OA/xxts.png" alt="" />
+        </el-badge>
+      </div>
+      <div class="offLogin" @click="offClick">
+        <img src="@/assets/imgs/OA/offLogin.png" alt="" />
+      </div>
     </div>
   </div>
 </template>
 <script setup lang="ts">
+import { ElMessageBox } from 'element-plus'
 import { useAppStore } from '@/store/modules/app'
+import { useUserStore } from '@/store/modules/user'
+import Cookies from 'js-cookie'
 import Weather from './weather.vue'
+const { replace } = useRouter()
+import { useTagsViewStore } from '@/store/modules/tagsView'
 defineOptions({ name: 'Header' })
 const appStore = useAppStore()
 const titleName = ref(appStore.title)
+const userStore = useUserStore()
+const tagsViewStore = useTagsViewStore()
+const offClick = () => {
+  ElMessageBox.confirm('清除缓存并退出登录?', '警告', {
+    confirmButtonText: '确定',
+    cancelButtonText: '取消',
+    type: 'warning'
+  }).then(async () => {
+    await userStore.loginOut()
+    tagsViewStore.delAllViews()
+    removeCokLog()
+    replace('/login?redirect=/home')
+  })
+}
 
+const removeCokLog = () => {
+  var cookiesAll = document.cookie.split(';')
+  for (var i = 0; i < cookiesAll.length; i++) {
+    console.log(cookiesAll[i])
+    Cookies.remove(cookiesAll[i])
+  }
+}
 /** 初始化 **/
 onMounted(() => {})
 </script>
@@ -43,10 +78,22 @@ onMounted(() => {})
       font-family: AlibabaPuHuiTiB;
     }
   }
+  .offLogin {
+    cursor: pointer;
+  }
   .header-right {
     display: flex;
     align-items: center;
     height: 100%;
+    .hx {
+      width: 1px;
+      height: 30px;
+      background-color: #ccd4dd;
+      margin: 0 30px;
+    }
+    .message {
+      margin-right: 30px;
+    }
   }
 }
 </style>

+ 0 - 2
client/src/views/OaSystem/oaLayout/tagList.vue

@@ -170,8 +170,6 @@ const tagsHomeClick = () => {}
 const addTags = () => {
   const { name } = unref(currentRoute)
   if (name) {
-    console.log(name)
-
     selectedTag.value = unref(currentRoute)
     tagsViewStore.addView(unref(currentRoute))
   }