审批流优化

This commit is contained in:
xiangheng
2023-12-17 01:33:58 +08:00
parent 73998f14b4
commit 60b2a5ce4c
23 changed files with 528 additions and 311 deletions

View File

@@ -28,3 +28,8 @@ export function flow_history_edit(params: Record<string, any>) {
export function flow_history_delete(params: Record<string, any>) {
return request.post({ url: '/flow_history/del', params })
}
// 获取下一个审批节点,中间可能有系统任务和结束节点被跳过
export function flow_apply_next_node(params: Record<string, any>) {
return request.post({ url: '/flow_apply/next_node', params })
}

View File

@@ -172,7 +172,7 @@ export default {
basicSetting: res[0].formData,
flowFormData: res[1].formData,
flowProcessData: res[2].formData,
flowProcessTreeData: res[2].TreeNode
flowProcessDataList: res[2].treeToList
// advancedSetting: getCmpData("advancedSetting"),
}

View File

@@ -19,8 +19,8 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogVisible = false">Cancel</el-button>
<el-button type="primary" @click="getData"> Confirm </el-button>
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="getData"> 确定 </el-button>
</span>
</template>
</el-dialog>

View File

@@ -228,9 +228,23 @@ export default {
return newArr
}
const TreeNode = handel(findStartNode, 0)
// tree转list
function treeToList(tree) {
const arr = []
tree.forEach((item) => {
arr.push(item)
if (item.children) {
arr.push(...treeToList(item.children))
}
})
return arr
}
console.log('TreeNode', TreeNode)
console.log('treeToList', treeToList(TreeNode))
// 检查连线方向是否正确;
resolve({ formData: data, TreeNode })
resolve({ formData: data, treeToList: treeToList(TreeNode) })
})
}
}

View File

@@ -105,7 +105,6 @@ import {
watch,
nextTick,
toRefs,
watchEffect,
getCurrentInstance
} from 'vue'
// "captchaType":"blockPuzzle",

View File

@@ -0,0 +1,113 @@
<template>
<el-dialog
v-model="dialogVisible"
:show-close="false"
:fullscreen="false"
:close-on-click-modal="false"
:close-on-press-escape="false"
:destroy-on-close="true"
top="1px"
>
<el-form ref="formRef" :model="formData" label-width="84px" :rules="formRules">
<el-form-item label="审批节点" prop="flowName">
<el-input v-model="formData.flowName" placeholder="请输入流程名称" />
</el-form-item>
<el-form-item label="审批人" prop="applyUserId">
<el-select
class="flex-1"
v-model="formData.applyUserId"
placeholder="请选择审批人"
@change="handleTemplateChange"
>
<el-option
v-for="(item, index) in flow_template"
:key="index"
:label="item.flowName"
:value="item.id"
clearable
/>
</el-select>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="getData"> 确定 </el-button>
</template>
</el-dialog>
</template>
<script setup>
import { ref } from 'vue'
import { flow_apply_next_node } from '@/api/flow_history'
const formRef = ref(null)
const dialogVisible = ref(false)
const props = defineProps({
save: {
type: Function,
default: () => {}
}
})
const formData = reactive({
id: '',
templateId: '',
// applyUserId: '',
// applyUserNickname: '',
flowName: '',
flowGroup: '',
flowRemark: '',
flowFormData: '',
flowProcessData: '',
status: 0,
formValue: ''
})
const formRules = {
id: [
{
required: true,
message: '请输入',
trigger: ['blur']
}
]
}
function open(row) {
console.log('open')
formData.value = row
dialogVisible.value = true
flow_apply_next_node({
id: row.id,
historyId: ''
}).then((res) => {
console.log('res', res)
})
}
function closeFn() {
dialogVisible.value = false
formData.value = {}
}
function getData() {
formRef.value.getFormData().then((formData) => {
console.log('formData', formData)
props
.save(formData)
.then(() => {
closeFn()
})
.catch(() => {})
})
}
defineExpose({
getData,
open
})
</script>
<style lang="scss">
// body {
// margin: 0; /* 如果页面出现垂直滚动条则加入此行CSS以消除之 */
// }
</style>

