小小儁爺
2024-11-15 c0e9df213221d16f6ab6c9106ae01ad571cd45fc
src/views/attendanceModule/attendanceClockIn.vue
@@ -79,19 +79,19 @@
          />
        </el-table>
      </div>
      <div
        class="bodyTopButtonGroup"
        style="margin-top: 0;height: 60px;display:flex;align-items: center;justify-content: center"
      >
        <el-button
          v-waves
          :disabled="isDisabled"
          type="primary"
          style="width: 150px;height: 40px;"
          icon="el-icon-alarm-clock"
          @click="clockIn"
        >考勤打卡</el-button>
      </div>
      <!--      <div-->
      <!--        class="bodyTopButtonGroup"-->
      <!--        style="margin-top: 0;height: 60px;display:flex;align-items: center;justify-content: center"-->
      <!--      >-->
      <!--        <el-button-->
      <!--          v-waves-->
      <!--          :disabled="isDisabled"-->
      <!--          type="primary"-->
      <!--          style="width: 150px;height: 40px;"-->
      <!--          icon="el-icon-alarm-clock"-->
      <!--          @click="clockIn"-->
      <!--        >考勤打卡</el-button>-->
      <!--      </div>-->
    </div>
@@ -103,6 +103,7 @@
import waves from '@/directive/waves'
import { AttendanceSave, AttendanceSearch } from '@/api/attendanceModule'
import $ from 'jquery'
import { handleDatetime2 } from '@/utils/global'
export default {
  name: 'AttendanceClockIn',
@@ -120,6 +121,10 @@
      tableData: [],
      isDisabled: true
    }
  },
  activated() {
    window.addEventListener('resize', this.getHeight)
    this.getHeight()
  },
  created() {
  },
@@ -144,8 +149,10 @@
        this.isDisabled = true
      } else {
        this.form2 = res.userdate[0]
        this.tableData = res.checkcrd
        this.isDisabled = false
        await this.clockIn()
        // this.tableData = res.checkcrd
        // this.isDisabled = false
      }
    },
    async clockIn() {
@@ -155,14 +162,19 @@
      }
      const res = await AttendanceSave(data)
      if (res.code === '200') {
        await this.enterNative(this.form2.usercode)
        // await this.enterNative(this.form2.usercode)
        this.$message.success('打卡成功!')
        const { data: res2 } = await AttendanceSearch({ usercode: this.form2.usercode })
        this.tableData = res2.checkcrd.sort((a, b) => new Date(b.createdate).getTime() - new Date(a.createdate).getTime())
        this.isDisabled = false
      }
    },
    // 获取页面高度
    getHeight() {
      this.$nextTick(() => {
        this.mainHeight = window.innerHeight - 85
        this.tableHeight = this.mainHeight - 250
        this.tableHeight = this.mainHeight - 180
        this.$refs.tableDataRef.doLayout()
      })
    }