From df3902e7eae5dd38a2d47aa63e5f27131f701db9 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期一, 20 四月 2026 13:49:14 +0800
Subject: [PATCH] 绩效管理模块调整

---
 src/views/performance/attendance/index.vue |   94 +++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 87 insertions(+), 7 deletions(-)

diff --git a/src/views/performance/attendance/index.vue b/src/views/performance/attendance/index.vue
index d8089c8..c8784c4 100644
--- a/src/views/performance/attendance/index.vue
+++ b/src/views/performance/attendance/index.vue
@@ -30,12 +30,12 @@
         </div>
       </div>
       <div class="search_thing">
-        <el-button size="mini" type="primary" @click="refreshTable()"
-          >鏌� 璇�</el-button
+        <el-button icon="el-icon-search" size="mini" type="primary" @click="refreshTable()">鏌� 璇�</el-button
         >
-        <el-button size="mini" @click="resetQuery">閲嶇疆</el-button>
-        <el-button size="mini" type="primary" @click="openAddAttendanceDialog()">鎵嬪姩鏂板</el-button>
-        <el-button size="mini" type="success" @click="openSyncAttendanceDialog()">鍚屾鑰冨嫟璁板綍</el-button>
+        <el-button icon="el-icon-refresh-left" size="mini" @click="resetQuery">閲嶇疆</el-button>
+        <el-button icon="el-icon-plus" size="mini" type="primary" @click="openAddAttendanceDialog()">鎵嬪姩鏂板</el-button>
+        <el-button icon="el-icon-refresh" size="mini" type="success" @click="openSyncAttendanceDialog()">鍚屾鑰冨嫟璁板綍</el-button>
+        <el-button plain icon="el-icon-download" size="mini" type="primary" @click="openAttendanceRecordDialog()">瀵煎嚭</el-button>
       </div>
     </div>
     <div class="container">
@@ -211,6 +211,45 @@
     <el-button type="primary" @click="confirmSyncAttendance">纭� 瀹�</el-button>
   </span>
     </el-dialog>
+    <el-dialog
+      title="瀵煎嚭鑰冨嫟璁板綍"
+      :visible.sync="attendanceRecordVisible"
+      width="40%">
+      <el-row>
+        <el-col :span="4">
+          <label>缁熻缁村害:</label>
+        </el-col>
+        <el-col :span="20">
+            <el-radio-group v-model="reportType" size="mini" disabled>
+              <el-radio label="YEAR">骞村害</el-radio>
+              <el-radio label="MONTH">鏈堝害</el-radio>
+            </el-radio-group>
+        </el-col>
+      </el-row>
+      <el-row style="margin-top:20px">
+        <el-col :span="4">
+          <label>缁熻鏃ユ湡:</label>
+        </el-col>
+        <el-col :span="20">
+          <el-date-picker
+            size="small"
+            v-model="reportDateRange"
+            style="width:100%"
+            @change="changeReportDateRange"
+            type="datetimerange"
+            value-format="yyyy-MM-dd HH:mm:ss"
+            :default-time="['00:00:00','23:59:59']"
+            range-separator="鑷�"
+            start-placeholder="寮�濮嬫棩鏈�"
+            end-placeholder="缁撴潫鏃ユ湡">
+          </el-date-picker>
+        </el-col>
+      </el-row>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="attendanceRecordVisible = false">鍙� 娑�</el-button>
+        <el-button :loading="exportLoading" type="primary" @click="exportStaffAttendanceRecords()">纭� 瀹�</el-button>
+      </span>
+    </el-dialog>
   </div>
 </template>
 
@@ -222,10 +261,12 @@
   checkDutyDate,
   saveOrUpdateStaffAttendanceTrackingRecord,
   removeStaffAttendanceTrackingRecord,
-  syncAttendanceRecord
+  syncAttendanceRecord,
+  exportStaffAttendanceRecords
 } from '@/api/performance/attendance'
 import {getDicts} from "@/api/system/dict/data";
-import {getTimeRange} from "@/utils/date";
+import {getTimeRange,isOverOneMonth} from "@/utils/date";
+import {transformExcel} from '@/utils/file'
 export default {
   name: "Attendance",
   components: {
@@ -233,8 +274,12 @@
   },
   data() {
     return {
+      reportDateRange:[],
+      reportType:"MONTH",
+      attendanceRecordVisible:false,
       syncDateRange:[],
       syncAttendanceVisible: false,
+      exportLoading: false,
       attendanceForm:{
         workDataId: null,
         offWorkDataId: null,
@@ -313,6 +358,41 @@
     window.removeEventListener("resize",this.resizeHandler)
   },
   methods: {
+    changeReportDateRange(val){
+      //鍒ゆ柇鏃堕棿鍖洪棿鏄惁瓒呰繃涓�涓湀
+      if(val && val.length===2){
+        const flag = isOverOneMonth(val[0],val[1]);
+        this.reportType = flag?'YEAR':'MONTH'
+      }
+    },
+    openAttendanceRecordDialog (){
+      this.reportDateRange = getTimeRange()
+      this.$nextTick(()=>{
+        this.attendanceRecordVisible = true
+      })
+    },
+    //瀵煎嚭鑰冨嫟璁板綍
+    exportStaffAttendanceRecords(){
+      this.exportLoading = true
+      let params = {
+        attendanceReportType:this.reportType,
+      }
+      if (this.reportDateRange && this.reportDateRange.length === 2) {
+        params.startDate = this.reportDateRange[0];
+        params.endDate = this.reportDateRange[1];
+      } else {
+        params.startDate = "";
+        params.endDate = "";
+      }
+      exportStaffAttendanceRecords({...params}).then(res=>{
+        transformExcel(res, "涓ぉ鑰愪笣璐ㄩ噺鑰冨嫟姹囨��.xlsx")
+        this.$message.success("瀵煎嚭鎴愬姛")
+      }).catch(error=>{
+        console.error(error)
+      }).finally(()=>{
+        this.exportLoading = false
+      })
+    },
     getShiftByDic(e) {
       let obj = this.dailyTypeList.find((m) => m.dictValue == e);
       if (obj) {

--
Gitblit v1.9.3