From 8fc1138d2f2115121fd15b679ca1a20fc2ba838a Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期四, 02 四月 2026 13:37:40 +0800
Subject: [PATCH] 绩效管理:工时汇总对接MES数据&人员考勤调整

---
 src/views/performance/attendance/index.vue |   79 ++++++++++++---------------------------
 1 files changed, 24 insertions(+), 55 deletions(-)

diff --git a/src/views/performance/attendance/index.vue b/src/views/performance/attendance/index.vue
index 3726bc0..d8089c8 100644
--- a/src/views/performance/attendance/index.vue
+++ b/src/views/performance/attendance/index.vue
@@ -64,14 +64,14 @@
           </el-table-column>
           <el-table-column prop="swingDate" label="鑰冨嫟鏃堕棿" min-width="150" width="150"></el-table-column>
           <el-table-column label="绛惧叆/绛惧嚭鎯呭喌">
-            <el-table-column prop="workDateTime" label="涓婄彮鏃堕棿" min-width="160" width="160">
+            <el-table-column prop="workDateTime" label="涓婄彮鏃堕棿" min-width="160" >
               <template slot-scope="scope">
                 <el-tag type="success" v-if="scope.row.workDateTime && scope.row.workClockInState===1">{{ scope.row.workDateTime }}</el-tag>
                 <el-tag type="danger" v-else-if="scope.row.workDateTime && scope.row.workClockInState===0">{{ scope.row.workDateTime }}</el-tag>
                 <span v-else>{{ scope.row.workDateTime }}</span>
               </template>
             </el-table-column>
-            <el-table-column prop="offWorkDateTime" label="涓嬬彮鏃堕棿" min-width="160" width="160">
+            <el-table-column prop="offWorkDateTime" label="涓嬬彮鏃堕棿" min-width="160" >
               <template slot-scope="scope">
                 <el-tag type="success" v-if="scope.row.offWorkDateTime && scope.row.offClockInState===1">{{ scope.row.offWorkDateTime }}</el-tag>
                 <el-tag type="danger" v-else-if="scope.row.offWorkDateTime && scope.row.offClockInState===0">{{ scope.row.offWorkDateTime }}</el-tag>
@@ -80,19 +80,19 @@
             </el-table-column>
           </el-table-column>
           <el-table-column label="鑰冨嫟鏃堕暱(h)">
-            <el-table-column prop="plannedWorkHours" label="搴斿嫟鏃堕暱" min-width="80" width="80"></el-table-column>
-            <el-table-column prop="actualWorkHours" label="瀹為檯鏃堕暱" min-width="80" width="80"></el-table-column>
-            <el-table-column prop="absenceWorkHours" label="缂哄嫟鏃堕暱" min-width="80" width="80"></el-table-column>
+            <el-table-column prop="plannedWorkHours" label="搴斿嫟鏃堕暱" min-width="100" ></el-table-column>
+            <el-table-column prop="actualWorkHours" label="瀹為檯鏃堕暱" min-width="100"></el-table-column>
+            <el-table-column prop="absenceWorkHours" label="缂哄嫟鏃堕暱" min-width="100" ></el-table-column>
           </el-table-column>
-          <el-table-column prop="isSync" label="鏁版嵁鏉ユ簮" min-width="120">
+          <el-table-column prop="isSync" label="鏁版嵁鏉ユ簮" min-width="120" width="120">
             <template slot-scope="scope">
               <el-tag v-if="scope.row.isSync===0" type="success">ICC鍚屾</el-tag>
               <el-tag v-else-if="scope.row.isSync===1" type="info">鎵嬪姩鏂板</el-tag>
             </template>
           </el-table-column>
-          <el-table-column prop="createUser" label="鍒涘缓浜�" min-width="150" width="150" :formatter="(row)=>formatterUserName(row.createUser)"></el-table-column>
+          <el-table-column prop="createUser" label="鍒涘缓浜�" min-width="120" width="120" :formatter="(row)=>formatterUserName(row.createUser)"></el-table-column>
           <el-table-column prop="createTime" label="鍒涘缓鏃堕棿" min-width="180" width="180"></el-table-column>
-          <el-table-column prop="updateUser" label="鏇存柊浜�" min-width="150" width="150" :formatter="(row)=>formatterUserName(row.updateUser)"></el-table-column>
+          <el-table-column prop="updateUser" label="鏇存柊浜�" min-width="120" width="120" :formatter="(row)=>formatterUserName(row.updateUser)"></el-table-column>
           <el-table-column prop="updateTime" label="鏇存柊鏃堕棿" min-width="180" width="180"></el-table-column>
           <el-table-column fixed="right" width="180" label="鎿嶄綔">
             <template slot-scope="scope">
@@ -114,7 +114,7 @@
       title="杩涘嚭璁板綍"
       :visible.sync="dialogVisible"
       width="60%">
-      <staff-clock-in-record :key="Math.random()" :query-params="clockInQueryParams" ></staff-clock-in-record>
+      <staff-clock-in-record :query-params="clockInQueryParams" @changeEnable="refreshTable()"></staff-clock-in-record>
     </el-dialog>
     <el-dialog
       :title="attendanceForm.id?'缂栬緫鑰冨嫟璁板綍':'鏂板鑰冨嫟璁板綍'"
@@ -158,18 +158,11 @@
                 </el-select>
               </el-form-item>
             </el-col>
