wangkang3 лет назад: 5
Родитель
Сommit
546b724245

+ 435 - 0
vue-project/hn-kq/src/components/overtime/OverTime.vue

@ -0,0 +1,435 @@
1
<template>
2
  <div class="ipu-flex-row ipu-flex-vertical">
3
    <div class="ipu-flex-col">
4
      <header class="ipu-toolbar">
5
        <h1 class="ipu-toolbar-title">{{isUpdate?'加班申请修改':'加班申请'}}</h1>
6
        <a class="ipu-fn-left common-page-back" href="javascript:;" @click="back"></a>
7
      </header>
8
    </div>
9
    <div class="ipu-flex-col ipu-flex-col-auto gray-backgroud">
10
      <div class="distance">
11
        <div
12
          class="ipu-flex ipu-flex-justify-space from-content border-content"
13
          @click="showStartDateTimePicker"
14
        >
15
          <div class="content-title">开始时间</div>
16
          <div class="ipu-flex content-value">
17
            <div>{{startTimeText}}</div>
18
            <div class="arrow-drop-right"></div>
19
          </div>
20
        </div>
21
        <div class="ipu-flex ipu-flex-justify-space from-content" @click="showEndDateTimePicker">
22
          <div class="content-title">结束时间</div>
23
          <div class="ipu-flex content-value">
24
            <div>{{endTimeText}}</div>
25
            <div class="arrow-drop-right"></div>
26
          </div>
27
        </div>
28
      </div>
29
      <!-- <div class="ipu-flex ipu-flex-justify-space from-content distance">
30
        <div class="content-title">加班时间</div>
31
        <div class="content-value day-value">{{day}}</div>
32
      </div> -->
33
      <div class="distance">
34
        <div class="content-title border-content from-content">备注</div>
35
        <div>
36
          <cube-textarea class="remark-content" placeholder="请输入" v-model="value"></cube-textarea>
37
        </div>
38
      </div>
39
      <div>
40
        <div class="from-content border-content content-title">图片</div>
41
        <div class="pic-content">
42
          <div class="ipu-flex remark-upload">
43
             <div class="ipu-flex attendance-detail-imgs">
44
               <div v-for="(img, index) in imgs" :key="index">
45
                 <img :src="img" alt=""  @click="showImagePreview(index)">
46
                 <i class="cubeic-wrong" @click="deleteImg(index)"></i>
47
               </div>
48
            </div>
49
            <i class="cubeic-add" v-if="imgs.length<3" @click="showCameraPhoto"></i>
50
          </div>
51
        </div>
52
      </div>
53
      <div class="gray-backgroud submit-container">
54
        <cube-button @click="submitOutWork">{{isUpdate?'提交修改':'提交申请'}}</cube-button>
55
      </div>
56
    </div>
57
  </div>
58
</template>
59
60
<script>
61
import TypeUtil from "../../util/TypeUtil"
62
export default {
63
  name: "ClockSuccess",
64
  props: {
65
    msg: String
66
  },
67
  data() {
68
    return {
69
      type: "请选择",
70
      leaveType: "",
71
      startTime: "",
72
      endTime: "",
73
      startTimeText: "",
74
      endTimeText: "",
75
      day: "",
76
      value: "",
77
      files: [],
78
      imgs:[],
79
      max: 3,
80
      startDate: null,
81
      column: [
82
        { text: "事假", value: "事假" },
83
        { text: "病假", value: "病假" },
84
        { text: "调休", value: "调休" },
85
        { text: "其他", value: "其他" }
86
      ],
87
      isUpdate: false
88
    };
89
  },
90
  mounted(){
91
    if(this.$route.query.id){
92
      this.isUpdate = true
93
      var params = {}
94
      params.overtimeInstId = this.$route.query.id
95
       this.$http
96
        .post("/userapro/getOvertimeDetail", params)
97
        .then(response => {
98
          if (response.respCode == "0000") {
99
            this.startTimeText = response.userovertimeRecordVo.overtimeBeginTime 
100
            this.endTimeText = response.userovertimeRecordVo.overtimeEndTime
101
            this.startTime = response.userovertimeRecordVo.overtimeBeginTime 
102
            this.startDate = new Date(response.userovertimeRecordVo.overtimeBeginTime.replace(/-/g, '/'))
103
            this.endDate = new Date(response.userovertimeRecordVo.overtimeEndTime.replace(/-/g, '/'))
104
            this.endTime = response.userovertimeRecordVo.overtimeEndTime
105
            if(response.userovertimeRecordVo.overtimePic1){
106
              this.imgs.push(response.userovertimeRecordVo.overtimePic1)
107
              this.files.push(response.userovertimeRecordVo.overtimePic1)
108
            }
109
            if(response.userovertimeRecordVo.overtimePic2){
110
              this.imgs.push(response.userovertimeRecordVo.overtimePic2)
111
              this.files.push(response.userovertimeRecordVo.overtimePic2)
112
            }
113
            if(response.userovertimeRecordVo.overtimePic3){
114
              this.imgs.push(response.userovertimeRecordVo.overtimePic3)
115
              this.files.push(response.userovertimeRecordVo.overtimePic3)
116
            }
117
            this.value = response.userovertimeRecordVo.overtimeDesc
118
          }
119
        }).catch(error => {
120
          console.log(error);
121
        })
122
    }
123
  },
124
  methods: {
125
     showCameraPhoto(){
126
      this.$createActionSheet({
127
         title: '选择照片类型',
128
         data: [
129
          {
130
            content: '拍照'
131
          },
132
          {
133
            content: '相册'
134
          }
135
        ],
136
        onSelect: (item, index) => {
137
          if(index==0){
138
            WadeMobile.getPhoto(path=>{
139
              this.submittedHandler('data:image/jpeg;base64,'+path)
140
            },0)
141
          }else if(index ==1){
142
             WadeMobile.getPicture(path=>{
143
              this.submittedHandler('data:image/jpeg;base64,'+path)
144
            },0)
145
          }
146
        },
147
        onCancel: () => {
148
         
149
        }
150
      }).show()
151
    },
152
    deleteImg(index){
153
      this.imgs.splice(index,1)
154
      this.files.splice(index,1)
155
    },
156
    dataURLtoFile(dataurl) {
157
      var filename = new Date().getTime()
158
      var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1],  
159
      bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);  
160
      while(n--){  
161
          u8arr[n] = bstr.charCodeAt(n);  
162
      }  
163
      return new File([u8arr], filename, {type:mime});
164
    },
