浏览代码

考勤页面

chenxr3 4 年之前
父节点
当前提交
800667618a
共有 1 个文件被更改,包括 62 次插入39 次删除
  1. 62 39
      ebc-middle-platform/src/modules/attendance/attendance.vue

+ 62 - 39
ebc-middle-platform/src/modules/attendance/attendance.vue

@ -37,7 +37,7 @@
37 37
      <t-table :data="table.data">
38 38
        <t-table-column prop="name" label="姓名"></t-table-column>
39 39
        <t-table-column prop="mainJobPositionId" label="职务"></t-table-column>
40
        <t-table-column v-if="queryCondition.currentIndex === 0" :formatter="time_formatter" prop="goToWorkTime" label="打卡时间"></t-table-column>
40
        <t-table-column v-if="queryCondition.currentIndex === 0" :formatter="date_formatter" prop="goToWorkTime" label="打卡时间"></t-table-column>
41 41
        <t-table-column v-if="queryCondition.currentIndex !== 0" prop="clockingDays" label="出勤天数(天)"></t-table-column>
42 42
        <t-table-column
43 43
          v-if="queryCondition.currentIndex === 1"
@ -95,14 +95,14 @@
95 95
          <t-table-column prop="workDay" label="日期"></t-table-column>
96 96
          <t-table-column :formatter="time_formatter" prop="goToWorkTime" label="打卡时间" ></t-table-column>
97 97
        </t-table>
98
<!--        <t-pager :total="monthModalData.table.pager.total" :current.sync="monthModalData.table.pager.currentPage"-->
99
<!--                 :page-size.sync="monthModalData.table.pager.size"-->
100
<!--                 :sizer-range="[10,20,50]"-->
101
<!--                 class="px-24 pt-16 float-right"-->
102
<!--                 show-elevator show-sizer-->
103
<!--                 @on-size-change="onModalSizeChange"-->
104
<!--                 @on-change="onModalPagerChange">-->
105
<!--        </t-pager>-->
98
        <!--        <t-pager :total="monthModalData.table.pager.total" :current.sync="monthModalData.table.pager.currentPage"-->
99
        <!--                 :page-size.sync="monthModalData.table.pager.size"-->
100
        <!--                 :sizer-range="[10,20,50]"-->
101
        <!--                 class="px-24 pt-16 float-right"-->
102
        <!--                 show-elevator show-sizer-->
103
        <!--                 @on-size-change="onModalSizeChange"-->
104
        <!--                 @on-change="onModalPagerChange">-->
105
        <!--        </t-pager>-->
106 106
      </div>
107 107
    </t-modal>
108 108
  </div>
