Ver Código Fonte

考勤页面

chenxr3 4 anos atrás
pai
commit
800667618a

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

37
      <t-table :data="table.data">
37
      <t-table :data="table.data">
38
        <t-table-column prop="name" label="姓名"></t-table-column>
38
        <t-table-column prop="name" label="姓名"></t-table-column>
39
        <t-table-column prop="mainJobPositionId" label="职务"></t-table-column>
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
        <t-table-column v-if="queryCondition.currentIndex !== 0" prop="clockingDays" label="出勤天数(天)"></t-table-column>
41
        <t-table-column v-if="queryCondition.currentIndex !== 0" prop="clockingDays" label="出勤天数(天)"></t-table-column>
42
        <t-table-column
42
        <t-table-column
43
          v-if="queryCondition.currentIndex === 1"
43
          v-if="queryCondition.currentIndex === 1"
95
          <t-table-column prop="workDay" label="日期"></t-table-column>
95
          <t-table-column prop="workDay" label="日期"></t-table-column>
96
          <t-table-column :formatter="time_formatter" prop="goToWorkTime" label="打卡时间" ></t-table-column>
96
          <t-table-column :formatter="time_formatter" prop="goToWorkTime" label="打卡时间" ></t-table-column>
97
        </t-table>
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
      </div>
106
      </div>
107
    </t-modal>
107
    </t-modal>
108
  </div>
108
  </div>
196
      var mark
196
      var mark
197
      if (this.queryCondition.currentIndex === 0) {
197
      if (this.queryCondition.currentIndex === 0) {
198
        mark = 'day'
198
        mark = 'day'
199
        if (this.queryCondition.singleDateVal == ''){
199
        if (this.queryCondition.singleDateVal == '') {
200
          this.queryCondition.singleDateVal = this.getTime(2)
200
          this.queryCondition.singleDateVal = this.getTime(2)
201
        }
201
        }
202
      } else if (this.queryCondition.currentIndex === 1) {
202
      } else if (this.queryCondition.currentIndex === 1) {
203
        mark = 'week'
203
        mark = 'week'
204
        if (this.queryCondition.singleDateVal == ''){
204
        if (this.queryCondition.singleDateVal == '') {
205
          this.queryCondition.singleDateVal = this.getTime(2)
205
          this.queryCondition.singleDateVal = this.getTime(2)
206
        }
206
        }
207
      } else {
207
      } else {
208
        mark = 'month'
208
        mark = 'month'
209
        if (this.queryCondition.singleDateVal == '' || this.queryCondition.singleDateVal.length > 8 ){
209
        if (this.queryCondition.singleDateVal == '' || this.queryCondition.singleDateVal.length > 8) {
210
          this.queryCondition.singleDateVal = this.getTime(1)
210
          this.queryCondition.singleDateVal = this.getTime(1)
211
        }
211
        }
212
      }
212
      }
272
      this.modalData.days = row.clockingDays
272
      this.modalData.days = row.clockingDays
273
      this.$test
273
      this.$test
274
        .post(services.areaInOutRecord.GET_ATTENDANCE_DETAILE, {
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
        .then((res) => {
284
        .then((res) => {
285
          // 请求成功处理...
285
          // 请求成功处理...
286
          var arr = []
286
          var arr = []
287
          res.data.forEach(e => {
287
          res.data.forEach(e => {
288
            if (e.goToWorkTime)
289
              arr.push(e)
288
            if (e.goToWorkTime) { arr.push(e) }
290
          })
289
          })
291
          this.modalData.table = arr
290
          this.modalData.table = arr
292
        })
291
        })
305
      this.monthModalData.duty = row.mainJobPositionId
304
      this.monthModalData.duty = row.mainJobPositionId
306
      this.monthModalData.days = row.clockingDays
305
      this.monthModalData.days = row.clockingDays
307
      this.monthModalData.EMPLOYEE_ID = row.EMPLOYEE_ID
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
      this.$test
308
      this.$test
310
        .post(services.areaInOutRecord.GET_ATTENDANCE_DETAILE, {
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
        .then((res) => {
319
        .then((res) => {
321
          // 请求成功处理...
320
          // 请求成功处理...
322
          var arr = []
321
          var arr = []
323
          res.data.forEach(e => {
322
          res.data.forEach(e => {
324
            if (e.goToWorkTime)
325
              arr.push(e)
323
            if (e.goToWorkTime) { arr.push(e) }
326
          })
324
          })
327
          this.monthModalData.table.data = arr
325
          this.monthModalData.table.data = arr
328
          // this.monthModalData.table.pager.total = res.data.total
326
          // this.monthModalData.table.pager.total = res.data.total
347
    },
345
    },
348
    getLastDay(d) {
346
    getLastDay(d) {
349
      var now = Date.parse(d)
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
      var new_year = date.getFullYear()
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
      return currentdate
354
      return currentdate
357
    },
355
    },
358
    getTime(type) {
356
    getTime(type) {
387
      return year + '-' + mon + '-' + day
385
      return year + '-' + mon + '-' + day
388
    },
386
    },
389
    time_formatter(row, column) {
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
  }