Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
253d7071
authored
Mar 29, 2024
by
jason
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
仿钉钉设计流程-30%: 获取仿钉钉流程模型数据结构
parent
627b822f
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
103 additions
and
30 deletions
+103
-30
src/api/bpm/simple/index.ts
+7
-0
src/components/SimpleProcessDesigner/src/addNode.vue
+2
-2
src/components/SimpleProcessDesigner/src/drawer/approverDrawer.vue
+20
-3
src/components/SimpleProcessDesigner/src/nodeWrap.vue
+26
-3
src/components/SimpleProcessDesigner/src/util.ts
+4
-4
src/views/bpm/simpleWorkflow/index.vue
+44
-18
No files found.
src/api/bpm/simple/index.ts
View file @
253d7071
...
@@ -7,3 +7,9 @@ export const saveBpmSimpleModel = async (data) => {
...
@@ -7,3 +7,9 @@ export const saveBpmSimpleModel = async (data) => {
data
:
data
data
:
data
})
})
}
}
export
const
getBpmSimpleModel
=
async
(
modelId
)
=>
{
return
await
request
.
get
({
url
:
'/bpm/simple/get?modelId='
+
modelId
})
}
\ No newline at end of file
src/components/SimpleProcessDesigner/src/addNode.vue
View file @
253d7071
...
@@ -71,9 +71,9 @@ const addType = (type) => {
...
@@ -71,9 +71,9 @@ const addType = (type) => {
attributes
:
{
attributes
:
{
approveMethod
:
undefined
,
approveMethod
:
undefined
,
candidateStrategy
:
undefined
,
candidateStrategy
:
undefined
,
candidateParam
:
[]
candidateParam
:
undefined
},
},
//
childNode: props.childNodeP
childNode
:
props
.
childNodeP
}
}
}
else
if
(
type
==
2
)
{
}
else
if
(
type
==
2
)
{
data
=
{
data
=
{
...
...
src/components/SimpleProcessDesigner/src/drawer/approverDrawer.vue
View file @
253d7071
...
@@ -202,7 +202,19 @@ let visible = computed({
...
@@ -202,7 +202,19 @@ let visible = computed({
})
})
watch
(
userTaskConfig
,
(
val
)
=>
{
watch
(
userTaskConfig
,
(
val
)
=>
{
if
(
val
.
value
.
attributes
)
{
if
(
val
.
value
.
attributes
)
{
candidateConfig
.
value
=
val
.
value
.
attributes
console
.
log
(
'val.value.attributes'
,
val
.
value
.
attributes
);
candidateConfig
.
value
.
approveMethod
=
val
.
value
.
attributes
.
approveMethod
candidateConfig
.
value
.
candidateStrategy
=
val
.
value
.
attributes
.
candidateStrategy
const
candidateParamStr
=
val
.
value
.
attributes
.
candidateParam
;
if
(
val
.
value
.
attributes
.
candidateStrategy
===
60
)
{
candidateConfig
.
value
.
candidateParam
=
[
candidateParamStr
]
}
else
{
if
(
candidateParamStr
){
candidateConfig
.
value
.
candidateParam
=
candidateParamStr
.
split
(
','
).
map
((
item
)
=>
+
item
)
}
}
// candidateConfig.value = val.value.attributes
}
}
})
})
watch
(
approverConfig1
,
(
val
)
=>
{
watch
(
approverConfig1
,
(
val
)
=>
{
...
@@ -250,9 +262,14 @@ const saveApprover = () => {
...
@@ -250,9 +262,14 @@ const saveApprover = () => {
closeDrawer
()
closeDrawer
()
}
}
const
saveConfig
=
()
=>
{
const
saveConfig
=
()
=>
{
const
rawConfig
=
toRaw
(
userTaskConfig
.
value
)
const
rawConfig
=
toRaw
(
userTaskConfig
.
value
)
rawConfig
.
value
.
attributes
=
toRaw
(
candidateConfig
.
value
)
const
{
approveMethod
,
candidateStrategy
,
candidateParam
}
=
toRaw
(
candidateConfig
.
value
);
const
candidateParamStr
=
candidateParam
.
join
(
','
)
rawConfig
.
value
.
attributes
=
{
approveMethod
,
candidateStrategy
,
candidateParam
:
candidateParamStr
}
rawConfig
.
flag
=
true
rawConfig
.
flag
=
true
// TODO 进行校验
// TODO 进行校验
// setApproverConfig({
// setApproverConfig({
...
...
src/components/SimpleProcessDesigner/src/nodeWrap.vue
View file @
253d7071
...
@@ -6,14 +6,19 @@
...
@@ -6,14 +6,19 @@
* @FilePath: /Workflow-Vue3/src/components/nodeWrap.vue
* @FilePath: /Workflow-Vue3/src/components/nodeWrap.vue
-->
-->
<
template
>
<
template
>
<div
class=
"node-wrap"
v-if=
"nodeConfig.type
<
3
"
>
<div
class=
"node-wrap"
v-if=
"nodeConfig.type
<
3
"
>
<div
class=
"start-event-node"
v-if=
"nodeConfig.type === -1"
>
<div
class=
"start-event-node-text"
>
{{
nodeConfig
.
name
}}
</div>
<div
class=
"start-event-node-circle"
></div>
</div>
<div
<div
class=
"node-wrap-box"
class=
"node-wrap-box"
:class=
"
:class=
"
(nodeConfig.type == 0 ? 'start-node ' : '') +
(nodeConfig.type == 0 ? 'start-node ' : '') +
(isTried && nodeConfig.error ? 'active error' : '')
(isTried && nodeConfig.error ? 'active error' : '')
"
"
>
v-else
>
<div
class=
"title"
:style=
"`background: rgb($
{bgColors[nodeConfig.type]});`">
<div
class=
"title"
:style=
"`background: rgb($
{bgColors[nodeConfig.type]});`">
<span
v-if=
"nodeConfig.type == 0"
>
{{
nodeConfig
.
name
}}
</span>
<span
v-if=
"nodeConfig.type == 0"
>
{{
nodeConfig
.
name
}}
</span>
<template
v-else
>
<template
v-else
>
...
@@ -109,7 +114,6 @@
...
@@ -109,7 +114,6 @@
import
addNode
from
'./addNode.vue'
import
addNode
from
'./addNode.vue'
import
{
onMounted
,
ref
,
watch
,
getCurrentInstance
,
computed
}
from
'vue'
import
{
onMounted
,
ref
,
watch
,
getCurrentInstance
,
computed
}
from
'vue'
import
{
import
{
arrToStr
,
conditionStr
,
conditionStr
,
setApproverStr
,
setApproverStr
,
copyerStr
,
copyerStr
,
...
@@ -165,7 +169,6 @@ let {
...
@@ -165,7 +169,6 @@ let {
setCopyer
,
setCopyer
,
setCondition
,
setCondition
,
setFlowPermission
,
setFlowPermission
,
setApproverConfig
,
setCopyerConfig
,
setCopyerConfig
,
setConditionsConfig
,
setConditionsConfig
,
setUserTaskConfig
setUserTaskConfig
...
@@ -340,4 +343,24 @@ const arrTransfer = (index, type = 1) => {
...
@@ -340,4 +343,24 @@ const arrTransfer = (index, type = 1) => {
text-overflow
:
ellipsis
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
white-space
:
nowrap
;
}
}
.start-event-node
{
color
:
#191f2566
;
text-align
:
left
;
border-radius
:
50%
;
}
.start-event-node-circle
{
width
:
10px
;
height
:
10px
;
margin
:
auto
;
background
:
#dbdcdc
;
border-radius
:
50%
;
}
.start-event-node-text
{
margin-top
:
5px
;
font-size
:
14px
;
text-align
:
center
;
}
</
style
>
</
style
>
src/components/SimpleProcessDesigner/src/util.ts
View file @
253d7071
...
@@ -56,14 +56,14 @@ export const setApproverStr = (nodeConfig: any) => {
...
@@ -56,14 +56,14 @@ export const setApproverStr = (nodeConfig: any) => {
export
const
approveMethods
:
DictDataVO
[]
=
[
export
const
approveMethods
:
DictDataVO
[]
=
[
{
label
:
'单人审批'
,
value
:
1
}
,
{
label
:
'单人审批'
,
value
:
1
}
{
label
:
'多人审批(所有人审批通过)'
,
value
:
2
}
//
{ label: '多人审批(所有人审批通过)', value: 2 }
// TODO 更多的类型
// TODO 更多的类型
];
];
export
const
getApproverShowText
=
(
approveMethod
:
number
,
candidateStrategy
:
number
)
=>
{
export
const
getApproverShowText
=
(
approveMethod
:
number
,
candidateStrategy
:
number
)
=>
{
if
(
approveMethod
&&
candidateStrategy
)
{
let
appoveMethodText
=
'单人审批'
let
appoveMethodText
=
''
if
(
candidateStrategy
)
{
approveMethods
.
forEach
((
item
)
=>
{
approveMethods
.
forEach
((
item
)
=>
{
if
(
item
.
value
==
approveMethod
)
{
if
(
item
.
value
==
approveMethod
)
{
appoveMethodText
=
item
.
label
appoveMethodText
=
item
.
label
...
...
src/views/bpm/simpleWorkflow/index.vue
View file @
253d7071
<
template
>
<
template
>
<div>
<div>
<section
class=
"dingflow-design"
>
<section
class=
"dingflow-design"
>
<el-row>
<el-row>
<el-col
:span=
"20"
/>
<el-col
:span=
"20"
/>
<el-col
:span=
"4"
>
<el-col
:span=
"4"
>
<el-button
type=
"primary"
size=
"small"
@
click=
"test"
>
保存(用于测试,还未完成)
</el-button>
<el-button
type=
"primary"
size=
"small"
@
click=
"test"
>
保存(用于测试,还未完成)
</el-button>
</el-col>
</el-col>
</el-row>
</el-row>
<div
class=
"box-scale"
>
<div
class=
"box-scale"
>
<!--
<div
class=
"start-event-node"
>
<div
class=
"start-event-node-text"
>
流程开始
</div>
<div
class=
"start-event-node-circle"
></div>
<div
class=
"start-event-node-flow"
>
<el-popover
placement=
"right-start"
width=
"auto"
>
<div
class=
"add-node-popover-body"
>
<a
class=
"add-node-popover-item approver"
@
click=
"addType(1)"
>
<div
class=
"item-wrapper"
>
<span
class=
"iconfont"
>
</span>
</div>
<p>
审批人
</p>
</a>
</div>
<template
#
reference
>
<button
class=
"btn"
type=
"button"
>
<span
class=
"iconfont"
>
</span>
</button>
</
template
>
</el-popover>
</div>
</div>
-->
<nodeWrap
v-model:nodeConfig=
"nodeConfig"
/>
<nodeWrap
v-model:nodeConfig=
"nodeConfig"
/>
<div
class=
"end-node"
>
<div
class=
"end-node"
>
<div
class=
"end-node-circle"
></div>
<div
class=
"end-node-circle"
></div>
...
@@ -21,25 +41,23 @@
...
@@ -21,25 +41,23 @@
</template>
</template>
<
script
lang=
"ts"
setup
>
<
script
lang=
"ts"
setup
>
import
nodeWrap
from
'@/components/SimpleProcessDesigner/src/nodeWrap.vue'
import
nodeWrap
from
'@/components/SimpleProcessDesigner/src/nodeWrap.vue'
import
addNode
from
'@/components/SimpleProcessDesigner/src/addNode.vue'
import
approverDrawer
from
'@/components/SimpleProcessDesigner/src/drawer/approverDrawer.vue'
import
approverDrawer
from
'@/components/SimpleProcessDesigner/src/drawer/approverDrawer.vue'
import
{
ref
}
from
'vue'
import
{
ref
}
from
'vue'
import
{
saveBpmSimpleModel
}
from
'@/api/bpm/simple'
import
{
saveBpmSimpleModel
,
getBpmSimpleModel
}
from
'@/api/bpm/simple'
defineOptions
({
name
:
'SimpleWorkflowDesignEditor'
})
defineOptions
({
name
:
'SimpleWorkflowDesignEditor'
})
const
uid
=
getCurrentInstance
().
uid
;
const
uid
=
getCurrentInstance
().
uid
const
router
=
useRouter
()
// 路由
const
router
=
useRouter
()
// 路由
const
{
query
}
=
useRoute
()
// 路由的查询
const
{
query
}
=
useRoute
()
// 路由的查询
const
modelId
=
query
.
modelId
;
const
modelId
=
query
.
modelId
const
message
=
useMessage
()
// 国际化
const
message
=
useMessage
()
// 国际化
const
nodeConfig
=
ref
({
const
nodeConfig
=
ref
({
name
:
'发起人'
,
name
:
'流程开始'
,
type
:
0
,
type
:
-
1
,
id
:
'Activity_'
+
uid
,
id
:
'StartEvent_'
+
uid
,
attributes
:
{
"candidateStrategy"
:
'70'
},
childNode
:
undefined
childNode
:
undefined
})
})
const
test
=
async
()
=>
{
const
test
=
async
()
=>
{
if
(
!
modelId
)
{
if
(
!
modelId
)
{
message
.
error
(
'缺少模型 modelId 编号'
)
message
.
error
(
'缺少模型 modelId 编号'
)
return
return
...
@@ -49,19 +67,27 @@ const test = async ()=> {
...
@@ -49,19 +67,27 @@ const test = async ()=> {
simpleModelBody
:
toRaw
(
nodeConfig
.
value
)
simpleModelBody
:
toRaw
(
nodeConfig
.
value
)
}
}
console
.
log
(
'request json data is '
,
data
)
console
.
log
(
'request json data is '
,
data
)
const
result
=
await
saveBpmSimpleModel
(
data
);
const
result
=
await
saveBpmSimpleModel
(
data
)
console
.
log
(
'the result is '
,
result
)
console
.
log
(
'
save
the result is '
,
result
)
if
(
result
)
{
if
(
result
)
{
message
.
success
(
'修改成功'
)
message
.
success
(
'修改成功'
)
close
()
}
else
{
}
else
{
message
.
alert
(
'修改失败'
)
;
message
.
alert
(
'修改失败'
)
}
}
close
()
}
}
const
close
=
()
=>
{
const
close
=
()
=>
{
router
.
push
({
path
:
'/bpm/manager/model'
})
router
.
push
({
path
:
'/bpm/manager/model'
})
}
}
onMounted
(
async
()
=>
{
console
.
log
(
'the modelId is '
,
modelId
)
const
result
=
await
getBpmSimpleModel
(
modelId
)
if
(
result
){
console
.
log
(
'get the result is '
,
result
)
nodeConfig
.
value
=
result
;
}
})
</
script
>
</
script
>
<
style
>
<
style
>
@import
url('@/components/SimpleProcessDesigner/theme/workflow.css')
;
@import
url('@/components/SimpleProcessDesigner/theme/workflow.css')
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment