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
22e9eb2a
authored
Nov 26, 2024
by
Lesan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: bpm设计器适配Simple设计器,字段权限
parent
513ea33f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
245 additions
and
4 deletions
+245
-4
src/components/bpmnProcessDesigner/package/designer/plugins/descriptor/flowableDescriptor.json
+24
-1
src/components/bpmnProcessDesigner/package/penal/custom-config/ElementCustomConfig.vue
+207
-3
src/views/bpm/model/editor/index.vue
+14
-0
No files found.
src/components/bpmnProcessDesigner/package/designer/plugins/descriptor/flowableDescriptor.json
View file @
22e9eb2a
...
@@ -1305,8 +1305,31 @@
...
@@ -1305,8 +1305,31 @@
"isAttr"
:
true
"isAttr"
:
true
}
}
]
]
},
{
"name"
:
"FieldsPermission"
,
"superClass"
:
[
"Element"
],
"meta"
:
{
"allowedIn"
:
[
"bpmn:UserTask"
]
},
"properties"
:
[
{
"name"
:
"flowable:field"
,
"type"
:
"String"
,
"isAttr"
:
true
},
{
"name"
:
"flowable:title"
,
"type"
:
"String"
,
"isAttr"
:
true
},
{
"name"
:
"flowable:permission"
,
"type"
:
"String"
,
"isAttr"
:
true
}
]
}
}
],
],
"emumerations"
:
[]
"emumerations"
:
[]
}
}
src/components/bpmnProcessDesigner/package/penal/custom-config/ElementCustomConfig.vue
View file @
22e9eb2a
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
2. 审批人拒绝时
2. 审批人拒绝时
3. 审批人为空时
3. 审批人为空时
4. 操作按钮
4. 操作按钮
5. 字段权限
-->
-->
<
template
>
<
template
>
<div
class=
"panel-tab__content"
>
<div
class=
"panel-tab__content"
>
...
@@ -104,6 +105,47 @@
...
@@ -104,6 +105,47 @@
</div>
</div>
</div>
</div>
</div>
</div>
<el-divider
content-position=
"left"
>
字段权限
</el-divider>
<div
class=
"field-setting-pane"
v-if=
"formType === 10"
>
<div
class=
"field-permit-title"
>
<div
class=
"setting-title-label first-title"
>
字段名称
</div>
<div
class=
"other-titles"
>
<span
class=
"setting-title-label"
>
只读
</span>
<span
class=
"setting-title-label"
>
可编辑
</span>
<span
class=
"setting-title-label"
>
隐藏
</span>
</div>
</div>
<div
class=
"field-setting-item"
v-for=
"(item, index) in fieldsPermissionEl"
:key=
"index"
>
<div
class=
"field-setting-item-label"
>
{{
item
.
title
}}
</div>
<el-radio-group
class=
"field-setting-item-group"
v-model=
"item.permission"
>
<div
class=
"item-radio-wrap"
>
<el-radio
:value=
"FieldPermissionType.READ"
size=
"large"
:label=
"FieldPermissionType.READ"
><span></span
></el-radio>
</div>
<div
class=
"item-radio-wrap"
>
<el-radio
:value=
"FieldPermissionType.WRITE"
size=
"large"
:label=
"FieldPermissionType.WRITE"
><span></span
></el-radio>
</div>
<div
class=
"item-radio-wrap"
>
<el-radio
:value=
"FieldPermissionType.NONE"
size=
"large"
:label=
"FieldPermissionType.NONE"
><span></span
></el-radio>
</div>
</el-radio-group>
</div>
</div>
</div>
</div>
</
template
>
</
template
>
...
@@ -115,9 +157,11 @@ import {
...
@@ -115,9 +157,11 @@ import {
ASSIGN_EMPTY_HANDLER_TYPES
,
ASSIGN_EMPTY_HANDLER_TYPES
,
AssignEmptyHandlerType
,
AssignEmptyHandlerType
,
OPERATION_BUTTON_NAME
,
OPERATION_BUTTON_NAME
,
DEFAULT_BUTTON_SETTING
DEFAULT_BUTTON_SETTING
,
FieldPermissionType
}
from
'@/components/SimpleProcessDesignerV2/src/consts'
}
from
'@/components/SimpleProcessDesignerV2/src/consts'
import
*
as
UserApi
from
'@/api/system/user'
import
*
as
UserApi
from
'@/api/system/user'
import
{
cloneDeep
}
from
'lodash-es'
defineOptions
({
name
:
'ElementCustomConfig'
})
defineOptions
({
name
:
'ElementCustomConfig'
})
const
props
=
defineProps
({
const
props
=
defineProps
({
...
@@ -148,6 +192,12 @@ const buttonsSettingEl = ref()
...
@@ -148,6 +192,12 @@ const buttonsSettingEl = ref()
const
{
buttonsSetting
,
btnDisplayNameEdit
,
changeBtnDisplayName
,
btnDisplayNameBlurEvent
}
=
const
{
buttonsSetting
,
btnDisplayNameEdit
,
changeBtnDisplayName
,
btnDisplayNameBlurEvent
}
=
useButtonsSetting
()
useButtonsSetting
()
// 字段权限
const
fieldsPermissionEl
=
ref
()
const
{
formType
,
fieldsPermissionConfig
,
getNodeConfigFormFields
}
=
useFormFieldsPermission
(
FieldPermissionType
.
READ
)
const
elExtensionElements
=
ref
()
const
elExtensionElements
=
ref
()
const
otherExtensions
=
ref
()
const
otherExtensions
=
ref
()
const
bpmnElement
=
ref
()
const
bpmnElement
=
ref
()
...
@@ -218,6 +268,21 @@ const resetCustomConfigList = () => {
...
@@ -218,6 +268,21 @@ const resetCustomConfigList = () => {
})
})
}
}
// 字段权限
if
(
formType
.
value
===
10
)
{
fieldsPermissionEl
.
value
=
elExtensionElements
.
value
.
values
?.
filter
(
(
ex
)
=>
ex
.
$type
===
`
${
prefix
}
:FieldsPermission`
)
if
(
fieldsPermissionEl
.
value
.
length
===
0
)
{
getNodeConfigFormFields
()
fieldsPermissionConfig
.
value
.
forEach
((
el
)
=>
{
fieldsPermissionEl
.
value
.
push
(
bpmnInstances
().
moddle
.
create
(
`
${
prefix
}
:FieldsPermission`
,
el
)
)
})
}
}
// 保留剩余扩展元素,便于后面更新该元素对应属性
// 保留剩余扩展元素,便于后面更新该元素对应属性
otherExtensions
.
value
=
otherExtensions
.
value
=
elExtensionElements
.
value
.
values
?.
filter
(
elExtensionElements
.
value
.
values
?.
filter
(
...
@@ -227,7 +292,8 @@ const resetCustomConfigList = () => {
...
@@ -227,7 +292,8 @@ const resetCustomConfigList = () => {
ex
.
$type
!==
`
${
prefix
}
:RejectReturnTaskId`
&&
ex
.
$type
!==
`
${
prefix
}
:RejectReturnTaskId`
&&
ex
.
$type
!==
`
${
prefix
}
:AssignEmptyHandlerType`
&&
ex
.
$type
!==
`
${
prefix
}
:AssignEmptyHandlerType`
&&
ex
.
$type
!==
`
${
prefix
}
:AssignEmptyUserIds`
&&
ex
.
$type
!==
`
${
prefix
}
:AssignEmptyUserIds`
&&
ex
.
$type
!==
`
${
prefix
}
:ButtonsSetting`
ex
.
$type
!==
`
${
prefix
}
:ButtonsSetting`
&&
ex
.
$type
!==
`
${
prefix
}
:FieldsPermission`
)
??
[]
)
??
[]
// 更新元素扩展属性,避免后续报错
// 更新元素扩展属性,避免后续报错
...
@@ -276,7 +342,8 @@ const updateElementExtensions = () => {
...
@@ -276,7 +342,8 @@ const updateElementExtensions = () => {
returnNodeIdEl
.
value
,
returnNodeIdEl
.
value
,
assignEmptyHandlerTypeEl
.
value
,
assignEmptyHandlerTypeEl
.
value
,
assignEmptyUserIdsEl
.
value
,
assignEmptyUserIdsEl
.
value
,
...
buttonsSettingEl
.
value
...
buttonsSettingEl
.
value
,
...
fieldsPermissionEl
.
value
]
]
})
})
bpmnInstances
().
modeling
.
updateProperties
(
toRaw
(
bpmnElement
.
value
),
{
bpmnInstances
().
modeling
.
updateProperties
(
toRaw
(
bpmnElement
.
value
),
{
...
@@ -359,6 +426,69 @@ function useButtonsSetting() {
...
@@ -359,6 +426,69 @@ function useButtonsSetting() {
}
}
}
}
// 表单字段权限设置
function
useFormFieldsPermission
(
defaultPermission
)
{
// 字段权限配置. 需要有 field, title, permissioin 属性
const
fieldsPermissionConfig
=
ref
<
Array
<
Record
<
string
,
string
>>>
([])
const
formType
=
inject
<
Ref
<
number
>>
(
'formType'
)
// 表单类型
const
formFields
=
inject
<
Ref
<
string
[]
>>
(
'formFields'
)
// 流程表单字段
const
getNodeConfigFormFields
=
(
nodeFormFields
?:
Array
<
Record
<
string
,
string
>>
)
=>
{
nodeFormFields
=
toRaw
(
nodeFormFields
)
fieldsPermissionConfig
.
value
=
cloneDeep
(
nodeFormFields
)
||
getDefaultFieldsPermission
(
unref
(
formFields
))
}
// 默认的表单权限: 获取表单的所有字段,设置字段默认权限为只读
const
getDefaultFieldsPermission
=
(
formFields
?:
string
[])
=>
{
const
defaultFieldsPermission
:
Array
<
Record
<
string
,
string
>>
=
[]
if
(
formFields
)
{
formFields
.
forEach
((
fieldStr
:
string
)
=>
{
parseFieldsSetDefaultPermission
(
JSON
.
parse
(
fieldStr
),
defaultFieldsPermission
)
})
}
return
defaultFieldsPermission
}
// 解析字段。赋给默认权限
const
parseFieldsSetDefaultPermission
=
(
rule
:
Record
<
string
,
any
>
,
fieldsPermission
:
Array
<
Record
<
string
,
string
>>
,
parentTitle
:
string
=
''
)
=>
{
const
{
/**type,*/
field
,
title
:
tempTitle
,
children
}
=
rule
if
(
field
&&
tempTitle
)
{
let
title
=
tempTitle
if
(
parentTitle
)
{
title
=
`
${
parentTitle
}
.
${
tempTitle
}
`
}
fieldsPermission
.
push
({
field
,
title
,
permission
:
defaultPermission
})
// TODO 子表单 需要处理子表单字段
// if (type === 'group' && rule.props?.rule && Array.isArray(rule.props.rule)) {
// // 解析子表单的字段
// rule.props.rule.forEach((item) => {
// parseFieldsSetDefaultPermission(item, fieldsPermission, title)
// })
// }
}
if
(
children
&&
Array
.
isArray
(
children
))
{
children
.
forEach
((
rule
)
=>
{
parseFieldsSetDefaultPermission
(
rule
,
fieldsPermission
)
})
}
}
return
{
formType
,
fieldsPermissionConfig
,
getNodeConfigFormFields
}
}
const
userOptions
=
ref
<
UserApi
.
UserVO
[]
>
([])
// 用户列表
const
userOptions
=
ref
<
UserApi
.
UserVO
[]
>
([])
// 用户列表
onMounted
(
async
()
=>
{
onMounted
(
async
()
=>
{
// 获得用户列表
// 获得用户列表
...
@@ -449,4 +579,78 @@ onMounted(async () => {
...
@@ -449,4 +579,78 @@ onMounted(async () => {
}
}
}
}
}
}
.field-setting-pane
{
display
:
flex
;
flex-direction
:
column
;
font-size
:
14px
;
.field-setting-desc
{
padding-right
:
8px
;
margin-bottom
:
16px
;
font-size
:
16px
;
font-weight
:
700
;
}
.field-permit-title
{
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
height
:
45px
;
padding-left
:
12px
;
line-height
:
45px
;
background-color
:
#f8fafc0
a
;
border
:
1px
solid
#1f38581
a
;
.first-title
{
text-align
:
left
!important
;
}
.other-titles
{
display
:
flex
;
justify-content
:
space-between
;
}
.setting-title-label
{
display
:
inline-block
;
width
:
100px
;
padding
:
5px
0
;
font-size
:
13px
;
font-weight
:
700
;
color
:
#000
;
text-align
:
center
;
}
}
.field-setting-item
{
align-items
:
center
;
display
:
flex
;
justify-content
:
space-between
;
height
:
38px
;
padding-left
:
12px
;
border
:
1px
solid
#1f38581
a
;
border-top
:
0
;
.field-setting-item-label
{
display
:
inline-block
;
width
:
100px
;
min-height
:
16px
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
cursor
:
text
;
}
.field-setting-item-group
{
display
:
flex
;
justify-content
:
space-between
;
.item-radio-wrap
{
display
:
inline-block
;
width
:
100px
;
text-align
:
center
;
}
}
}
}
</
style
>
</
style
>
src/views/bpm/model/editor/index.vue
View file @
22e9eb2a
...
@@ -31,6 +31,7 @@ import CustomContentPadProvider from '@/components/bpmnProcessDesigner/package/d
...
@@ -31,6 +31,7 @@ import CustomContentPadProvider from '@/components/bpmnProcessDesigner/package/d
// 自定义左侧菜单(修改 默认任务 为 用户任务)
// 自定义左侧菜单(修改 默认任务 为 用户任务)
import
CustomPaletteProvider
from
'@/components/bpmnProcessDesigner/package/designer/plugins/palette'
import
CustomPaletteProvider
from
'@/components/bpmnProcessDesigner/package/designer/plugins/palette'
import
*
as
ModelApi
from
'@/api/bpm/model'
import
*
as
ModelApi
from
'@/api/bpm/model'
import
{
getForm
,
FormVO
}
from
'@/api/bpm/form'
defineOptions
({
name
:
'BpmModelEditor'
})
defineOptions
({
name
:
'BpmModelEditor'
})
...
@@ -38,6 +39,12 @@ const router = useRouter() // 路由
...
@@ -38,6 +39,12 @@ const router = useRouter() // 路由
const
{
query
}
=
useRoute
()
// 路由的查询
const
{
query
}
=
useRoute
()
// 路由的查询
const
message
=
useMessage
()
// 国际化
const
message
=
useMessage
()
// 国际化
// 表单信息
const
formFields
=
ref
<
string
[]
>
([])
const
formType
=
ref
(
20
)
provide
(
'formFields'
,
formFields
)
provide
(
'formType'
,
formType
)
const
xmlString
=
ref
(
undefined
)
// BPMN XML
const
xmlString
=
ref
(
undefined
)
// BPMN XML
const
modeler
=
ref
(
null
)
// BPMN Modeler
const
modeler
=
ref
(
null
)
// BPMN Modeler
const
controlForm
=
ref
({
const
controlForm
=
ref
({
...
@@ -99,6 +106,13 @@ onMounted(async () => {
...
@@ -99,6 +106,13 @@ onMounted(async () => {
</bpmndi:BPMNDiagram>
</bpmndi:BPMNDiagram>
</definitions>`
</definitions>`
}
}
formType
.
value
=
data
.
formType
if
(
data
.
formType
===
10
)
{
const
bpmnForm
=
(
await
getForm
(
data
.
formId
))
as
unknown
as
FormVO
formFields
.
value
=
bpmnForm
?.
fields
}
model
.
value
=
{
model
.
value
=
{
...
data
,
...
data
,
bpmnXml
:
undefined
// 清空 bpmnXml 属性
bpmnXml
:
undefined
// 清空 bpmnXml 属性
...
...
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