View File

@@ -184,7 +184,7 @@ const formRules = {
status: [
{
required: true,
message: '请选择状态0待提交1审批中2审批完成3审批失败',
message: '请选择状态',
trigger: ['blur']
}
]

View File

@@ -62,7 +62,7 @@
</el-table-column>
<el-table-column label="更新时间" prop="updateTime" min-width="100" />
<el-table-column label="创建时间" prop="createTime" min-width="100" />
<el-table-column label="操作" width="120" fixed="right">
<el-table-column label="操作" width="260" fixed="right">
<template #default="{ row }">
<el-button
v-perms="['flow_apply:edit']"
@@ -72,6 +72,15 @@
>
编辑表单
</el-button>
<el-button
v-perms="['flow_apply:edit']"
type="primary"
link
@click="OpenApplySubmit(row)"
>
提交申请
</el-button>
<el-button
v-perms="['flow_apply:edit']"
type="primary"
@@ -103,6 +112,7 @@
@close="showEdit = false"
/>
<ViewForm ref="viewFormRef" :save="SaveViewForm"></ViewForm>
<ApplySubmit ref="ApplySubmitRef"></ApplySubmit>
</div>
</template>
<script lang="ts" setup>
@@ -112,12 +122,14 @@ import { usePaging } from '@/hooks/usePaging'
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
import ApplySubmit from '@/views/flow_apply/components/apply_submit.vue'
import ViewForm from '@/components/flow/XForm/view.vue'
defineOptions({
name: 'flow_apply'
})
const viewFormRef = shallowRef<InstanceType<typeof EditPopup>>()
const viewFormRef = shallowRef<InstanceType<typeof ViewForm>>()
const ApplySubmitRef = shallowRef<InstanceType<typeof ApplySubmit>>()
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
const showEdit = ref(false)
const queryParams = reactive({
@@ -164,15 +176,24 @@ const OpenViewForm = async (data: any) => {
let form_data = {}
try {
form_data = JSON.parse(data.formValue)
} catch (error) {}
} catch (error) {
// 解析失败
}
let form_json = {}
try {
form_json = JSON.parse(data.flowFormData)
} catch (error) {}
} catch (error) {
// 解析失败
}
console.log(data, form_data, form_json)
viewFormRef.value?.open(data.id, form_json, form_data)
}
const OpenApplySubmit = async (data: any) => {
console.log('OpenApplySubmit')
ApplySubmitRef.value?.open(data)
}
const SaveViewForm = (id, form_data) => {
return new Promise((resolve, reject) => {
flow_apply_edit({

View File

@@ -132,7 +132,8 @@ function save(info) {
flowGroup: info.basicSetting.flowGroup,
flowRemark: info.basicSetting.flowRemark,
flowFormData: JSON.stringify(info.flowFormData),
flowProcessData: JSON.stringify(info.flowProcessData)
flowProcessData: JSON.stringify(info.flowProcessData),
flowProcessDataList: JSON.stringify(info.flowProcessDataList)
})
.then(() => {
feedback.msgSuccess('修改成功')

View File

@@ -9,9 +9,7 @@ import (
"github.com/gin-gonic/gin"
)
type FlowApplyHandler struct {
Service IFlowApplyService
}
type FlowApplyHandler struct{}
// @Summary 申请流程列表
// @Tags flow_apply-申请流程
@@ -40,7 +38,7 @@ func (hd FlowApplyHandler) List(c *gin.Context) {
if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &listReq)) {
return
}
res, err := hd.Service.List(page, listReq)
res, err := Service.List(page, listReq)
response.CheckAndRespWithData(c, res, err)
}
@@ -56,7 +54,7 @@ func (hd FlowApplyHandler) Detail(c *gin.Context) {
if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &detailReq)) {
return
}
res, err := hd.Service.Detail(detailReq.Id)
res, err := Service.Detail(detailReq.Id)
response.CheckAndRespWithData(c, res, err)
}
@@ -86,7 +84,7 @@ func (hd FlowApplyHandler) Add(c *gin.Context) {
addReq.ApplyUserNickname = Nickname
addReq.ApplyUserId = int(AdminId)
response.CheckAndResp(c, hd.Service.Add(addReq))
response.CheckAndResp(c, Service.Add(addReq))
}
// @Summary 申请流程编辑
@@ -110,7 +108,7 @@ func (hd FlowApplyHandler) Edit(c *gin.Context) {
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &editReq)) {
return
}
response.CheckAndResp(c, hd.Service.Edit(editReq))
response.CheckAndResp(c, Service.Edit(editReq))
}
// @Summary 申请流程删除
@@ -125,5 +123,5 @@ func (hd FlowApplyHandler) Del(c *gin.Context) {
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &delReq)) {
return
}
response.CheckAndResp(c, hd.Service.Del(delReq.Id))
response.CheckAndResp(c, Service.Del(delReq.Id))
}

View File

@@ -12,6 +12,7 @@ type FlowApplyListReq struct {
FlowRemark string `form:"flowRemark"` // 流程描述
FlowFormData string `form:"flowFormData"` // 表单配置
FlowProcessData string `form:"flowProcessData"` // 流程配置
FlowProcessDataList string `form:"flowProcessDataList"` // 流程配置list数据
FormValue string `form:"formValue"` // 表单值
Status int `form:"status"` // 状态0待提交1审批中2审批完成3审批失败
}
@@ -26,11 +27,12 @@ type FlowApplyAddReq struct {
TemplateId int `form:"templateId"` // 模板
ApplyUserId int `form:"applyUserId"` // 申请人id
ApplyUserNickname string `form:"applyUserNickname"` // 申请人昵称
FlowName string `form:"flowName"` // 流程名称
FlowGroup int `form:"flowGroup"` // 流程分类
FlowRemark string `form:"flowRemark"` // 流程描述
FlowFormData string `form:"flowFormData"` // 表单配置
FlowProcessData string `form:"flowProcessData"` // 流程配置
// FlowName string `form:"flowName"` // 流程名称
// FlowGroup int `form:"flowGroup"` // 流程分类
// FlowRemark string `form:"flowRemark"` // 流程描述
// FlowFormData string `form:"flowFormData"` // 表单配置
// FlowProcessData string `form:"flowProcessData"` // 流程配置
// FlowProcessDataList string `form:"flowProcessDataList"` // 流程配置list数据
FormValue string `form:"formValue"` // 表单值
Status int `form:"status"` // 状态0待提交1审批中2审批完成3审批失败
}
@@ -38,14 +40,15 @@ type FlowApplyAddReq struct {
//FlowApplyEditReq 申请流程新增参数
type FlowApplyEditReq struct {
Id int `form:"id"` //
TemplateId int `form:"templateId"` // 模板
ApplyUserId int `form:"applyUserId"` // 申请人id
ApplyUserNickname string `form:"applyUserNickname"` // 申请人昵称
FlowName string `form:"flowName"` // 流程名称
FlowGroup int `form:"flowGroup"` // 流程分类
FlowRemark string `form:"flowRemark"` // 流程描述
FlowFormData string `form:"flowFormData"` // 表单配置
FlowProcessData string `form:"flowProcessData"` // 流程配置
// TemplateId int `form:"templateId"` // 模板
// ApplyUserId int `form:"applyUserId"` // 申请人id
// ApplyUserNickname string `form:"applyUserNickname"` // 申请人昵称
// FlowName string `form:"flowName"` // 流程名称
// FlowGroup int `form:"flowGroup"` // 流程分类
// FlowRemark string `form:"flowRemark"` // 流程描述
// FlowFormData string `form:"flowFormData"` // 表单配置
// FlowProcessData string `form:"flowProcessData"` // 流程配置
// FlowProcessDataList string `form:"flowProcessDataList"` // 流程配置list数据
FormValue string `form:"formValue"` // 表单值
Status int `form:"status"` // 状态0待提交1审批中2审批完成3审批失败
}
@@ -66,6 +69,7 @@ type FlowApplyResp struct {
FlowRemark string `json:"flowRemark" structs:"flowRemark"` // 流程描述
FlowFormData string `json:"flowFormData" structs:"flowFormData"` // 表单配置
FlowProcessData string `json:"flowProcessData" structs:"flowProcessData"` // 流程配置
FlowProcessDataList string `form:"flowProcessDataList"` // 流程配置list数据
FormValue string `json:"formValue"` // 表单值
Status int `json:"status" structs:"status"` // 状态0待提交1审批中2审批完成3审批失败
UpdateTime core.TsTime `json:"updateTime" structs:"updateTime"` // 更新时间

View File

@@ -1,6 +1,8 @@
package flow_apply
import (
"x_admin/admin/flow_template"
"x_admin/core"
"x_admin/core/request"
"x_admin/core/response"
"x_admin/model"
@@ -16,8 +18,11 @@ type IFlowApplyService interface {
Del(id int) (e error)
}
var Service = NewFlowApplyService()
// NewFlowApplyService 初始化
func NewFlowApplyService(db *gorm.DB) IFlowApplyService {
func NewFlowApplyService() *flowApplyService {
db := core.GetDB()
return &flowApplyService{db: db}
}
@@ -99,10 +104,20 @@ func (Service flowApplyService) Detail(id int) (res FlowApplyResp, e error) {
// Add 申请流程新增
func (Service flowApplyService) Add(addReq FlowApplyAddReq) (e error) {
var obj model.FlowApply
var flow_template_resp, err = flow_template.Service.Detail(addReq.TemplateId)
if e = response.CheckErrDBNotRecord(err, "模板不存在!"); e != nil {
return
}
response.Copy(&obj, addReq)
err := Service.db.Create(&obj).Error
e = response.CheckErr(err, "Add Create err")
obj.FlowName = flow_template_resp.FlowName
obj.FlowGroup = flow_template_resp.FlowGroup
obj.FlowRemark = flow_template_resp.FlowRemark
obj.FlowFormData = flow_template_resp.FlowFormData
obj.FlowProcessData = flow_template_resp.FlowProcessData
obj.FlowProcessDataList = flow_template_resp.FlowProcessDataList
err = Service.db.Create(&obj).Error
e = response.CheckErr(err, "添加失败")
return
}

View File

@@ -1,10 +1,10 @@
package admin
import (
"github.com/gin-gonic/gin"
"x_admin/core"
"x_admin/middleware"
"x_admin/admin/flow_apply"
"x_admin/middleware"
"github.com/gin-gonic/gin"
)
/**
@@ -24,14 +24,10 @@ flow_apply:list
flow_apply:detail
*/
// FlowApplyRoute(rg)
func FlowApplyRoute(rg *gin.RouterGroup) {
db := core.GetDB()
server := flow_apply.NewFlowApplyService(db)
handle := flow_apply.FlowApplyHandler{Service: server}
handle := flow_apply.FlowApplyHandler{}
rg = rg.Group("/", middleware.TokenAuth())
rg.GET("/flow_apply/list", handle.List)
@@ -39,4 +35,5 @@ func FlowApplyRoute(rg *gin.RouterGroup) {
rg.POST("/flow_apply/add", handle.Add)
rg.POST("/flow_apply/edit", handle.Edit)
rg.POST("/flow_apply/del", handle.Del)
}

View File

@@ -40,7 +40,7 @@ func (hd FlowHistoryHandler) List(c *gin.Context) {
if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &listReq)) {
return
}
res, err := hd.Service.List(page, listReq)
res, err := Service.List(page, listReq)
response.CheckAndRespWithData(c, res, err)
}
@@ -50,7 +50,7 @@ func (hd FlowHistoryHandler) List(c *gin.Context) {
// @Success 200 {object} []FlowHistoryResp "成功"
// @Router /api/flow_history/list [get]
func (hd FlowHistoryHandler) ListAll(c *gin.Context) {
res, err := hd.Service.ListAll()
res, err := Service.ListAll()
response.CheckAndRespWithData(c, res, err)
}
@@ -66,7 +66,7 @@ func (hd FlowHistoryHandler) Detail(c *gin.Context) {
if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &detailReq)) {
return
}
res, err := hd.Service.Detail(detailReq.Id)
res, err := Service.Detail(detailReq.Id)
response.CheckAndRespWithData(c, res, err)
}
@@ -91,7 +91,7 @@ func (hd FlowHistoryHandler) Add(c *gin.Context) {
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &addReq)) {
return
}
response.CheckAndResp(c, hd.Service.Add(addReq))
response.CheckAndResp(c, Service.Add(addReq))
}
// @Summary 流程历史编辑
@@ -116,7 +116,7 @@ func (hd FlowHistoryHandler) Edit(c *gin.Context) {
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &editReq)) {
return
}
response.CheckAndResp(c, hd.Service.Edit(editReq))
response.CheckAndResp(c, Service.Edit(editReq))
}
// @Summary 流程历史删除
@@ -131,23 +131,41 @@ func (hd FlowHistoryHandler) Del(c *gin.Context) {
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &delReq)) {
return
}
response.CheckAndResp(c, hd.Service.Del(delReq.Id))
}
type FlowTree struct {
Id string `json:"id"`
Pid string `json:"pid"`
Type string `json:"type"`
User string `json:"user"`
// FieldAuth map[string]int `json:"fieldAuth"`
Children *FlowTree
response.CheckAndResp(c, Service.Del(delReq.Id))
}
// 提交申请
//
// @Router /api/flow_apply/SubmitApply [post]
func (hd FlowHistoryHandler) SubmitApply(c *gin.Context) {
// 申请流程id
// var addReq FlowApplyAddReq
// if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &addReq)) {
// return
// }
// var Nickname = config.AdminConfig.GetNickname(c)
// var AdminId = config.AdminConfig.GetAdminId(c)
// addReq.ApplyUserNickname = Nickname
// addReq.ApplyUserId = int(AdminId)
// 解析json
// 查找开始节点
// 查找开始的下一级节点
// 下一个可能是网关,系统任务,用户任务,结束
// 网关,系统任务节点处理后继续向下查找节点,网关只能有一个满足条件
}
// 获取下一个审批节点,中间可能存在系统任务节点和网关
func (hd FlowHistoryHandler) NextNode(c *gin.Context) {
var nextNode NextNodeReq
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &nextNode)) {
return
}
response.CheckAndResp(c, Service.GetNextNode(nextNode))
}
// 同意审批(当前nodeId)

View File

@@ -71,3 +71,18 @@ type FlowHistoryResp struct {
UpdateTime core.TsTime `json:"updateTime" structs:"updateTime"` // 更新时间
CreateTime core.TsTime `json:"createTime" structs:"createTime"` // 创建时间
}
type NextNodeReq struct {
ApplyId int `form:"applyId"` // 申请id
NodeId string `form:"nodeId"` // 流程里的节点id
}
type FlowTree struct {
Id string `json:"id"`
Pid string `json:"pid"`
Type string `json:"type"`
User string `json:"user"`
// FieldAuth map[string]int `json:"fieldAuth"`
Children *FlowTree
}

View File

@@ -1,9 +1,11 @@
package flow_history
import (
"x_admin/core"
"x_admin/core/request"
"x_admin/core/response"
"x_admin/model"
"gorm.io/gorm"
)
@@ -15,10 +17,15 @@ type IFlowHistoryService interface {
Add(addReq FlowHistoryAddReq) (e error)
Edit(editReq FlowHistoryEditReq) (e error)
Del(id int) (e error)
GetNextNode(nextNode NextNodeReq) (e error)
}
var Service = NewFlowHistoryService()
// NewFlowHistoryService 初始化
func NewFlowHistoryService(db *gorm.DB) IFlowHistoryService {
func NewFlowHistoryService() IFlowHistoryService {
db := core.GetDB()
return &flowHistoryService{db: db}
}
@@ -85,6 +92,7 @@ func (Service flowHistoryService) List(page request.PageReq, listReq FlowHistory
Lists: resps,
}, nil
}
// ListAll 流程历史列表
func (Service flowHistoryService) ListAll() (res []FlowHistoryResp, e error) {
var objs model.FlowHistory
@@ -154,3 +162,11 @@ func (Service flowHistoryService) Del(id int) (e error) {
e = response.CheckErr(err, "Del Delete err")
return
}
/**
* 获取下一个流程
*/
func (Service flowHistoryService) GetNextNode(nextNode NextNodeReq) (e error) {
//
return e
}

View File

@@ -1,10 +1,10 @@
package admin
import (
"github.com/gin-gonic/gin"
"x_admin/core"
"x_admin/middleware"
"x_admin/admin/flow_history"
"x_admin/middleware"
"github.com/gin-gonic/gin"
)
/**
@@ -25,14 +25,10 @@ flow_history:listAll
flow_history:detail
*/
// FlowHistoryRoute(rg)
func FlowHistoryRoute(rg *gin.RouterGroup) {
db := core.GetDB()
server := flow_history.NewFlowHistoryService(db)
handle := flow_history.FlowHistoryHandler{Service: server}
handle := flow_history.FlowHistoryHandler{}
rg = rg.Group("/", middleware.TokenAuth())
rg.GET("/flow_history/list", handle.List)
@@ -41,4 +37,6 @@ func FlowHistoryRoute(rg *gin.RouterGroup) {
rg.POST("/flow_history/add", handle.Add)
rg.POST("/flow_history/edit", handle.Edit)
rg.POST("/flow_history/del", handle.Del)
rg.POST("/flow_history/next_node", handle.NextNode)
}

View File

@@ -8,9 +8,7 @@ import (
"github.com/gin-gonic/gin"
)
type FlowTemplateHandler struct {
Service IFlowTemplateService
}
type FlowTemplateHandler struct{}
// @Summary 流程模板列表
// @Tags flow_template-流程模板
@@ -35,7 +33,7 @@ func (hd FlowTemplateHandler) List(c *gin.Context) {
if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &listReq)) {
return
}
res, err := hd.Service.List(page, listReq)
res, err := Service.List(page, listReq)
response.CheckAndRespWithData(c, res, err)
}
@@ -43,7 +41,7 @@ func (hd FlowTemplateHandler) List(c *gin.Context) {
// @Tags flow_template-流程模板
// @Router /api/flow_template/listAll [get]
func (hd FlowTemplateHandler) ListAll(c *gin.Context) {
res, err := hd.Service.ListAll()
res, err := Service.ListAll()
response.CheckAndRespWithData(c, res, err)
}
@@ -59,7 +57,7 @@ func (hd FlowTemplateHandler) Detail(c *gin.Context) {
if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &detailReq)) {
return
}
res, err := hd.Service.Detail(detailReq.Id)
res, err := Service.Detail(detailReq.Id)
response.CheckAndRespWithData(c, res, err)
}
@@ -79,7 +77,7 @@ func (hd FlowTemplateHandler) Add(c *gin.Context) {
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &addReq)) {
return
}
response.CheckAndResp(c, hd.Service.Add(addReq))
response.CheckAndResp(c, Service.Add(addReq))
}
// @Summary 流程模板编辑
@@ -99,7 +97,7 @@ func (hd FlowTemplateHandler) Edit(c *gin.Context) {
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &editReq)) {
return
}
response.CheckAndResp(c, hd.Service.Edit(editReq))
response.CheckAndResp(c, Service.Edit(editReq))
}
// @Summary 流程模板删除
@@ -114,5 +112,5 @@ func (hd FlowTemplateHandler) Del(c *gin.Context) {
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &delReq)) {
return
}
response.CheckAndResp(c, hd.Service.Del(delReq.Id))
response.CheckAndResp(c, Service.Del(delReq.Id))
}