165
    showImagePreview(index) {
166
        this.$createImagePreview({
167
          initialIndex: index,
168
          imgs: this.imgs
169
        }).show()
170
      },
171
    submitOutWork() {
172
      var params = {};
173
      console.log(this.leaveType);
174
      if (!(this.startTimeText && this.endTimeText)) {
175
        const toast = this.$createToast({
176
          type: "txt",
177
          txt: "请选择时间",
178
          time: 2000
179
        });
180
        toast.show();
181
        return;
182
      }
183
      params.overTimeBeginTime = this.startTimeText;
184
      params.overTimeEndTime = this.endTimeText;
185
      params.overTimeDesc = this.value;
186
      this.files.forEach((e,index)=>{
187
        params['overTimePic'+(index+1)] = e
188
      })
189
      console.log(params)
190
      if(this.$route.query.id){
191
        params.overtimeInstId = this.$route.query.id
192
        this.$http
193
          .post("/userapro/updateErrandDetail", params)
194
          .then(response => {
195
            if (response.respCode == "0000") {
196
              console.log(response);
197
              var param = {}
198
              param.title = '修改申请成功'
199
              param.content = '将来的你一定会感谢现在的自己'
200
              param.className = 'flag-blue-pass'
201
              this.$router.push({ path: "/reissueClockSuccess",query:param  });
202
            }
203
          })
204
          .catch(error => {
205
            console.log(error);
206
        });
207
      }else{
208
      this.$http
209
        .post("/useratd/addOverTime", params)
210
        .then(response => {
211
          if (response.respCode == "0000") {
212
            console.log(response);
213
            var param = {}
214
            param.title = '申请成功'
215
            param.content = '将来的你一定会感谢现在的自己'
216
            param.className = 'flag-blue-pass'
217
            this.$router.push({ path: "/reissueClockSuccess",query:param  });
218
          }
219
        })
220
        .catch(error => {
221
          console.log(error);
222
        });
223
        }
224
    },
225
    back() {
226
      this.$router.back(-1);
227
    },
228
    selectPickerHandle(selectedVal, selectedIndex, selectedText) {
229
      console.log(selectedVal);
230
      this.leaveType = selectedVal[0];
231
      this.type = selectedText.join(" ");
232
    },
233
    removedHandler(file) {
234
      console.log(file)
235
    },
236
    submittedHandler(base64) {
237
      if(this.files.length>=3){
238
        const toast = this.$createToast({
239
          type: "txt",
240
          txt: "最多上传3张图片",
241
          time: 2000
242
        });
243
        toast.show();
244
        return;
245
      }
246
      var params = new FormData();
247
      params.append("file", this.dataURLtoFile(base64));
248
      this.$http
249
        .post("/uploadFile", params)
250
        .then(response => {
251
          if (response.respCode == "0000") {
252
            this.imgs.push(base64)
253
            this.files.push(response.respMsg);
254
          }
255
        })
256
        .catch(error => {
257
          console.log(error);
258
        });
259
    },
260
    showStartDateTimePicker() {
261
      if (!this.startDateSegmentPicker) {
262
        var year = new Date().getFullYear();
263
        this.startDateSegmentPicker = this.$createDatePicker({
264
              is: 'cube-date-picker',
265
              title: '选择日期',
266
              min: new Date(year-1, 1, 1, 0, 0),
267
              max: new Date(year+5, 12, 31, 23, 59),
268
              value: new Date(),
269
              columnCount: 5,
270
              format: { year: "YYYY年", month: "MM月", date: " D 日" ,hour: 'hh时', minute: 'mm分'},
271
              onSelect: (date, selectedVal, selectedText) => {
272
              this.startDate = date;
273
              this.startTimeText =
274
                selectedVal[0] +
275
                "-" +
276
                (selectedVal[1]<10?"0"+selectedVal[1]:selectedVal[1]) +
277
                "-" +
278
                (selectedVal[2] < 10 ? "0" + selectedVal[2] : selectedVal[2])+" "+(selectedVal[3] < 10 ? "0" + selectedVal[3] : selectedVal[3])+":"+(selectedVal[4] < 10 ? "0" + selectedVal[4] : selectedVal[4]);
279
            },
280
            onCancel: () =>{}
281
            }
282
          )
283
      }
284
      this.startDateSegmentPicker.show()
285
    },
286
    showEndDateTimePicker() {
287
      if (!this.startDate||this.startDate == "") {
288
        const toast = this.$createToast({
289
          type: "txt",
290
          txt: "请先选择开始时间",
291
          time: 2000
292
        });
293
        toast.show();
294
        return;
295
      }
296
      // if (!this.endDateSegmentPicker) {
297
        var year = new Date().getFullYear();
298
        this.endDateSegmentPicker = this.$createDatePicker({
299
              is: 'cube-date-picker',
300
              title: '选择日期',
301
              min: this.startDate,
302
              max: new Date(year+5, 12, 31, 23, 59),
303
              value: new Date(),
304
              columnCount: 5,
305
              format: { year: "YYYY年", month: "MM月", date: " D 日" ,hour: 'hh时', minute: 'mm分'},
306
              onSelect: (date, selectedVal, selectedText) => {
307
              this.endDate = date;
308
              this.endTimeText =
309
                selectedVal[0] +
310
                "-" +
311
                (selectedVal[1]<10?"0"+selectedVal[1]:selectedVal[1]) +
312
                "-" +
313
                (selectedVal[2] < 10 ? "0" + selectedVal[2] : selectedVal[2])+" "+(selectedVal[3] < 10 ? "0" + selectedVal[3] : selectedVal[3])+":"+(selectedVal[4] < 10 ? "0" + selectedVal[4] : selectedVal[4]);
314
            },
315
            onCancel: () =>{}
316
            }
317
          )
318
      // }
319
320
      this.endDateSegmentPicker.show();
321
    },
