Ver Fonte

添加流转接口 设计流转表

pixel há 4 anos atrás
pai
commit
26e46a748d

+ 3 - 3
server/api/v1/wk_process.go

@@ -111,11 +111,11 @@ func FindWorkflowProcess(c *gin.Context) {
 // @Produce application/json
 // @Param data body model.WorkflowProcess true "用id查询WorkflowProcess"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
-// @Router /workflowProcess/findWorkflowCreateStep [get]
-func FindWorkflowCreateStep(c *gin.Context) {
+// @Router /workflowProcess/findWorkflowStep [get]
+func FindWorkflowStep(c *gin.Context) {
 	var workflowProcess model.WorkflowProcess
 	_ = c.ShouldBindQuery(&workflowProcess)
-	err, workflow := service.GetWorkflowCreateStep(workflowProcess.ID)
+	err, workflow := service.FindWorkflowStep(workflowProcess.ID)
 	if err != nil {
 		response.FailWithMessage(fmt.Sprintf("查询失败,%v", err), c)
 	} else {

+ 1 - 1
server/cmd/datas/apis.go

@@ -82,7 +82,7 @@ var Apis = []model.SysApi{
 	{global.GVA_MODEL{ID: 71, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/workflowProcess/updateWorkflowProcess", "更新工作流", "workflowProcess", "PUT"},
 	{global.GVA_MODEL{ID: 72, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/workflowProcess/findWorkflowProcess", "根据ID获取工作流", "workflowProcess", "GET"},
 	{global.GVA_MODEL{ID: 73, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/workflowProcess/getWorkflowProcessList", "获取工作流", "workflowProcess", "GET"},
-	{global.GVA_MODEL{ID: 74, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/workflowProcess/findWorkflowCreateStep", "获取工作流步骤", "workflowProcess", "GET"},
+	{global.GVA_MODEL{ID: 74, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/workflowProcess/findWorkflowStep", "获取工作流步骤", "workflowProcess", "GET"},
 }
 
 func InitSysApi(db *gorm.DB) (err error) {

+ 1 - 1
server/cmd/datas/casbins.go

@@ -80,7 +80,7 @@ var Carbines = []gormadapter.CasbinRule{
 	{PType: "p", V0: "888", V1: "/workflowProcess/updateWorkflowProcess", V2: "PUT"},
 	{PType: "p", V0: "888", V1: "/workflowProcess/findWorkflowProcess", V2: "GET"},
 	{PType: "p", V0: "888", V1: "/workflowProcess/getWorkflowProcessList", V2: "GET"},
-	{PType: "p", V0: "888", V1: "/workflowProcess/findWorkflowCreateStep", V2: "GET"},
+	{PType: "p", V0: "888", V1: "/workflowProcess/findWorkflowStep", V2: "GET"},
 	{PType: "p", V0: "8881", V1: "/base/login", V2: "POST"},
 	{PType: "p", V0: "8881", V1: "/user/register", V2: "POST"},
 	{PType: "p", V0: "8881", V1: "/api/createApi", V2: "POST"},

+ 37 - 0
server/model/wf_process.go

@@ -6,6 +6,24 @@ import (
 	"time"
 )
 
+
+type GVA_Workflow interface {
+	CreateWorkflow(WorkflowNode,GVA_Workflow)
+	GetBusinessType()string
+}
+
+type WorkflowFunc struct {
+	BusinessType string
+}
+
+func(w *WorkflowFunc)CreateWorkflow(node WorkflowNode,businessModel GVA_Workflow){
+
+}
+
+func(w *WorkflowFunc)GetBusinessType()(businessType string){
+	return w.BusinessType
+}
+
 //定义clazz常量
 
 const (
@@ -22,6 +40,25 @@ const (
 	PROCESS       string = "process"
 )
 
+type  WorkflowMove struct {
+	global.GVA_MODEL
+	WorkflowProcessID string `json:"workflowProcessID" gorm:"comment:工作流模板ID"`
+	BusinessType string `json:"businessType" gorm:"comment:业务标记"`
+	BusinessID uint `json:"businessID" gorm:"comment:业务ID"`
+	WorkflowMoveInfo []WorkflowMoveInfo `json:"workflowMoveInfo" gorm:"comment:当前流转详情"`
+	Promoter uint `json:"Promoter" gorm:"comment:当前流转发起人"`
+}
+
+
+type WorkflowMoveInfo struct {
+	global.GVA_MODEL
+	WorkflowMoveID uint `json:"workflowMoveID" gorm:"comment:关联WorkflowMove"`
+	WorkflowNodeID string `json:"workflowNodeID" gorm:"comment:流程节点ID"`
+	Params   string `json:"params" gorm:"comment:流转参数"`
+	Description string `json:"description" gorm:"comment:流转说明"`
+	Status   int `json:"status" gorm:"comment:流转状态(来自字典 0为进行中)"`
+}
+
 type WorkflowProcess struct {
 	ID          string `json:"id" form:"id" gorm:"comment:流程标识;primaryKey;unique;not null"`
 	CreatedAt   time.Time

+ 1 - 1
server/router/wk_process.go

@@ -14,7 +14,7 @@ func InitWorkflowProcessRouter(Router *gin.RouterGroup) {
 		WorkflowProcessRouter.DELETE("deleteWorkflowProcessByIds", v1.DeleteWorkflowProcessByIds) // 批量删除WorkflowProcess
 		WorkflowProcessRouter.PUT("updateWorkflowProcess", v1.UpdateWorkflowProcess)              // 更新WorkflowProcess
 		WorkflowProcessRouter.GET("findWorkflowProcess", v1.FindWorkflowProcess)                  // 根据ID获取WorkflowProcess
-		WorkflowProcessRouter.GET("findWorkflowCreateStep", v1.FindWorkflowCreateStep)            // 根据ID获取工作流开启步骤
+		WorkflowProcessRouter.GET("findWorkflowStep", v1.FindWorkflowStep)            // 根据ID获取工作流步骤
 		WorkflowProcessRouter.GET("getWorkflowProcessList", v1.GetWorkflowProcessList)            // 获取WorkflowProcess列表
 	}
 }

+ 1 - 1
server/service/wk_process.go

@@ -123,7 +123,7 @@ func GetWorkflowProcess(id string) (err error, workflowProcess model.WorkflowPro
 //@param: id string
 //@return: err error, workflowNodes []model.WorkflowNode
 
-func GetWorkflowCreateStep(id string) (err error, workflowNode model.WorkflowProcess) {
+func FindWorkflowStep(id string) (err error, workflowNode model.WorkflowProcess) {
 	err = global.GVA_DB.Preload("Nodes", "clazz = ?", model.START).Where("id = ?", id).First(&workflowNode).Error
 	return
 }

+ 3 - 3
web/src/api/workflowProcess.js

@@ -106,10 +106,10 @@ export const getWorkflowProcessList = (params) => {
 // @Produce application/json
 // @Param data body model.WorkflowProcess true "用id查询WorkflowProcess"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
-// @Router /workflowProcess/findWorkflowCreateStep [get]
-export const findWorkflowCreateStep = (params) => {
+// @Router /workflowProcess/findWorkflowStep [get]
+export const findWorkflowStep = (params) => {
     return service({
-        url: "/workflowProcess/findWorkflowCreateStep",
+        url: "/workflowProcess/findWorkflowStep",
         method: 'get',
         params
     })

+ 7 - 6
web/src/mixins/infoList.js

@@ -10,13 +10,14 @@ export default {
         }
     },
     methods: {
-        filterDict(value,type){
-          const rowLabel = this[type+"Options"]&&this[type+"Options"].filter(item=>item.value == value)
-          return rowLabel&&rowLabel[0]&&rowLabel[0].label
+        filterDict(value, type) {
+            const rowLabel = this[type + "Options"] && this[type + "Options"].filter(item => item.value == value)
+            return rowLabel && rowLabel[0] && rowLabel[0].label
         },
-        async getDict(type){
+        async getDict(type) {
             const dicts = await getDict(type)
-            this[type+"Options"] = dicts
+            this[type + "Options"] = dicts
+            return dicts
         },
         handleSizeChange(val) {
             this.pageSize = val
@@ -28,7 +29,7 @@ export default {
         },
         async getTableData(page = this.page, pageSize = this.pageSize) {
             const table = await this.listApi({ page, pageSize, ...this.searchInfo })
-            if(table.code == 0){
+            if (table.code == 0) {
                 this.tableData = table.data.list
                 this.total = table.data.total
                 this.page = table.data.page

+ 3 - 2
web/src/view/workflow/workflowProcess/workflowProcess.vue

@@ -56,7 +56,7 @@
 
       <el-table-column label="按钮组">
         <template slot-scope="scope">
-          <el-button class="table-button" @click="useWorkflowProcess(scope.row)" size="success" >使用</el-button>
+          <el-button class="table-button" @click="useWorkflowProcess(scope.row)" size="success" >启动</el-button>
           <el-button class="table-button" @click="updateWorkflowProcess(scope.row)" size="small" type="primary">变更</el-button>
           <el-button class="table-button" @click="viewWorkflowProcess(scope.row)" size="small" type="warning">查看</el-button>
           <el-popover placement="top" width="160" v-model="scope.row.visible">
@@ -164,7 +164,8 @@ export default {
       this.$router.push({
         name: "workflowUse",
         query: {
-          id: row.id
+          workflowId: row.id,
+          activeId:0,
         }
       });
     },

+ 28 - 0
web/src/view/workflow/workflowUse/workflowUse.vue

@@ -0,0 +1,28 @@
+<template>
+    <div class="workflow-use">
+
+    </div>
+</template>
+<script>
+import {findWorkflowStep} from "@/api/workflowProcess.js"
+export default {
+    name:"WorklowUse",
+    data(){
+        return{
+            
+        }
+    },
+    async created(){
+        const workflowId = this.$route.query.workflowId
+        const actionId = this.$route.query.actionId
+        const businessId = this.$route.query.businessId
+        if(workflowId){
+            const res = await findWorkflowStep({id:workflowId})
+            if(res.code == 0){
+                this.workflow = res.data.workflow
+                this.node = res.data.workflow.node[0]
+            }
+        }
+    }
+}
+</script>