工單系統表的設計
-
apps/user.py/model.py
-
from django.contrib.auth.models import AbstractUser from django.db import models # Create your models here. # 用戶表 class User(AbstractUser): mobile = models.CharField('手機號', max_length=32, null=True) email = models.CharField('電子郵箱', max_length=50, null=True) class Meta: db_table = '用戶表' # 中文角色名稱 class Role(models.Model): zh_name = models.CharField('中文角色名稱', max_length=32) name = models.CharField('角色名稱', max_length=32) description = models.TextField('描述') class Meta: db_table = '角色名稱表' # 用戶角色表 關系關聯表 class UserRole(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) roles = models.ForeignKey(Role, on_delete=models.CASCADE) class Meta: db_table = '用戶角色表'
-
-
apps/workflow.py/model.py
-
from django.db import models # Create your models here. # 工單分類 from user.models import User # 工單模板 class FlowConf(models.Model): name = models.CharField('工作流名稱', max_length=32) customfield = models.TextField('自定義字段') description = models.TextField('描述', ) class Meta: db_table = '工單模板' # 工單分類 # class FlowType(models.Model): # name = models.CharField('工作流名稱', max_length=50) # description = models.TextField('描述', ) # flowconf = models.ForeignKey(FlowConf, on_delete=models.CASCADE) # 配置審批流 class NewFlowUserRoleActionConf(models.Model): flowconf = models.ForeignKey(FlowConf, on_delete=models.CASCADE) sequence = models.IntegerField('審批序號', ) approvetype = models.CharField('審批類型', max_length=32, choices=(('1', 'user'), ('2', 'role'))) approve_type_id = models.CharField('審批id', max_length=32) class Meta: db_table = '配置審批流' # 自動化工單配置 # class AutoActionConf(models.Model): # flowconf = models.ManyToManyField(FlowConf) # scriptpath = models.CharField('執行腳本路徑', max_length=50) # url = models.CharField('自動化調用路徑', max_length=200) # method = models.CharField('調用自動化接口', max_length=32) # timeout = models.CharField('自動化執行超時時間', max_length=32)
-
-
apps/workeorderpy/model.py
-
from django.contrib.auth.models import AbstractUser from django.db import models # Create your models here. # 用戶表 class User(AbstractUser): mobile = models.CharField('手機號', max_length=32, null=True) email = models.CharField('電子郵箱', max_length=50, null=True) class Meta: db_table = '用戶表' # 中文角色名稱 class Role(models.Model): zh_name = models.CharField('中文角色名稱', max_length=32) name = models.CharField('角色名稱', max_length=32) description = models.TextField('描述') class Meta: db_table = '角色名稱表' # 用戶角色表 關系關聯表 class UserRole(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) roles = models.ForeignKey(Role, on_delete=models.CASCADE) class Meta: db_table = '用戶角色表'
-