322
  }
323
};
324
</script>
325
326
<style lang="stylus" rel="stylesheet/stylus">
327
@import '../../style/variable.styl';
328
.attendance-detail-imgs{
329
  >div{
330
    position: relative;
331
  }
332
  img{
333
    float: left;
334
    width: 100px;
335
    height: 100px;
336
    margin-right: 10px;
337
    margin-bottom: 10px;
338
    background-color: #eee;
339
  }
340
  .cubeic-wrong {
341
    position: absolute;
342
    z-index: 2;
343
    top: -1px;
344
    right: -1px;
345
    color: rgba(0,0,0,0.8);
346
    font-size: 20px;
347
    background-color: #fff;
348
    border-radius: 50%;
349
  }
350
  .cubeic-wrong::before{
351
    display: inline-block;
352
    -webkit-transform: scale(1.625);
353
    transform: scale(1.625);
354
    -webkit-transform-origin: center;
355
    transform-origin: center;
356
  }
357
}
358
359
360
.gray-backgroud {
361
  background-color: #eee;
362
}
363
364
.from-content {
365
  height: 44px;
366
  font-size: 16px;
367
  line-height: 44px;
368
  padding: 0 15px;
369
  background-color: #fff;
370
  .arrow-drop-right {
371
    background-image: url('../../assets/arrow-drop-right.png');
372
    background-size: 100% 100%;
373
    height: 12px;
374
    width: 8px;
375
    margin: 15px 0 0 14px;
376
  }
377
  .content-title {
378
    color: rgba(0, 0, 0, 0.85);
379
  }
380
  .content-value {
381
    color: rgba(0, 0, 0, 0.45);
382
  }
383
  input{
384
    text-align: right;
385
    color: rgba(0, 0, 0, 0.45);
386
  }
387
  .day-value {
388
    padding-right: 21px;
389
  }
390
  .remark-content {
391
    height: 100px;
392
  }
393
  .pic-content {
394
    background-color: #fff;
395
    .remark-upload {
396
      padding: 10px 15px;
397
      flex-wrap: wrap;
398
    }
399
  }
400
}
401
402
.distance {
403
  margin-bottom: 10px;
404
  .border-content {
405
    border-bottom: 1px solid rgba(0, 0, 0, 0.09); /* no */
406
  }
407
}
408
409
// .cube-textarea-wrapper::after {
410
//   border: none;
411
// }
412
413
.cube-upload-file {
414
  margin-right: 10px;
415
  margin-bottom: 15px;
416
}
417
418
.file-content .cube-upload-file-def {
419
  width: 75px;
420
  height: 75px;
421
}
422
423
.cube-upload-btn {
424
  line-height: 70px;
425
}
426
427
.submit-container {
428
  padding: 30px 15px 30px 15px;
429
}
430
431
.submit-container button {
432
  background-color: $c-primary;
433
  font-size: 18px;
434
}
435
</style>

+ 433 - 0
vue-project/hn-kq/src/components/overtime/OverTimeApplyList.vue

@ -0,0 +1,433 @@
1
<template>
2
  <div class="ipu-flex-content pages-leaveapply-list"
3
       :class="{'pages-leaveapply-list-manager': !auditManager }">
4
    <div class="ipu-flex-row ipu-flex-vertical">
5
      <div class="ipu-flex-col">
6
        <header class="ipu-toolbar">
7
          <a class="ipu-fn-left common-page-back" href="javascript:;" @click="pageBack"></a>
8
          <h1 class="ipu-toolbar-title">加班审批记录</h1>
9
        </header>
10
      </div>
11
12
      <div class="ipu-flex-col">
13
        <div class="ipu-tab ipu-tab-fixed ipu-tab-button">
14
          <div class="ipu-tab-head">
15
            <ul>
16
              <li v-for="statusItem in statusTypes"
17
                  :class="{'ipu-current' : queryData.overtimeAdminStatus==statusItem.status}"
18
                  @click="changeApplyType(statusItem.status)">{{statusItem.name}}
19
              </li>
20
            </ul>
21
22
            <div class="ipu-flex leaveapply-list-filter" v-show="filterType==0">
23
              <div class="ipu-flex-grow-1 leaveapply-list-filter-type  ipu-flex ipu-flex-justify-center"
24
                   @click="toSearchFilter">
25
                <div class="leaveapply-list-filter-search">搜索</div>
26
              </div>
27
              <div class="ipu-flex-grow-1 leaveapply-list-filter-type  ipu-flex ipu-flex-justify-center"
28
                   @click="toDateFilter">
29
                <div class="leaveapply-list-filter-date">筛选</div>
30
              </div>
31
              <div class="ipu-flex-grow-1 leaveapply-list-filter-type  ipu-flex ipu-flex-justify-center"
32
                   v-show="queryData.overtimeAdminStatus=='W'" @click="toAuditMange">
33
                <div class="leaveapply-list-filter-manage">管理</div>
34
              </div>
35
            </div>
36
37
            <div class="leaveapply-filter-search-query" v-show="filterType==1">
38
              <input type="search" placeholder="请输入姓名关键字" v-model="searchKey" @keyup.enter="toQuery"/>
39
            </div>
