Browse Source

港大打卡改造-首页打卡

zhonghuizhen 1 tháng trước cách đây
mục cha
commit
20d2790e78

+ 24 - 0
src/api/business/attendance.js

@@ -132,3 +132,27 @@ export function queryAttendanceStatData (data) {
       data
       data
   })
   })
 }
 }
+
+/**
+ * 修改上下班时间
+ * @param {*} params
+ */
+export function gdUpdateAttendce (data) {
+  return request({
+      url: BUSINESS_BASE_URL() + '/employee/attendanceDetail/gdUpdateAttendce',
+      method: 'post',
+      data
+  })
+}
+
+/**
+ * 港大打卡
+ * @param {*} params
+ */
+export function gdClockIn (data) {
+  return request({
+      url: BUSINESS_BASE_URL() + '/employee/attendanceDetail/gdClockIn',
+      method: 'post',
+      data
+  })
+}

+ 17 - 4
src/views/business/attendance/dakaDialog.vue

@@ -1,6 +1,6 @@
 <template>
 <template>
   <el-dialog
   <el-dialog
-    :visible.sync="visible"
+    :visible.sync="dialogVisible"
     title="选择打卡班次"
     title="选择打卡班次"
     width="400px"
     width="400px"
     @close="handleClose"
     @close="handleClose"
@@ -18,7 +18,7 @@
       </el-radio-group>
       </el-radio-group>
     </div>
     </div>
     <span slot="footer" class="dialog-footer">
     <span slot="footer" class="dialog-footer">
-      <el-button @click="visible = false">取消</el-button>
+      <el-button @click="handleCancel">取消</el-button>
       <el-button type="primary" @click="handleConfirm">确定</el-button>
       <el-button type="primary" @click="handleConfirm">确定</el-button>
     </span>
     </span>
   </el-dialog>
   </el-dialog>
@@ -48,6 +48,16 @@ export default {
       }
       }
     }
     }
   },
   },
+  computed: {
+    dialogVisible: {
+      get() {
+        return this.visible
+      },
+      set(val) {
+        this.$emit('update:visible', val)
+      }
+    }
+  },
   methods: {
   methods: {
     handleConfirm() {
     handleConfirm() {
       if (!this.selectedValue) {
       if (!this.selectedValue) {
@@ -55,11 +65,14 @@ export default {
         return
         return
       }
       }
       this.$emit('confirm', this.selectedValue)
       this.$emit('confirm', this.selectedValue)
-      this.visible = false
+      this.dialogVisible = false
     },
     },
     handleClose() {
     handleClose() {
       this.$emit('close')
       this.$emit('close')
-    }
+    },
+    handleCancel() {
+      this.dialogVisible = false
+    },
   }
   }
 }
 }
 </script>
 </script>

+ 30 - 0
src/views/system/dashboard/components/util.js

@@ -29,6 +29,9 @@ import dayjs from 'dayjs'
 import { scheduleType } from '@/views/constants/schedule'
 import { scheduleType } from '@/views/constants/schedule'
 import { attendanceDetailClockIn } from '@/api/business/attendance'
 import { attendanceDetailClockIn } from '@/api/business/attendance'
 import { lifeTimeData } from '@/views/business/deviceManagement/constants/simulated'
 import { lifeTimeData } from '@/views/business/deviceManagement/constants/simulated'
