Browse Source

作业考勤页面

chenxr3 4 years ago
parent
commit
5aaf8371a9

+ 4 - 0
ebc-middle-platform/src/conf/services.js

@ -169,6 +169,10 @@ export default {
169 169
  history: {
170 170
    GET_HISTORICAL_ALARM: '/history/queryHistoricalAlarm' // 查询历史报警信息
171 171
  },
172
  areaInOutRecord: {
173
    GET_ATTENDANCE: '/areaInOutRecord/queryPageAttendanceCount', // 分页查询考勤统计分析
174
    GET_ATTENDANCE_DETAILE: '/areaInOutRecord/queryPageAttendanceRecordDetaile' // 分页查询考勤统计分析
175
  },
172 176
  excel: {
173 177
    EXPROT_MAP_TAG: '/ExportToExcel/exportMapTagInfoToExcel' // 导出地图标记信息
174 178
  }

+ 230 - 66
ebc-middle-platform/src/modules/attendance/attendance.vue

@ -10,17 +10,20 @@
10 10
            <t-button v-for="(item,index) in queryCondition.type" :class="index==queryCondition.currentIndex?'active':''" :key="index" color="secondary" @click="changeType(index)">{{ item }}</t-button>
11 11
          </t-button-group>
12 12
        </div>
13
        <div>
14
          <t-date-picker v-model="queryCondition.singleDateVal" style="width:120px" placeholder="时间" @date-change="onChangeDate"
13
        <div v-if="queryCondition.dateType">
14
          <t-date-picker v-model="queryCondition.singleDateVal" type= "date" style="width:120px" placeholder="时间" @date-change="onChangeDate"
15 15
          ></t-date-picker>
16 16
        </div>
17
        <div v-if="!queryCondition.dateType">
18
          <div>
19
            <t-date-picker v-model="queryCondition.singleDateVal" type="month" style="width:120px" placeholder="时间" @date-change="onChangeDate"
20
            ></t-date-picker>
21
          </div>
22
        </div>
17 23
        <div>
18 24
          <div class="label">姓名:</div>
19 25
          <div class="input-rule">
20
            <t-select v-model="queryCondition.alarmPerson" width="200" placeholder="请输入...">
21
              <t-option>张三</t-option>
22
              <t-option>李四</t-option>
23
            </t-select>
26
            <t-input v-model="queryCondition.alarmPerson" placeholder="请输入..."></t-input>
24 27
          </div>
25 28
        </div>
26 29
        <div class="btns">
@ -32,12 +35,12 @@
32 35
    </div>
33 36
    <div>
34 37
      <t-table :data="table.data">
35
        <t-table-column prop="name" label="姓名"></t-table-column>
36
        <t-table-column prop="job" label="职务"></t-table-column>
37
        <t-table-column v-if="queryCondition.currentIndex === 0" prop="time" label="打卡时间"></t-table-column>
38
        <t-table-column v-if="queryCondition.currentIndex !== 0" prop="attendance" label="出勤天数(天)"></t-table-column>
38
        <t-table-column prop="userName" label="姓名"></t-table-column>
39
        <t-table-column prop="duty" label="职务"></t-table-column>
40
        <t-table-column v-if="queryCondition.currentIndex === 0" prop="IN_DATE" label="打卡时间"></t-table-column>
41
        <t-table-column v-if="queryCondition.currentIndex !== 0" prop="gateDays" label="出勤天数(天)"></t-table-column>
39 42
        <t-table-column
40
          v-if="queryCondition.currentIndex !== 0"
43
          v-if="queryCondition.currentIndex === 1"
41 44
          fixed="right"
42 45
          label="操作"
43 46
          width="120"
@ -46,6 +49,16 @@
46 49
            <a href="javascript:void(0)" size="sm" @click="detail(scope.row)">详情</a>
47 50
          </template>
48 51
        </t-table-column>
52
        <t-table-column
53
          v-if="queryCondition.currentIndex === 2"
54
          fixed="right"
55
          label="操作"
56
          width="120"
57
        >
58
          <template slot-scope="scope">
59
            <a href="javascript:void(0)" size="sm" @click="monthDetail(scope.row)">详情</a>
60
          </template>
61
        </t-table-column>
49 62
      </t-table>
50 63
      <t-pager :total="table.pager.total" :current.sync="table.pager.currentPage"
51 64
               :page-size.sync="table.pager.size"
@ -58,46 +71,50 @@
58 71
    </div>
59 72
    <t-modal :visibled.sync="modal" :footer-visibled="false" class="modal" title="考勤详情" width="1200px">
60 73
      <div class="title">
61
        <div>姓名:张三</div>
62
        <div>职务:运维人员</div>
63
        <div>考勤时间:2020-08-01 ~ 2020-08-07</div>
64
        <div>出勤天数:7天</div>
74
        <div>姓名:{{ modalData.userName }}</div>
75
        <div>职务:{{ modalData.duty }}</div>
76
        <div>考勤时间:{{ modalData.date }}</div>
77
        <div>出勤天数:{{ modalData.days }}</div>
65 78
      </div>
66 79
      <div>
67 80
        <t-table :data="modalData.table">
68 81
          <t-table-column prop="date" label="日期"></t-table-column>
69
          <t-table-column prop="time" label="打卡时间" ></t-table-column>
82
          <t-table-column prop="printTime" label="打卡时间" ></t-table-column>
83
        </t-table>
84
      </div>
85
    </t-modal>
86
    <t-modal :visibled.sync="monthModal" :footer-visibled="false" class="modal" title="考勤详情" width="1200px">
87
      <div class="title">
88
        <div>姓名:{{ monthModalData.userName }}</div>
89
        <div>职务:{{ monthModalData.duty }}</div>
90
        <div>考勤时间:{{ monthModalData.date }}</div>
91
        <div>出勤天数:{{ monthModalData.days }}</div>
92
      </div>
93
      <div>
94
        <t-table :data="monthModalData.table.data">
95
          <t-table-column prop="date" label="日期"></t-table-column>
96
          <t-table-column prop="printTime" label="打卡时间" ></t-table-column>
70 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>
71 106
      </div>
72 107
    </t-modal>
73 108
  </div>
74 109
</template>
75 110
<script>
76 111
import './attendance.scss'
112
import services from "../../conf/services";
77 113
export default {
78 114
  data() {
79 115
    return {
80 116
      table: {
81
        data: [
82
          {
83
            name: '王小明',
84
            job: '运维人员',
85
            time: '08:18',
86
            attendance: '7'
87
          },
88
          {
89
            name: '王小明',
90
            job: '运维人员',
91
            time: '08:18',
92
            attendance: '7'
93
          },
94
          {
95
            name: '王小明',
96
            job: '运维人员',
97
            time: '08:18',
98
            attendance: '7'
99
          }
100
        ],
117
        data: [],
101 118
        pager: {
102 119
          currentPage: 1,
103 120
          size: 10,
@ -105,8 +122,9 @@ export default {
105 122
        }
106 123
      },
107 124
      queryCondition: {
125
        dateType: true,
108 126
        type: [
109
          '日', '', ''
127
          '日', '', ''
110 128
        ],
111 129
        currentIndex: 0,
112 130
        singleDateVal: '',
@ -114,71 +132,217 @@ export default {
114 132
      },
115 133
      modal: false,
116 134
      modalData: {
117
        table: [{
118
          date: '2020-08-01',
119
          time: '08:18'
120
        }, {
121
          date: '2020-08-02',
122
          time: '08:18'
123
        }, {
124
          date: '2020-08-03',
125
          time: '08:18'
126
        }, {
127
          date: '2020-08-04',
128
          time: '08:18'
129
        }, {
130
          date: '2020-08-05',
131
          time: '08:18'
132
        }, {
133
          date: '2020-08-06',
134
          time: '08:18'
135
        }, {
136
          date: '2020-08-07',
137
          time: '08:18'
138
        }]
135
        userName: '',
136
        duty: '',
137
        date: '',
138
        days: '',
139
        table: []
140
      },
141
      monthModal: false,
142
      monthModalData: {
143
        userName: '',
144
        EMPLOYEE_ID: '',
145
        duty: '',
146
        date: '',
147
        days: '',
148
        table: {
149
          data: [],
150
          pager: {
151
            currentPage: 1,
152
            size: 10,
153
            total: 0
154
          }
155
        }
139 156
      }
140 157
    }
141 158
  },
142 159
  mounted() {
143
    this.table.data = this.table.data.concat(this.table.data)
144
    this.table.pager.total = this.table.data.length
160
    this.getList()
145 161
  },
146 162
  methods: {
147 163
    changeType(index) {
148 164
      this.queryCondition.currentIndex = index
165
      this.queryCondition.singleDateVal = ''
166
      this.queryCondition.dateType = !(index === 2)
167
      this.getList()
149 168
    },
150 169
    onChangeDate(value) {
151 170
      console.log(value)
152
      this.singleDateVal = value
171
      this.onSearch()
153 172
    },
154 173
    onChange(value) {
155 174
      console.log('date change:' + value)
156 175
    },
157 176
    onReset() {
158 177
      this.queryCondition = {
178
        dateType: true,
159 179
        type: [
160
          '日', '', ''
180
          '日', '', ''
161 181
        ],
162 182
        currentIndex: 0,
163 183
        singleDateVal: '',
164 184
        alarmPerson: ''
165 185
      }
186
      this.table.pager.currentPage = 1
187
      this.table.pager.size = 10
188
      this.getList()
189
    },
190
    getList() {
191
      var mark
192
      if (this.queryCondition.currentIndex === 0) {
193
        mark = 'day'
194
      } else if (this.queryCondition.currentIndex === 1) {
195
        mark = 'week'
196
      } else {
197
        mark = 'month'
198
      }
199
      var params = new FormData()
200
      params.append(
201
        'data',
202
        JSON.stringify({
203
          currentDate: this.queryCondition.singleDateVal,
204
          mark: mark,
205
          userName: this.queryCondition.alarmPerson,
206
          pageNum: this.table.pager.currentPage,
207
          pageSize: this.table.pager.size
208
        })
209
      )
210
      this.$test
211
        .post(services.areaInOutRecord.GET_ATTENDANCE, params)
212
        .then((res) => {
213
          // 请求成功处理...
214
          this.table.data = res.data.list
215
          this.table.pager.total = res.data.total
216
        })
217
        .catch((res) => {
218
          // 请求失败处理...
219
        })
166 220
    },
167 221
    onSearch() {
168
222
      this.table.pager.currentPage = 1
223
      this.getList()
169 224
    },
170 225
    toExport() {
171 226
172 227
    },
173 228
    onPagerChange(page) {
174
229
      this.table.pager.currentPage = page
230
      this.getList()
175 231
    },
176 232
    onSizeChange(number) {
177
233
      this.table.pager.currentPage = 1
234
      this.table.pager.size = number
235
      this.getList()
236
    },
237
    onModalPagerChange(page) {
238
      this.monthModalData.table.pager.currentPage = page
239
      this.getMonthDetail()
240
    },
241
    onModalSizeChange(number) {
242
      this.monthModalData.table.pager.currentPage = 1
243
      this.monthModalData.table.pager.size = number
244
      this.getMonthDetail()
178 245
    },
179 246
    detail(row) {
180 247
      this.modal = true
248
      var data
249
      if (this.queryCondition.singleDateVal === '') {
250
        data = this.getTime(2)
251
      } else {
252
        data = this.queryCondition.singleDateVal
253
      }
254
      this.modalData.date = this.getBeforeDate(6, data) + ' ~ ' + data
255
      this.modalData.userName = row.userName
256
      this.modalData.duty = row.duty
257
      this.modalData.days = row.gateDays
258
      var params = new FormData()
259
      params.append(
260
        'data',
261
        JSON.stringify({
262
          EMPLOYEE_ID: row.EMPLOYEE_ID,
263
          mark: 'week',
264
          currentDate: this.queryCondition.singleDateVal
265
        })
266
      )
267
      this.$test
268
        .post(services.areaInOutRecord.GET_ATTENDANCE_DETAILE, params)
269
        .then((res) => {
270
          // 请求成功处理...
271
          this.modalData.table = res.data.list
272
        })
273
        .catch((res) => {
274
          // 请求失败处理...
275
        })
276
    },
277
    monthDetail(row) {
278
      this.monthModal = true
279
      if (this.queryCondition.singleDateVal === '') {
280
        this.monthModalData.date = this.getTime(1)
281
      } else {
282
        this.monthModalData.date = this.queryCondition.singleDateVal
283
      }
284
      this.monthModalData.userName = row.userName
285
      this.monthModalData.duty = row.duty
286
      this.monthModalData.days = row.gateDays
287
      this.monthModalData.EMPLOYEE_ID = row.EMPLOYEE_ID
288
      this.getMonthDetail()
289
    },
290
    getMonthDetail() {
291
      var params = new FormData()
292
      params.append(
293
        'data',
294
        JSON.stringify({
295
          EMPLOYEE_ID: this.monthModalData.EMPLOYEE_ID,
296
          mark: 'month',
297
          currentDate: this.queryCondition.singleDateVal,
298
          pageNum: this.monthModalData.table.pager.currentPage,
299
          pageSize: this.monthModalData.table.pager.size
300
        })
301
      )
302
      this.$test
303
        .post(services.areaInOutRecord.GET_ATTENDANCE_DETAILE, params)
304
        .then((res) => {
305
          debugger;
306
          // 请求成功处理...
307
          this.monthModalData.table.data = res.data.list
308
          this.monthModalData.table.pager.total = res.data.total
309
        })
310
        .catch((res) => {
311
          // 请求失败处理...
312
        })
313
    },
314
    getTime(type) {
315
      var date = new Date()
316
      var year = date.getFullYear()
317
      var mon = date.getMonth() + 1
318
      var da = date.getDate()
319
      mon = mon < 10 ? '0' + mon : mon
320
      da = da < 10 ? '0' + da : da
321
      if (type === 1) {
322
        return year + '-' + mon
323
      } else {
324
        return year + '-' + mon + '-' + da
325
      }
326
    },
327
    // 根据传入的整数和时间计算一周前的日期
328
    getBeforeDate(days, date) {
329
      var now
330
      if (date !== '') {
331
        var arr = date.split('-')
332
        now = new Date(arr[0], arr[1], arr[2]).getTime()
333
      } else {
334
        now = new Date().getTime()
335
      }
336
      var ago = now - 86400000 * days // 一天的毫秒数为86400000
337
      var agoData = new Date(ago)
338
      var year = agoData.getFullYear()
339
      var mon = agoData.getMonth() + 1
340
      var day = agoData.getDate()
341
      mon = mon < 10 ? '0' + mon : mon
342
      day = day < 10 ? '0' + day : day
343
      return year + '-' + mon + '-' + day
181 344
    }
182 345
  }
183 346
}
184 347
</script>
348