40
41
            <div class="leaveapply-filter-date-query" v-show="filterType==2">
42
              <div class="leaveapply-filter-date-block">
43
                <div class="leaveapply-filter-date-title">
44
                  快速筛选
45
                </div>
46
                <div class="ipu-flex leaveapply-filter-date-content">
47
                  <a href="javascript:;" class="leaveapply-filter-date-range" @click="sltDateRange('lastWeek')">近一周</a>
48
                  <a href="javascript:;" class="leaveapply-filter-date-range" @click="sltDateRange('lastMonth')">近一月</a>
49
                  <a href="javascript:;" class="leaveapply-filter-date-range"
50
                     @click="sltDateRange('last3Month')">近三月</a>
51
                </div>
52
              </div>
53
              <div class="leaveapply-filter-date-block">
54
                <div class="leaveapply-filter-date-title">
55
                  时间
56
                </div>
57
                <div class="leaveapply-filter-date-content">
58
                  <div class="ipu-flex leaveapply-filter-date-input-wrap">
59
                    <input class="ipu-flex-grow-0 leaveapply-filter-date-input" type="text" placeholder="请选择日期" readonly
60
                           @click="showBeginDate" v-model="beginDate"/>
61
                    <div class="ipu-flex-grow-1 leaveapply-filter-date-split"></div>
62
                    <input class="ipu-flex-grow-0 leaveapply-filter-date-input" type="text" placeholder="请选择日期" readonly
63
                           @click="showEndDate" v-model="endDate"/>
64
                  </div>
65
                </div>
66
              </div>
67
            </div>
68
69
            <div class="leaveapply-list-select-all">
70
              <label class="ipu-flex-grow-0 ipu-checkbox" @click="checkAllClick">
71
                <input type="checkbox" v-model="isCheckAll">全选
72
              </label>
73
            </div>
74
          </div>
75
        </div>
76
      </div>
77
78
      <div class="ipu-flex-col ipu-flex-col-auto">
79
        <div class="ipu-flex-content scroll-list-wrap" v-show="filterType == 0 && isQuery">
80
          <cube-scroll ref="scroll" :data="items"
81
                       :options="options"
82
                       @pulling-down="onPullingDown"
83
                       @pulling-up="onPullingUp">
84
85
            <div class="leaveapply-list">
86
              <div v-for="applyItem in items"
87
                   class="ipu-flex ipu-flex-align-center leaveapply-list-item-wrap">
88
                <label class="ipu-flex-grow-0 ipu-checkbox">
89
                  <input type="checkbox" :value="applyItem.overtimeInstId" v-model="sltItems">
90
                </label>
91
                <div class="ipu-flex-grow-1 leaveapply-list-item" @click="toDetail(applyItem)">
92
                  <div class="ipu-flex leavaapply-list-item-head">
93
                    <div class="ipu-flex-grow-1 leavaapply-list-item-title">
94
                      {{applyItem.atdObjName}}
95
                    </div>
96
                    <!-- leavaapply-list-item-type-illness  leavaapply-list-item-type-affair 事假颜色和其它不一样 -->
97
                   <div class="ipu-flwx-grow-0 leavaapply-list-item-type ">加班
98
                    </div>
99
                  </div>
100
                  <div class="leaveapply-list-item-body">
101
                    <div class="leaveapply-list-item-note">
102
                      {{applyItem.overtimeDesc}}
103
                    </div>
104
                    <div class="leaveapply-list-item-date">
105
                      {{applyItem.overtimeAskTime}}
106
                    </div>
107
                  </div>
108
                </div>
109
              </div>
110
            </div>
111
112
            <div class="list-empty-flag" v-show="items.length==0 && isQuery">
113
              暂无数据
114
            </div>
115
            <div class="no-more-data" v-show="items.length!=0  && !nextPage && isQuery">
116
              没有更多数据
117
            </div>
118
          </cube-scroll>
119
        </div>
120
      </div>
121
122
      <div class="ipu-flex-col" v-show="filterType!=0">
123
        <div class="filter-query-btn-wrap">
124
          <button class="ipu-btn common-btn common-btn-primary filter-query-btn" @click="toQuery">查询</button>
125
        </div>
126
      </div>
127
128
      <div class="ipu-flex-col" v-show="auditManager">
129
        <div class="ipu-flex audit-btns list-audit-btns">
130
          <button class="ipu-btn common-btn common-btn-asset" @click="auditApply('N')">
131
            审核不通过
132
          </button>
133
          <button class="ipu-btn common-btn common-btn-primary" @click="auditApply('A')">
134
            审核通过
135
          </button>
136
        </div>
137
      </div>
138
    </div>
139
  </div>
140
</template>
141
<script type="text/ecmascript-6">
142
  import List from "../common/List"
143
  import DateUtil from "../../util/DateUtil"
144
  import TypeUtil from "../../util/TypeUtil"
145
  import EventBus from "../common/EventBus.js"
