From 5d187bac9e3d6521fee19d2655255a5e7e8c4e0b Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期四, 07 五月 2026 17:07:00 +0800
Subject: [PATCH] 人员考勤:导出日期选择调整&不合格处理展示供应商编码字段

---
 src/views/performance/attendance/index.vue |  128 +++++++++++++++++++++++++++++-------------
 1 files changed, 88 insertions(+), 40 deletions(-)

diff --git a/src/views/performance/attendance/index.vue b/src/views/performance/attendance/index.vue
index d197b61..93bb3a5 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,21 +211,70 @@
     <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 @change="()=>{this.reportDate = null}" v-model="reportType" size="mini">
+              <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
+            v-if="reportType==='YEAR'"
+            size="small"
+            v-model="reportDate"
+            style="width:100%"
+            type="year"
+            format="yyyy"
+            value-format="yyyy"
+            placeholder="璇烽�夋嫨骞翠唤">
+          </el-date-picker>
+          <el-date-picker
+            v-if="reportType==='MONTH'"
+            size="small"
+            v-model="reportDate"
+            style="width:100%"
+            type="month"
+            format="yyyy-MM"
+            value-format="yyyy-MM"
+            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>
 
 <script>
 import StaffClockInRecord from "./components/staffClockInRecord.vue";
-import {selectAllUser} from '@/api/system/user'
+import {selectUserListByPerformance} from '@/api/system/user'
 import {
   pageAttendanceRecord,
   checkDutyDate,
   saveOrUpdateStaffAttendanceTrackingRecord,
   removeStaffAttendanceTrackingRecord,
-  syncAttendanceRecord
+  syncAttendanceRecord,
+  exportStaffAttendanceRecords
 } from '@/api/performance/attendance'
 import {getDicts} from "@/api/system/dict/data";
-import dayjs from 'dayjs';
+import {getTimeRange,isOverOneMonth} from "@/utils/date";
+import {transformExcel} from '@/utils/file'
 export default {
   name: "Attendance",
   components: {
@@ -233,8 +282,12 @@
   },
   data() {
     return {
+      reportDate: null,
+      reportType:"MONTH",
+      attendanceRecordVisible:false,
       syncDateRange:[],
       syncAttendanceVisible: false,
+      exportLoading: false,
       attendanceForm:{
         workDataId: null,
         offWorkDataId: null,
@@ -299,7 +352,7 @@
     this.selectEnumByCategory()
     this.getUserList()
     this.getTableHeight();
-    this.dateRange = this.getTimeRange()
+    this.dateRange = getTimeRange()
     this.resizeHandler = this.debounce(() => {
       this.getTableHeight();
     }, 200);
@@ -313,6 +366,26 @@
     window.removeEventListener("resize",this.resizeHandler)
   },
   methods: {
+    openAttendanceRecordDialog (){
+      this.attendanceRecordVisible = true
+    },
+    //瀵煎嚭鑰冨嫟璁板綍
+    exportStaffAttendanceRecords(){
+      this.exportLoading = true
+      let params = {
+        attendanceReportType:this.reportType,
+        reportDate: this.reportDate,
+        keyword: this.queryParams.keyword
+      }
+      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) {
@@ -332,35 +405,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){
@@ -384,7 +429,10 @@
     },
     //鎵撳紑鍚屾鑰冨嫟璁板綍寮规
     openSyncAttendanceDialog(){
-      this.syncAttendanceVisible = true
+      this.syncDateRange = getTimeRange()
+      this.$nextTick(()=>{
+        this.syncAttendanceVisible = true
+      })
     },
     //鍒犻櫎鑰冨嫟璁板綍
     confirmRemoveRecord(row){
@@ -567,7 +615,7 @@
     },
     //鏌ヨ鐢ㄦ埛鍒楄〃
     getUserList(){
-      selectAllUser().then(res=>{
+      selectUserListByPerformance().then(res=>{
         this.userList = res.data
       }).catch(error=>{
         console.error(error)
@@ -575,7 +623,7 @@
     },
     //閲嶇疆鎸夐挳
     resetQuery() {
-      this.dateRange = this.getTimeRange();
+      this.dateRange = getTimeRange();
       this.queryParams = {
         startDate: "",
         endDate: "",

--
Gitblit v1.9.3