mirror of
https://gitee.com/hhyykk/ipms-sjy-ui.git
synced 2025-06-20 23:32:01 +08:00
commit
4835316fca
@ -1357,6 +1357,62 @@
|
|||||||
"isBody": true
|
"isBody": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ApproveType",
|
||||||
|
"superClass": ["Element"],
|
||||||
|
"meta": {
|
||||||
|
"allowedIn": ["bpmn:UserTask"]
|
||||||
|
},
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"name": "value",
|
||||||
|
"type": "Integer",
|
||||||
|
"isBody": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ApproveMethod",
|
||||||
|
"superClass": ["Element"],
|
||||||
|
"meta": {
|
||||||
|
"allowedIn": ["bpmn:UserTask"]
|
||||||
|
},
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"name": "value",
|
||||||
|
"type": "Integer",
|
||||||
|
"isBody": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CandidateStrategy",
|
||||||
|
"superClass": ["Element"],
|
||||||
|
"meta": {
|
||||||
|
"allowedIn": ["bpmn:UserTask"]
|
||||||
|
},
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"name": "value",
|
||||||
|
"type": "Integer",
|
||||||
|
"isBody": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CandidateParam",
|
||||||
|
"superClass": ["Element"],
|
||||||
|
"meta": {
|
||||||
|
"allowedIn": ["bpmn:UserTask"]
|
||||||
|
},
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"name": "value",
|
||||||
|
"type": "String",
|
||||||
|
"isBody": true
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"emumerations": []
|
"emumerations": []
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
key="multiInstance"
|
key="multiInstance"
|
||||||
>
|
>
|
||||||
<template #title><Icon icon="ep:help-filled" />多实例(会签配置)</template>
|
<template #title><Icon icon="ep:help-filled" />多实例(会签配置)</template>
|
||||||
<element-multi-instance :business-object="elementBusinessObject" :type="elementType" />
|
<element-multi-instance :id="elementId" :business-object="elementBusinessObject" :type="elementType" />
|
||||||
</el-collapse-item>
|
</el-collapse-item>
|
||||||
<el-collapse-item name="listeners" key="listeners">
|
<el-collapse-item name="listeners" key="listeners">
|
||||||
<template #title><Icon icon="ep:bell-filled" />执行监听器</template>
|
<template #title><Icon icon="ep:bell-filled" />执行监听器</template>
|
||||||
|
@ -193,7 +193,7 @@ const { buttonsSetting, btnDisplayNameEdit, changeBtnDisplayName, btnDisplayName
|
|||||||
useButtonsSetting()
|
useButtonsSetting()
|
||||||
|
|
||||||
// 字段权限
|
// 字段权限
|
||||||
const fieldsPermissionEl = ref()
|
const fieldsPermissionEl = ref([])
|
||||||
const { formType, fieldsPermissionConfig, getNodeConfigFormFields } = useFormFieldsPermission(
|
const { formType, fieldsPermissionConfig, getNodeConfigFormFields } = useFormFieldsPermission(
|
||||||
FieldPermissionType.READ
|
FieldPermissionType.READ
|
||||||
)
|
)
|
||||||
@ -246,7 +246,7 @@ const resetCustomConfigList = () => {
|
|||||||
elExtensionElements.value.values?.filter(
|
elExtensionElements.value.values?.filter(
|
||||||
(ex) => ex.$type === `${prefix}:AssignEmptyUserIds`
|
(ex) => ex.$type === `${prefix}:AssignEmptyUserIds`
|
||||||
)?.[0] || bpmnInstances().moddle.create(`${prefix}:AssignEmptyUserIds`, { value: '' })
|
)?.[0] || bpmnInstances().moddle.create(`${prefix}:AssignEmptyUserIds`, { value: '' })
|
||||||
assignEmptyUserIds.value = assignEmptyUserIdsEl.value.value.split(',').map((item) => {
|
assignEmptyUserIds.value = assignEmptyUserIdsEl.value.value?.split(',').map((item) => {
|
||||||
// 如果数字超出了最大安全整数范围,则将其作为字符串处理
|
// 如果数字超出了最大安全整数范围,则将其作为字符串处理
|
||||||
let num = Number(item)
|
let num = Number(item)
|
||||||
return num > Number.MAX_SAFE_INTEGER || num < -Number.MAX_SAFE_INTEGER ? item : num
|
return num > Number.MAX_SAFE_INTEGER || num < -Number.MAX_SAFE_INTEGER ? item : num
|
||||||
@ -270,18 +270,19 @@ const resetCustomConfigList = () => {
|
|||||||
|
|
||||||
// 字段权限
|
// 字段权限
|
||||||
if (formType.value === 10) {
|
if (formType.value === 10) {
|
||||||
fieldsPermissionEl.value = elExtensionElements.value.values?.filter(
|
const fieldsPermissionList = elExtensionElements.value.values?.filter(
|
||||||
(ex) => ex.$type === `${prefix}:FieldsPermission`
|
(ex) => ex.$type === `${prefix}:FieldsPermission`
|
||||||
)
|
)
|
||||||
if (fieldsPermissionEl.value.length === 0) {
|
fieldsPermissionEl.value = []
|
||||||
getNodeConfigFormFields()
|
getNodeConfigFormFields()
|
||||||
fieldsPermissionConfig.value.forEach((el) => {
|
fieldsPermissionConfig.value.forEach((element) => {
|
||||||
|
element.permission =
|
||||||
|
fieldsPermissionList?.find((obj) => obj.field === element.field)?.permission ?? '1'
|
||||||
fieldsPermissionEl.value.push(
|
fieldsPermissionEl.value.push(
|
||||||
bpmnInstances().moddle.create(`${prefix}:FieldsPermission`, el)
|
bpmnInstances().moddle.create(`${prefix}:FieldsPermission`, element)
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// 保留剩余扩展元素,便于后面更新该元素对应属性
|
// 保留剩余扩展元素,便于后面更新该元素对应属性
|
||||||
otherExtensions.value =
|
otherExtensions.value =
|
||||||
|
@ -1,6 +1,30 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="panel-tab__content">
|
<div class="panel-tab__content">
|
||||||
<el-form label-width="90px">
|
<el-radio-group v-model="approveMethod" @change="onApproveMethodChange">
|
||||||
|
<div class="flex-col">
|
||||||
|
<div v-for="(item, index) in APPROVE_METHODS" :key="index">
|
||||||
|
<el-radio :value="item.value" :label="item.value">
|
||||||
|
{{ item.label }}
|
||||||
|
</el-radio>
|
||||||
|
<el-form-item prop="approveRatio">
|
||||||
|
<el-input-number
|
||||||
|
v-model="approveRatio"
|
||||||
|
:min="10"
|
||||||
|
:max="100"
|
||||||
|
:step="10"
|
||||||
|
size="small"
|
||||||
|
v-if="
|
||||||
|
item.value === ApproveMethodType.APPROVE_BY_RATIO &&
|
||||||
|
approveMethod === ApproveMethodType.APPROVE_BY_RATIO
|
||||||
|
"
|
||||||
|
@change="onApproveRatioChange"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-radio-group>
|
||||||
|
<!-- 与Simple设计器配置合并,保留以前的代码 -->
|
||||||
|
<el-form label-width="90px" style="display: none">
|
||||||
<el-form-item label="快捷配置">
|
<el-form-item label="快捷配置">
|
||||||
<el-button size="small" @click="changeConfig('依次审批')">依次审批</el-button>
|
<el-button size="small" @click="changeConfig('依次审批')">依次审批</el-button>
|
||||||
<el-button size="small" @click="changeConfig('会签')">会签</el-button>
|
<el-button size="small" @click="changeConfig('会签')">会签</el-button>
|
||||||
@ -76,11 +100,14 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import { ApproveMethodType, APPROVE_METHODS } from '@/components/SimpleProcessDesignerV2/src/consts'
|
||||||
|
|
||||||
defineOptions({ name: 'ElementMultiInstance' })
|
defineOptions({ name: 'ElementMultiInstance' })
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
businessObject: Object,
|
businessObject: Object,
|
||||||
type: String
|
type: String,
|
||||||
|
id: String
|
||||||
})
|
})
|
||||||
const prefix = inject('prefix')
|
const prefix = inject('prefix')
|
||||||
const loopCharacteristics = ref('')
|
const loopCharacteristics = ref('')
|
||||||
@ -267,16 +294,111 @@ const changeConfig = (config) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* -----新版本多实例-----
|
||||||
|
*/
|
||||||
|
const approveMethod = ref()
|
||||||
|
const approveRatio = ref(100)
|
||||||
|
const otherExtensions = ref()
|
||||||
|
const getElementLoopNew = () => {
|
||||||
|
const extensionElements = bpmnElement.value.businessObject?.extensionElements ?? []
|
||||||
|
approveMethod.value = extensionElements.values.filter(
|
||||||
|
(ex) => ex.$type === `${prefix}:ApproveMethod`
|
||||||
|
)?.[0]?.value
|
||||||
|
|
||||||
|
otherExtensions.value =
|
||||||
|
extensionElements.values.filter((ex) => ex.$type !== `${prefix}:ApproveMethod`) ?? []
|
||||||
|
}
|
||||||
|
const onApproveMethodChange = () => {
|
||||||
|
approveRatio.value = 100
|
||||||
|
updateLoopCharacteristics()
|
||||||
|
}
|
||||||
|
const onApproveRatioChange = () => {
|
||||||
|
updateLoopCharacteristics()
|
||||||
|
}
|
||||||
|
const updateLoopCharacteristics = () => {
|
||||||
|
// 根据ApproveMethod生成multiInstanceLoopCharacteristics节点
|
||||||
|
if (approveMethod.value === ApproveMethodType.RANDOM_SELECT_ONE_APPROVE) {
|
||||||
|
bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
|
||||||
|
loopCharacteristics: null
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
if (approveMethod.value === ApproveMethodType.APPROVE_BY_RATIO) {
|
||||||
|
multiLoopInstance.value = bpmnInstances().moddle.create(
|
||||||
|
'bpmn:MultiInstanceLoopCharacteristics',
|
||||||
|
{ isSequential: false, collection: '${coll_userList}' }
|
||||||
|
)
|
||||||
|
multiLoopInstance.value.completionCondition = bpmnInstances().moddle.create(
|
||||||
|
'bpmn:FormalExpression',
|
||||||
|
{
|
||||||
|
body: '${ nrOfCompletedInstances/nrOfInstances >= ' + approveRatio.value / 100 + '}'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (approveMethod.value === ApproveMethodType.ANY_APPROVE) {
|
||||||
|
multiLoopInstance.value = bpmnInstances().moddle.create(
|
||||||
|
'bpmn:MultiInstanceLoopCharacteristics',
|
||||||
|
{ isSequential: false, collection: '${coll_userList}' }
|
||||||
|
)
|
||||||
|
multiLoopInstance.value.completionCondition = bpmnInstances().moddle.create(
|
||||||
|
'bpmn:FormalExpression',
|
||||||
|
{
|
||||||
|
body: '${ nrOfCompletedInstances > 0 }'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (approveMethod.value === ApproveMethodType.SEQUENTIAL_APPROVE) {
|
||||||
|
multiLoopInstance.value = bpmnInstances().moddle.create(
|
||||||
|
'bpmn:MultiInstanceLoopCharacteristics',
|
||||||
|
{ isSequential: true, collection: '${coll_userList}' }
|
||||||
|
)
|
||||||
|
multiLoopInstance.value.loopCardinality = bpmnInstances().moddle.create(
|
||||||
|
'bpmn:FormalExpression',
|
||||||
|
{
|
||||||
|
body: '1'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
multiLoopInstance.value.completionCondition = bpmnInstances().moddle.create(
|
||||||
|
'bpmn:FormalExpression',
|
||||||
|
{
|
||||||
|
body: '${ nrOfCompletedInstances >= nrOfInstances }'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
|
||||||
|
loopCharacteristics: toRaw(multiLoopInstance.value)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加ApproveMethod到ExtensionElements
|
||||||
|
const extensions = bpmnInstances().moddle.create('bpmn:ExtensionElements', {
|
||||||
|
values: [
|
||||||
|
...otherExtensions.value,
|
||||||
|
bpmnInstances().moddle.create(`${prefix}:ApproveMethod`, {
|
||||||
|
value: approveMethod.value
|
||||||
|
})
|
||||||
|
]
|
||||||
|
})
|
||||||
|
bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
|
||||||
|
extensionElements: extensions
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
multiLoopInstance.value = null
|
multiLoopInstance.value = null
|
||||||
bpmnElement.value = null
|
bpmnElement.value = null
|
||||||
})
|
})
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.businessObject,
|
() => props.id,
|
||||||
(val) => {
|
(val) => {
|
||||||
|
if (val) {
|
||||||
|
nextTick(() => {
|
||||||
bpmnElement.value = bpmnInstances().bpmnElement
|
bpmnElement.value = bpmnInstances().bpmnElement
|
||||||
getElementLoop(val)
|
// getElementLoop(val)
|
||||||
|
getElementLoopNew()
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
)
|
)
|
||||||
|
@ -142,6 +142,7 @@ const props = defineProps({
|
|||||||
id: String,
|
id: String,
|
||||||
type: String
|
type: String
|
||||||
})
|
})
|
||||||
|
const prefix = inject('prefix')
|
||||||
const userTaskForm = ref({
|
const userTaskForm = ref({
|
||||||
candidateStrategy: undefined, // 分配规则
|
candidateStrategy: undefined, // 分配规则
|
||||||
candidateParam: [] // 分配选项
|
candidateParam: [] // 分配选项
|
||||||
@ -154,12 +155,43 @@ const deptTreeOptions = ref() // 部门树
|
|||||||
const postOptions = ref<PostApi.PostVO[]>([]) // 岗位列表
|
const postOptions = ref<PostApi.PostVO[]>([]) // 岗位列表
|
||||||
const userOptions = ref<UserApi.UserVO[]>([]) // 用户列表
|
const userOptions = ref<UserApi.UserVO[]>([]) // 用户列表
|
||||||
const userGroupOptions = ref<UserGroupApi.UserGroupVO[]>([]) // 用户组列表
|
const userGroupOptions = ref<UserGroupApi.UserGroupVO[]>([]) // 用户组列表
|
||||||
|
const otherExtensions = ref()
|
||||||
|
|
||||||
const resetTaskForm = () => {
|
const resetTaskForm = () => {
|
||||||
const businessObject = bpmnElement.value.businessObject
|
const businessObject = bpmnElement.value.businessObject
|
||||||
if (!businessObject) {
|
if (!businessObject) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const extensionElements = businessObject?.extensionElements ?? []
|
||||||
|
userTaskForm.value.candidateStrategy = extensionElements.values?.filter(
|
||||||
|
(ex) => ex.$type === `${prefix}:CandidateStrategy`
|
||||||
|
)?.[0]?.value
|
||||||
|
const candidateParamStr = extensionElements.values?.filter(
|
||||||
|
(ex) => ex.$type === `${prefix}:CandidateParam`
|
||||||
|
)?.[0]?.value
|
||||||
|
if (candidateParamStr && candidateParamStr.length > 0) {
|
||||||
|
if (userTaskForm.value.candidateStrategy === 60) {
|
||||||
|
// 特殊:流程表达式,只有一个 input 输入框
|
||||||
|
userTaskForm.value.candidateParam = [candidateParamStr]
|
||||||
|
} else {
|
||||||
|
userTaskForm.value.candidateParam = candidateParamStr.split(',').map((item) => {
|
||||||
|
// 如果数字超出了最大安全整数范围,则将其作为字符串处理
|
||||||
|
let num = Number(item)
|
||||||
|
return num > Number.MAX_SAFE_INTEGER || num < -Number.MAX_SAFE_INTEGER ? item : num
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
userTaskForm.value.candidateParam = []
|
||||||
|
}
|
||||||
|
|
||||||
|
otherExtensions.value =
|
||||||
|
extensionElements.values?.filter(
|
||||||
|
(ex) => ex.$type !== `${prefix}:CandidateStrategy` && ex.$type !== `${prefix}:CandidateParam`
|
||||||
|
) ?? []
|
||||||
|
|
||||||
|
// 改用通过extensionElements来存储数据
|
||||||
|
return
|
||||||
if (businessObject.candidateStrategy != undefined) {
|
if (businessObject.candidateStrategy != undefined) {
|
||||||
userTaskForm.value.candidateStrategy = parseInt(businessObject.candidateStrategy) as any
|
userTaskForm.value.candidateStrategy = parseInt(businessObject.candidateStrategy) as any
|
||||||
} else {
|
} else {
|
||||||
@ -172,7 +204,7 @@ const resetTaskForm = () => {
|
|||||||
} else {
|
} else {
|
||||||
userTaskForm.value.candidateParam = businessObject.candidateParam
|
userTaskForm.value.candidateParam = businessObject.candidateParam
|
||||||
.split(',')
|
.split(',')
|
||||||
.map((item) => +item)
|
.map((item) => item)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
userTaskForm.value.candidateParam = []
|
userTaskForm.value.candidateParam = []
|
||||||
@ -187,6 +219,23 @@ const changeCandidateStrategy = () => {
|
|||||||
|
|
||||||
/** 选中某个 options 时候,更新 bpmn 图 */
|
/** 选中某个 options 时候,更新 bpmn 图 */
|
||||||
const updateElementTask = () => {
|
const updateElementTask = () => {
|
||||||
|
const extensions = bpmnInstances().moddle.create('bpmn:ExtensionElements', {
|
||||||
|
values: [
|
||||||
|
...otherExtensions.value,
|
||||||
|
bpmnInstances().moddle.create(`${prefix}:CandidateStrategy`, {
|
||||||
|
value: userTaskForm.value.candidateStrategy
|
||||||
|
}),
|
||||||
|
bpmnInstances().moddle.create(`${prefix}:CandidateParam`, {
|
||||||
|
value: userTaskForm.value.candidateParam.join(',')
|
||||||
|
})
|
||||||
|
]
|
||||||
|
})
|
||||||
|
bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
|
||||||
|
extensionElements: extensions
|
||||||
|
})
|
||||||
|
|
||||||
|
// 改用通过extensionElements来存储数据
|
||||||
|
return
|
||||||
bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
|
bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
|
||||||
candidateStrategy: userTaskForm.value.candidateStrategy,
|
candidateStrategy: userTaskForm.value.candidateStrategy,
|
||||||
candidateParam: userTaskForm.value.candidateParam.join(',')
|
candidateParam: userTaskForm.value.candidateParam.join(',')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user