View File

@@ -7,6 +7,7 @@ type FlowTemplateListReq struct {
FlowRemark string `form:"flowRemark"` // 流程描述
FlowFormData string `form:"flowFormData"` // 表单配置
FlowProcessData string `form:"flowProcessData"` // 流程配置
FlowProcessDataList string `form:"flowProcessDataList"` // 流程配置list数据
}
//FlowTemplateDetailReq 流程模板详情参数
@@ -21,6 +22,7 @@ type FlowTemplateAddReq struct {
FlowRemark string `form:"flowRemark"` // 流程描述
FlowFormData string `form:"flowFormData"` // 表单配置
FlowProcessData string `form:"flowProcessData"` // 流程配置
FlowProcessDataList string `form:"flowProcessDataList"` // 流程配置list数据
}
@@ -32,6 +34,7 @@ type FlowTemplateEditReq struct {
FlowRemark string `form:"flowRemark"` // 流程描述
FlowFormData string `form:"flowFormData"` // 表单配置
FlowProcessData string `form:"flowProcessData"` // 流程配置
FlowProcessDataList string `form:"flowProcessDataList"` // 流程配置list数据
}
@@ -48,5 +51,5 @@ type FlowTemplateResp struct {
FlowRemark string `json:"flowRemark" structs:"flowRemark"` // 流程描述
FlowFormData string `json:"flowFormData" structs:"flowFormData"` // 表单配置
FlowProcessData string `json:"flowProcessData" structs:"flowProcessData"` // 流程配置
FlowProcessDataList string `form:"flowProcessDataList"` // 流程配置list数据
}

