churf
2023-09-18 4b4e1b54cae72088fa60978e0192fe57f986e6f3
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
539
540
541
542
543
544
545
546
<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <div v-if="crud.props.searchToggle">
        <!-- 搜索 -->
        <label class="el-form-item-label">员工</label>
        <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>
        <label class="el-form-item-label">年月</label>
        <el-date-picker v-model="query.yearMonth" clearable type="month" format="yyyy 年 MM 月" placeholder="请选择年月" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <rrOperation :crud="crud" />
      </div>
      <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
      <crudOperation :permission="permission">
        <el-button
          slot="right"
          v-permission="permission.generate"
          class="filter-item"
          size="mini"
          type="primary"
          icon="el-icon-plus"
          style="margin-right: 6px;"
          @click="openGenerate"
        >生成</el-button>
      </crudOperation>
      <!--表单组件-->
      <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="80px">
          <el-form-item label="员工" prop="userId">
            <el-select v-model="form.userId" filterable clearable placeholder="请选择员工" style="width: 340px;" @change="changeUser">
              <el-option
                v-for="item in users"
                :key="item.id"
                :label="item.nickName"
                :value="item.id"
              >
                <span style="float: left">{{ item.nickName }}</span>
                <span style="float: right; color: #8492a6; font-size: 13px">{{ item.company.label }}</span>
              </el-option>
            </el-select>
            <el-button icon="el-icon-refresh" plain circle @click="loadCmnInsurance" />
          </el-form-item>
          <el-form-item label="年月" prop="yearMonth">
            <el-date-picker v-model="form.yearMonth" value-format="yyyy-MM" format="yyyy 年 MM 月" clearable type="month" placeholder="请选择年月" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="公积金基数" prop="accumulationFund">
            <el-input v-model="form.accumulationFund" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="公积金个人比例" prop="accumulationFundPersonal">
            <el-input v-model="form.accumulationFundPersonal" style="width: 370px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="公积金公司比例" prop="accumulationFundCompany">
            <el-input v-model="form.accumulationFundCompany" style="width: 370px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="养老险基数" prop="retirementInsurance">
            <el-input v-model="form.retirementInsurance" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="公积金个人比例" prop="retirementInsurancePersonal">
            <el-input v-model="form.retirementInsurancePersonal" style="width: 370px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="公积金公司比例" prop="retirementInsuranceCompany">
            <el-input v-model="form.retirementInsuranceCompany" style="width: 370px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="医疗险基数" prop="medicalInsurance">
            <el-input v-model="form.medicalInsurance" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="医疗险个人比例" prop="medicalInsurancePersonal">
            <el-input v-model="form.medicalInsurancePersonal" style="width: 370px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="医疗险公司比例" prop="medicalInsuranceCompany">
            <el-input v-model="form.medicalInsuranceCompany" style="width: 370px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="失业险基数" prop="unemploymentInsurance">
            <el-input v-model="form.unemploymentInsurance" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="失业险个人比例" prop="unemploymentInsurancePersonal">
            <el-input v-model="form.unemploymentInsurancePersonal" style="width: 370px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="失业险公司比例" prop="unemploymentInsuranceCompany">
            <el-input v-model="form.unemploymentInsuranceCompany" style="width: 370px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="生育险基数" prop="birthInsurance">
            <el-input v-model="form.birthInsurance" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="生育险个人比例" prop="birthInsurancePersonal">
            <el-input v-model="form.birthInsurancePersonal" style="width: 370px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="生育险公司比例" prop="birthInsuranceCompany">
            <el-input v-model="form.birthInsuranceCompany" style="width: 370px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="工伤险基数" prop="employmentInsurance">
            <el-input v-model="form.employmentInsurance" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="工伤险个人比例" prop="employmentInsurancePersonal">
            <el-input v-model="form.employmentInsurancePersonal" style="width: 370px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="工伤险公司比例" prop="employmentInsuranceCompany">
            <el-input v-model="form.employmentInsuranceCompany" style="width: 370px;">
              <template slot="append">%</template>
            </el-input>
          </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-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
        <el-table-column type="selection" width="55" />
        <el-table-column prop="nickName" label="员工" />
        <el-table-column prop="yearMonth" label="年月" />
        <el-table-column prop="accumulationFund" label="公积金基数" />
        <el-table-column prop="accumulationFundPersonal" label="公积金个人比例">
          <template slot-scope="scope">
            {{ scope.row.accumulationFundPersonal }}%
          </template>
        </el-table-column>
        <el-table-column prop="accumulationFundCompany" label="公积金公司比例">
          <template slot-scope="scope">
            {{ scope.row.accumulationFundCompany }}%
          </template>
        </el-table-column>
        <el-table-column prop="retirementInsurance" label="养老险基数" />
        <el-table-column prop="retirementInsurancePersonal" label="公积金个人比例">
          <template slot-scope="scope">
            {{ scope.row.retirementInsurancePersonal }}%
          </template>
        </el-table-column>
        <el-table-column prop="retirementInsuranceCompany" label="公积金公司比例">
          <template slot-scope="scope">
            {{ scope.row.retirementInsuranceCompany }}%
          </template>
        </el-table-column>
        <el-table-column prop="medicalInsurance" label="医疗险基数" />
        <el-table-column prop="medicalInsurancePersonal" label="医疗险个人比例">
          <template slot-scope="scope">
            {{ scope.row.medicalInsurancePersonal }}%
          </template>
        </el-table-column>
        <el-table-column prop="medicalInsuranceCompany" label="医疗险公司比例">
          <template slot-scope="scope">
            {{ scope.row.medicalInsuranceCompany }}%
          </template>
        </el-table-column>
        <el-table-column prop="unemploymentInsurance" label="失业险基数" />
        <el-table-column prop="unemploymentInsurancePersonal" label="失业险个人比例">
          <template slot-scope="scope">
            {{ scope.row.unemploymentInsurancePersonal }}%
          </template>
        </el-table-column>
        <el-table-column prop="unemploymentInsuranceCompany" label="失业险公司比例">
          <template slot-scope="scope">
            {{ scope.row.unemploymentInsuranceCompany }}%
          </template>
        </el-table-column>
        <el-table-column prop="birthInsurance" label="生育险基数" />
        <el-table-column prop="birthInsurancePersonal" label="生育险个人比例">
          <template slot-scope="scope">
            {{ scope.row.birthInsurancePersonal }}%
          </template>
        </el-table-column>
        <el-table-column prop="birthInsuranceCompany" label="生育险公司比例">
          <template slot-scope="scope">
            {{ scope.row.birthInsuranceCompany }}%
          </template>
        </el-table-column>
        <el-table-column prop="employmentInsurance" label="工伤险基数" />
        <el-table-column prop="employmentInsurancePersonal" label="工伤险个人比例">
          <template slot-scope="scope">
            {{ scope.row.employmentInsurancePersonal }}%
          </template>
        </el-table-column>
        <el-table-column prop="employmentInsuranceCompany" label="工伤险公司比例">
          <template slot-scope="scope">
            {{ scope.row.employmentInsuranceCompany }}%
          </template>
        </el-table-column>
        <el-table-column v-if="checkPer(['admin','userInsurance:edit','userInsurance:del','userInsurance:generate'])" label="操作" width="150px" align="center">
          <template slot-scope="scope">
            <udOperation
              :data="scope.row"
              :permission="permission"
            />
          </template>
        </el-table-column>
      </el-table>
      <!--分页组件-->
      <pagination />
      <!--表单组件-->
      <el-dialog :close-on-click-modal="false" :before-close="closeGenerate" :visible.sync="generateStatus" title="生成五险一金" width="500px">
        <el-form ref="generateForm" :model="generateForm" :rules="generateRules" size="small" label-width="80px">
          <el-form-item label="工资年月" prop="targetYearMonth">
            <el-date-picker
              v-model="generateForm.targetYearMonth"
              value-format="yyyy-MM"
              format="yyyy 年 MM 月"
              type="month"
              style="width: 370px;"
              placeholder="工资年月"
            />
          </el-form-item>
          <el-form-item label="员工" prop="userId">
            <el-tree
              ref="tree"
              :data="deptDatas"
              :props="props"
              :load="getDeptDatas"
              lazy
              :default-expanded-keys="[]"
              show-checkbox
              node-key="id"
              @check="handleCheckChange"
            />
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button type="text" @click="closeGenerate">取消</el-button>
          <el-button :loading="generateLoading" type="primary" @click="submitGenerate">确认</el-button>
        </div>
      </el-dialog>
    </div>
  </div>
