张晓波
2023-09-19 164694c47c35d6654df69b533e8dbf8b5423efc5
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
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
<template>
  <div class="main tabs_main">
    <div class="main_header">
      <div class="header_item">
        <span class="header_label">员工姓名:</span>
        <el-input v-model="realName" clearable :size="size" placeholder="请输入员工姓名"></el-input>
      </div>
      <div class="header_item">
        <span class="header_label">部门:</span>
        <el-select v-model="departId" :size="size" clearable placeholder="请选择部门">
          <el-option
            v-for="item in departmentData"
            :key="item.departId"
            :label="item.departName"
            :value="item.departId">
          </el-option>
        </el-select>
      </div>
      <div class="header_item">
        <span class="header_label">岗位:</span>
        <el-select v-model="posId" :size="size" clearable placeholder="请选择岗位">
          <el-option
            v-for="item in postData"
            :key="item.posId"
            :label="item.posName"
            :value="item.posId">
          </el-option>
        </el-select>
      </div>
      <div class="header_item">
        <span class="header_label">人员状态:</span>
        <el-select v-model="status" :size="size" clearable placeholder="请选择人员状态">
          <el-option label="在岗" value="1"></el-option>
          <el-option label="已离职" value="2"></el-option>
        </el-select>
      </div>
      <div class="header_item">
        <el-button v-if="showButton('search')" icon="el-icon-search" @click="searchLabourInfo(true)">查询</el-button>
        <el-button class="search_btn" v-if="showButton('insert')" icon="el-icon-plus" @click="propInsert()">新增</el-button>
        <el-button v-if="showButton('export')" icon="el-icon-upload2" @click="exportExcel()">导出Excel</el-button>
        <el-button v-if="showButton('export')" icon="el-icon-thumb" @click="patchOff()">批量离场</el-button>
      </div>
    </div>
    <div class="main_content">
      <el-table
        v-loading="loading"
        :data="labourList"
        height="100%"
        @selection-change="handleSelectionChange">
        <el-table-column
          type="selection"
          width="60">
        </el-table-column>
        <el-table-column label="序号" width="55" align="center">
          <template #default="scope">
            <span>{{(pageNum - 1) * pageSize + scope.$index + 1}}</span>
          </template>
        </el-table-column>
        <el-table-column prop="jobNum" label="工号" align="center"></el-table-column>
        <el-table-column prop="realName" label="员工姓名" align="center"></el-table-column>
        <el-table-column prop="sexStr" label="性别" align="center"></el-table-column>
        <el-table-column prop="idNo" width="200" label="身份证号" align="center"></el-table-column>
        <el-table-column prop="phone" width="150" label="手机号码" align="center"></el-table-column>
        <el-table-column prop="departName" width="150" label="部门" align="center"></el-table-column>
        <el-table-column prop="groupNames" width="150" label="班组" align="center"></el-table-column>
        <el-table-column prop="posName" width="150" label="岗位" align="center"></el-table-column>
        <el-table-column prop="hasCertStr" width="150" label="有无作业证书" align="center"></el-table-column>
        <el-table-column prop="zzmmValue" label="政治面貌" align="center"></el-table-column>
        <el-table-column prop="comeFactoryTime" width="200" label="进厂时间" align="center"></el-table-column>
        <el-table-column prop="leaveFactoryTime" width="200" label="离岗时间" align="center"></el-table-column>
        <el-table-column prop="jg" label="籍贯" align="center"></el-table-column>
        <el-table-column prop="employedTime" width="200" label="入职日期" align="center"></el-table-column>
        <el-table-column prop="statusStr" label="人员状态" align="center"></el-table-column>
        <el-table-column prop="isLoginStr"  width="100" label="建登录账号" align="center"></el-table-column>
        <el-table-column label="操作" width="300" align="center">
          <template #default="{ row }">
            <el-button class="table_btn" size="mini" v-if="showButton('update')" @click="propInsertFace(row)">人脸识别</el-button>
            <el-button class="table_btn" size="mini" v-if="showButton('update')" @click="propUpdate(row)">修改</el-button>
            <el-button class="delete_btn" size="mini" v-if="showButton('delete')" @click="deleteInfo(row)">删除</el-button>
            <el-button class="table_btn" size="mini" v-if="showButton('delete')" @click="propDetails(row)">详情</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div class="main_footer">
      <el-pagination
        background
        @current-change="changePageNum"
        @size-change="changePageSize"
        :current-page="pageNum"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total">
      </el-pagination>
    </div>
    <!-- 新增 修改 -->
    <el-dialog
      class="prop_dialog"
      :title="asyncTitle === 1 ? '新增员工' : asyncTitle === 2 ? '修改员工信息' : '查看详情信息'"
      :visible.sync="asyncLabour"
      width="35%">
      <el-form ref="form" :model="formLabour" :rules="rulesLabour" label-width="auto" class="rule_form">
        <!-- <el-form-item label="工号:" >  
          <el-input v-model="formLabour.number" :size="size" clearable placeholder="请输入工号"></el-input>
        </el-form-item> -->
        <el-form-item label="员工姓名:" prop="realName">
          <el-input v-model="formLabour.realName" :size="size" :disabled="disabled" clearable placeholder="请输入员工姓名"></el-input>
        </el-form-item>
        <el-form-item label="性别:" prop="sex">
          <el-select v-model="formLabour.sex" :size="size" :disabled="disabled" clearable placeholder="请选择性别">
            <el-option label="男" :value="0"></el-option>
            <el-option label="女" :value="1"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="手机号:" prop="phone">
          <el-input v-model="formLabour.phone" :size="size" :disabled="disabled" clearable placeholder="请输入手机号"></el-input>
        </el-form-item>
        <el-form-item label="身份证号:" prop="idNo">
          <el-input v-model="formLabour.idNo" :size="size" :disabled="disabled" clearable placeholder="请输入身份证号"></el-input>
        </el-form-item>
        <el-form-item label="岗位:" prop="posId">
          <el-select v-model="formLabour.posId" :size="size" :disabled="disabled" clearable placeholder="请选择岗位">
            <el-option
              v-for="item in postData"
              :key="item.posId"
              :label="item.posName"
              :value="item.posId">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="部门:" prop="departId">
          <el-select v-model="formLabour.departId" :size="size" :disabled="disabled" @change="changeDepartment" clearable placeholder="请选择部门">
            <el-option
              v-for="item in departmentData"
              :key="item.departId"
              :label="item.departName"
              :value="item.departId">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="班组:" >
          <el-select v-model="formLabour.groups" multiple :disabled="disabled" :size="size" clearable placeholder="请选择班组">
            <el-option
              v-for="item in teamGroupData"
              :key="item.groupId"
              :label="item.groupName"
              :value="item.groupId">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="有无作业证书:" >
          <el-select v-model="formLabour.hasCert" :size="size" :disabled="disabled" clearable placeholder="请选择有无作业证书">
            <el-option label="有" :value="1"></el-option>
            <el-option label="无" :value="0"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="政治面貌:" prop="zzmm">
          <el-select v-model="formLabour.zzmm" :size="size" :disabled="disabled" clearable placeholder="请选择政治面貌">
            <el-option
              v-for="item in dictionaryData"
              :key="item.dictId"
              :value="item.dictId"
              :label="item.dictName">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="进厂时间:" prop="comeFactoryTime">
          <el-date-picker
            v-model="formLabour.comeFactoryTime"
            value-format="yyyy-MM-dd"
            type="date"
            :size="size"
            :disabled="disabled"
            clearable
            placeholder="请选择进厂时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="离岗时间:">
          <el-date-picker
            v-model="formLabour.leaveFactoryTime"
            value-format="yyyy-MM-dd"
            type="date"
            :size="size"
            :disabled="disabled"
            clearable
            placeholder="请选择离岗时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="籍贯:" prop="jg">
          <el-cascader
            v-model="formLabour.jg"
            :options="cityData"
            :props="{
              value: 'id',
              label: 'name',
              children: 'childs',
              emitPath: false
            }"
            placeholder="请选择籍贯"
            clearable>
          </el-cascader>
        </el-form-item>
        <el-form-item label="入职日期:" prop="employedTime">
          <el-date-picker
            v-model="formLabour.employedTime"
            value-format="yyyy-MM-dd"
            type="date"
            :size="size"
            :disabled="disabled"
            clearable
            placeholder="请选择入职日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="人员状态:" prop="status">
          <el-select v-model="formLabour.status" :size="size" :disabled="disabled" clearable placeholder="请选择人员状态">
            <el-option label="在岗" :value="1"></el-option>
            <el-option label="已离职" :value="2"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="建登录账号:" prop="isLogin">
          <el-radio-group v-model="formLabour.isLogin" :size="size" :disabled="disabled || disableds">
            <el-radio :label="1">是</el-radio>
            <el-radio :label="2">否</el-radio>
          </el-radio-group>
        </el-form-item>
      </el-form>
      <div slot="footer" v-if="!disabled">
        <el-button @click="asyncLabour = false">取 消</el-button>
        <el-button class="submit_btn" @click="asyncTitle === 1 ? submitInsertForm() : submitUpdateForm()">提 交</el-button>
      </div>
    </el-dialog>
    <el-dialog
      class="prop_dialog"
      title="人脸识别"
      :visible.sync="asyncFace"
      width="35%">
      <el-form ref="formFace" :model="formFace" :rules="rulesFace" label-width="auto" class="rule_form">
        <el-form-item label="人员图像:" prop="photo">
          <UploadPhoto :file-list.sync="formFace.photo">
            <template #info>
                <span>仅支持jpg格式文件</span>
            </template>
          </UploadPhoto>
        </el-form-item>
        <el-form-item label="是否下发:" prop="syncToDevice">
          <el-radio-group v-model="formFace.syncToDevice">
            <el-radio :label="1">是</el-radio>
            <el-radio :label="2">否</el-radio>
          </el-radio-group>
        </el-form-item>
      </el-form>
      <div slot="footer">
        <el-button @click="asyncFace = false">取 消</el-button>
        <el-button class="submit_btn" @click="submitInsertFace()">提 交</el-button>
      </div>
    </el-dialog>
  </div>
