zouyu
2026-05-25 edc6b742457bcdfcfbd49ff41a625f956a733459
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 {getTimeRange} from "@/utils/date";
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,
@@ -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) {
@@ -542,7 +615,7 @@
    },
    //查询用户列表
    getUserList(){
      selectAllUser().then(res=>{
      selectUserListByPerformance().then(res=>{
        this.userList = res.data
      }).catch(error=>{
        console.error(error)