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
1e161d2e
authored
Dec 30, 2024
by
GoldenZqqq
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/feature/bpm' into feature/bpm
parents
59281a71
6f724d9d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
76 additions
and
80 deletions
+76
-80
src/components/SimpleProcessDesignerV2/src/nodes-config/ConditionNodeConfig.vue
+1
-1
src/components/SimpleProcessDesignerV2/theme/simple-process-designer.scss
+6
-1
src/components/bpmnProcessDesigner/package/designer/ProcessDesigner.vue
+19
-64
src/views/bpm/model/editor/index.vue
+3
-3
src/views/bpm/model/form/index.vue
+7
-8
src/views/bpm/processInstance/create/ProcessDefinitionDetail.vue
+40
-3
No files found.
src/components/SimpleProcessDesignerV2/src/nodes-config/ConditionNodeConfig.vue
View file @
1e161d2e
...
...
@@ -381,7 +381,7 @@ const fieldOptions = computed(() => {
/** 获取字段名称 */
const
getFieldTitle
=
(
field
:
string
)
=>
{
const
item
=
field
sInfo
.
find
((
item
)
=>
item
.
field
===
field
)
const
item
=
field
Options
.
value
.
find
((
item
)
=>
item
.
field
===
field
)
return
item
?.
title
}
...
...
src/components/SimpleProcessDesignerV2/theme/simple-process-designer.scss
View file @
1e161d2e
...
...
@@ -173,13 +173,16 @@
height
:
100%
;
padding-top
:
32px
;
background-color
:
#fafafa
;
overflow-x
:
auto
;
width
:
100%
;
.simple-process-model
{
display
:
flex
;
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
transform-origin
:
50%
0
0
;
overflow
:
auto
;
min-width
:
fit-content
;
transform
:
scale
(
1
);
transition
:
transform
0
.3s
cubic-bezier
(
0
.645
,
0
.045
,
0
.355
,
1
);
background
:
url(@/assets/svgs/bpm/simple-process-bg.svg)
0
0
repeat
;
...
...
@@ -473,6 +476,7 @@
.branch-node-container
{
position
:
relative
;
display
:
flex
;
min-width
:
fit-content
;
&
:
:
before
{
position
:
absolute
;
...
...
@@ -548,6 +552,7 @@
background
:
transparent
;
border-top
:
2px
solid
#dedede
;
border-bottom
:
2px
solid
#dedede
;
flex-shrink
:
0
;
&
:
:
before
{
position
:
absolute
;
...
...
src/components/bpmnProcessDesigner/package/designer/ProcessDesigner.vue
View file @
1e161d2e
...
...
@@ -309,18 +309,26 @@ const props = defineProps({
})
// 监听value变化,重新加载流程图
watch
(()
=>
props
.
value
,
(
newValue
)
=>
{
if
(
newValue
&&
bpmnModeler
)
{
createNewDiagram
(
newValue
)
}
},
{
immediate
:
true
})
watch
(
()
=>
props
.
value
,
(
newValue
)
=>
{
if
(
newValue
&&
bpmnModeler
)
{
createNewDiagram
(
newValue
)
}
},
{
immediate
:
true
}
)
// 监听processId和processName变化
watch
([()
=>
props
.
processId
,
()
=>
props
.
processName
],
([
newId
,
newName
])
=>
{
if
(
newId
&&
newName
&&
!
props
.
value
)
{
createNewDiagram
(
null
)
}
},
{
immediate
:
true
})
watch
(
[()
=>
props
.
processId
,
()
=>
props
.
processName
],
([
newId
,
newName
])
=>
{
if
(
newId
&&
newName
&&
!
props
.
value
)
{
createNewDiagram
(
null
)
}
},
{
immediate
:
true
}
)
provide
(
'configGlobal'
,
props
)
let
bpmnModeler
:
any
=
null
...
...
@@ -599,16 +607,6 @@ const processZoomOut = (zoomStep = 0.1) => {
defaultZoom
.
value
=
newZoom
bpmnModeler
.
get
(
'canvas'
).
zoom
(
defaultZoom
.
value
)
}
// const processZoomTo = (newZoom = 1) => {
// if (newZoom
<
0.2
)
{
// throw new Error('[Process Designer Warn ]: The zoom ratio cannot be less than 0.2')
// }
// if (newZoom > 4) {
// throw new Error('[Process Designer Warn ]: The zoom ratio cannot be greater than 4')
// }
// defaultZoom = newZoom
// bpmnModeler.get('canvas').zoom(newZoom)
// }
const
processReZoom
=
()
=>
{
defaultZoom
.
value
=
1
bpmnModeler
.
get
(
'canvas'
).
zoom
(
'fit-viewport'
,
'auto'
)
...
...
@@ -647,62 +645,19 @@ const previewProcessXML = () => {
}
const
previewProcessJson
=
()
=>
{
bpmnModeler
.
saveXML
({
format
:
true
}).
then
(({
xml
})
=>
{
// console.log(xml, 'xml')
// const rootNode = parseXmlString(xml)
// console.log(rootNode, 'rootNoderootNode')
const
rootNodes
=
new
XmlNode
(
XmlNodeType
.
Root
,
parseXmlString
(
xml
))
// console.log(rootNodes, 'rootNodesrootNodesrootNodes')
// console.log(rootNodes.parent.toJsObject(), 'rootNodes.toJSON()')
// console.log(JSON.stringify(rootNodes.parent.toJsObject()), 'rootNodes.toJSON()')
// console.log(JSON.stringify(rootNodes.parent.toJSON()), 'rootNodes.toJSON()')
// const parser = new xml2js.XMLParser()
// let jObj = parser.parse(xml)
// console.log(jObj, 'jObjjObjjObjjObjjObj')
// const builder = new xml2js.XMLBuilder(xml)
// const xmlContent = builder
// console.log(xmlContent, 'xmlContent')
// console.log(xml2js, 'convertconvertconvert')
previewResult
.
value
=
rootNodes
.
parent
?.
toJSON
()
as
unknown
as
string
// previewResult.value = jObj
// previewResult.value = convert.xml2json(xml, {explicitArray : false},{ spaces: 2 })
previewType
.
value
=
'json'
previewModelVisible
.
value
=
true
})
}
/* ------------------------------------------------ 芋道源码 methods ------------------------------------------------------ */
const
processSave
=
async
()
=>
{
try
{
const
{
err
,
xml
}
=
await
bpmnModeler
.
saveXML
()
if
(
err
)
{
ElMessage
.
error
(
'保存流程设计失败,请重试!'
)
return
}
emit
(
'save'
,
xml
)
}
catch
(
error
)
{
console
.
error
(
error
)
ElMessage
.
error
(
'保存流程设计失败,请重试!'
)
}
}
/** 高亮显示 */
// const highlightedCode = (previewType, previewResult) => {
// console.log(previewType, 'previewType, previewResult')
// console.log(previewResult, 'previewType, previewResult')
// console.log(hljs.highlight, 'hljs.highlight')
// const result = hljs.highlight(previewType, previewResult.value || '', true)
// return result.value || ' '
// }
onBeforeMount
(()
=>
{
console
.
log
(
props
,
'propspropspropsprops'
)
})
onMounted
(()
=>
{
initBpmnModeler
()
createNewDiagram
(
props
.
value
)
})
onBeforeUnmount
(()
=>
{
// this.$once('hook:beforeDestroy', () => {
// })
if
(
bpmnModeler
)
bpmnModeler
.
destroy
()
emit
(
'destroy'
,
bpmnModeler
)
bpmnModeler
=
null
...
...
src/views/bpm/model/editor/index.vue
View file @
1e161d2e
...
...
@@ -221,7 +221,7 @@ onBeforeUnmount(() => {
}
})
/** 获取
XML
字符串 */
/** 获取
XML
字符串 */
const
saveXML
=
async
()
=>
{
if
(
!
modeler
.
value
)
{
return
{
xml
:
xmlString
.
value
}
...
...
@@ -273,7 +273,7 @@ defineExpose({
<
style
lang=
"scss"
>
.process-panel__container
{
position
:
absolute
;
top
:
1
80
px
;
right
:
6
0px
;
top
:
1
72
px
;
right
:
7
0px
;
}
</
style
>
src/views/bpm/model/form/index.vue
View file @
1e161d2e
...
...
@@ -79,14 +79,14 @@
</
template
>
<
script
lang=
"ts"
setup
>
import
{
useRoute
r
,
useRoute
}
from
'vue-router'
import
{
useRoute
,
useRouter
}
from
'vue-router'
import
{
useMessage
}
from
'@/hooks/web/useMessage'
import
*
as
ModelApi
from
'@/api/bpm/model'
import
*
as
FormApi
from
'@/api/bpm/form'
import
{
CategoryApi
}
from
'@/api/bpm/category'
import
*
as
UserApi
from
'@/api/system/user'
import
{
useUserStoreWithOut
}
from
'@/store/modules/user'
import
{
BpmModel
Type
,
BpmModelForm
Type
}
from
'@/utils/constants'
import
{
BpmModel
FormType
,
BpmModel
Type
}
from
'@/utils/constants'
import
BasicInfo
from
'./BasicInfo.vue'
import
FormDesign
from
'./FormDesign.vue'
import
ProcessDesign
from
'./ProcessDesign.vue'
...
...
@@ -108,16 +108,17 @@ const validateBasic = async () => {
await
basicInfoRef
.
value
?.
validate
()
}
/** 表单设计校验 */
const
validateForm
=
async
()
=>
{
await
formDesignRef
.
value
?.
validate
()
}
/** 流程设计校验 */
const
validateProcess
=
async
()
=>
{
await
processDesignRef
.
value
?.
validate
()
}
// 步骤控制
const
currentStep
=
ref
(
0
)
const
currentStep
=
ref
(
0
)
// 步骤控制
const
steps
=
[
{
title
:
'基本信息'
,
validator
:
validateBasic
},
{
title
:
'表单设计'
,
validator
:
validateForm
},
...
...
@@ -255,7 +256,6 @@ const handleSave = async () => {
if
(
formData
.
value
.
id
)
{
// 修改场景
await
ModelApi
.
updateModel
(
modelData
)
message
.
success
(
'修改成功'
)
// 询问是否发布流程
try
{
await
message
.
confirm
(
'修改流程成功,是否发布流程?'
)
...
...
@@ -266,8 +266,7 @@ const handleSave = async () => {
}
}
else
{
// 新增场景
const
result
=
await
ModelApi
.
createModel
(
modelData
)
formData
.
value
.
id
=
result
formData
.
value
.
id
=
await
ModelApi
.
createModel
(
modelData
)
message
.
success
(
'新增成功'
)
try
{
await
message
.
confirm
(
'创建流程成功,是否继续编辑?'
)
...
...
@@ -335,7 +334,7 @@ const handleDeploy = async () => {
await
ModelApi
.
deployModel
(
formData
.
value
.
id
)
message
.
success
(
'发布成功'
)
// 返回列表页
router
.
push
({
name
:
'BpmModel'
})
await
router
.
push
({
name
:
'BpmModel'
})
}
catch
(
error
:
any
)
{
console
.
error
(
'发布失败:'
,
error
)
message
.
warning
(
error
.
message
||
'发布失败'
)
...
...
src/views/bpm/processInstance/create/ProcessDefinitionDetail.vue
View file @
1e161d2e
...
...
@@ -8,7 +8,7 @@
<!-- 中间主要内容 tab 栏 -->
<el-tabs
v-model=
"activeTab"
>
<!-- 表单信息 -->
<el-tab-pane
label=
"表单填写"
name=
"form"
>
<el-tab-pane
label=
"表单填写"
name=
"form"
>
<div
class=
"form-scroll-area"
v-loading=
"processInstanceStartLoading"
>
<el-scrollbar>
<el-row>
...
...
@@ -75,7 +75,11 @@
<
script
lang=
"ts"
setup
>
import
{
decodeFields
,
setConfAndFields2
}
from
'@/utils/formCreate'
import
{
BpmModelType
}
from
'@/utils/constants'
import
{
CandidateStrategy
}
from
'@/components/SimpleProcessDesignerV2/src/consts'
import
{
CandidateStrategy
,
NodeId
,
FieldPermissionType
}
from
'@/components/SimpleProcessDesignerV2/src/consts'
import
ProcessInstanceBpmnViewer
from
'../detail/ProcessInstanceBpmnViewer.vue'
import
ProcessInstanceSimpleViewer
from
'../detail/ProcessInstanceSimpleViewer.vue'
import
ProcessInstanceTimeline
from
'../detail/ProcessInstanceTimeline.vue'
...
...
@@ -129,8 +133,10 @@ const initProcessInfo = async (row: any, formVariables?: any) => {
}
}
setConfAndFields2
(
detailForm
,
row
.
formConf
,
row
.
formFields
,
formVariables
)
await
nextTick
()
fApi
.
value
?.
btn
.
show
(
false
)
// 隐藏提交按钮
// 获取流程审批信息
await
getApprovalDetail
(
row
)
...
...
@@ -152,7 +158,12 @@ const initProcessInfo = async (row: any, formVariables?: any) => {
/** 获取审批详情 */
const
getApprovalDetail
=
async
(
row
:
any
)
=>
{
try
{
const
data
=
await
ProcessInstanceApi
.
getApprovalDetail
({
processDefinitionId
:
row
.
id
})
// TODO 获取审批详情,设置 activityId 为发起人节点(为了获取字段权限。暂时只对 Simple 设计器有效)
const
data
=
await
ProcessInstanceApi
.
getApprovalDetail
({
processDefinitionId
:
row
.
id
,
activityId
:
NodeId
.
START_USER_NODE_ID
})
if
(
!
data
)
{
message
.
error
(
'查询不到审批详情信息!'
)
return
...
...
@@ -170,10 +181,36 @@ const getApprovalDetail = async (row: any) => {
// 获取审批节点,显示 Timeline 的数据
activityNodes
.
value
=
data
.
activityNodes
// 获取表单字段权限
const
formFieldsPermission
=
data
.
formFieldsPermission
// 设置表单字段权限
if
(
formFieldsPermission
)
{
Object
.
keys
(
formFieldsPermission
).
forEach
((
item
)
=>
{
setFieldPermission
(
item
,
formFieldsPermission
[
item
])
})
}
}
finally
{
}
}
/**
* 设置表单权限
*/
const
setFieldPermission
=
(
field
:
string
,
permission
:
string
)
=>
{
if
(
permission
===
FieldPermissionType
.
READ
)
{
//@ts-ignore
fApi
.
value
?.
disabled
(
true
,
field
)
}
if
(
permission
===
FieldPermissionType
.
WRITE
)
{
//@ts-ignore
fApi
.
value
?.
disabled
(
false
,
field
)
}
if
(
permission
===
FieldPermissionType
.
NONE
)
{
//@ts-ignore
fApi
.
value
?.
hidden
(
true
,
field
)
}
}
/** 提交按钮 */
const
submitForm
=
async
()
=>
{
if
(
!
fApi
.
value
||
!
props
.
selectProcessDefinition
)
{
...
...
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