146
147
  export default {
148
    props: {},
149
    data: function () {
150
      return {
151
        statusTypes: [{name: '待审批', status: 'W'}, {name: '审批通过', status: 'A'}, {name: '审批未通过', status: 'N'}],
152
        queryData: {
153
          atdObjName: '',     // 申请人姓名,模糊匹配
154
          pageSize: 10,
155
          pageNumber: 1,
156
          overtimeAdminStatus: 'W',     // 默认W审批未通过,N审批通过,A审批未通过
157
          overtimeBeginTime: '',
158
          overtimeEndTime: ''
159
        },
160
        isQuery: false,     // 是否查询过
161
        filterType: 0,        // 0默认,1搜索,2筛选
162
        auditManager: false,      // 是否管理状态
163
        isCheckAll: false,   // 是否全选
164
        searchKey: '',        // 搜索关键字
165
        beginDate: '',
166
        endDate: '',
167
        sltItems: [],         // 选中项
168
        items: [],            // 数据列表
169
        nextPage: false,       // 是否下一页
170
        queryCount: 0,           // 查询计数器
171
        dateRanges: null,        // 近一周,一月,三月信息
172
        beginPicker: null,
173
        endPicker: null,
174
        defaultMin: null,
175
        defaultMax: null
176
      }
177
    },
178
    computed: {
179
      options: function () {
180
        return {
181
          pullDownRefresh: !this.auditManager && {
182
            txt: '刷新成功'
183
          },
184
          pullUpLoad: !this.auditManager && this.nextPage && { // ,加上后不再显示不能加载更多
185
            txt: {
186
              more: '向上加载更多...',
187
              noMore: '没有更多数据'
188
            }
189
          }
190
        }
191
      }
192
    },
193
    methods: {
194
      onPullingDown(){ // 模拟刷新数据
195
        this.getApplyList(2)
196
      },
197
      onPullingUp(){ // 加载新数据
198
        if (this.nextPage) {
199
          this.getApplyList(1)
200
        } else {
201
          this.$refs.scroll.forceUpdate()
202
        }
203
      },
204
      checkAllClick(){
205
        this.isCheckAll = !this.isCheckAll
206
        if (this.isCheckAll) {
207
          let newSltItem = this.items.map(function (item) { // 将数组中的数组全部放入
208
            return item.overtimeInstId
209
          });
210
          this.sltItems = newSltItem
211
        } else {
212
          this.sltItems = []
213
        }
214
      },
215
      leaveTypeText: TypeUtil.leaveTypeText,
216
      toAuditMange(){
217
        this.auditManager = !this.auditManager
218
      },
219
      toSearchFilter(){
220
        this.auditManager = false
221
        this.searchKey = this.queryData.atdObjName
222
        this.filterType = 1
223
      },
224
      toDateFilter(){
225
        this.auditManager = false
226
        this.beginDate = this.queryData.overtimeBeginTime
227
        this.endDate = this.queryData.overtimeEndTime
228
        this.filterType = 2
229
      },
230
      changeApplyType(type){  // 切换不同状态审批列表时,清空原来的查询条件
231
        if (this.queryData.overtimeAdminStatus != type) {
232
          this.queryData.overtimeAdminStatus = type
233
          this.queryData.overtimeBeginTime = ''
234
          this.queryData.overtimeEndTime = ''
235
          this.queryData.atdObjName = ''
236
          this.filterType = 0 // 默认展示列表页面
237
          this.auditManager = false
238
          this.isCheckAll = false
239
          this.getApplyList(0)
240
        }
241
      },
242
      toQuery(){
243
        let currentFileType = this.filterType
244
        if (currentFileType == 1) {  // 关键字搜索
245
          this.queryData.atdObjName = this.searchKey
246
          this.queryData.overtimeBeginTime = ''
247
          this.queryData.overtimeEndTime = ''
248
        } else if (currentFileType == 2) { // 时间搜索,设置相关查询条件
249
          this.queryData.overtimeBeginTime = this.beginDate
250
          this.queryData.overtimeEndTime = this.endDate
251
          this.queryData.atdObjName = ''
252
        }
253
254
        this.filterType = 0
255
        this.getApplyList(0)
256
      },
257
      pageBack(){
258
        if (this.auditManager) {
259
          this.auditManager = false
260
        } else if (this.filterType != 0) {
261
          this.filterType = 0
262
        } else {
263
          this.$router.back()
264
        }
265
      },
266
      auditApply(status){
267
        if (this.sltItems.length) {
268
          let _this = this
269
          let toast = this.$createToast({
270
            time: 0,
271
            txt: '提交中',
272
            mask: true
273
          })
274
          toast.show()
275
          this.$http.post('/userapro/updateOvertimeStatusForList', {
276
            adminStatus: status,
277
            overtimeInstIdList: this.sltItems
278
          }).then(function (data) {
279
            _this.$createDialog({type: 'alert', title: '提示', content: data.respMsg || '操作成功'}).show()
280
281
            _this.auditManager = false  // 重新触发查询,以便更新数据
282
          }).finally(function () {
283
            toast.hide()
284
            _this.sltItems = []
285
            _this.getApplyList(2)
286
          })
287
        } else {
288
          this.$createToast({
289
            type: 'text',
290
            txt: '请最少选择一个审批项',
291
            time: 2000
292
          }).show()
293
        }
294
      },
295
      initDatePicker(){
296
        let _this = this
297
        this.beginPicker = this.$createDatePicker({
298
          title: '开始日期',
299
          value: new Date(),
300
          format: { year: 'YYYY年', month: 'M月', date: 'D日' },
301
          onSelect: function (date) {
302
            _this.beginDate = DateUtil.formatDate(date)
303
          }
304
        })
305
306
        this.endPicker = this.$createDatePicker({
307
          title: '结束日期',
308
          value: new Date(),
309
          format: { year: 'YYYY年', month: 'M月', date: 'D日' },
310
          onSelect: function (date) {
311
            _this.endDate = DateUtil.formatDate(date)
312
          }
313
        })
314
315
        // 根据日期组件保存默认的最大最小值
316
        this.defaultMin = this.endPicker.min
317
        this.defaultMax = this.beginPicker.max
318
319
        // 监听两个数据的变化,设置最大值与最小值
320
        this.$watch("beginDate", function (newValue, oldValue) {
321
          _this.endPicker.$updateProps({
322
            min: _this.strToDate(newValue) || this.defaultMin
323
          })
324
        })
325
        this.$watch("endDate", function (newValue, oldValue) {
326
          _this.beginPicker.$updateProps({
327
            max: _this.strToDate(newValue) || this.defaultMax
328
          })
329
        })
330
      },
331
      showBeginDate(){
332
        this.beginPicker.show()
333
      },
334
      showEndDate(){
335
        this.endPicker.show()
336
      },
337
      sltDateRange(index){ // 0:近一周,1:近一月,2:近三月
338
        let dateRange = this.dateRanges[index]
339
        this.beginDate = dateRange[0]
340
        this.endDate = dateRange[1]
341
      },
342
      strToDate(str){
343
        if (!str) {
344
          return null
345
        }
346
        let items = str.split("-")
347
        return new Date(items[0], items[1] - 1, items[2])
348
      },
349
      createDateRange(){
350
        let today = new Date()
351
        let computeDay = new Date(today.getTime())
352
        let lastWeekDay = new Date(computeDay.setDate(computeDay.getDate() - 7));  // 最近一周起始时间
353
354
        computeDay = new Date(today.getTime())
355
        let lastMonthDay = new Date(computeDay.setMonth(computeDay.getMonth() - 1));  // 最近一月起始时间
356
357
        computeDay = new Date(today.getTime())
358
        let last3MonthDay = new Date(computeDay.setMonth(computeDay.getMonth() - 3));  // 最近三月起始时间
359
360
        let todayStr = DateUtil.formatDate(today)
361
362
        this.dateRanges = {
363
          lastWeek: [DateUtil.formatDate(lastWeekDay), todayStr],
364
          lastMonth: [DateUtil.formatDate(lastMonthDay), todayStr],
365
          last3Month: [DateUtil.formatDate(last3MonthDay), todayStr]
366
        }
367
      },
368
      getApplyList(type){  // type 0:首次加载,1:加载更多 ,2:刷新加载
369
        let _this = this
370
        let toast = null
371
        this.queryCount++
372
        let localCount = this.queryCount
373
374
        if (type == 0) {
375
          this.items = []   // 重置数据,否则查询出错时,会显示历史数据
376
          toast = this.$createToast({
377
            time: 0,
378
            txt: '加载中',
379
            mask: true
380
          })
381
          toast.show()
382
        }
383
        if (type != 1) {
384
          this.queryData.pageNumber = 1
385
        }
386
387
        this.$http.post("/userapro/getOvertimeList", this.queryData).then(function (data) {
388
          if (localCount != _this.queryCount) {
389
            return
390
          }
391
          let item = data.userOvertimeRecordVoList || []
392
          if (type == 0 || type == 2) { // 刷新或切换审核状态
393
            _this.items = item
394
          } else if (type == 1) {
395
            _this.items = _this.items.concat(item)
396
          }
397
398
          _this.nextPage = item.length == _this.queryData.pageSize
399
          if (_this.nextPage) {
400
            _this.queryData.pageNumber = _this.queryData.pageNumber + 1
401
          }
402
        }).finally(function () {
403
          _this.isQuery = true
404
          if (toast) {
405
            toast.hide()
406
          }
407
          _this.$refs.scroll.forceUpdate()
408
        })
409
      },
410
      toDetail(applyItem){  // 未审核的进入审核页面,审核的进入详情页面
411
        if (applyItem.adminStatus == 'W') {
412
          this.$router.push({name: 'OverTimeAudit', query: {id: applyItem.overtimeInstId}})
413
        } else {
414
          this.$router.push({name: 'OverTimeDetail', query: {id: applyItem.overtimeInstId}})
415
        }
416
      }
417
    },
418
    mounted: function () {
419
      let _this = this
420
      EventBus.$on(TypeUtil.eventName.overTimeApplyList, function () {
421
        _this.getApplyList(0)
422
      })
423
    },
424
    created: function () {
425
      this.initDatePicker()
426
      this.createDateRange()
427
      this.getApplyList(0)
428
    }
429
  }
