Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
飞一样的人
gin-vue-admin
提交
58ecca14
G
gin-vue-admin
项目概览
飞一样的人
/
gin-vue-admin
与 Fork 源项目一致
Fork自
FLIPPED-AURORA / gin-vue-admin
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gin-vue-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
58ecca14
编写于
11月 19, 2020
作者:
Mr.奇淼(
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
数据动态查找以及动态赋值方法变更
上级
468483ee
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
67 addition
and
26 deletion
+67
-26
server/api/v1/wk_process.go
server/api/v1/wk_process.go
+2
-2
server/initialize/workflow.go
server/initialize/workflow.go
+4
-4
server/model/exa_wf_leave.go
server/model/exa_wf_leave.go
+4
-0
server/model/wf_process.go
server/model/wf_process.go
+1
-6
server/service/wk_process.go
server/service/wk_process.go
+16
-4
web/src/api/workflowProcess.js
web/src/api/workflowProcess.js
+16
-0
web/src/view/exa_wf_leave/exa_wf_leaveFrom.vue
web/src/view/exa_wf_leave/exa_wf_leaveFrom.vue
+10
-2
web/src/view/workflow/workflowProcess/workflowProcess.vue
web/src/view/workflow/workflowProcess/workflowProcess.vue
+1
-2
web/src/view/workflow/workflowUse/workflowUse.vue
web/src/view/workflow/workflowUse/workflowUse.vue
+13
-6
未找到文件。
server/api/v1/wk_process.go
浏览文件 @
58ecca14
...
...
@@ -228,12 +228,12 @@ func GetMyNeed(c *gin.Context) {
func
GetWorkflowMoveByID
(
c
*
gin
.
Context
)
{
var
req
request
.
GetById
_
=
c
.
ShouldBindQuery
(
&
req
)
err
,
move
,
moves
:=
service
.
GetWorkflowMoveByID
(
req
.
Id
)
err
,
move
,
moves
,
business
:=
service
.
GetWorkflowMoveByID
(
req
.
Id
)
if
err
!=
nil
{
errStr
:=
err
.
Error
()
global
.
GVA_LOG
.
Error
(
errStr
)
response
.
FailWithMessage
(
errStr
,
c
)
return
}
response
.
OkWithData
(
gin
.
H
{
"move"
:
move
,
"moves"
:
moves
},
c
)
response
.
OkWithData
(
gin
.
H
{
"move"
:
move
,
"moves"
:
moves
,
"business"
:
business
},
c
)
}
server/initialize/workflow.go
浏览文件 @
58ecca14
...
...
@@ -10,13 +10,13 @@ func initWkModel() {
}
func
initWkTable
()
{
model
.
WorkflowBusinessTable
=
make
(
map
[
string
]
string
)
model
.
WorkflowBusinessTable
[
"leave"
]
=
"exa_wf_leaves"
model
.
WorkflowBusinessTable
=
make
(
map
[
string
]
func
()
interface
{})
model
.
WorkflowBusinessTable
[
"leave"
]
=
func
()
interface
{}
{
return
new
(
model
.
ExaWfLeave
)
}
}
func
InitWkMode
()
{
initWkModel
()
initWkTable
()
}
server/model/exa_wf_leave.go
浏览文件 @
58ecca14
...
...
@@ -19,3 +19,7 @@ type ExaWfLeaveWorkflow struct {
WorkflowBase
`json:"wf"`
ExaWfLeave
`json:"business"`
}
func
(
e
ExaWfLeave
)
TableName
()
string
{
return
"exa_wf_leaves"
}
server/model/wf_process.go
浏览文件 @
58ecca14
...
...
@@ -7,10 +7,9 @@ import (
)
var
WorkflowBusinessStruct
map
[
string
]
func
()
GVA_Workflow
var
WorkflowBusinessTable
map
[
string
]
string
var
WorkflowBusinessTable
map
[
string
]
func
()
interface
{}
type
GVA_Workflow
interface
{
GetTableName
()
string
CreateWorkflowMove
()
*
WorkflowMove
GetBusinessType
()
string
GetWorkflowBase
()
WorkflowBase
...
...
@@ -47,10 +46,6 @@ func (w WorkflowBase) GetWorkflowBase() (workflowBase WorkflowBase) {
return
w
}
func
(
w
WorkflowBase
)
GetTableName
()
string
{
return
WorkflowBusinessTable
[
w
.
BusinessType
]
}
//定义clazz常量
const
(
...
...
server/service/wk_process.go
浏览文件 @
58ecca14
...
...
@@ -7,9 +7,14 @@ import (
"gin-vue-admin/model"
"gin-vue-admin/model/request"
"gorm.io/gorm"
"gorm.io/gorm/schema"
"strconv"
)
func
getTable
(
businessType
string
)
interface
{}
{
return
model
.
WorkflowBusinessTable
[
businessType
]()
}
//@author: [piexlmax](https://github.com/piexlmax)
//@function: CreateWorkflowProcess
//@description: 创建工作流相关信息
...
...
@@ -166,7 +171,8 @@ func GetWorkflowProcessInfoList(info request.WorkflowProcessSearch) (err error,
func
StartWorkflow
(
wfInterface
model
.
GVA_Workflow
)
(
err
error
)
{
err
=
global
.
GVA_DB
.
Transaction
(
func
(
tx
*
gorm
.
DB
)
error
{
var
txErr
error
txErr
=
tx
.
Table
(
wfInterface
.
GetTableName
())
.
Create
(
wfInterface
)
.
Error
tableName
:=
getTable
(
wfInterface
.
GetBusinessType
())
.
(
schema
.
Tabler
)
.
TableName
()
txErr
=
tx
.
Table
(
tableName
)
.
Create
(
wfInterface
)
.
Error
if
txErr
!=
nil
{
return
txErr
}
...
...
@@ -288,7 +294,8 @@ func GetMyNeed(userID uint, AuthorityID string) (err error, wfms []model.Workflo
return
err
,
wfms
}
func
GetWorkflowMoveByID
(
id
float64
)
(
err
error
,
move
model
.
WorkflowMove
,
moves
[]
model
.
WorkflowMove
)
{
func
GetWorkflowMoveByID
(
id
float64
)
(
err
error
,
move
model
.
WorkflowMove
,
moves
[]
model
.
WorkflowMove
,
business
interface
{})
{
var
result
interface
{}
err
=
global
.
GVA_DB
.
Transaction
(
func
(
tx
*
gorm
.
DB
)
error
{
var
txErr
error
txErr
=
tx
.
Preload
(
"Promoter"
)
.
Preload
(
"Operator"
)
.
Preload
(
"WorkflowNode"
)
.
Preload
(
"WorkflowProcess"
)
.
First
(
&
move
,
"id = ?"
,
id
)
.
Error
...
...
@@ -296,11 +303,16 @@ func GetWorkflowMoveByID(id float64) (err error, move model.WorkflowMove, moves
return
txErr
}
txErr
=
tx
.
Preload
(
"Promoter"
)
.
Preload
(
"Operator"
)
.
Preload
(
"WorkflowNode"
)
.
Preload
(
"WorkflowProcess"
)
.
Find
(
&
moves
,
"business_id = ? AND business_type = ?"
,
move
.
BusinessID
,
move
.
BusinessType
)
.
Error
fmt
.
Println
(
moves
)
if
txErr
!=
nil
{
return
txErr
}
result
=
getTable
(
move
.
BusinessType
)
fmt
.
Println
(
result
)
txErr
=
tx
.
First
(
result
,
"id = ?"
,
move
.
BusinessID
)
.
Error
if
txErr
!=
nil
{
return
txErr
}
return
nil
})
return
err
,
move
,
moves
return
err
,
move
,
moves
,
result
}
web/src/api/workflowProcess.js
浏览文件 @
58ecca14
...
...
@@ -161,4 +161,20 @@ export const getMyNeed = () => {
url
:
"
/workflowProcess/getMyNeed
"
,
method
:
'
get
'
,
})
}
// @Tags WorkflowProcess
// @Summary 根据id获取当前节点详情和历史
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.GetById true "根据id获取当前节点详情和过往"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /workflowProcess/getWorkflowMoveByID [get]
export
const
getWorkflowMoveByID
=
(
params
)
=>
{
return
service
({
url
:
"
/workflowProcess/getWorkflowMoveByID
"
,
method
:
'
get
'
,
params
})
}
\ No newline at end of file
web/src/view/exa_wf_leave/exa_wf_leaveFrom.vue
浏览文件 @
58ecca14
...
...
@@ -44,6 +44,10 @@ export default {
name
:
"
ExaWfLeave
"
,
mixins
:
[
infoList
],
props
:{
business
:{
type
:
Object
,
default
:
function
(){
return
null
}
},
wf
:{
type
:
Object
,
default
:
function
(){
return
{}}
...
...
@@ -51,7 +55,8 @@ export default {
},
data
()
{
return
{
type
:
""
,
formData
:
{
type
:
""
,
formData
:
{
cause
:
""
,
startTime
:
new
Date
(),
endTime
:
new
Date
(),
...
...
@@ -72,6 +77,7 @@ export default {
workflowProcessID
:
this
.
wf
.
workflowProcessID
,
workflowNodeID
:
this
.
wf
.
id
,
promoterID
:
this
.
userInfo
.
ID
,
operatorID
:
this
.
userInfo
.
ID
,
action
:
"
create
"
,
param
:
""
}
...
...
@@ -89,7 +95,9 @@ export default {
},
async
created
()
{
// 建议通过url传参获取目标数据ID 调用 find方法进行查询数据操作 从而决定本页面是create还是update 以下为id作为url参数示例
if
(
this
.
business
){
this
.
formData
=
this
.
business
}
}
};
</
script
>
...
...
web/src/view/workflow/workflowProcess/workflowProcess.vue
浏览文件 @
58ecca14
...
...
@@ -164,8 +164,7 @@ export default {
this
.
$router
.
push
({
name
:
"
workflowUse
"
,
query
:
{
workflowId
:
row
.
id
,
activeId
:
0
,
workflowId
:
row
.
id
}
});
},
...
...
web/src/view/workflow/workflowUse/workflowUse.vue
浏览文件 @
58ecca14
<
template
>
<div
class=
"workflow-use"
>
<WorkflowInfo
v-if=
"done"
:wf=
"this.node"
/>
<WorkflowInfo
v-if=
"done"
:wf=
"this.node"
:business=
"business"
/>
</div>
</
template
>
<
script
>
import
{
findWorkflowStep
}
from
"
@/api/workflowProcess.js
"
import
{
findWorkflowStep
,
getWorkflowMoveByID
}
from
"
@/api/workflowProcess.js
"
export
default
{
name
:
"
WorklowUse
"
,
data
(){
return
{
done
:
false
done
:
false
,
business
:
null
,
node
:
null
}
},
async
created
(){
const
workflowId
=
this
.
$route
.
query
.
workflowId
const
actionId
=
this
.
$route
.
query
.
actionId
const
businessId
=
this
.
$route
.
query
.
businessId
const
wfmId
=
this
.
$route
.
query
.
wfmId
if
(
workflowId
){
const
res
=
await
findWorkflowStep
({
id
:
workflowId
})
if
(
res
.
code
==
0
){
...
...
@@ -24,6 +24,13 @@ export default {
this
.
node
=
res
.
data
.
workflow
.
nodes
[
0
]
this
.
done
=
true
}
}
else
if
(
wfmId
){
const
res
=
await
getWorkflowMoveByID
({
id
:
wfmId
})
if
(
res
.
code
==
0
){
this
.
business
=
res
.
data
.
business
this
.
node
=
res
.
data
.
move
.
workflowNode
this
.
done
=
true
}
}
},
beforeCreate
(){
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录