</template>
 
<script>
import { buttonPinia } from '../../../../pinia/index';
import { changeSize, throttle, downLoadFile } from '../../../../plugins/public';
import UploadPhoto from '../../../../components/uploadPhoto.vue';
  export default {
    name: 'LabourPossession',
    data() {
      const fileMustUpload = (rule, value, callback) => {
        if (!value) {
          callback(new Error("请上传人脸图像"));
        } else if (value.length < 0) {
          callback(new Error("请上传人脸图像"));
        } else {
          this.$refs.formFace.clearValidate("photo");
          callback();
        }
      };
      return {
        size: changeSize(),
        realName: '',
        departId: '',
        departmentData: [], // 部门信息
        posId: '',
        postData: [], // 岗位信息
        status: '',
        pageNum: 1,
        pageSize: 10,
        total: 0,
        loading: false,
        labourList: [], // 列表信息
        asyncTitle: 1, // 弹窗标题 1 添加人员  2 修改人员信息 3 查看详情信息
        asyncLabour:false, // 弹窗
        rulesLabour: {
          realName: [{
            required: true,
            message: '请输入员工姓名',
            trigger: 'blur'
          }],
          sex:[{
            required: true,
            message: '请选择性别',
            trigger: ['blur', 'change']
          }],
          phone: [{
            required: true,
            message: '请输入手机号',
            trigger: 'blur'
          },{
            pattern:
              /^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/,
            message: '请输入正确的手机号码',
            trigger: 'blur'
          }],
          idNo: [{
            required: true,
            message: '请输入身份证号',
            trigger: 'blur'
          }],
          userType: [{
            required: true,
            message: '请选择人员类型',
            trigger: ['blur', 'change']
          }],
          posId: [{
            required: true,
            message: '请选择岗位',
            trigger: ['blur', 'change']
          }],
          departId: [{
            required: true,
            message: '请选择部门',
            trigger: ['blur', 'change']
          }],
          zzmm: [{
            required: true,
            message: '请选择政治面貌',
            trigger: ['blur', 'change']
          }],
          comeFactoryTime: [{
            required: true,
            message: '请选择进厂时间',
            trigger: ['blur', 'change']
          }],
          jg: [{
            required: true,
            message: '请输入籍贯',
            trigger: 'blur'
          }],
          employedTime: [{
            required: true,
            message: '请选择入职日期',
            trigger: ['blur', 'change']
          }],
          status: [{
            required: true,
            message: '请选择人员状态',
            trigger: ['blur', 'change']
          }],
          isLogin: [{
            required: true,
            message: '请选择是否创建登录账号',
            trigger: 'change'
          }]
        }, // 表单校验规则
        disabled: false,
        disableds: false,
        formLabour: {
          isLogin: 2
        }, // 表单信息
        teamGroupData: [], // 班组信息
        dictionaryData: [], // 政治面貌
        cityData: [], // 城市信息
        batchOffList: [],
        asyncFace: false,
        formFace: {
          photo: [],
        },
        rulesFace: {
          photo: [{
            required: true,
            message: '请上传人脸信息',
          }, {
            validator: fileMustUpload,
            trigger: ["change"],
          }],
          syncToDevice: [{
            required: true,
            message: '请选择是否下发',
            trigger: 'change'
          }],
        }
      }
    },
    components: {
      UploadPhoto
    },
    mounted() {
      const that = this;
      // 根据窗口大小动态修改组件尺寸
      window.onresize = () => {
        that.size = changeSize();
      }
      that.getAllCityInfo();
      that.getDepartmentInfo();
      that.getStationData();
      that.getDictionaryData();
      that.searchLabourInfo(true);
    },
    methods: {
      // 获取全部地区信息
      async getAllCityInfo() {
        const { data } = await this.$api.System.getAllCityInfo();
        this.cityData = this.disposeCity(data);
      },
      // 获取政治面貌
      async getDictionaryData() {
        const { data } = await this.$api.Dictionary.searchDictionary({
          dictType: 'zzmm',
          pageNum: 1,
          pageSize: 10000
        });
        this.dictionaryData = data.list;
      },
      // 获取岗位信息
      async getStationData() {
        const { data } = await this.$api.Personnerl.GETSTATIONDATA();
        this.postData = data;
      },
      // 获取部门信息
      async getDepartmentInfo() {
        const { data } = await this.$api.Personnerl.GETDEPARTMENTDATA();
        this.departmentData = data;
      },
      // 查询管服人员信息
      searchLabourInfo(bol) {
        if(bol) {
          this.pageNum = 1;
        }
        const params = {
          pageNum: this.pageNum,
          pageSize: this.pageSize,
          userType: 2,
          realName: this.realName,
          departId: this.departId,
          posId: this.posId,
          status: this.status
        }
        this.loading = true;
        this.labourList = [];
        this.$api.Personnerl.SEARCHMORTGAGEELIST(params).then((res) => {
          if(res.success) {
            this.total = res.data.total;
            this.labourList = res.data.list;
          }
          this.loading = false;
        }).catch(() => {
          this.loading = false;
        })
      },
      // 打开添加信息
      propInsert() {
        this.disabled = false;
        this.disableds = false;
        this.asyncTitle = 1;
        this.asyncLabour = true;
      },
      // 打开修改信息
      propUpdate(row) {
        this.disabled = false;
        this.asyncTitle = 2;
        this.asyncLabour = true;
        this.setFormData(row);
      },
      // 打开详情信息
      propDetails(row) {
        this.disabled = true;
        this.asyncTitle = 3;
        this.asyncLabour = true;
        this.setFormData(row);
      },
      // 打开添加人脸识别
      propInsertFace(row) {
        this.asyncFace = true;
        this.$set(this.formFace, 'userId', row.userId);
        if(row.photo) {
          this.$set(this.formFace, 'photo', [{
            id: 1,
            url: `https://pipe.thhy-tj.com/${row.photo}`,
            name: row.photo,
            nameImg: row.realName,
          }]);
          this.$set(this.formFace, 'syncToDevice', row.syncToDevice);
        }
      },
      // 导出Excel
      exportExcel() {
        this.$api.System.GETEXPORTTOKENDATA({
          userType: 2,
          realName: this.realName,
          departId: this.departId,
          posId: this.posId,
          status: this.status
        }).then((res) => {
          if(res.success) {
            downLoadFile(res.data, '/staff/platUser/export');
          }
        })
      },
      // 批量离场
      patchOff() {
        if(this.batchOffList.length < 1) {
          this.$message.warning("请选择离场人员!");
          return false;
        }
        this.$confirm("该操作会将选择人员离场,是否继续?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
       })
       .then(() => {
        const userIds = this.batchOffList.map(item => item.userId);
         this.$api.Personnerl.DELETEMORTGAGEEINFO({userIds: userIds.join(',')})
        .then(res => {
          if(res.success) {
            this.searchLabourInfo(true);
            this.$message.success("离场成功!");
          } else {
            this.$message.warning(res.statusMsg);
          }
        })
       })
       .catch(() => {
         this.$message.warning("您已取消");
       })
      },
      handleSelectionChange(selection) {
        this.batchOffList = selection;
      },
      // 删除人员信息
      deleteInfo(row) {
        this.$confirm("该操作将删除该人员信息,是否继续删除?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
       })
       .then(() => {
         this.$api.Personnerl.DELETEMORTGAGEEINFO({userId: row.userId})
        .then(res => {
          if(res.success) {
            this.searchLabourInfo(true);
            this.$message.success("删除成功!");
          } else {
            this.$message.warning(res.statusMsg);
          }
        })
       })
       .catch(() => {
         this.$message.warning("您已取消");
       })
      },
      // 提交添加信息
      submitInsertForm: throttle(function() {
        this.$refs.form.validate((valid) => {
          if(valid) {
            const params = Object.assign({}, this.formLabour);
            params.userType = 2;
            params.groups = params.groups ? params.groups.join(',') : '';
            this.$api.Personnerl.INSERTMORTGAGEEINFO(params).then((res) => {
              if(res.success) {
                this.asyncLabour = false;
                this.searchLabourInfo(true);
                this.$message.success('添加成功!');
              } else {
                this.$message.warning(res.statusMsg);
              }
            })     
          }
        })
      }, 3000),
      // 提交修改信息
      submitUpdateForm: throttle(function() {
        this.$refs.form.validate((valid) => {
          if(valid) {
            const params = Object.assign({}, this.formLabour);
            params.userType = 2;
            params.groups = params.groups ? params.groups.join(',') : '';
            this.$api.Personnerl.UPDATEMORTGAGEEINFO(params).then((res) => {
              if(res.success) {
                this.asyncLabour = false;
                this.searchLabourInfo(true);
                this.$message.success('修改成功!');
              } else {
                this.$message.warning(res.statusMsg);
              }
            })
          }
        })
      }, 3000),
      // 提交人脸识别添加
      submitInsertFace:throttle(function() {
        this.$refs.formFace.validate((valid) => {
          if(valid) {
            const params = Object.assign({}, this.formFace);
            params.photo = params.photo.length > 0 ? params.photo[0].name : '';
            this.$api.Personnerl.insertFaceInfo(params).then((res) => {
              if(res.success) {
                this.asyncFace = false;
                this.searchLabourInfo(true);
                this.$message.success('添加人脸成功!');
              } else {
                this.$message.warning(res.statusMsg);
              }
            })
          }
        })
      }, 3000),
      // 选择部门获取班组信息
      changeDepartment(value) {
        if(value) {
          const data = this.departmentData.find((item) => item.departId === value);
          this.teamGroupData = data.groups;
        } else {
          this.teamGroupData = [];
          this.$set(this.formLabour, 'groups', '');
        }
      },
      // 处理城市信息
      disposeCity(list) {
        const data = list.map(item => {
          if(item.childs) {
            item.childs = item.childs.map(element => {
              return {
                id: element.id,
                name: element.name
              }
            })
          }
          return item;
        })
        return data;
      },
      // 切换页数
      changePageNum(page) {
        this.pageNum = page;
        this.searchLabourInfo();
      },
      // 切换每页条数
      changePageSize(size) {
        this.pageSize = size;
        this.searchLabourInfo();
      },
      // 判断按钮权限信息
      showButton(str) {
        const pinia = buttonPinia();
        return pinia.$state.buttonInfo.includes(str);
      },
      // 回填表单信息
      setFormData(data) {
        const object = this.departmentData.find((item) => item.departId === data.departId);
        this.teamGroupData = object ? object.groups : [];
        this.$set(this.formLabour, 'userId', data.userId);
        this.$set(this.formLabour, 'realName', data.realName);
        this.$set(this.formLabour, 'phone', data.phone);
        this.$set(this.formLabour, 'sex', data.sex);
        this.$set(this.formLabour, 'idNo', data.idNo);
        this.$set(this.formLabour, 'hasCert', data.hasCert);
        this.$set(this.formLabour, 'zzmm', data.zzmm);
        this.$set(this.formLabour, 'employedTime', data.employedTime);
        this.$set(this.formLabour, 'comeFactoryTime', data.comeFactoryTime);
        this.$set(this.formLabour, 'leaveFactoryTime', data.leaveFactoryTime);
        this.$set(this.formLabour, 'jg', Number(data.jgs));
        this.$set(this.formLabour, 'status', data.status);
        this.$set(this.formLabour, 'posId', data.posId);
        this.$set(this.formLabour, 'departId', data.departId);
        this.$set(this.formLabour, 'groups', data.groupIds ? data.groupIds.split(',') : []);
        this.$set(this.formLabour, 'isLogin', data.isLogin);
        if(data.isLogin == 1) {
          this.disableds = true;
        } else {
          this.disableds = false;
        }
      },
    },
    watch: {
      asyncLabour(bol) {
        if(!bol) {
          this.formLabour = {};
          this.$set(this.formLabour, 'photo', []);
          this.$set(this.formLabour, 'isLogin', 2);
          this.$refs.form.resetFields();
        }
      },
      asyncFace(bol) {
        if(!bol) {
          this.formFace = {};
          this.$set(this.formFace, 'photo', []);
          this.$refs.formFace.resetFields();
        }
      }
    }
  }
</script>
 
<style lang="scss" scoped>
@import'@/style/layout-main.scss';
 
::v-deep .el-radio {
  padding: 8px 0;
}
</style>