430
</script>
431
<!-- Add "scoped" attribute to limit CSS to this component only -->
432
<style lang="stylus" rel="stylesheet/stylus" scoped>
433
</style>

+ 181 - 0
vue-project/hn-kq/src/components/overtime/OverTimeAudit.vue

@ -0,0 +1,181 @@
1
<template>
2
  <div class="ipu-flex-content pages-laeveapply-audit">
3
    <div class="ipu-flex-row ipu-flex-vertical">
4
      <div class="ipu-flex-col">
5
        <header class="ipu-toolbar">
6
          <a class="ipu-fn-left common-page-back" href="javascript:;" @click="pageBack"></a>
7
          <h1 class="ipu-toolbar-title">加班审批</h1>
8
        </header>
9
      </div>
10
11
      <div class="ipu-flex-col ipu-flex-col-auto">
12
        <div class="page-content">
13
          <div class="ipu-list ipu-list-high ipu-list-form">
14
            <ul>
15
              <li class="ipu-list-item">
16
                <div class="ipu-list-item-inner">
17
                  <div class="ipu-list-item-label">
18
                    申请人
19
                  </div>
20
                  <div class="ipu-list-item-input-wrap">
21
                    {{applyInfo.atdObjName}}
22
                  </div>
23
                </div>
24
              </li>
25
              <li class="ipu-list-item">
26
                <div class="ipu-list-item-inner">
27
                  <div class="ipu-list-item-label">
28
                    申请时间
29
                  </div>
30
                  <div class="ipu-list-item-input-wrap">
31
                    {{applyInfo.overtimeAskTime}}
32
                  </div>
33
                </div>
34
              </li>
35
              <li class="ipu-list-item">
36
                <div class="ipu-list-item-inner">
37
                  <div class="ipu-list-item-label">
38
                    申请周期
39
                  </div>
40
                  <div class="ipu-list-item-input-wrap">
41
                    {{applyInfo.overtimeBeginTime}} ~ {{applyInfo.overtimeEndTime}}
42
                  </div>
43
                </div>
44
              </li>
45
              <!-- <li class="ipu-list-item">
46
                <div class="ipu-list-item-inner">
47
                  <div class="ipu-list-item-label">
48
                    请假类型
49
                  </div>
50
                  <div class="ipu-list-item-input-wrap">
