pixel
4 years ago
5 changed files with 56 additions and 81 deletions
-
38server/api/v1/sys_work_flow.go
-
4server/cmd/datas/init.go
-
25server/model/sys_workflow.go
-
14server/model/sys_workflow_process.go
-
56server/model/wf_process.go
@ -1,38 +0,0 @@ |
|||||
package v1 |
|
||||
|
|
||||
import ( |
|
||||
"fmt" |
|
||||
"gin-vue-admin/global/response" |
|
||||
"gin-vue-admin/model" |
|
||||
"gin-vue-admin/service" |
|
||||
"gin-vue-admin/utils" |
|
||||
"github.com/gin-gonic/gin" |
|
||||
) |
|
||||
|
|
||||
// @Tags workflow
|
|
||||
// @Summary 注册工作流
|
|
||||
// @Produce application/json
|
|
||||
// @Param data body model.SysWorkflow true "注册工作流接口"
|
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"注册成功"}"
|
|
||||
// @Router /workflow/createWorkFlow [post]
|
|
||||
func CreateWorkFlow(c *gin.Context) { |
|
||||
var wk model.SysWorkflow |
|
||||
_ = c.ShouldBindJSON(&wk) |
|
||||
WKVerify := utils.Rules{ |
|
||||
"WorkflowNickName": {utils.NotEmpty()}, |
|
||||
"WorkflowName": {utils.NotEmpty()}, |
|
||||
"WorkflowDescription": {utils.NotEmpty()}, |
|
||||
"WorkflowStepInfo": {utils.NotEmpty()}, |
|
||||
} |
|
||||
WKVerifyErr := utils.Verify(wk, WKVerify) |
|
||||
if WKVerifyErr != nil { |
|
||||
response.FailWithMessage(WKVerifyErr.Error(), c) |
|
||||
return |
|
||||
} |
|
||||
err := service.Create(wk) |
|
||||
if err != nil { |
|
||||
response.FailWithMessage(fmt.Sprintf("获取失败:%v", err), c) |
|
||||
} else { |
|
||||
response.OkWithMessage("获取成功", c) |
|
||||
} |
|
||||
} |
|
@ -1,25 +0,0 @@ |
|||||
package model |
|
||||
|
|
||||
import ( |
|
||||
"gorm.io/gorm" |
|
||||
) |
|
||||
|
|
||||
// 工作流属性表
|
|
||||
type SysWorkflow struct { |
|
||||
gorm.Model |
|
||||
WorkflowNickName string `json:"workflowNickName" gorm:"comment:工作流中文名称"` // 工作流名称
|
|
||||
WorkflowName string `json:"workflowName" gorm:"comment:工作流英文名称"` // 工作流英文id
|
|
||||
WorkflowDescription string `json:"workflowDescription" gorm:"comment:工作流描述"` // 工作流描述
|
|
||||
WorkflowStepInfo []SysWorkflowStepInfo `json:"workflowStep" gorm:"comment:工作流步骤"` // 工作流步骤
|
|
||||
} |
|
||||
|
|
||||
// 工作流状态表
|
|
||||
type SysWorkflowStepInfo struct { |
|
||||
gorm.Model |
|
||||
SysWorkflowID uint `json:"workflowID" gorm:"comment:所属工作流ID"` // 所属工作流ID
|
|
||||
IsStart bool `json:"isStart" gorm:"comment:是否是开始流节点"` // 是否是开始流节点
|
|
||||
StepName string `json:"stepName" gorm:"comment:工作流节点名称"` // 工作流名称
|
|
||||
StepNo float64 `json:"stepNo" gorm:"comment:步骤id (第几步)"` // 步骤id (第几步)
|
|
||||
StepAuthorityID string `json:"stepAuthorityID" gorm:"comment:操作者级别id"` // 操作者级别id
|
|
||||
IsEnd bool `json:"isEnd" gorm:"comment:是否是完结流节点"` // 是否是完结流节点
|
|
||||
} |
|
@ -1,14 +0,0 @@ |
|||||
package model |
|
||||
|
|
||||
import "gorm.io/gorm" |
|
||||
|
|
||||
// 工作流流转表
|
|
||||
type SysWorkFlowProcess struct { |
|
||||
gorm.Model |
|
||||
ApplicationID uint `json:"applicationID" gorm:"comment:当前工作流所属申请的ID"` // 当前工作流所属申请的ID
|
|
||||
CurrentNode string `json:"currentNode" gorm:"comment:当前进度节点"` // 当前进度节点
|
|
||||
HistoricalNode string `json:"historicalNode" gorm:"comment:上一个进度节点"` // 上一个进度节点
|
|
||||
CurrentUser string `json:"currentUser" gorm:"comment:当前进度操作人"` // 当前进度操作人
|
|
||||
HistoricalUser string `json:"historicalUser" gorm:"comment:上一个进度的操作人"` // 上一个进度的操作人
|
|
||||
State bool `json:"state" gorm:"comment:是否是正在进行的状态"` // 状态 是否是正在进行的状态
|
|
||||
} |
|
@ -0,0 +1,56 @@ |
|||||
|
package model |
||||
|
|
||||
|
type WorkflowProcess struct { |
||||
|
ID string `json:"id" gorm:"comment:流程标识"` |
||||
|
Name string `json:"name" gorm:"comment:流程名称"` |
||||
|
Category string `json:"category" gorm:"comment:分类"` |
||||
|
Clazz string `json:"clazz" gorm:"comment:类型"` |
||||
|
Label string `json:"label" gorm:"comment:流程标题"` |
||||
|
HideIcon bool `json:"hideIcon" gorm:"comment:是否隐藏图标"` |
||||
|
Nodes []WorkflowNode `json:"nodes"` // 流程节点数据
|
||||
|
Edges []WorkflowEdge `json:"edges"` // 流程链接数据
|
||||
|
} |
||||
|
|
||||
|
type WorkflowNode struct { |
||||
|
ID string `json:"id" gorm:"comment:节点id"` |
||||
|
WorkflowProcessID string `json:"-" gorm:"comment:流程标识"` |
||||
|
Clazz string `json:"clazz" gorm:"comment:节点类型"` |
||||
|
Size [2]int `json:"size" gorm:"comment:节点大小"` |
||||
|
Label string `json:"label" gorm:"comment:节点名称"` |
||||
|
Type string `json:"type" gorm:"comment:图标类型"` |
||||
|
Shape string `json:"shape" gorm:"comment:形状"` |
||||
|
X float64 `json:"y" gorm:"comment:x位置"` |
||||
|
Y float64 `json:"x" gorm:"comment:y位置"` |
||||
|
WaitState string `json:"waitState" gorm:"comment:等待属性"` |
||||
|
StateValue string `json:"stateValue" gorm:"comment:等待值"` |
||||
|
To string `json:"to" gorm:"comment:收件人"` |
||||
|
Subject string `json:"subject" gorm:"comment:标题"` |
||||
|
Content string `json:"content" gorm:"comment:内容"` |
||||
|
Cycle string `json:"cycle" gorm:"comment:循环时间"` |
||||
|
Duration string `json:"duration" gorm:"comment:持续时间"` |
||||
|
HideIcon bool `json:"hideIcon" gorm:"comment:是否隐藏图标"` |
||||
|
} |
||||
|
|
||||
|
type WorkflowEdge struct { |
||||
|
WorkflowProcessID string `json:"-" gorm:"comment:流程标识"` |
||||
|
ID string `json:"id" gorm:"comment:唯一标识"` |
||||
|
Clazz string `json:"clazz" gorm:"comment:类型(线)"` |
||||
|
Source string `json:"source" gorm:"comment:起点节点"` |
||||
|
Target string `json:"target" gorm:"comment:目标节点"` |
||||
|
SourceAnchor int `json:"sourceAnchor" gorm:"comment:起点"` |
||||
|
TargetAnchor int `json:"targetAnchor" gorm:"comment:目标点"` |
||||
|
Shape string `json:"shape" gorm:"comment:形状"` |
||||
|
StartPoint WorkflowPoint `json:"startPoint"` // 起点信息
|
||||
|
EndPoint WorkflowPoint `json:"endPoint"` // 终点信息
|
||||
|
Label string `json:"label" gorm:"comment:标题"` |
||||
|
HideIcon bool `json:"hideIcon" gorm:"comment:隐藏图标"` |
||||
|
ConditionExpression string `json:"conditionExpression" gorm:"comment:条件标识"` |
||||
|
Seq string `json:"seq" gorm:"comment:序号"` |
||||
|
Reverse bool `json:"reverse" gorm:"comment:是否反向"` |
||||
|
} |
||||
|
|
||||
|
type WorkflowPoint struct { |
||||
|
X float64 `json:"x"` |
||||
|
Y float64 `json:"y"` |
||||
|
Index int `json:"index"` |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue