wf_process.go 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. package model
  2. import (
  3. "gin-vue-admin/global"
  4. "gorm.io/gorm"
  5. "time"
  6. )
  7. //定义clazz常量
  8. const (
  9. USER_TASK string = "userTask"
  10. SCRIPT_TASK string = "scriptTask"
  11. RECEIVE_TASK string = "receiveTask"
  12. MAIL_TASK string = "mailTask"
  13. TIMER_START string = "timerStart"
  14. MESSAGE_START string = "messageStart"
  15. GATEWAY string = "gateway"
  16. FLOW string = "flow"
  17. START string = "start"
  18. END string = "end"
  19. PROCESS string = "process"
  20. )
  21. type WorkflowProcess struct {
  22. ID string `json:"id" form:"id" gorm:"comment:流程标识;primaryKey;unique;not null"`
  23. CreatedAt time.Time
  24. UpdatedAt time.Time
  25. DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
  26. Name string `json:"name" gorm:"comment:流程名称"`
  27. Category string `json:"category" gorm:"comment:分类"`
  28. Clazz string `json:"clazz" gorm:"comment:类型"`
  29. Label string `json:"label" gorm:"comment:流程标题"`
  30. HideIcon bool `json:"hideIcon" gorm:"comment:是否隐藏图标"`
  31. Description string `json:"description" gorm:"comment:详细介绍"`
  32. View string `json:"view" gorm:"comment:前端视图文件"`
  33. Nodes []WorkflowNode `json:"nodes"` // 流程节点数据
  34. Edges []WorkflowEdge `json:"edges"` // 流程链接数据
  35. }
  36. type WorkflowNode struct {
  37. ID string `json:"id" form:"id" gorm:"comment:节点id;primaryKey;unique;not null"`
  38. CreatedAt time.Time
  39. UpdatedAt time.Time
  40. DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
  41. WorkflowProcessID string `json:"-" gorm:"comment:流程标识"`
  42. Clazz string `json:"clazz" gorm:"comment:节点类型"`
  43. Label string `json:"label" gorm:"comment:节点名称"`
  44. Type string `json:"type" gorm:"comment:图标类型"`
  45. Shape string `json:"shape" gorm:"comment:形状"`
  46. Description string `json:"description" gorm:"comment:详细介绍"`
  47. View string `json:"view" gorm:"comment:前端视图文件"`
  48. X float64 `json:"y" gorm:"comment:x位置"`
  49. Y float64 `json:"x" gorm:"comment:y位置"`
  50. WaitState string `json:"waitState" gorm:"comment:等待属性"`
  51. StateValue string `json:"stateValue" gorm:"comment:等待值"`
  52. To string `json:"to" gorm:"comment:收件人"`
  53. Subject string `json:"subject" gorm:"comment:标题"`
  54. Content string `json:"content" gorm:"comment:内容"`
  55. Cycle string `json:"cycle" gorm:"comment:循环时间"`
  56. Duration string `json:"duration" gorm:"comment:持续时间"`
  57. HideIcon bool `json:"hideIcon" gorm:"comment:是否隐藏图标"`
  58. DueDate time.Time `json:"dueDate" gorm:"comment:到期时间"`
  59. AssignType string `json:"assignType" gorm:"comment:审批类型"`
  60. AssignValue string `json:"assignValue" gorm:"comment:审批类型值"`
  61. Success bool `json:"success" gorm:"comment:是否成功"`
  62. }
  63. type WorkflowEdge struct {
  64. ID string `json:"id" form:"id" gorm:"comment:唯一标识;primaryKey;unique;not null"`
  65. CreatedAt time.Time
  66. UpdatedAt time.Time
  67. DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
  68. WorkflowProcessID string `json:"-" gorm:"comment:流程标识"`
  69. Clazz string `json:"clazz" gorm:"comment:类型(线)"`
  70. Source string `json:"source" gorm:"comment:起点节点"`
  71. Target string `json:"target" gorm:"comment:目标节点"`
  72. SourceAnchor int `json:"sourceAnchor" gorm:"comment:起点"`
  73. TargetAnchor int `json:"targetAnchor" gorm:"comment:目标点"`
  74. Description string `json:"description" gorm:"comment:详细介绍"`
  75. Shape string `json:"shape" gorm:"comment:形状"`
  76. StartPoint WorkflowStartPoint `json:"startPoint"` // 起点信息
  77. EndPoint WorkflowEndPoint `json:"endPoint"` // 终点信息
  78. Label string `json:"label" gorm:"comment:标题"`
  79. HideIcon bool `json:"hideIcon" gorm:"comment:隐藏图标"`
  80. ConditionExpression string `json:"conditionExpression" gorm:"comment:条件标识"`
  81. Seq string `json:"seq" gorm:"comment:序号"`
  82. Reverse bool `json:"reverse" gorm:"comment:是否反向"`
  83. }
  84. type WorkflowStartPoint struct {
  85. WorkflowEdgeID string
  86. WorkflowPoint
  87. }
  88. type WorkflowEndPoint struct {
  89. WorkflowEdgeID string
  90. WorkflowPoint
  91. }
  92. //
  93. type WorkflowPoint struct {
  94. global.GVA_MODEL
  95. X float64 `json:"x"`
  96. Y float64 `json:"y"`
  97. Index int `json:"index"`
  98. }