</template>
 
<script>
import crudUserInsurance from '@/api/treatment/userInsurance'
import crudCmnInsurance from '@/api/treatment/cmnInsurance'
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 crudUser from '@/api/system/user'
import { getDepts } from '@/api/system/dept'
 
const defaultForm = { id: null, userId: null, yearMonth: null, accumulationFund: null, accumulationFundPersonal: null, accumulationFundCompany: null, retirementInsurance: null, retirementInsurancePersonal: null, retirementInsuranceCompany: null, medicalInsurance: null, medicalInsurancePersonal: null, medicalInsuranceCompany: null, unemploymentInsurance: null, unemploymentInsurancePersonal: null, unemploymentInsuranceCompany: null, birthInsurance: null, birthInsurancePersonal: null, birthInsuranceCompany: null, employmentInsurance: null, employmentInsurancePersonal: null, employmentInsuranceCompany: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null }
export default {
  name: 'UserInsurance',
  components: { pagination, crudOperation, rrOperation, udOperation },
  mixins: [presenter(), header(), form(defaultForm), crud()],
  cruds() {
    return CRUD({ title: '员工五险一金', url: 'api/userInsurance', idField: 'id', sort: 'id,desc', crudMethod: { ...crudUserInsurance }})
  },
  data() {
    return {
      permission: {
        add: ['admin'],
        edit: ['admin', 'userInsurance:edit'],
        del: ['admin', 'userInsurance:del'],
        download: ['admin', 'userInsurance:list'],
        generate: ['admin', 'userInsurance:generate']
      },
      rules: {
        userId: [
          { required: true, message: '员工不能为空', trigger: 'blur' }
        ],
        yearMonth: [
          { required: true, message: '年月不能为空', trigger: 'blur' }
        ],
        accumulationFund: [
          { required: true, message: '公积金基数不能为空', trigger: 'blur' }
        ],
        accumulationFundPersonal: [
          { required: true, message: '公积金个人缴纳比例不能为空', trigger: 'blur' }
        ],
        accumulationFundCompany: [
          { required: true, message: '公积金公司缴纳比例不能为空', trigger: 'blur' }
        ],
        retirementInsurance: [
          { required: true, message: '养老险基数不能为空', trigger: 'blur' }
        ],
        retirementInsurancePersonal: [
          { required: true, message: '养老险个人缴纳比例不能为空', trigger: 'blur' }
        ],
        retirementInsuranceCompany: [
          { required: true, message: '养老险公司缴纳比例不能为空', trigger: 'blur' }
        ],
        medicalInsurance: [
          { required: true, message: '医疗险基数不能为空', trigger: 'blur' }
        ],
        medicalInsurancePersonal: [
          { required: true, message: '医疗险个人缴纳比例不能为空', trigger: 'blur' }
        ],
        medicalInsuranceCompany: [
          { required: true, message: '医疗险公司缴纳比例不能为空', trigger: 'blur' }
        ],
        unemploymentInsurance: [
          { required: true, message: '失业险基数不能为空', trigger: 'blur' }
        ],
        unemploymentInsurancePersonal: [
          { required: true, message: '失业险个人缴纳比例不能为空', trigger: 'blur' }
        ],
        unemploymentInsuranceCompany: [
          { required: true, message: '失业险公司缴纳比例不能为空', trigger: 'blur' }
        ],
        birthInsurance: [
          { required: true, message: '生育险基数不能为空', trigger: 'blur' }
        ],
        birthInsurancePersonal: [
          { required: true, message: '生育险个人缴纳比例不能为空', trigger: 'blur' }
        ],
        birthInsuranceCompany: [
          { required: true, message: '生育险公司缴纳比例不能为空', trigger: 'blur' }
        ],
        employmentInsurance: [
          { required: true, message: '工伤险基数不能为空', trigger: 'blur' }
        ],
        employmentInsurancePersonal: [
          { required: true, message: '工伤险个人缴纳比例不能为空', trigger: 'blur' }
        ],
        employmentInsuranceCompany: [
          { required: true, message: '工伤险公司缴纳比例不能为空', trigger: 'blur' }
        ]
      },
      queryTypeOptions: [
        { key: 'userId', display_name: '员工' },
        { key: 'yearMonth', display_name: '年月' }
      ],
      // 员工
      users: [],
      // 生成表单状态
      generateStatus: false,
      // 生成表单加载
      generateLoading: false,
      // 生成表单数据
      generateForm: { targetYearMonth: null, nodes: [] },
      // 生成表单验证
      generateRules: {
        targetYearMonth: [
          { required: true, message: '工资年月不能为空', trigger: 'blur' }
        ]
      },
      props: {
        children: 'children', label: 'label', isLeaf: 'leaf'
      },
      deptDatas: []
    }
  },
  mounted() {
    this.getAllUser()
  },
  methods: {
    // 钩子:在获取表格数据之前执行,false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      return true
    },
    // 获取全部员工
    getAllUser() {
      // 用户
      crudUser.getAll({ enabled: true }).then(res => {
        this.users = res
      })
    },
    // 变更员工
    changeUser(userId) {
      this.form.company = null
      this.users.forEach(user => {
        if (user.id === userId) {
          this.form.company = user.company
        }
      })
    },
    // 生成表单打开
    openGenerate() {
      // 生成表单数据
      this.generateForm = { targetYearMonth: null, nodes: [] }
      // 生成表单状态
      this.generateStatus = true
    },
    // 生成表单关闭
    closeGenerate() {
      // 生成表单状态
      this.generateStatus = false
      this.getDeptDatas({ level: 0 })
      // 清空表单
      this.$refs['generateForm'].clearValidate()
    },
    // 生成表单提交
    submitGenerate() {
      // 生成表单加载
      this.generateLoading = true
      // 表单验证
      this.$refs['generateForm'].validate((valid) => {
        if (valid) {
          // 生成工资
          crudUserInsurance.generate(this.generateForm).then(res => {
            // 生成表单加载
            this.generateLoading = false
            // 生成表单关闭
            this.closeGenerate()
            // 搜索:刷新表格
            this.crud.toQuery()
            // 消息提示
            this.crud.notify('生成成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
          }).catch(() => {
            // 生成表单加载
            this.generateLoading = false
          })
        } else {
          // 生成表单加载
          this.generateLoading = false
        }
      })
    },
    // 加载企业五险一金
    loadCmnInsurance() {
      if (this.form.company === undefined || this.form.company === null) {
        return false
      }
      crudCmnInsurance.getAll({ companyId: this.form.company.id }).then(res => {
        // 公积金基数
        if (this.form.accumulationFund === null || this.form.accumulationFund < res[0].accumulationFund) {
          this.form.accumulationFund = res[0].accumulationFund
        }
        // 公积金个人比例
        if (this.form.accumulationFundPersonal === null || this.form.accumulationFundPersonal < res[0].accumulationFundPersonal) {
          this.form.accumulationFundPersonal = res[0].accumulationFundPersonal
        }
        // 公积金公司比例
        if (this.form.accumulationFundCompany === null || this.form.accumulationFundCompany < res[0].accumulationFundCompany) {
          this.form.accumulationFundCompany = res[0].accumulationFundCompany
        }
        // 养老保险基数
        if (this.form.retirementInsurance === null || this.form.retirementInsurance < res[0].retirementInsurance) {
          this.form.retirementInsurance = res[0].retirementInsurance
        }
        // 养老保险个人比例
        if (this.form.retirementInsurancePersonal === null || this.form.retirementInsurancePersonal < res[0].retirementInsurancePersonal) {
          this.form.retirementInsurancePersonal = res[0].retirementInsurancePersonal
        }
        // 养老保险公司比例
        if (this.form.retirementInsuranceCompany === null || this.form.retirementInsuranceCompany < res[0].retirementInsuranceCompany) {
          this.form.retirementInsuranceCompany = res[0].retirementInsuranceCompany
        }
        // 医疗保险基数
        if (this.form.medicalInsurance === null || this.form.medicalInsurance < res[0].medicalInsurance) {
          this.form.medicalInsurance = res[0].medicalInsurance
        }
        // 医疗保险个人比例
        if (this.form.medicalInsurancePersonal === null || this.form.medicalInsurancePersonal < res[0].medicalInsurancePersonal) {
          this.form.medicalInsurancePersonal = res[0].medicalInsurancePersonal
        }
        // 医疗保险公司比例
        if (this.form.medicalInsuranceCompany === null || this.form.medicalInsuranceCompany < res[0].medicalInsuranceCompany) {
          this.form.medicalInsuranceCompany = res[0].medicalInsuranceCompany
        }
        // 失业保险基数
        if (this.form.unemploymentInsurance === null || this.form.unemploymentInsurance < res[0].unemploymentInsurance) {
          this.form.unemploymentInsurance = res[0].unemploymentInsurance
        }
        // 失业保险个人比例
        if (this.form.unemploymentInsurancePersonal === null || this.form.unemploymentInsurancePersonal < res[0].unemploymentInsurancePersonal) {
          this.form.unemploymentInsurancePersonal = res[0].unemploymentInsurancePersonal
        }
        // 失业保险公司比例
        if (this.form.unemploymentInsuranceCompany === null || this.form.unemploymentInsuranceCompany < res[0].unemploymentInsuranceCompany) {
          this.form.unemploymentInsuranceCompany = res[0].unemploymentInsuranceCompany
        }
        // 生育保险基数
        if (this.form.birthInsurance === null || this.form.birthInsurance < res[0].birthInsurance) {
          this.form.birthInsurance = res[0].birthInsurance
        }
        // 生育保险个人比例
        if (this.form.birthInsurancePersonal === null || this.form.birthInsurancePersonal < res[0].birthInsurancePersonal) {
          this.form.birthInsurancePersonal = res[0].birthInsurancePersonal
        }
        // 生育保险公司比例
        if (this.form.birthInsuranceCompany === null || this.form.birthInsuranceCompany < res[0].birthInsuranceCompany) {
          this.form.birthInsuranceCompany = res[0].birthInsuranceCompany
        }
        // 工伤保险基数
        if (this.form.employmentInsurance === null || this.form.employmentInsurance < res[0].employmentInsurance) {
          this.form.employmentInsurance = res[0].employmentInsurance
        }
        // 工伤保险个人比例
        if (this.form.employmentInsurancePersonal === null || this.form.employmentInsurancePersonal < res[0].employmentInsurancePersonal) {
          this.form.employmentInsurancePersonal = res[0].employmentInsurancePersonal
        }
        // 工伤保险公司比例
        if (this.form.employmentInsuranceCompany === null || this.form.employmentInsuranceCompany < res[0].employmentInsuranceCompany) {
          this.form.employmentInsuranceCompany = res[0].employmentInsuranceCompany
        }
      })
    },
    // 获取部门数据
    getDeptDatas(node, resolve) {
      const sort = 'id,desc'
      const params = { sort: sort }
      if (node.level !== 0) {
        crudUser.getByDept(node.level !== 0 ? node.data.id : null).then(res => {
          if (resolve) {
            resolve(res)
          } else {
            this.deptDatas = res.content
          }
        })
      } else {
        getDepts(params).then(res => {
          if (resolve) {
            resolve(res.content)
          } else {
            this.deptDatas = res.content
          }
        })
      }
    },
    handleCheckChange(data, status) {
      this.generateForm.nodes = status.checkedNodes
    }
  }
}
</script>
 
<style scoped>
 
</style>