weicd
2023-02-20 6754df3c4faf22d426d45d1c4995c865cab686de
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
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <div v-if="crud.props.searchToggle">
        <!-- 搜索 -->
        <el-select v-model="query.jobId" filterable clearable placeholder="所属岗位" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
          <el-option
            v-for="item in jobs"
            :key="item.id"
            :label="item.name"
            :value="item.id"
          />
        </el-select>
        <el-input v-model="query.name" clearable placeholder="名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <rrOperation :crud="crud" />
      </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="jobId">
            <el-select v-model="form.jobId" filterable clearable placeholder="所属岗位" style="width: 340px;">
              <el-option
                v-for="item in jobs"
                :key="item.id"
                :label="item.name"
                :value="item.id"
                :disabled="!item.enabled"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="名称" prop="name">
            <el-input v-model="form.name" style="width: 340px;" />
          </el-form-item>
          <el-form-item label="描述">
            <el-input v-model="form.description" :rows="3" type="textarea" style="width: 340px;" />
          </el-form-item>
          <el-form-item label="级别工资" prop="levelWage">
            <money-input :key="random" v-model="form.levelWage" :width="340" />
          </el-form-item>
          <el-divider>工资比例</el-divider>
          <el-form-item label="基本工资" prop="basicWageProportion">
            <el-input v-model="form.basicWageProportion" style="width: 340px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="绩效工资" prop="achievementsWageProportion">
            <el-input v-model="form.achievementsWageProportion" style="width: 340px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="业绩工资" prop="performanceWageProportion">
            <el-input v-model="form.performanceWageProportion" style="width: 340px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="团队工资" prop="teamWageProportion">
            <el-input v-model="form.teamWageProportion" style="width: 340px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-divider>公积金</el-divider>
          <el-form-item label="基数" prop="accumulationRadix">
            <money-input :key="random" v-model="form.accumulationRadix" :width="340" />
          </el-form-item>
          <el-form-item label="个人缴纳比例" prop="accumulationPersonalProportion">
            <el-input v-model="form.accumulationPersonalProportion" style="width: 340px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="公司缴纳比例" prop="accumulationCompanyProportion">
            <el-input v-model="form.accumulationCompanyProportion" style="width: 340px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-divider>养老险</el-divider>
          <el-form-item label="基数" prop="pensionRadix">
            <money-input :key="random" v-model="form.pensionRadix" :width="340" />
          </el-form-item>
          <el-form-item label="个人缴纳比例" prop="pensionPersonalProportion">
            <el-input v-model="form.pensionPersonalProportion" style="width: 340px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="公司缴纳比例" prop="pensionCompanyProportion">
            <el-input v-model="form.pensionCompanyProportion" style="width: 340px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-divider>医疗险</el-divider>
          <el-form-item label="基数" prop="medicalRadix">
            <money-input :key="random" v-model="form.medicalRadix" :width="340" />
          </el-form-item>
          <el-form-item label="个人缴纳比例" prop="medicalPersonalProportion">
            <el-input v-model="form.medicalPersonalProportion" style="width: 340px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="公司缴纳比例" prop="medicalCompanyProportion">
            <el-input v-model="form.medicalCompanyProportion" style="width: 340px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-divider>失业险</el-divider>
          <el-form-item label="基数" prop="unemploymentRadix">
            <money-input :key="random" v-model="form.unemploymentRadix" :width="340" />
          </el-form-item>
          <el-form-item label="个人缴纳比例" prop="unemploymentPersonalProportion">
            <el-input v-model="form.unemploymentPersonalProportion" style="width: 340px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="公司缴纳比例" prop="unemploymentCompanyProportion">
            <el-input v-model="form.unemploymentCompanyProportion" style="width: 340px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-divider>生育险</el-divider>
          <el-form-item label="基数" prop="maternityRadix">
            <money-input :key="random" v-model="form.maternityRadix" :width="340" />
          </el-form-item>
          <el-form-item label="个人缴纳比例" prop="maternityPersonalProportion">
            <el-input v-model="form.maternityPersonalProportion" style="width: 340px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="公司缴纳比例" prop="maternityCompanyProportion">
            <el-input v-model="form.maternityCompanyProportion" style="width: 340px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-divider>工伤险</el-divider>
          <el-form-item label="基数" prop="industrialInjuryRadix">
            <money-input :key="random" v-model="form.industrialInjuryRadix" :width="340" />
          </el-form-item>
          <el-form-item label="个人缴纳比例" prop="industrialInjuryPersonalProportion">
            <el-input v-model="form.industrialInjuryPersonalProportion" style="width: 340px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="公司缴纳比例" prop="industrialInjuryCompanyProportion">
            <el-input v-model="form.industrialInjuryCompanyProportion" style="width: 340px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-divider>其他</el-divider>
          <el-form-item label="个人业绩比例" prop="personalPerformanceProportion">
            <el-input v-model="form.personalPerformanceProportion" style="width: 340px;">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="年假天数" prop="annualLeaveDays">
            <el-input v-model="form.annualLeaveDays" style="width: 340px;" />
          </el-form-item>
          <el-form-item label="备注">
            <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 340px;" />
          </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" fixed="left" />
        <el-table-column :show-overflow-tooltip="true" prop="jobName" label="岗位名称" width="100" fixed="left">
          <template slot-scope="scope">
            <el-tag>{{ scope.row.jobName }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="name" label="名称" width="100" fixed="left" />
        <el-table-column :show-overflow-tooltip="true" prop="description" label="描述" width="140" />
        <el-table-column :show-overflow-tooltip="true" prop="levelWage" label="级别工资" width="100">
          <template slot-scope="scope">
            {{ crud.toMoney(scope.row.levelWage) }}
          </template>
        </el-table-column>
        <el-table-column label="工资比例">
          <el-table-column :show-overflow-tooltip="true" prop="basicWageProportion" label="基本工资" width="100">
            <template slot-scope="scope">
              {{ scope.row.basicWageProportion }}%
            </template>
          </el-table-column>
          <el-table-column :show-overflow-tooltip="true" prop="achievementsWageProportion" label="绩效工资" width="100">
            <template slot-scope="scope">
              {{ scope.row.achievementsWageProportion }}%
            </template>
          </el-table-column>
          <el-table-column :show-overflow-tooltip="true" prop="performanceWageProportion" label="业绩工资" width="100">
            <template slot-scope="scope">
              {{ scope.row.performanceWageProportion }}%
            </template>
          </el-table-column>
          <el-table-column :show-overflow-tooltip="true" prop="teamWageProportion" label="团队工资" width="100">
            <template slot-scope="scope">
              {{ scope.row.teamWageProportion }}%
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column label="公积金">
          <el-table-column :show-overflow-tooltip="true" prop="accumulationRadix" label="基数" width="100">
            <template slot-scope="scope">
              {{ crud.toMoney(scope.row.accumulationRadix) }}
            </template>
          </el-table-column>
          <el-table-column :show-overflow-tooltip="true" prop="accumulationPersonalProportion" label="个人缴纳比例" width="100">
            <template slot-scope="scope">
              {{ scope.row.accumulationPersonalProportion }}%
            </template>
          </el-table-column>
          <el-table-column :show-overflow-tooltip="true" prop="accumulationCompanyProportion" label="公司缴纳比例" width="100">
            <template slot-scope="scope">
              {{ scope.row.accumulationCompanyProportion }}%
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column label="养老险">
          <el-table-column :show-overflow-tooltip="true" prop="pensionRadix" label="基数" width="100">
            <template slot-scope="scope">
              {{ crud.toMoney(scope.row.pensionRadix) }}
            </template>
          </el-table-column>
          <el-table-column :show-overflow-tooltip="true" prop="pensionPersonalProportion" label="个人缴纳比例" width="100">
            <template slot-scope="scope">
              {{ scope.row.pensionPersonalProportion }}%
            </template>
          </el-table-column>
          <el-table-column :show-overflow-tooltip="true" prop="pensionCompanyProportion" label="公司缴纳比例" width="100">
            <template slot-scope="scope">
              {{ scope.row.pensionCompanyProportion }}%
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column label="医疗险">
          <el-table-column :show-overflow-tooltip="true" prop="medicalRadix" label="基数" width="100">
            <template slot-scope="scope">
              {{ crud.toMoney(scope.row.medicalRadix) }}
            </template>
          </el-table-column>
          <el-table-column :show-overflow-tooltip="true" prop="medicalPersonalProportion" label="个人缴纳比例" width="100">
            <template slot-scope="scope">
              {{ scope.row.medicalPersonalProportion }}%
            </template>
          </el-table-column>
          <el-table-column :show-overflow-tooltip="true" prop="medicalCompanyProportion" label="公司缴纳比例" width="100">
            <template slot-scope="scope">
              {{ scope.row.medicalCompanyProportion }}%
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column label="失业险">
          <el-table-column :show-overflow-tooltip="true" prop="unemploymentRadix" label="基数" width="100">
            <template slot-scope="scope">
              {{ crud.toMoney(scope.row.unemploymentRadix) }}
            </template>
          </el-table-column>
          <el-table-column :show-overflow-tooltip="true" prop="unemploymentPersonalProportion" label="个人缴纳比例" width="100">
            <template slot-scope="scope">
              {{ scope.row.unemploymentPersonalProportion }}%
            </template>
          </el-table-column>
          <el-table-column :show-overflow-tooltip="true" prop="unemploymentCompanyProportion" label="公司缴纳比例" width="100">
            <template slot-scope="scope">
              {{ scope.row.unemploymentCompanyProportion }}%
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column label="生育险">
          <el-table-column :show-overflow-tooltip="true" prop="maternityRadix" label="基数" width="100">
            <template slot-scope="scope">
              {{ crud.toMoney(scope.row.maternityRadix) }}
            </template>
          </el-table-column>
          <el-table-column :show-overflow-tooltip="true" prop="maternityPersonalProportion" label="个人缴纳比例" width="100">
            <template slot-scope="scope">
              {{ scope.row.maternityPersonalProportion }}%
            </template>
          </el-table-column>
          <el-table-column :show-overflow-tooltip="true" prop="maternityCompanyProportion" label="公司缴纳比例" width="100">
            <template slot-scope="scope">
              {{ scope.row.maternityCompanyProportion }}%
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column label="工伤险">
          <el-table-column :show-overflow-tooltip="true" prop="industrialInjuryRadix" label="基数" width="100">
            <template slot-scope="scope">
              {{ crud.toMoney(scope.row.industrialInjuryRadix) }}
            </template>
          </el-table-column>
          <el-table-column :show-overflow-tooltip="true" prop="industrialInjuryPersonalProportion" label="个人缴纳比例" width="100">
            <template slot-scope="scope">
              {{ scope.row.industrialInjuryPersonalProportion }}%
            </template>
          </el-table-column>
          <el-table-column :show-overflow-tooltip="true" prop="industrialInjuryCompanyProportion" label="公司缴纳比例" width="100">
            <template slot-scope="scope">
              {{ scope.row.industrialInjuryCompanyProportion }}%
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column label="其他">
          <el-table-column :show-overflow-tooltip="true" prop="personalPerformanceProportion" label="个人业绩比例" width="100">
            <template slot-scope="scope">
              {{ scope.row.personalPerformanceProportion }}%
            </template>
          </el-table-column>
          <el-table-column :show-overflow-tooltip="true" prop="annualLeaveDays" label="年假天数" width="100">
            <template slot-scope="scope">
              {{ scope.row.annualLeaveDays }}天
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="remarks" label="备注" width="140" />
        <el-table-column :show-overflow-tooltip="true" prop="createTime" label="创建时间" width="140" />
        <el-table-column v-if="checkPer(['admin','sysLevel:edit','sysLevel: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 crudSysLevel from '@/api/system/level'
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 moneyInput from '../../assembly/moneyInput/index.vue'
import constant from '../../../utils/constant.js'
import crudJob from '@/api/system/job'
import crudConfigProportion from '@/api/system/configProportion'
 
const defaultForm = { id: null, jobId: null, name: null, description: null, levelWage: null, basicWageProportion: null, achievementsWageProportion: null, performanceWageProportion: null, teamWageProportion: null, accumulationRadix: null, accumulationPersonalProportion: null, accumulationCompanyProportion: null, pensionRadix: null, pensionPersonalProportion: null, pensionCompanyProportion: null, medicalRadix: null, medicalPersonalProportion: null, medicalCompanyProportion: null, unemploymentRadix: null, unemploymentPersonalProportion: null, unemploymentCompanyProportion: null, maternityRadix: null, maternityPersonalProportion: null, maternityCompanyProportion: null, industrialInjuryRadix: null, industrialInjuryPersonalProportion: null, industrialInjuryCompanyProportion: null, personalPerformanceProportion: null, annualLeaveDays: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null }
export default {
  name: 'SysLevel',
  components: { pagination, crudOperation, rrOperation, udOperation, moneyInput },
  mixins: [presenter(), header(), form(defaultForm), crud()],
  cruds() {
    return CRUD({ title: '级别', url: 'api/sysLevel', idField: 'id', sort: 'id,desc', crudMethod: { ...crudSysLevel }})
  },
  data() {
    // 工资(千万内)验证
    var wageValidate = (rule, value, callback) => {
      if (value != null && value !== '' && (isNaN(value) || Number(value) < 0 || Number(value) > 10000000)) {
        callback(new Error('请输入 一千万 以内的正整数或两位小数'))
      } else {
        callback()
      }
    }
    // 比例(百内)验证
    var proportionValidate = (rule, value, callback) => {
      const reg = /^([0-9]|[1-9]\d)(\.\d{1,2})?$|100$/
      if (value != null && value !== '' && !reg.test(value)) {
        callback(new Error('请输入 一百 以内的正整数或两位小数'))
      } else {
        callback()
      }
    }
    // 天数(百内)验证
    var dayValidate = (rule, value, callback) => {
      const reg = /^([0-9]|[1-9]\d)$|100$/
      if (value != null && value !== '' && !reg.test(value)) {
        callback(new Error('请输入 一百 以内的正整数'))
      } else {
        callback()
      }
    }
    return {
      permission: {
        add: ['admin', 'sysLevel:add'],
        edit: ['admin', 'sysLevel:edit'],
        del: ['admin', 'sysLevel:del'],
        download: ['admin', 'sysLevel:download']
      },
      rules: {
        jobId: [
          { required: true, message: '所属岗位不能为空', trigger: 'change' }
        ],
        name: [
          { required: true, message: '名称不能为空', trigger: 'blur' },
          { max: 100, message: '最大长度 100 个字符', trigger: 'blur' }
        ],
        levelWage: [
          { required: true, message: '级别工资不能为空', trigger: 'blur' },
          { validator: wageValidate, trigger: 'blur' }
        ],
        basicWageProportion: [
          { required: true, message: '基本工资比例不能为空', trigger: 'blur' },
          { validator: proportionValidate, trigger: 'blur' }
        ],
        achievementsWageProportion: [
          { required: true, message: '绩效工资比例不能为空', trigger: 'blur' },
          { validator: proportionValidate, trigger: 'blur' }
        ],
        performanceWageProportion: [
          { required: true, message: '业绩工资比例不能为空', trigger: 'blur' },
          { validator: proportionValidate, trigger: 'blur' }
        ],
        teamWageProportion: [
          { required: true, message: '团队工资比例不能为空', trigger: 'blur' },
          { validator: proportionValidate, trigger: 'blur' }
        ],
        accumulationRadix: [
          { required: true, message: '公积金基数不能为空', trigger: 'blur' },
          { validator: wageValidate, trigger: 'blur' }
        ],
        accumulationPersonalProportion: [
          { required: true, message: '公积金个人缴纳比例不能为空', trigger: 'blur' },
          { validator: proportionValidate, trigger: 'blur' }
        ],
        accumulationCompanyProportion: [
          { required: true, message: '公积金公司缴纳比例不能为空', trigger: 'blur' },
          { validator: proportionValidate, trigger: 'blur' }
        ],
        pensionRadix: [
          { required: true, message: '养老险基数不能为空', trigger: 'blur' },
          { validator: wageValidate, trigger: 'blur' }
        ],
        pensionPersonalProportion: [
          { required: true, message: '养老险个人缴纳比例不能为空', trigger: 'blur' },
          { validator: proportionValidate, trigger: 'blur' }
        ],
        pensionCompanyProportion: [
          { required: true, message: '养老险公司缴纳比例不能为空', trigger: 'blur' },
          { validator: proportionValidate, trigger: 'blur' }
        ],
        medicalRadix: [
          { required: true, message: '医疗险基数不能为空', trigger: 'blur' },
          { validator: wageValidate, trigger: 'blur' }
        ],
        medicalPersonalProportion: [
          { required: true, message: '医疗险个人缴纳比例不能为空', trigger: 'blur' },
          { validator: proportionValidate, trigger: 'blur' }
        ],
        medicalCompanyProportion: [
          { required: true, message: '医疗险公司缴纳比例不能为空', trigger: 'blur' },
          { validator: proportionValidate, trigger: 'blur' }
        ],
        unemploymentRadix: [
          { required: true, message: '失业险基数不能为空', trigger: 'blur' },
          { validator: wageValidate, trigger: 'blur' }
        ],
        unemploymentPersonalProportion: [
          { required: true, message: '失业险个人缴纳比例不能为空', trigger: 'blur' },
          { validator: proportionValidate, trigger: 'blur' }
        ],
        unemploymentCompanyProportion: [
          { required: true, message: '失业险公司缴纳比例不能为空', trigger: 'blur' },
          { validator: proportionValidate, trigger: 'blur' }
        ],
        maternityRadix: [
          { required: true, message: '生育险基数不能为空', trigger: 'blur' },
          { validator: wageValidate, trigger: 'blur' }
        ],
        maternityPersonalProportion: [
          { required: true, message: '生育险个人缴纳比例不能为空', trigger: 'blur' },
          { validator: proportionValidate, trigger: 'blur' }
        ],
        maternityCompanyProportion: [
          { required: true, message: '生育险公司缴纳比例不能为空', trigger: 'blur' },
          { validator: proportionValidate, trigger: 'blur' }
        ],
        industrialInjuryRadix: [
          { required: true, message: '工伤险基数不能为空', trigger: 'blur' },
          { validator: wageValidate, trigger: 'blur' }
        ],
        industrialInjuryPersonalProportion: [
          { required: true, message: '工伤险个人缴纳比例不能为空', trigger: 'blur' },
          { validator: proportionValidate, trigger: 'blur' }
        ],
        industrialInjuryCompanyProportion: [
          { required: true, message: '工伤险公司缴纳比例不能为空', trigger: 'blur' },
          { validator: proportionValidate, trigger: 'blur' }
        ],
        personalPerformanceProportion: [
          { required: true, message: '个人业绩比例不能为空', trigger: 'blur' },
          { validator: proportionValidate, trigger: 'blur' }
        ],
        annualLeaveDays: [
          { required: true, message: '年假天数不能为空', trigger: 'blur' },
          { validator: dayValidate, trigger: 'blur' }
        ]
      },
      queryTypeOptions: [
        { key: 'jobId', display_name: '岗位ID' },
        { key: 'name', display_name: '名称' }
      ],
      // 比例配置:基本工资比例
      configProportionBasicWage: constant.CONFIG_PROPORTION_BASIC_WAGE,
      // 比例配置:绩效工资比例
      configProportionMeritWage: constant.CONFIG_PROPORTION_MERIT_WAGE,
      // 比例配置:业绩工资比例
      configProportionAchievementWage: constant.CONFIG_PROPORTION_ACHIEVEMENT_WAGE,
      // 比例配置:团队工资比例
      configProportionTeamWage: constant.CONFIG_PROPORTION_TEAM_WAGE,
      // 比例配置:公积金个人缴纳比例
      configProportionAccumulationFundPersonal: constant.CONFIG_PROPORTION_ACCUMULATION_FUND_PERSONAL,
      // 比例配置:公积金公司缴纳比例
      configProportionAccumulationFundCompany: constant.CONFIG_PROPORTION_ACCUMULATION_FUND_COMPANY,
      // 比例配置:养老险个人缴纳比例
      configProportionPensionInsurancePersonal: constant.CONFIG_PROPORTION_PENSION_INSURANCE_PERSONAL,
      // 比例配置:养老险公司缴纳比例
      configProportionPensionInsuranceCompany: constant.CONFIG_PROPORTION_PENSION_INSURANCE_COMPANY,
      // 比例配置:医疗险个人缴纳比例
      configProportionMedicalInsurancePersonal: constant.CONFIG_PROPORTION_MEDICAL_INSURANCE_PERSONAL,
      // 比例配置:医疗险公司缴纳比例
      configProportionMedicalInsuranceCompany: constant.CONFIG_PROPORTION_MEDICAL_INSURANCE_COMPANY,
      // 比例配置:失业险个人缴纳比例
      configProportionUnemploymentInsurancePersonal: constant.CONFIG_PROPORTION_UNEMPLOYMENT_INSURANCE_PERSONAL,
      // 比例配置:失业险公司缴纳比例
      configProportionUnemploymentInsuranceCompany: constant.CONFIG_PROPORTION_UNEMPLOYMENT_INSURANCE_COMPANY,
      // 比例配置:生育险个人缴纳比例
      configProportionMaternityInsurancePersonal: constant.CONFIG_PROPORTION_MATERNITY_INSURANCE_PERSONAL,
      // 比例配置:生育险公司缴纳比例
      configProportionMaternityInsuranceCompany: constant.CONFIG_PROPORTION_MATERNITY_INSURANCE_COMPANY,
      // 比例配置:工伤险个人缴纳比例
      configProportionIndustrialInjuryInsurancePersonal: constant.CONFIG_PROPORTION_INDUSTRIAL_INJURY_INSURANCE_PERSONAL,
      // 比例配置:工伤险公司缴纳比例
      configProportionIndustrialInjuryInsuranceCompany: constant.CONFIG_PROPORTION_INDUSTRIAL_INJURY_INSURANCE_COMPANY,
      // 比例配置:个人业绩比例
      configProportionPersonalPerformance: constant.CONFIG_PROPORTION_PERSONAL_PERFORMANCE,
      // 岗位列表
      jobs: [],
      // 比例列表
      proportions: [],
      // 随机数
      random: 0
    }
  },
  methods: {
    // 钩子:在获取表格数据之前执行,false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      // 获取所有岗位
      this.getAllJob()
      // 获取比例配置
      this.getAllProportion()
      return true
    },
    // 获取所有岗位
    getAllJob() {
      // 获取所有岗位
      crudJob.getAll().then(res => {
        // 岗位列表
        this.jobs = res
      }).catch(() => {
 
      })
    },
    // 获取比例配置
    getAllProportion() {
      // 获取比例配置
      crudConfigProportion.getAll().then(res => {
        // 比例列表
        this.proportions = res
      }).catch(() => {
 
      })
    },
    // 钩子: 开始 "新建/编辑" - 之前
    [CRUD.HOOK.beforeToCU]() {
      // 随机数
      this.random = Math.random()
    },
    // 钩子:新建 - 之前
    [CRUD.HOOK.beforeToAdd]() {
      // 循环比例列表
      for (const item of this.proportions) {
        // 判断比例配置
        if (item.title === this.configProportionBasicWage) {
          // 基本工资比例
          this.form.basicWageProportion = item.proportion
        } else if (item.title === this.configProportionMeritWage) {
          // 绩效工资比例
          this.form.achievementsWageProportion = item.proportion
        } else if (item.title === this.configProportionAchievementWage) {
          // 业绩工资比例
          this.form.performanceWageProportion = item.proportion
        } else if (item.title === this.configProportionTeamWage) {
          // 团队工资比例
          this.form.teamWageProportion = item.proportion
        } else if (item.title === this.configProportionAccumulationFundPersonal) {
          // 公积金个人缴纳比例
          this.form.accumulationPersonalProportion = item.proportion
        } else if (item.title === this.configProportionAccumulationFundCompany) {
          // 公积金公司缴纳比例
          this.form.accumulationCompanyProportion = item.proportion
        } else if (item.title === this.configProportionPensionInsurancePersonal) {
          // 养老险个人缴纳比例
          this.form.pensionPersonalProportion = item.proportion
        } else if (item.title === this.configProportionPensionInsuranceCompany) {
          // 养老险公司缴纳比例
          this.form.pensionCompanyProportion = item.proportion
        } else if (item.title === this.configProportionMedicalInsurancePersonal) {
          // 医疗险个人缴纳比例
          this.form.medicalPersonalProportion = item.proportion
        } else if (item.title === this.configProportionMedicalInsuranceCompany) {
          // 医疗险公司缴纳比例
          this.form.medicalCompanyProportion = item.proportion
        } else if (item.title === this.configProportionUnemploymentInsurancePersonal) {
          // 失业险个人缴纳比例
          this.form.unemploymentPersonalProportion = item.proportion
        } else if (item.title === this.configProportionUnemploymentInsuranceCompany) {
          // 失业险公司缴纳比例
          this.form.unemploymentCompanyProportion = item.proportion
        } else if (item.title === this.configProportionMaternityInsurancePersonal) {
          // 生育险个人缴纳比例
          this.form.maternityPersonalProportion = item.proportion
        } else if (item.title === this.configProportionMaternityInsuranceCompany) {
          // 生育险公司缴纳比例
          this.form.maternityCompanyProportion = item.proportion
        } else if (item.title === this.configProportionIndustrialInjuryInsurancePersonal) {
          // 工伤险个人缴纳比例
          this.form.industrialInjuryPersonalProportion = item.proportion
        } else if (item.title === this.configProportionIndustrialInjuryInsuranceCompany) {
          // 工伤险公司缴纳比例
          this.form.industrialInjuryCompanyProportion = item.proportion
        } else if (item.title === this.configProportionPersonalPerformance) {
          // 个人业绩比例
          this.form.personalPerformanceProportion = item.proportion
        }
      }
    }
  }
}
</script>
 
<style scoped>
 
</style>