From design to development, a workflow system that can be easily used and managed by everyone

Workflow introduction

Workflow is the calculation model of a workflow, that is, the logic and rules of how the work in the workflow is organized together in a computer, represented by an appropriate model, and calculated.

Workflow is not a "new person" in IT field. Workflow idea was proposed in 1960s. It was tried in 1970s, but because of many limitations at that time, workflow has not been successfully realized. The first batch of successful workflow systems appeared in 1980s. Workflow technology reached its first peak in 1990s; Workflow has been working since 1990sThere are many versions of streams, but the theme remains the same to make our work more efficient.

We can save a lot of unnecessary time through the workflow, pre-set handlers can let us not repeatedly ask others who is responsible for this node; through the task to achieve the final operation, we can reduce a lot of human costs, of course, it is very easy to achieve a complete, simple, universal, easy to manage workflow system, and then push onRecommend a workflow system that is more general and easy to use and manage.

Demo: Workflow system (ferry)

Project Q&A Community: Q&A Community

The technology stack used by this workflow system:

  • Golang
  • Gin
  • Gorm
  • Vue
  • Element

Data structure design

For a complete workflow system, we need processes, templates, groupings, users, tasks, and so on, which can be flexibly customized, because if they cannot be flexibly customized, it is very inconvenient for normal use, so it is necessary to achieve flexibility for a good workflow system.

Here's a direct look at the design of the data structure.

Following is a detailed description of each table, which is only in Chinese. As for the table name of the database, you can define it yourself:

surface introduce
user management This is a comprehensive user management including (user management, user group management, Department management, rights management)
Process Classification A process that distinguishes functions only
Technological process Manage process information, manage and maintain node, flow, classification and other data
Template Save our custom set template to render the form when creating or processing a process
Work list Record each process application submitted
Work Order Binding Template Bind templates and record application data for each process request
Work Order Transition History Record the results of each process request
task Optional tasks to be performed after each node and process ends
Task Execution History Record the history of each task execution and save the execution results

Process Classification

type Classify struct {
    base.Model
    Name    string `gorm:"column:name; type: varchar(128)" json:"name" form:"name"`     // Category name
    Creator int    `gorm:"column:creator; type: int(11)" json:"creator" form:"creator"` // creator
}

func (Classify) TableName() string {
    return "process_classify"
}

Technological process

type Info struct {
    base.Model
    Name      string          `gorm:"column:name; type:varchar(128)" json:"name" form:"name"`        // Process Name
    Structure json.RawMessage `gorm:"column:structure; type:json" json:"structure" form:"structure"` // Process structure
    Classify  int             `gorm:"column:classify; type:int(11)" json:"classify" form:"classify"` // Classification ID
    Tpls      json.RawMessage `gorm:"column:tpls; type:json" json:"tpls" form:"tpls"`                // Template
    Task      json.RawMessage `gorm:"column:task; type:json" json:"task" form:"task"`                // Task ID, array, can perform multiple tasks, can be used as notification tasks, each node will execute
    Creator   int             `gorm:"column:creator; type:int(11)" json:"creator" form:"creator"`    // creator
}

func (Info) TableName() string {
    return "process_info"
}

Template

type Info struct {
    base.Model
    Name          string          `gorm:"column:name; type: varchar(128)" json:"name" form:"name" binding:"required"`                       // Template Name
    FormStructure json.RawMessage `gorm:"column:form_structure; type: json" json:"form_structure" form:"form_structure" binding:"required"` // Form structure
    Creator       int             `gorm:"column:creator; type: int(11)" json:"creator" form:"creator"`                                      // creator
    Remarks       string          `gorm:"column:remarks; type: longtext" json:"remarks" form:"remarks"`                                     // Remarks
}

func (Info) TableName() string {
    return "tpl_info"
}

Work list

type Info struct {
    base.Model
    Title         string          `gorm:"column:title; type:varchar(128)" json:"title" form:"title"`                    // Title of work order
    Process       int             `gorm:"column:process; type:int(11)" json:"process" form:"process"`                   // Process ID
    Classify      int             `gorm:"column:classify; type:int(11)" json:"classify" form:"classify"`                // Classification ID
    IsEnd         int             `gorm:"column:is_end; type:int(11); default:0" json:"is_end" form:"is_end"`           // Is it over, 0 is not over, 1 is over
    State         json.RawMessage `gorm:"column:state; type:json" json:"state" form:"state"`                            // status information
    RelatedPerson json.RawMessage `gorm:"column:related_person; type:json" json:"related_person" form:"related_person"` // Bill Owner
    Creator       int             `gorm:"column:creator; type:int(11)" json:"creator" form:"creator"`                   // Creator
}