@ -196,17 +196,17 @@ export default {
196 196
      var mark
197 197
      if (this.queryCondition.currentIndex === 0) {
198 198
        mark = 'day'
199
        if (this.queryCondition.singleDateVal == ''){
199
        if (this.queryCondition.singleDateVal == '') {
200 200
          this.queryCondition.singleDateVal = this.getTime(2)
201 201
        }
202 202
      } else if (this.queryCondition.currentIndex === 1) {
203 203
        mark = 'week'
204
        if (this.queryCondition.singleDateVal == ''){
204
        if (this.queryCondition.singleDateVal == '') {
205 205
          this.queryCondition.singleDateVal = this.getTime(2)
206 206
        }
207 207
      } else {
208 208
        mark = 'month'
209
        if (this.queryCondition.singleDateVal == '' || this.queryCondition.singleDateVal.length > 8 ){
209
        if (this.queryCondition.singleDateVal == '' || this.queryCondition.singleDateVal.length > 8) {
210 210
          this.queryCondition.singleDateVal = this.getTime(1)
211 211
        }
212 212
      }
@ -272,21 +272,20 @@ export default {
272 272
      this.modalData.days = row.clockingDays
273 273
      this.$test
274 274
        .post(services.areaInOutRecord.GET_ATTENDANCE_DETAILE, {
275
          data:{
276
            id:row.id+"",
277
            mark:'week',
278
            beginDay:beginDay,
279
            endDay:this.queryCondition.singleDateVal
275
          data: {
276
            id: row.id + '',
277
            mark: 'week',
278
            beginDay: beginDay,
279
            endDay: this.queryCondition.singleDateVal
280 280
          },
281
          pageNumber:0,
282
          pageSize:0
281
          pageNumber: 0,
282
          pageSize: 0
283 283
        })
284 284
        .then((res) => {
285 285
          // 请求成功处理...
286 286
          var arr = []
287 287
          res.data.forEach(e => {
288
            if (e.goToWorkTime)
289
              arr.push(e)
288
            if (e.goToWorkTime) { arr.push(e) }
290 289
          })
291 290
          this.modalData.table = arr
292 291
        })
@ -305,24 +304,23 @@ export default {
305 304
      this.monthModalData.duty = row.mainJobPositionId
306 305
      this.monthModalData.days = row.clockingDays
307 306
      this.monthModalData.EMPLOYEE_ID = row.EMPLOYEE_ID
308
      var lastDay = this.getLastDay(this.queryCondition.singleDateVal+'-01')
307
      var lastDay = this.getLastDay(this.queryCondition.singleDateVal + '-01')
309 308
      this.$test
310 309
        .post(services.areaInOutRecord.GET_ATTENDANCE_DETAILE, {
311
          data:{
312
            id:row.id+"",
313
            mark:'month',
314
            beginDay:this.queryCondition.singleDateVal + '-01',
315
            endDay:lastDay
310
          data: {
311
            id: row.id + '',
312
            mark: 'month',
313
            beginDay: this.queryCondition.singleDateVal + '-01',
314
            endDay: lastDay
316 315
          },
317
          pageNumber:0,
318
          pageSize:0
316
          pageNumber: 0,
317
          pageSize: 0
319 318
        })
320 319
        .then((res) => {
321 320
          // 请求成功处理...
322 321
          var arr = []
323 322
          res.data.forEach(e => {
324
            if (e.goToWorkTime)
325
              arr.push(e)
323
            if (e.goToWorkTime) { arr.push(e) }
326 324
          })
327 325
          this.monthModalData.table.data = arr
328 326
          // this.monthModalData.table.pager.total = res.data.total
@ -347,12 +345,12 @@ export default {
347 345
    },
348 346
    getLastDay(d) {
349 347
      var now = Date.parse(d)
350
      var seperator1 = "-"
351
      var date=new Date(now)
352
      var new_month = date.getMonth()+1
348
      var seperator1 = '-'
349
      var date = new Date(now)
350
      var new_month = date.getMonth() + 1
353 351
      var new_year = date.getFullYear()
354
      var new_date = new Date(new_year,new_month,1)
355
      var currentdate = new_year + seperator1 + new_month + seperator1 +(new Date(new_date.getTime()-1000*60*60*24)).getDate()
352
      var new_date = new Date(new_year, new_month, 1)
353
      var currentdate = new_year + seperator1 + new_month + seperator1 + (new Date(new_date.getTime() - 1000 * 60 * 60 * 24)).getDate()
356 354
      return currentdate
357 355
    },
358 356
    getTime(type) {
@ -387,9 +385,34 @@ export default {
387 385
      return year + '-' + mon + '-' + day
388 386
    },
389 387
    time_formatter(row, column) {
390
      if (row.goToWorkTime){
391
        var json_date = new Date(row.goToWorkTime).toJSON()
392
        return new Date(new Date(json_date) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '')
388
      if (row.goToWorkTime) {
389
        var date = new Date(row.goToWorkTime)
390
        var h = date.getHours()
391
        var m = date.getMinutes()
392
        var s = date.getSeconds()
393
        h = h < 10 ? '0' + h : h
394
        m = m < 10 ? '0' + m : m
395
        s = s < 10 ? '0' + s : s
396
        return h + ':' + m + ':' + s
397
      }
398
    },
399
    date_formatter(row, column) {
400
      if (row.goToWorkTime) {
401
        var date = new Date(row.goToWorkTime)
402
        var Y = date.getFullYear() + '-'
403
        var M =
404
            (date.getMonth() + 1 < 10
405
              ? '0' + (date.getMonth() + 1)
406
              : date.getMonth() + 1) + '-'
407
        var D = date.getDate()
408
        var h = date.getHours()
409
        var m = date.getMinutes()
410
        var s = date.getSeconds()
411
        D = D < 10 ? '0' + D : D
412
        h = h < 10 ? '0' + h : h
413
        m = m < 10 ? '0' + m : m
414
        s = s < 10 ? '0' + s : s
415
        return Y + M + D + ' ' + h + ':' + m + ':' + s
393 416
      }
394 417
    }
395 418
  }