View File

@@ -1,6 +1,7 @@
package flow_template
import (
"x_admin/core"
"x_admin/core/request"
"x_admin/core/response"
"x_admin/model"
@@ -17,8 +18,11 @@ type IFlowTemplateService interface {
Del(id int) (e error)
}
var Service = NewFlowTemplateService()
// NewFlowTemplateService 初始化
func NewFlowTemplateService(db *gorm.DB) IFlowTemplateService {
func NewFlowTemplateService() *flowTemplateService {
db := core.GetDB()
return &flowTemplateService{db: db}
}

View File

@@ -2,7 +2,6 @@ package admin
import (
"x_admin/admin/flow_template"
"x_admin/core"
"x_admin/middleware"
"github.com/gin-gonic/gin"
@@ -28,11 +27,8 @@ flow_template:detail
// FlowTemplateRoute(rg)
func FlowTemplateRoute(rg *gin.RouterGroup) {
db := core.GetDB()
server := flow_template.NewFlowTemplateService(db)
handle := flow_template.FlowTemplateHandler{Service: server}
handle := flow_template.FlowTemplateHandler{}
rg = rg.Group("/", middleware.TokenAuth())
rg.GET("/flow_template/list", handle.List)

View File

@@ -11,6 +11,7 @@ type FlowApply struct {
FlowRemark string `gorm:"comment:'流程描述'"` // 流程描述
FlowFormData string `gorm:"comment:'表单配置'"` // 表单配置
FlowProcessData string `gorm:"comment:'流程配置'"` // 流程配置
FlowProcessDataList string `gorm:"comment:'流程配置list数据'"` // 流程配置list数据
FormValue string `gorm:"comment:'表单值'"` // 表单值
Status int `gorm:"comment:'状态0待提交1审批中2审批完成3审批失败'"` // 状态0待提交1审批中2审批完成3审批失败
UpdateTime int64 `gorm:"autoUpdateTime;comment:'更新时间'"` // 更新时间

View File

@@ -8,4 +8,5 @@ type FlowTemplate struct {
FlowRemark string `gorm:"comment:'流程描述'"` // 流程描述
FlowFormData string `gorm:"comment:'表单配置'"` // 表单配置
FlowProcessData string `gorm:"comment:'流程配置'"` // 流程配置
FlowProcessDataList string `gorm:"comment:'流程配置list数据'"` // 流程配置list数据
}