func (Info) TableName() string {
    return "work_order_info"
}

Work Order Binding Template

type TplData struct {
    base.Model
    WorkOrder     int             `gorm:"column:work_order; type: int(11)" json:"work_order" form:"work_order"`          // Work Order ID
    FormStructure json.RawMessage `gorm:"column:form_structure; type: json" json:"form_structure" form:"form_structure"` // Form structure
    FormData      json.RawMessage `gorm:"column:form_data; type: json" json:"form_data" form:"form_data"`                // Form Data
}

func (TplData) TableName() string {
    return "work_order_tpl_data"
}

Work Order Transition History

type CirculationHistory struct {
    base.Model
    Title        string `gorm:"column:title; type: varchar(128)" json:"title" form:"title"`                         // Title of work order
    WorkOrder    int    `gorm:"column:work_order; type: int(11)" json:"work_order" form:"work_order"`               // Work Order ID
    State        string `gorm:"column:state; type: varchar(128)" json:"state" form:"state"`                         // Work order status
    Source       string `gorm:"column:source; type: varchar(128)" json:"source" form:"source"`                      // Source Node ID
    Target       string `gorm:"column:target; type: varchar(128)" json:"target" form:"target"`                      // Target Node ID
    Circulation  string `gorm:"column:circulation; type: varchar(128)" json:"circulation" form:"circulation"`       // Flow ID
    Processor    string `gorm:"column:processor; type: varchar(45)" json:"processor" form:"processor"`              // Handler
    ProcessorId  int    `gorm:"column:processor_id; type: int(11)" json:"processor_id" form:"processor_id"`         // Handler ID
    CostDuration string `gorm:"column:cost_duration; type: varchar(128)" json:"cost_duration" form:"cost_duration"` // Processing time
    Remarks      string `gorm:"column:remarks; type: longtext" json:"remarks" form:"remarks"`                       // Remarks
}

func (CirculationHistory) TableName() string {
    return "work_order_circulation_history"
}

task

type Info struct {
    base.Model
    Name     string `gorm:"column:name; type: varchar(256)" json:"name" form:"name"`               // Task Name
    TaskType string `gorm:"column:task_type; type: varchar(45)" json:"task_type" form:"task_type"` // Task type
    Content  string `gorm:"column:content; type: longtext" json:"content" form:"content"`          // Task Content
    Creator  int    `gorm:"column:creator; type: int(11)" json:"creator" form:"creator"`           // creator
    Remarks  string `gorm:"column:remarks; type: longtext" json:"remarks" form:"remarks"`          // Remarks
}

func (Info) TableName() string {
    return "task_info"
}

Task Execution History

type History struct {
    base.Model
    Task          int    `gorm:"column:task; type: int(11)" json:"task" form:"task"`                                    // Task ID
    Name          string `gorm:"column:name; type: varchar(256)" json:"name" form:"name"`                               // Task Name
    TaskType      int    `gorm:"column:task_type; type: int(11)" json:"task_type" form:"task_type"`                     // Task type, python, shell
    ExecutionTime string `gorm:"column:execution_time; type: varchar(128)" json:"execution_time" form:"execution_time"` // execution time
    Result        string `gorm:"column:result; type: longtext" json:"result" form:"result"`                             // Task Return
}

func (History) TableName() string {
    return "task_history"
}

Introduction to management and use

Process Management

It is very simple to create a process, drag, link the corresponding nodes, fill the nodes and flow the corresponding data on the right, you can create a process data perfectly.With this process, we can apply for the process.

Form Design

Being able to customize forms is important for a workflow system.Because of this, it is very convenient to manage what the user's input data is.It is also very convenient to control user input.At the same time, for workflow management, it saves a lot of time for form maintenance.

This time, we mainly introduce the design of data structure and code demonstration.It also shows that data is complex in workflow development, but it has two functions that are good for user experience: process management and form design.

Tags: Web Development JSON Vue Database Python

Posted on Wed, 17 Jun 2020 12:26:35 -0400 by ypirc