Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
nizhengjia888
gin-vue-admin
提交
7e33276e
G
gin-vue-admin
项目概览
nizhengjia888
/
gin-vue-admin
与 Fork 源项目一致
Fork自
FLIPPED-AURORA / gin-vue-admin
通知
3
Star
0
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,发现更多精彩内容 >>
提交
7e33276e
编写于
11月 24, 2020
作者:
Mr.奇淼(
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加自动化产生的工作流form页面
上级
9e6b8ff0
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
202 addition
and
6 deletion
+202
-6
server/initialize/workflow.go
server/initialize/workflow.go
+4
-4
server/model/exa_wf_leave.go
server/model/exa_wf_leave.go
+1
-1
server/resource/template/server/model.go.tpl
server/resource/template/server/model.go.tpl
+24
-1
server/resource/template/web/workflowForm.vue.tpl
server/resource/template/web/workflowForm.vue.tpl
+171
-0
server/service/sys_auto_code.go
server/service/sys_auto_code.go
+2
-0
未找到文件。
server/initialize/workflow.go
浏览文件 @
7e33276e
...
...
@@ -2,14 +2,14 @@ package initialize
import
"gin-vue-admin/model"
func
initW
k
Model
()
{
func
initW
orkflow
Model
()
{
model
.
WorkflowBusinessStruct
=
make
(
map
[
string
]
func
()
model
.
GVA_Workflow
)
model
.
WorkflowBusinessStruct
[
"leave"
]
=
func
()
model
.
GVA_Workflow
{
return
new
(
model
.
ExaWfLeaveWorkflow
)
}
}
func
initW
k
Table
()
{
func
initW
orkflow
Table
()
{
model
.
WorkflowBusinessTable
=
make
(
map
[
string
]
func
()
interface
{})
model
.
WorkflowBusinessTable
[
"leave"
]
=
func
()
interface
{}
{
return
new
(
model
.
ExaWfLeave
)
...
...
@@ -17,6 +17,6 @@ func initWkTable() {
}
func
InitWkMode
()
{
initW
k
Model
()
initW
k
Table
()
initW
orkflow
Model
()
initW
orkflow
Table
()
}
server/model/exa_wf_leave.go
浏览文件 @
7e33276e
...
...
@@ -20,6 +20,6 @@ type ExaWfLeaveWorkflow struct {
ExaWfLeave
`json:"business"`
}
func
(
e
ExaWfLeave
)
TableName
()
string
{
func
(
ExaWfLeave
)
TableName
()
string
{
return
"exa_wf_leaves"
}
server/resource/template/server/model.go.tpl
浏览文件 @
7e33276e
...
...
@@ -19,4 +19,27 @@ type {{.StructName}} struct {
func ({{.StructName}}) TableName() string {
return "{{.TableName}}"
}
{{ end }}
\ No newline at end of file
{{ end }}
// 如果使用工作流功能 需要打开下方注释 并到initialize的workflow中进行注册 且必须指定TableName
// type {{.StructName}}Workflow struct {
// // 工作流操作结构体
// WorkflowBase `json:"wf"`
// {{.StructName}} `json:"business"`
// }
// func ({{.StructName}}) TableName() string {
// return "{{.TableName}}"
// }
// 工作流注册代码
// initWorkflowModel内部注册
// model.WorkflowBusinessStruct["{{.Abbreviation}}"] = func() model.GVA_Workflow {
// return new(model.{{.StructName}}Workflow)
// }
// initWorkflowTable内部注册
// model.WorkflowBusinessTable["{{.Abbreviation}}"] = func() interface{} {
// return new(model.{{.StructName}})
// }
server/resource/template/web/workflowForm.vue.tpl
0 → 100644
浏览文件 @
7e33276e
<template>
<div>
<el-form
:model=
"formData"
label-position=
"right"
label-width=
"80px"
>
{{- range .Fields}}
<el-form-item
label=
"{{.FieldDesc}}:"
>
{{- if eq .FieldType "bool" }}
<el-switch
active-color=
"#13ce66"
inactive-color=
"#ff4949"
active-text=
"是"
inactive-text=
"否"
v-model=
"formData.{{.FieldJson}}"
clearable
></el-switch>
{{ end -}}
{{- if eq .FieldType "string" }}
<el-input
v-model=
"formData.{{.FieldJson}}"
clearable
placeholder=
"请输入"
></el-input>
{{ end -}}
{{- if eq .FieldType "int" }}
{{- if .DictType}}
<el-select
v-model=
"formData.{{ .FieldJson }}"
placeholder=
"请选择"
clearable
>
<el-option
v-for=
"(item,key) in {{ .DictType }}Options"
:key=
"key"
:label=
"item.label"
:value=
"item.value"
></el-option>
</el-select>
{{ else -}}
<el-input
v-model.number=
"formData.{{ .FieldJson }}"
clearable
placeholder=
"请输入"
></el-input>
{{ end -}}
{{ end -}}
{{- if eq .FieldType "time.Time" }}
<el-date-picker
type=
"date"
placeholder=
"选择日期"
v-model=
"formData.{{ .FieldJson }}"
clearable
></el-date-picker>
{{ end -}}
{{- if eq .FieldType "float64" }}
<el-input-number
v-model=
"formData.{{ .FieldJson }}"
:precision=
"2"
clearable
></el-input-number>
{{ end -}}
</el-form-item>
{{ end -}}
<el-form-item>
<el-button
v-if=
"this.wf.clazz == 'start'"
@
click=
"start"
type=
"primary"
>
启动
</el-button>
// complete传入流转参数 决定下一步会流转到什么位置 此处可以设置多个按钮来做不同的流转
<el-button
v-if=
"this.wf.clazz == 'userTask'"
@
click=
"complete('yes')"
type=
"primary"
>
提交
</el-button>
<el-button
@
click=
"back"
type=
"primary"
>
返回
</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import
{
startWorkflow
,
completeWorkflowMove
}
from
"
@/api/workflowProcess
"
;
import
infoList
from
"
@/mixins/infoList
"
;
import
{
mapGetters
}
from
"
vuex
"
;
export
default
{
name
:
"
{{.StructName}}
"
,
mixins
:
[
infoList
],
props
:{
business
:{
type
:
Object
,
default
:
function
()
{
return
null
}
},
wf
:{
type
:
Object
,
default
:
function
()
{
return
{}}
},
workflowMoveID
:{
type
:
Number
,
default
:
0
}
},
data
()
{
return
{
{{
-
range
.
Fields
}}
{{
-
if
.
DictType
}}
{{
.
DictType
}}
Options
:[],
{{
end
-
}}
{
{
end
-
}
}
formData
:
{
{
{
range
.
Fields
}
}
{{
-
if
eq
.
FieldType
"
bool
"
-
}}
{{.
FieldJson
}}:
false
,
{{
end
-
}}
{{
-
if
eq
.
FieldType
"
string
"
-
}}
{{.
FieldJson
}}:
""
,
{{
end
-
}}
{{
-
if
eq
.
FieldType
"
int
"
-
}}
{{.
FieldJson
}}:
0
,
{{
end
-
}}
{{
-
if
eq
.
FieldType
"
time.Time
"
-
}}
{{.
FieldJson
}}:
new
Date
(),
{{
end
-
}}
{{
-
if
eq
.
FieldType
"
float64
"
-
}}
{{.
FieldJson
}}:
0
,
{{
end
-
}}
{{
end
}}
}
};
},
computed
:{
canShow
(){
if
(
this
.
wf
.
assignType
==
"
user
"
){
if
(
this
.
wf
.
assginValue
.
indexOf
(
"
,
"
+
this
.
userInfo
.
ID
+
"
,
"
)
>
0
){
return
true
}
else
{
return
false
}
}
else
if
(
this
.
wf
.
assign_type
==
"
authority
"
){
if
(
this
.
wf
.
assginValue
.
indexOf
(
"
,
"
+
this
.
userInfo
.
authorityId
+
"
,
"
)
>
0
){
return
true
}
else
{
return
false
}
}
},
...
mapGetters
(
"
user
"
,
[
"
userInfo
"
])
},
methods
:
{
async
start
()
{
const
res
=
await
startWorkflow
({
business
:
this
.
formData
,
wf
:{
workflowMoveID
:
this
.
workflowMoveID
,
businessId
:
0
,
businessType
:
"
{{.Abbreviation}}
"
,
workflowProcessID
:
this
.
wf
.
workflowProcessID
,
workflowNodeID
:
this
.
wf
.
id
,
promoterID
:
this
.
userInfo
.
ID
,
operatorID
:
this
.
userInfo
.
ID
,
action
:
"
create
"
,
param
:
""
}
});
if
(
res
.
code
==
0
)
{
this
.
$message
({
type
:
"
success
"
,
message
:
"
启动成功
"
})
this
.
back
()
}
},
async
complete
(
param
){
const
res
=
await
completeWorkflowMove
({
business
:
this
.
formData
,
wf
:{
workflowMoveID
:
this
.
workflowMoveID
,
businessID
:
this
.
formData
.
ID
,
businessType
:
"
{{.Abbreviation}}
"
,
workflowProcessID
:
this
.
wf
.
workflowProcessID
,
workflowNodeID
:
this
.
wf
.
id
,
promoterID
:
this
.
userInfo
.
ID
,
operatorID
:
this
.
userInfo
.
ID
,
action
:
"
complete
"
,
param
:
param
}
})
if
(
res
.
code
==
0
){
this
.
$message
({
type
:
"
success
"
,
message
:
"
提交成功
"
})
this
.
back
()
}
},
back
(){
this
.
$router
.
go
(
-
1
)
}
},
async
created
()
{
if
(
this
.
business
){
this
.
formData
=
this
.
business
}
}
};
</script>
<style>
</style>
\ No newline at end of file
server/service/sys_auto_code.go
浏览文件 @
7e33276e
...
...
@@ -201,6 +201,8 @@ func addAutoMoveFile(data *tplData) {
}
else
if
strings
.
Contains
(
data
.
autoCodePath
,
"web"
)
{
if
strings
.
Contains
(
data
.
autoCodePath
,
"js"
)
{
data
.
autoMoveFilePath
=
filepath
.
Join
(
"../"
,
"web"
,
"src"
,
dir
,
base
)
}
else
if
strings
.
Contains
(
data
.
autoCodePath
,
"workflowForm"
)
{
data
.
autoMoveFilePath
=
filepath
.
Join
(
"../"
,
"web"
,
"src"
,
"view"
,
filepath
.
Base
(
filepath
.
Dir
(
filepath
.
Dir
(
data
.
autoCodePath
))),
strings
.
TrimSuffix
(
base
,
filepath
.
Ext
(
base
))
+
"WorkflowForm.vue"
)
}
else
if
strings
.
Contains
(
data
.
autoCodePath
,
"form"
)
{
data
.
autoMoveFilePath
=
filepath
.
Join
(
"../"
,
"web"
,
"src"
,
"view"
,
filepath
.
Base
(
filepath
.
Dir
(
filepath
.
Dir
(
data
.
autoCodePath
))),
strings
.
TrimSuffix
(
base
,
filepath
.
Ext
(
base
))
+
"Form.vue"
)
}
else
if
strings
.
Contains
(
data
.
autoCodePath
,
"table"
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录