+import {
+  queryScheduleConfigItem
+} from '@/api/business/schedule'
 
 
 /**
 /**
  * 创建组件
  * 创建组件
@@ -897,6 +900,33 @@ export function buildComponent(name, column, preview, vm) {
           const timeDifference = endTime - startTime
           const timeDifference = endTime - startTime
           return timeDifference / (1000 * 60)
           return timeDifference / (1000 * 60)
         },
         },
+        // 港大新首页打卡处理逻辑
+        handleClockFromTabNew() {
+          const { userInfo } = this.$store.getters || {}
+          const buMen = userInfo.mainPosition?.id || ''
+          const params = {
+              "pageNo": 1,
+              "limit": 50,
+              "param": {
+                  "buMen": buMen,
+                  "shengXiaoBiaoZhi":"Y"
+              }
+          }
+          //获取当前用户所在部门的班次信息
+          queryScheduleConfigItem(params)
+          .then((res) => {
+            const data = res.data.dataResult || []
+            if (data.length > 0) { 
+              this.$emit('action-event', 'daka', data)
+            } else {
+              this.$message.warning('您所在部门目前没有配置班次,无法打卡')
+            }
+          })
+          .catch(() => {
+            console.log('获取班次信息失败')
+          })
+        },
+
         // 首页打卡处理逻辑
         // 首页打卡处理逻辑
         handleClockFromTab(todaySchedule) {
         handleClockFromTab(todaySchedule) {
           const today = this.$common.getDateNow()
           const today = this.$common.getDateNow()

+ 17 - 1
src/views/system/dashboard/templates/userInfoTab.vue

@@ -45,6 +45,7 @@
               >
               >
             </div>
             </div>
             <div style="display: flex; align-items: center; flex-wrap: wrap">
             <div style="display: flex; align-items: center; flex-wrap: wrap">
+              <!--
               <template v-if="todaySchedule.length">
               <template v-if="todaySchedule.length">
                 <span style="flex-shrink: 0">今日班次:</span>
                 <span style="flex-shrink: 0">今日班次:</span>
                 <el-tag
                 <el-tag
@@ -59,7 +60,7 @@
               <span v-else style="text-overflow: ellipsis; width: 190px"
               <span v-else style="text-overflow: ellipsis; width: 190px"
                 >今日无排班,祝您休息愉快!</span
                 >今日无排班,祝您休息愉快!</span
               >
               >
-              <!--<a style="color: #409eff;" @click="showMySchedule">我的排班</a>-->
+              <a style="color: #409eff;" @click="showMySchedule">我的排班</a>-->
               <el-button
               <el-button
                 type="primary"
                 type="primary"
                 size="mini"
                 size="mini"
@@ -75,6 +76,21 @@
                 ><i class="el-icon-date" style="margin-right: 3px"></i
                 ><i class="el-icon-date" style="margin-right: 3px"></i
                 >我的排班</el-button
                 >我的排班</el-button
               >
               >
+              <el-button
+                type="primary"
+                size="mini"
+                @click="showMySchedule"
+                style="
+                  display: flex;
+                  align-items: center;
+                  height: 20px;
+                  padding: 0 5px;
+                  line-height: 19px;
+                  margin-left: 4px;
+                "
+                ><i class="el-icon-date" style="margin-right: 3px"></i
+                >我的打卡记录</el-button
+              >
               <el-button
               <el-button
                 type="primary"
                 type="primary"
                 size="mini"
                 size="mini"

+ 35 - 3
src/views/system/homepage/index.vue

@@ -197,6 +197,7 @@ import mySchedule from './components/mySchedule.vue'
 import makeUpEdit from '@/views/business/attendance/makeUpEdit.vue'
 import makeUpEdit from '@/views/business/attendance/makeUpEdit.vue'
 import dakaDialog from '@/views/business/attendance/dakaDialog.vue'
 import dakaDialog from '@/views/business/attendance/dakaDialog.vue'
 import { attendanceDetailClockIn } from '@/api/business/attendance'
 import { attendanceDetailClockIn } from '@/api/business/attendance'
+import { gdClockIn } from '@/api/business/attendance'
 
 
 const _import = require('@/utils/util.import.' + process.env.NODE_ENV)
 const _import = require('@/utils/util.import.' + process.env.NODE_ENV)
 export default {
 export default {
@@ -279,7 +280,8 @@ export default {
       makeUpEditVisible: false,
       makeUpEditVisible: false,
       dakaDialogVisible: false,
       dakaDialogVisible: false,
       dakaArr: [],
       dakaArr: [],
-      tempSelectedValue: ''
+      tempSelectedValue: '',
+      ScheduleConfigItem: {}, //港大班次配置
     }
     }
   },
   },
   computed: {
   computed: {
@@ -825,6 +827,29 @@ export default {
       this.scheduleConfig = data
       this.scheduleConfig = data
       this.$refs.schedule.openDialog()
       this.$refs.schedule.openDialog()
     },
     },
+    dakaSingle(selectedValue) {
+      const selectedpaiban = this.ScheduleConfigItem.find(item => item.paiBanLeiXing === selectedValue)
+      const { userId,userInfo } = this.$store.getters || {}
+      const buMen = userInfo.mainPosition?.id || ''
+      const params = {
+          "yongHuId": userId,
+          "paiBanMingChen": selectedpaiban.peiZhiMingChen,
+          "banCiMing": selectedpaiban.paiBanLeiXing,
+          "buMen": buMen
+      }
+      gdClockIn(params)
+          .then((res) => {
+            if (res.state == 200) { 
+              this.$message.success('打卡成功')
+            }else{
+              this.$message.warning('打卡失败')
+            }
+          })
+          .catch(() => {
+            this.$message.warning('打卡异常')
+          })
+    },
+    /*
     dakaSingle(selectedValue) {
     dakaSingle(selectedValue) {
       const today = this.$common.getDateNow()
       const today = this.$common.getDateNow()
       const { first, second } = this.$store.getters.level || {}
       const { first, second } = this.$store.getters.level || {}
@@ -848,14 +873,21 @@ export default {
             })
             })
         })
         })
         
         
-    },
+    },*/
     handleDakaConfirm(selectedValue) {
     handleDakaConfirm(selectedValue) {
       this.dakaSingle(selectedValue)
       this.dakaSingle(selectedValue)
     },
     },
     handleDakaDialog(data) {
     handleDakaDialog(data) {
-      this.dakaArr = data
+      const types = data.map(item => item.paiBanLeiXing)   // 班次类型
+      this.dakaArr = types
+      this.ScheduleConfigItem = data
       this.dakaDialogVisible = true
       this.dakaDialogVisible = true
     }
     }
+    /*
+    handleDakaDialog(data) {
+      this.dakaArr = data
+      this.dakaDialogVisible = true
+    }*/
   }
   }
 }
 }
 </script>
 </script>