40 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Python
		
	
	
	
			
		
		
	
	
			40 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Python
		
	
	
	
from django.db import models
 | 
						|
from django.contrib.auth.models import AbstractUser
 | 
						|
from django.db.models.base import Model
 | 
						|
import django.utils.timezone as timezone
 | 
						|
from django.db.models.query import QuerySet
 | 
						|
from apps.system.models import CommonAModel, CommonBModel, Organization, User, Dict, File,Position
 | 
						|
from utils.model import SoftModel, BaseModel
 | 
						|
from simple_history.models import HistoricalRecords
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
class Employee(CommonAModel):
 | 
						|
    """
 | 
						|
    员工信息
 | 
						|
    """
 | 
						|
    jobstate_choices = (
 | 
						|
         (1, '在职'),
 | 
						|
         (2, '离职'),
 | 
						|
    )
 | 
						|
    user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='employee_user')
 | 
						|
    number = models.CharField('人员编号', max_length=50,null=True, blank=True, unique=True)
 | 
						|
    photo = models.CharField('证件照', max_length=1000, null=True, blank=True)
 | 
						|
    ID_number = models.CharField('身份证号', max_length=100, null=True, blank=True)
 | 
						|
    gender = models.CharField('性别', max_length=10, default='男')
 | 
						|
    signature = models.CharField('签名图片', max_length=200, null=True, blank=True)
 | 
						|
    birthdate = models.DateField('出生年月', null=True, blank=True)
 | 
						|
    academic = models.CharField('学历', max_length=50, null=True, blank=True)
 | 
						|
    jobstate  = models.IntegerField('在职状态', choices=jobstate_choices, default=1)
 | 
						|
    job = models.ForeignKey(Position, null=True, blank=True, on_delete=models.SET_NULL, verbose_name='岗位')
 | 
						|
    face_data = models.JSONField('人脸识别数据', null=True, blank=True)
 | 
						|
    class Meta:
 | 
						|
        verbose_name = '员工补充信息'
 | 
						|
        verbose_name_plural = verbose_name
 | 
						|
 | 
						|
    def __str__(self):
 | 
						|
        return self.name
 | 
						|
 | 
						|
 |