51
                    {{getLeaveTypeDesc(applyInfo.leaveType)}}
52
                  </div>
53
                </div>
54
              </li> -->
55
              <li class="ipu-list-item ipu-flex-vertical list-item-img list-item-note">
56
                <div class="ipu-list-item-inner">
57
                  <div class="ipu-list-item-label">
58
                    事由描述
59
                  </div>
60
                  <div class="ipu-list-item-input-wrap">
61
                  </div>
62
                </div>
63
                <div class="attendance-note ipu-fn-bd-t">
64
                  {{applyInfo.overtimeDesc}}
65
                </div>
66
                <div class="attendance-detail-imgs">
67
                  <img v-for="img, index in imgs" :src="img" alt="" @click="showImagePreview(index)">
68
                </div>
69
              </li>
70
            </ul>
71
          </div>
72
73
          <div class="common-split-block"></div>
74
75
          <div class="audit-block" v-show="applyInfo.adminStatus=='W'">
76
            <div class="audit-title ipu-fn-bd-b">
77
              审批意见
78
            </div>
79
            <textarea class="audit-note-input" placeholder="请输入审批意见" v-model="auditNote">
80
81
            </textarea>
82
            <div class="ipu-flex audit-btns">
83
              <button class="ipu-btn common-btn common-btn-asset" @click="auditApply('N')">
84
                审核不通过
85
              </button>
86
              <button class="ipu-btn common-btn common-btn-primary" @click="auditApply('A')">
87
                审核通过
88
              </button>
89
            </div>
90
91
          </div>
92
        </div>
93
      </div>
94
95
    </div>
96
  </div>
97
</template>
98
99
<script type="text/ecmascript-6">
100
  import TypeUtil from "../../util/TypeUtil"
101
  import EventBus from "../common/EventBus.js"
102
103
  export default {
104
    props: {},
105
    data: function () {
106
      return {
107
        applyInfo: {},
108
        auditNote: '',
109
        imgs: []
110
      }
111
    },
112
    methods: {
113
      pageBack (){
114
        this.$router.back()
115
      },
116
      getLeaveTypeDesc: TypeUtil.leaveTypeText,
117
      getLeaveStatusDesc: TypeUtil.leaveApplyStatusText,
118
      getImgs(item){
119
        if (item.picUrl1) {
120
          this.imgs.push(item.picUrl1)
121
        }
122
        if (item.picUrl2) {
123
          this.imgs.push(item.picUrl2)
124
        }
125
        if (item.picUrl3) {
126
          this.imgs.push(item.picUrl3)
127
        }
128
      },
129
      getLeaveApply(){
130
        let _this = this
131
132
        this.$http.post('/userapro/getOvertimeDetail', {overtimeInstId: this.$route.query.id}).then(function (data) {
133
          _this.applyInfo = data.userovertimeRecordVo
134
135
          _this.getImgs(_this.applyInfo)
136
          if (_this.applyInfo.adminStatus != 'W') {  // 检查审核状态是否未审核
137
            _this.$createDialog({type: 'alert', title: '提示', content: '请假申请已经审核过了'}).show()
138
          }
139
        })
140
      },
141
      auditApply(status){
142
        let _this = this
143
        let toast = this.$createToast({
144
          time: 0,
145
          txt: '提交中',
146
          mask: true
147
        })
148
        toast.show()
149
150
        this.$http.post("/userapro/updateOvertimeStatus", {
151
          adminDesc: this.auditNote,
152
          overtimeInstId: this.applyInfo.overtimeInstId,
153
          adminStatus: status
154
        }).then(function (data) {
155
          let result = 0  // 表示审核失败
156
          if (data.respCode == '0000') {
157
            result = status == 'A' ? 1 : 2
158
          }
159
          // 应该是替换当前地址,除了失败?
160
          _this.$router.replace({name: 'AuditResult', query: {result: result}})
161
        }).finally(function () {
162
          EventBus.$emit(TypeUtil.eventName.leaveApplyList, null) // 通知列表页面刷新
163
          toast.hide()
164
        })
165
      },
166
      showImagePreview(index) {
167
        this.$createImagePreview({
168
          initialIndex: index,
169
          imgs: this.imgs
170
        }).show()
171
      }
172
    },
173
    created(){
174
      this.getLeaveApply()
175
    }
176
  }
177
</script>
178
<!-- Add "scoped" attribute to limit CSS to this component only -->
179
<style lang="stylus" rel="stylesheet/stylus" scoped>
180
181
</style>

+ 200 - 0
vue-project/hn-kq/src/components/overtime/OverTimeDetail.vue

@ -0,0 +1,200 @@
1
<template>
2
  <div class="ipu-flex-content pages-outattendance-detail">
3
    <div class="ipu-flex-row ipu-flex-vertical">
4
      <div class="ipu-flex-col">
5
        <header class="ipu-toolbar">
6
          <a class="ipu-fn-left common-page-back" href="javascript:;" @click="pageBack"></a>
7
          <h1 class="ipu-toolbar-title">加班详情</h1>
8
        </header>
9
      </div>
10
      <div class="ipu-flex-col ipu-flex-col-auto">
11
        <div class="page-content">
12
          <div class="ipu-list ipu-list-high ipu-list-form">
13
            <ul>
14
              <li class="ipu-list-item">
15
                <div class="ipu-list-item-inner">
16
                  <div class="ipu-list-item-label">
17
                    申请人
18
                  </div>
19
                  <div class="ipu-list-item-input-wrap">
20
                    {{applyInfo.atdObjName}}
21
                  </div>
22
                </div>
23
              </li>
24
              <li class="ipu-list-item">
25
                <div class="ipu-list-item-inner">
26
                  <div class="ipu-list-item-label">
27
                    申请时间
28
                  </div>
29
                  <div class="ipu-list-item-input-wrap">
