yaozc
2023-07-07 c752e33fe402e2179e7e6795f567d41c044ca3c6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <div>
        <el-select v-model="query.userId" filterable clearable placeholder="申请人" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
          <el-option
            v-for="item in users"
            :key="item.id"
            :label="item.nickName"
            :value="item.id"
          />
        </el-select>
        <el-select v-model="query.approvalUserId" filterable clearable placeholder="审批者" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
          <el-option
            v-for="item in users"
            :key="item.id"
            :label="item.nickName"
            :value="item.id"
          />
        </el-select>
        <el-select v-model="query.leaveType" filterable clearable placeholder="请假类型" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
          <el-option
            v-for="item in dict[dictLeaveType]"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
        <el-select v-model="query.approvalStatus" filterable clearable placeholder="审批状态" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
          <el-option
            v-for="item in dict[dictApprovalStart]"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
        <el-date-picker
          v-model="query.leaveStartTime"
          type="daterange"
          clearable
          class="date-item"
          value-format="yyyy-MM-dd HH:mm:ss"
          placeholder="请选择日期时间"
          range-separator=" : "
          start-placeholder="开始日期"
          end-placeholder="开始日期"
        />
        <el-date-picker
          v-model="query.leaveEndTime"
          type="daterange"
          clearable
          class="date-item"
          value-format="yyyy-MM-dd HH:mm:ss"
          placeholder="请选择日期时间"
          range-separator=" : "
          start-placeholder="结束日期"
          end-placeholder="结束日期"
        />
        <rrOperation />
      </div>
      <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
      <crudOperation :permission="permission" />
      <!--表单组件-->
      <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
        <el-form ref="form" :model="form" :rules="rules" size="small" label-width="110px">
          <el-form-item label="申请人" prop="userId">
            <el-select v-model="form.userId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="disabledUser(form)" @change="checkLeaveTime">
              <el-option
                v-for="item in users"
                :key="item.id"
                :label="item.nickName"
                :value="item.id"
                :disabled="!item.enabled"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="审批者" prop="approvalUserId">
            <el-select v-model="form.approvalUserId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="form.approvalStatus == dictAppRovalStatusPassed || form.approvalStatus == dictAppRovalStatusReturn">
              <el-option
                v-for="item in approvalUsers"
                :key="item.id"
                :label="item.nickName"
                :value="item.id"
                :disabled="!item.enabled"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="请假类型" prop="leaveType">
            <el-select v-model="form.leaveType" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="form.approvalStatus == dictAppRovalStatusPassed || form.approvalStatus == dictAppRovalStatusReturn" @change="checkLeaveTime">
              <el-option
                v-for="item in dict[dictLeaveType]"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="请假开始时间" prop="leaveStartTime">
            <el-date-picker
              v-model="form.leaveStartTime"
              :type="form.leaveType !== dictLeaveTypeAnnualLeave && form.leaveType !== dictLeaveTypeCompassionateLeave ? 'date' : 'datetime'"
              placeholder="选择日期时间"
              style="width: 340px;"
              value-format="yyyy-MM-dd HH:mm:ss"
              align="right"
              :picker-options="{
                disabledDate(time) {
                  return form.leaveEndTime ? time.getTime() > new Date(form.leaveEndTime).getTime() - 8.64e7 : false;
                }
              }"
              :default-time="$store.state.user.user.sysRostering.workStartTime + ':00'"
              :disabled="form.approvalStatus == dictAppRovalStatusPassed || form.approvalStatus == dictAppRovalStatusReturn"
              @change="checkLeaveTime"
            />
          </el-form-item>
          <el-form-item label="请假结束时间" prop="leaveEndTime">
            <el-date-picker
              v-model="form.leaveEndTime"
              :type="form.leaveType !== dictLeaveTypeAnnualLeave && form.leaveType !== dictLeaveTypeCompassionateLeave ? 'date' : 'datetime'"
              placeholder="选择日期时间"
              style="width: 340px;"
              value-format="yyyy-MM-dd HH:mm:ss"
              align="right"
              :picker-options="{
                disabledDate(time) {
                  return form.leaveStartTime ? time.getTime() < new Date(form.leaveStartTime).getTime() - 8.64e7 : false;
                }
              }"
              :default-time="$store.state.user.user.sysRostering.workEndTime + ':00'"
              :disabled="form.approvalStatus == dictAppRovalStatusPassed || form.approvalStatus == dictAppRovalStatusReturn"
              @change="checkLeaveTime"
            />
          </el-form-item>
          <el-form-item label="请假时长" prop="leaveDuration">
            <el-input v-model="form.leaveDuration" disabled style="width: 340px;">
              <template slot="append">{{ dict.label[dictLeaveTimeType][form.leaveDurationUnit] }}</template>
            </el-input>
          </el-form-item>
          <el-form-item label="请假原因">
            <el-input v-model="form.leaveReason" type="textarea" rows="3" style="width: 340px;" :disabled="form.approvalStatus == dictAppRovalStatusPassed || form.approvalStatus == dictAppRovalStatusReturn" />
          </el-form-item>
          <el-form-item label="审批说明">
            <el-input v-model="form.approvalDescription" type="textarea" rows="3" style="width: 340px;" disabled />
          </el-form-item>
          <el-form-item label="备注">
            <el-input v-model="form.remarks" type="textarea" rows="3" style="width: 340px;" :disabled="form.approvalStatus == dictAppRovalStatusPassed || form.approvalStatus == dictAppRovalStatusReturn" />
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button type="text" @click="crud.cancelCU">取消</el-button>
          <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
        </div>
      </el-dialog>
      <!--审核表单-->
      <el-dialog :close-on-click-modal="false" :before-close="closeCard" :visible.sync="makeUpCardVisible" title="请假审批" width="500px">
        <el-form ref="form" :model="form" :rules="rules" size="small" label-width="110px">
          <el-form-item label="申请人">
            {{ form.userName }}
          </el-form-item>
          <el-form-item label="请假类型">
            <el-tag>{{ dict.label[dictLeaveType][form.leaveType] }}</el-tag>
          </el-form-item>
          <el-form-item label="请假开始时间">
            {{ form.leaveDurationUnit === dictLeaveTimeTypeHour ? form.leaveStartTime : crud.toDate(form.leaveStartTime) }}
          </el-form-item>
          <el-form-item label="请假结束时间">
            {{ form.leaveDurationUnit === dictLeaveTimeTypeHour ? form.leaveEndTime : crud.toDate(form.leaveEndTime) }}
          </el-form-item>
          <el-form-item label="请假时长">
            {{ form.leaveDuration + '(' + dict.label[dictLeaveTimeType][form.leaveDurationUnit] + ')' }}
          </el-form-item>
          <el-form-item label="请假原因">
            {{ form.leaveReason }}
          </el-form-item>
          <el-form-item v-if="form.approvalStatus === dictAppRovalStatusReturn" label="退回原因" prop="approvalDescription">
            <div style="color: red;">*审核退回需要填写退回原因,请填写后再次点击审核退回</div>
            <el-input v-model="form.approvalDescription" type="textarea" :rows="3" style="width: 340px;" />
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button type="danger" style="margin-right: 10px;" @click="approveFunction(1,form)">审核退回</el-button>
          <el-button v-if="form.approvalStatus !== dictAppRovalStatusReturn" :loading="successLoading" type="success" @click="approveFunction(2,form)">审核通过</el-button>
        </div>
      </el-dialog>
      <!--表格渲染-->
      <el-table ref="table" v-loading="crud.loading" :data="crud.data" row-key="id" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
        <el-table-column type="selection" width="55" />
        <el-table-column prop="userName" label="申请人" min-width="100" fixed="left" show-overflow-tooltip>
          <template slot-scope="scope">
            <el-tag>{{ scope.row.userName }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="appUserName" label="审批者" min-width="100" fixed="left" show-overflow-tooltip>
          <template slot-scope="scope">
            <el-tag>{{ scope.row.appUserName }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="leaveType" label="请假类型" min-width="80" show-overflow-tooltip>
          <template slot-scope="scope">
            <el-tag>{{ dict.label[dictLeaveType][scope.row.leaveType] }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="leaveStartTime" min-width="140" label="请假开始时间" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.leaveDurationUnit === dictLeaveTimeTypeHour ? scope.row.leaveStartTime : crud.toDate(scope.row.leaveStartTime) }}
          </template>
        </el-table-column>
        <el-table-column prop="leaveEndTime" min-width="140" label="请假结束时间" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.leaveDurationUnit === dictLeaveTimeTypeHour ? scope.row.leaveEndTime : crud.toDate(scope.row.leaveEndTime) }}
          </template>
        </el-table-column>
        <el-table-column prop="leaveDuration" label="请假时长" min-width="80" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.leaveDuration + '(' + dict.label[dictLeaveTimeType][scope.row.leaveDurationUnit] + ')' }}
          </template>
        </el-table-column>
        <el-table-column prop="leaveReason" label="请假原因" min-width="140" show-overflow-tooltip />
        <el-table-column prop="approvalStatus" label="审批状态" min-width="80" show-overflow-tooltip>
          <template slot-scope="scope">
            <el-tag v-if="scope.row.approvalStatus === dictAppRovalStatusUnderAppover" type="warning">{{ dict.label[dictApprovalStart][scope.row.approvalStatus] }}</el-tag>
            <el-tag v-if="scope.row.approvalStatus === dictAppRovalStatusPassed" type="success">{{ dict.label[dictApprovalStart][scope.row.approvalStatus] }}</el-tag>
            <el-tag v-if="scope.row.approvalStatus === dictAppRovalStatusReturn" type="danger">{{ dict.label[dictApprovalStart][scope.row.approvalStatus] }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="approvalDescription" label="审批说明" min-width="140" show-overflow-tooltip />
        <el-table-column prop="remarks" label="备注" min-width="140" show-overflow-tooltip />
        <el-table-column prop="createTime" min-width="140" label="创建时间" show-overflow-tooltip />
        <el-table-column v-if="checkPer(['admin','attendanceLeave:approve'])" label="审核操作" width="180px" align="center" fixed="right">
          <template slot-scope="scope">
            <el-button
              v-if="scope.row.approvalUserId === $store.state.user.user.id"
              v-permission="permission.approve"
              :loading="crud.status.cu === 2"
              size="mini"
              type="primary"
              icon="el-icon-s-check"
              :disabled="scope.row.approvalStatus === dictAppRovalStatusUnderAppover ? false : true"
              @click="toApprove(scope.row)"
            >审核
            </el-button>
            <el-popover
              :ref="`popover_${scope.row.id}`"
              width="200"
            >
              <p>确定撤销该记录?</p>
              <div style="text-align: right; margin: 0">
                <el-button size="mini" type="primary" @click="canel(scope.row)">取消</el-button>
                <el-button :loading="successLoading" type="primary" size="mini" @click="revoke(scope.row)">确定</el-button>
              </div>
              <el-button
                v-if="scope.row.approvalUserId === $store.state.user.user.id"
                slot="reference"
                v-permission="permission.approve"
                type="danger"
                icon="el-icon-edit-outline"
                size="mini"
                :disabled="scope.row.approvalStatus === dictAppRovalStatusUnderAppover ? true : false"
              >撤销
              </el-button>
            </el-popover>
          </template>
        </el-table-column>
        <el-table-column v-if="checkPer(['admin','attendanceLeave:edit','attendanceLeave:del'])" label="操作" width="150px" align="center" fixed="right">
          <template slot-scope="scope">
            <udOperation
              :data="scope.row"
              :permission="permission"
            />
          </template>
        </el-table-column>
      </el-table>
      <!--分页组件-->
      <pagination />
    </div>
  </div>
</template>
 
<script>
import crudAttendanceLeave from '@/api/attendance/attendanceLeave'
import crudUser from '@/api/system/user'
import { mapGetters } from 'vuex'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import constant from '@/utils/constant'
 
const defaultForm = { id: null, userId: null, approvalUserId: null, leaveType: null, leaveStartTime: null, leaveEndTime: null, leaveDuration: null, leaveDurationUnit: null, leaveReason: null, approvalStatus: null, approvalDescription: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null }
export default {
  name: 'AttendanceLeave',
  components: { pagination, crudOperation, rrOperation, udOperation },
  mixins: [presenter(), header(), form(defaultForm), crud()],
  cruds() {
    return CRUD({ title: '请假记录', url: 'api/attendanceLeave', idField: 'id', sort: 'leaveStartTime,desc', crudMethod: { ...crudAttendanceLeave }})
  },
  // 数据字典
  dicts: [constant.LEAVE_TYPE, constant.APPROVAL_STATUS, constant.LEAVE_TIME_TYPE],
  data() {
    return {
      permission: {
        add: ['admin', 'attendanceLeave:add'],
        edit: ['admin', 'attendanceLeave:edit'],
        del: ['admin', 'attendanceLeave:del'],
        download: ['admin', 'attendanceLeave:download'],
        approve: ['admin', 'attendanceLeave:approve']
      },
      rules: {
        userId: [
          { required: true, message: '申请人不能为空', trigger: 'change' }
        ],
        approvalUserId: [
          { required: true, message: '审批者不能为空', trigger: 'change' }
        ],
        leaveType: [
          { required: true, message: '请假类型不能为空', trigger: 'change' }
        ],
        leaveStartTime: [
          { required: true, message: '请假开始时间不能为空', trigger: 'change' }
        ],
        leaveEndTime: [
          { required: true, message: '请假结束时间不能为空', trigger: 'change' }
        ],
        leaveDuration: [
          { required: true, message: '请假时长不能为空', trigger: 'blur' }
        ],
        approvalStatus: [
          { required: true, message: '审批状态不能为空', trigger: 'change' }
        ],
        approvalDescription: [
          { required: true, message: '审批说明不能为空', trigger: 'blur' }
        ]
      },
      users: [],
      approvalUsers: [],
      dictLeaveType: constant.LEAVE_TYPE,
      dictLeaveTypeAnnualLeave: constant.LEAVE_TYPE_ANNUAL_LEAVE,
      dictLeaveTypeCompassionateLeave: constant.LEAVE_TYPE_COMPASSIONATE_LEAVE,
      dictApprovalStart: constant.APPROVAL_STATUS,
      dictAppRovalStatusUnderAppover: constant.APPROVAL_STATUS_UNDER_APPROVAL,
      dictAppRovalStatusPassed: constant.APPROVAL_STATUS_PASSED,
      dictAppRovalStatusReturn: constant.APPROVAL_STATUS_RETURNED,
      dictLeaveTimeType: constant.LEAVE_TIME_TYPE,
      dictLeaveTimeTypeHour: constant.LEAVE_TIME_TYPE_HOUR,
      dictLeaveTimeTypeDay: constant.LEAVE_TIME_TYPE_DAY,
      yearTimeLenght: null,
      makeUpCardVisible: false,
      successLoading: false,
      userRolesLevelMin: null,
      // 角色级别:普通用户
      roleLevelOrdinary: constant.ROLE_LEVEL_ORDINARY,
      // 角色级别: 总经理
      roleLevelGenerl: constant.ROLE_LEVEL_GENERAL
    }
  },
  computed: {
    ...mapGetters([
      'user'
    ])
  },
  created() {
    this.getUsers()
    this.getApprovalUsers()
    // this.getUserTimes()
  },
  methods: {
    // 钩子:在获取表格数据之前执行,false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      // 用户角色级别数组
      const userRolesLevel = this.user.roles.map(({ level }) => level)
      // 用户最大角色级别
      this.userRolesLevelMin = Math.min(...userRolesLevel)
      return true
    },
    // 钩子:新建 - 之前
    [CRUD.HOOK.beforeToAdd]() {
      // 判断用户最大角色级别是否大于总经理角色:赋值
      if (this.userRolesLevelMin > this.roleLevelGenerl) {
        // 表单赋值
        this.form.userId = this.user.id
      }
    },
    // 钩子:在编辑之前执行
    // [CRUD.HOOK.beforeToEdit]() {
    //   this.getUserTimes()
    // },
    // 钩子:在提交表单之后执行
    // [CRUD.HOOK.afterSubmit]() {
    //   this.getUserTimes()
    // },
    // 禁用
    disabledUser(data) {
      if (this.userRolesLevelMin > this.roleLevelGenerl) {
        return true
      }
      if (data.approvalStatus !== null && data.approvalStatus === this.dictAppRovalStatusPassed || data.approvalStatus === this.dictAppRovalStatusReturn) {
        return true
      }
    },
    // 查询员工
    getUsers() {
      crudUser.getAll().then(res => {
        this.users = res
      })
    },
    // 查询审核人
    getApprovalUsers() {
      crudUser.getApprovalUsers().then(res => {
        this.approvalUsers = res
      })
    },
    checkLeaveTime() {
      // 根据请假类型改变时间单位
      if (this.form.leaveType === this.dictLeaveTypeAnnualLeave || this.form.leaveType === this.dictLeaveTypeCompassionateLeave) {
        this.form.leaveDurationUnit = this.dictLeaveTimeTypeHour
      } else {
        this.form.leaveDurationUnit = this.dictLeaveTimeTypeDay
      }
      if (this.form.leaveType == null || this.form.leaveStartTime == null || this.form.leaveEndTime == null) {
        return
      }
      // 获取年假剩余时长
      crudAttendanceLeave.getYearTimeLength((this.form.userId == null ? 1 : this.form.userId)).then(res => {
        this.yearTimeLenght = res
      })
      // 通过后台计算时长
      var data = JSON.stringify({
        'leaveType': this.form.leaveType,
        'leaveStartTime': this.form.leaveStartTime,
        'leaveEndTime': this.form.leaveEndTime
      })
      crudAttendanceLeave.calcTimeLength(data).then(res => {
        // 年假和计算的时长作比较
        if (this.form.leaveType === this.dictLeaveTypeAnnualLeave && this.yearTimeLenght < res.leaveDuration) {
          this.form.leaveDuration = null
          this.crud.notify('年假剩余时间不足', CRUD.NOTIFICATION_TYPE.ERROR)
        } else {
          this.form.leaveDuration = res.leaveDuration
        }
      })
    },
    // 查询员工剩余年假时长
    // getUserTimes() {
    //   crudAttendanceLeave.getYearTimeLength().then(res => {
    //     this.yearTimeLenght = res
    //   })
    // },
    // 审批页面赋值
    toApprove(data, Number) {
      if (Number !== '1') {
        this.makeUpCardVisible = true
      }
      this.form.id = data.id
      this.form.userId = data.userId
      this.form.userName = data.userName
      this.form.leaveType = data.leaveType
      this.form.leaveStartTime = data.leaveStartTime
      this.form.leaveEndTime = data.leaveEndTime
      this.form.leaveDuration = data.leaveDuration
      this.form.leaveDurationUnit = data.leaveDurationUnit
      this.form.leaveReason = data.leaveReason
      this.form.remarks = data.remarks
    },
    // 审核提交功能
    approveFunction(Number, data) {
      this.form.userId = data.userId
      const msg = Number === 2 ? '通过' : '拒绝'
      this.$refs['form'].validate(valid => {
        if (!valid) {
          return
        }
        // 判断通过状态
        if (Number === 2) {
          this.form.approvalStatus = this.dictAppRovalStatusPassed
        } else {
          // 退回改状态显示退回原因
          this.form.approvalStatus = this.dictAppRovalStatusReturn
          if (this.form.approvalDescription == null) {
            return
          }
        }
        this.successLoading = true
        crudAttendanceLeave.approve(this.form).then(res => {
          this.crud.refresh()
          this.makeUpCardVisible = false
          this.successLoading = false
          this.$message({
            type: 'success',
            message: '审核' + msg + '成功'
          })
        }).catch(() => {
          this.makeUpCardVisible = false
          this.successLoading = false
        })
        if (this.$refs['form']) {
          this.$refs['form'].resetFields()
        }
      })
    },
    // 撤消功能
    revoke(data) {
      this.toApprove(data, '1')
      this.form.approvalStatus = this.dictAppRovalStatusUnderAppover
      this.successLoading = true
      crudAttendanceLeave.approve(this.form).then(res => {
        this.crud.refresh()
        this.successLoading = false
        this.$message({ type: 'success', message: '撤销成功' })
        this.$refs[`popover_${data.id}`].showPopper = false
      }).catch((error) => {
        this.$message({ type: 'error', message: error.response.data.message })
      })
      if (this.$refs['form']) {
        this.$refs['form'].resetFields()
      }
      this.crud.cancelCU()
    },
    // 关闭
    closeCard() {
      if (this.$refs['form']) {
        this.$refs['form'].resetFields()
      }
      this.crud.cancelCU()
      this.makeUpCardVisible = false
    },
    // 取消
    canel(data) {
      this.$refs[`popover_${data.id}`].showPopper = false
    }
  }
}
</script>
 
<style scoped>
 
</style>