-            <el-col :span="12">
-<!--              <el-form-item label="鑰冨嫟缁撴灉" prop="result">-->
-<!--                <el-select size="small" style="width:100%" clearable v-model="attendanceForm.result" placeholder="璇烽�夋嫨鑰冨嫟缁撴灉">-->
-<!--                  <el-option v-for="(item,index) in resultList" :key="index" :label="item.label" :value="item.value"/>-->
-<!--                </el-select>-->
-<!--              </el-form-item>-->
-            </el-col>
           </el-row>
           <el-divider content-position="left">绛惧叆/绛惧嚭鎯呭喌</el-divider>
           <el-row>
             <el-col :span="12">
-              <el-form-item label="涓婄彮鏃堕棿" prop="workTime">
+              <el-form-item label="涓婄彮鏃堕棿" prop="workDateTime">
                 <el-time-picker
                   style="width:100%"
                   value-format="HH:mm"
@@ -180,7 +173,7 @@
               </el-form-item>
             </el-col>
             <el-col :span="12">
-              <el-form-item label="涓嬬彮鏃堕棿" prop="offWorkTime">
+              <el-form-item label="涓嬬彮鏃堕棿" prop="offWorkDateTime">
                 <el-time-picker
                   style="width:100%"
                   value-format="HH:mm"
@@ -232,7 +225,7 @@
   syncAttendanceRecord
 } from '@/api/performance/attendance'
 import {getDicts} from "@/api/system/dict/data";
-import dayjs from 'dayjs';
+import {getTimeRange} from "@/utils/date";
 export default {
   name: "Attendance",
   components: {
@@ -306,7 +299,7 @@
     this.selectEnumByCategory()
     this.getUserList()
     this.getTableHeight();
-    this.dateRange = this.getTimeRange()
+    this.dateRange = getTimeRange()
     this.resizeHandler = this.debounce(() => {
       this.getTableHeight();
     }, 200);
@@ -339,35 +332,7 @@
         this.dailyTypeList = response.data;
       });
     },
-    /**
-     * 鍒濆鍖栭粯璁ゆ棩鏈熻寖鍥达細杩戜竴涓湀锛堝綋鍓嶆棩鏈� - 30澶� 鑷� 褰撳墠鏃ユ湡锛�
-     */
-    getTimeRange(format = 'YYYY-MM-DD HH:mm:ss') {
-      // 鑾峰彇褰撳墠鏃堕棿
-      const now = dayjs();
-      // 鑾峰彇褰撳墠鏃ユ湡鐨勩�屾棩銆嶏紙1-31锛�
-      const currentDate = now.date();
 
-      let startTime, endTime;
-
-      // 鏍稿績閫昏緫锛氬垽鏂綋鍓嶆棩鏈熸槸鍚﹀ぇ浜�25鍙�
-      if (currentDate > 25) {
-        // 鉁� 鎯呭喌1锛氬綋鍓嶆棩>25 鈫� 褰撴湀26鍙� ~ 娆℃湀25鍙�
-        startTime = now.startOf('month').add(25, 'day'); // 褰撴湀1鍙� +25澶� = 26鍙�
-        endTime = startTime.add(1, 'month').date(25).hour(23)
-          .minute(59)
-          .second(59);     // 娆℃湀25鍙凤紙dayjs鑷姩澶勭悊璺ㄥ勾锛�
-      } else {
-        // 鉁� 鎯呭喌2锛氬綋鍓嶆棩鈮�25 鈫� 涓婃湀26鍙� ~ 褰撴湀25鍙�
-        startTime = now.subtract(1, 'month').startOf('month').add(25, 'day'); // 涓婃湀26鍙�
-        endTime = now.date(25).hour(23)
-          .minute(59)
-          .second(59); // 褰撴湀25鍙�
-      }
-
-      // 杩斿洖鏍煎紡鍖栧悗鐨勬椂闂存暟缁�
-      return [startTime.format(format), endTime.format(format)];
-    },
     //鍚屾鑰冨嫟璁板綍
     confirmSyncAttendance(){
       if(!this.syncDateRange || this.syncDateRange.length<2){
@@ -391,7 +356,10 @@
     },
     //鎵撳紑鍚屾鑰冨嫟璁板綍寮规
     openSyncAttendanceDialog(){
-      this.syncAttendanceVisible = true
+      this.syncDateRange = getTimeRange()
+      this.$nextTick(()=>{
+        this.syncAttendanceVisible = true
+      })
     },
     //鍒犻櫎鑰冨嫟璁板綍
     confirmRemoveRecord(row){
@@ -492,11 +460,12 @@
     openAddAttendanceDialog(row){
       if(row){
         //澶勭悊涓�/涓嬬彮鏃堕棿鏍煎紡
-        let workTime = row.workDateTime&&row.workDateTime.length>8?row.workDateTime.substring(11,16):row.workDateTime
-        let offWorkTime = row.offWorkDateTime&&row.offWorkDateTime.length>8?row.offWorkDateTime.substring(11,16):row.offWorkDateTime
-        row.workDateTime = workTime
-        row.offWorkDateTime = offWorkTime
-        this.attendanceForm = {...row}
+        let formData = {...row}
+        let workTime = formData.workDateTime&&formData.workDateTime.length>8?formData.workDateTime.substring(11,16):formData.workDateTime
+        let offWorkTime = formData.offWorkDateTime&&formData.offWorkDateTime.length>8?formData.offWorkDateTime.substring(11,16):formData.offWorkDateTime
+        formData.workDateTime = workTime
+        formData.offWorkDateTime = offWorkTime
+        this.attendanceForm = formData
       }
       this.addAttendanceVisible = true
     },
@@ -581,7 +550,7 @@
     },
     //閲嶇疆鎸夐挳
     resetQuery() {
-      this.dateRange = this.getTimeRange();
+      this.dateRange = getTimeRange();
       this.queryParams = {
         startDate: "",
         endDate: "",

--
Gitblit v1.9.3