30
                    {{applyInfo.overtimeAskTime}}
31
                  </div>
32
                </div>
33
              </li>
34
              <li class="ipu-list-item">
35
                <div class="ipu-list-item-inner">
36
                  <div class="ipu-list-item-label">
37
                    开始时间
38
                  </div>
39
                  <div class="ipu-list-item-input-wrap">
40
                    {{applyInfo.overtimeBeginTime}}
41
                  </div>
42
                </div>
43
              </li>
44
              <li class="ipu-list-item">
45
                <div class="ipu-list-item-inner">
46
                  <div class="ipu-list-item-label">
47
                    结束时间
48
                  </div>
49
                  <div class="ipu-list-item-input-wrap">
50
                    {{applyInfo.overtimeEndTime}}
51
                  </div>
52
                </div>
53
              </li>
54
              <li class="ipu-list-item">
55
                <div class="ipu-list-item-inner">
56
                  <div class="ipu-list-item-label">
57
                    加班事由
58
                  </div>
59
                  <div class="ipu-list-item-input-wrap">
60
                    {{applyInfo.overtimeDesc}}
61
                  </div>
62
                </div>
63
              </li>
64
              <li class="ipu-list-item">
65
                <div class="ipu-list-item-inner">
66
                  <div class="ipu-list-item-label">
67
                    审批时间
68
                  </div>
69
                  <div class="ipu-list-item-input-wrap">
70
                    {{applyInfo.updateTime=='null'?'':applyInfo.updateTime}}
71
                  </div>
72
                </div>
73
              </li>
74
              <li class="ipu-list-item">
75
                <div class="ipu-list-item-inner">
76
                  <div class="ipu-list-item-label">
77
                    审批人
78
                  </div>
79
                  <div class="ipu-list-item-input-wrap">
80
                    {{applyInfo.rePunchAdminName}}
81
                  </div>
82
                </div>
83
              </li>
84
              <li class="ipu-list-item">
85
                <div class="ipu-list-item-inner">
86
                  <div class="ipu-list-item-label">
87
                    审批备注
88
                  </div>
89
                  <div class="ipu-list-item-input-wrap">
90
                    {{applyInfo.adminDesc}}
91
                  </div>
92
                </div>
93
              </li>
94
              <li class="ipu-list-item">
95
                <div class="ipu-list-item-inner">
96
                  <div class="ipu-list-item-label">
97
                    审批结果
98
                  </div>
99
                  <div class="ipu-list-item-input-wrap">
100
                    {{leaveApplyStatusText(applyInfo.adminStatus)}}
101
                  </div>
102
                </div>
103
              </li>
104
              <li class="ipu-list-item ipu-flex-vertical list-item-img">
105
                <div class="ipu-list-item-inner">
106
                  <div class="ipu-list-item-label">
107
                    图片
108
                  </div>
109
                </div>
110
                <div class="attendance-detail-imgs">
111
                  <img v-for="img, index in imgs" :src="img" alt="" @click="showImagePreview(index)">
112
                </div>
113
              </li>
114
            </ul>
115
            <div class="ipu-flex submit-container" v-if="applyInfo.adminStatus=='A'&&applyInfo.reviseFlag!='A'">
116
              <cube-button style="margin:10px" @click="todelete">撤销</cube-button> 
117
              <cube-button style="margin:10px" @click="toupdate">修改</cube-button>
118
            </div>
119
          </div>
120
        </div>
121
      </div>
122
    </div>
123
  </div>
124
</template>
125
126
<script type="text/ecmascript-6">
127
128
  import TypeUtil from "../../util/TypeUtil"
129
  import {Toast, Dialog} from 'cube-ui'
130
131
  export default {
132
    props: {},
133
    data: function () {
134
      return {
135
        imgs: [],
136
        applyInfo: {}
137
      }
138
    },
139
    methods: {
140
      todelete(){
141
         Dialog.$create({type: 'confirm', title: '提示', content: '是否确认撤销加班申请!',onConfirm: () => {
142
            this.$http
143
          .post("/useratd/deleteErrAnd", {errAndId:this.$route.query.id})
144
          .then((response) => {
145
            if (response.respCode == "0000") {
146
              console.log(response);
147
              var param = {}
148
              param.title = '撤销成功'
149
              param.content = '将来的你一定会感谢现在的自己'
150
              param.className = 'flag-pass'
151
              this.$router.push({ path: "/reissueClockSuccess",query:param });
152
            }
153
          })
154
          .catch((error) => {
155
            console.log(error);
156
          });
157
        }}).show()
158
      },
159
      toupdate() {
160
        this.$router.push({
161
          name: "OverTime",
162
          query: { id: this.$route.query.id }
163
        });
164
      },
165
      pageBack (){
166
        this.$router.back()
167
      },
168
      leaveTypeText: TypeUtil.leaveTypeText,
169
      leaveApplyStatusText: TypeUtil.leaveApplyStatusText,
170
      getApplyInfo(){
171
        let _this = this
172
        this.$http.post('/userapro/getOvertimeDetail', {overtimeInstId: this.$route.query.id})
173
            .then(data => {
174
              this.applyInfo = data.userovertimeRecordVo
175
              _this.getImgs(_this.applyInfo)
176
            })
177
      },
178
      getImgs(item){
179
        if (item.overtimePic1) {
180
          this.imgs.push(item.overtimePic1)
181
        }
182
        if (item.overtimePic2) {
183
          this.imgs.push(item.overtimePic2)
184
        }
185
        if (item.overtimePic3) {
186
          this.imgs.push(item.overtimePic3)
187
        }
188
      },
189
      showImagePreview(index) {
190
        this.$createImagePreview({
191
          initialIndex: index,
192
          imgs: this.imgs
193
        }).show()
194
      }
195
    },
196
    created(){
197
      this.getApplyInfo()
198
    }
199
  }
200
</script>