mirror of
https://gitee.com/yudaocode/yudao-ui-admin-vue3.git
synced 2025-12-30 01:22:27 +00:00
feat: 流程设计器:优化 消息和信号 的新增,添加自动生成符合BPMN规范的id
This commit is contained in:
@@ -19,7 +19,7 @@
|
|||||||
link
|
link
|
||||||
size="small"
|
size="small"
|
||||||
style="color: #ff4d4f"
|
style="color: #ff4d4f"
|
||||||
@click="removeObject('message', scope.row, scope.$index)"
|
@click="removeObject('message', scope.row)"
|
||||||
>
|
>
|
||||||
移除
|
移除
|
||||||
</el-button>
|
</el-button>
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
link
|
link
|
||||||
size="small"
|
size="small"
|
||||||
style="color: #ff4d4f"
|
style="color: #ff4d4f"
|
||||||
@click="removeObject('signal', scope.row, scope.$index)"
|
@click="removeObject('signal', scope.row)"
|
||||||
>
|
>
|
||||||
移除
|
移除
|
||||||
</el-button>
|
</el-button>
|
||||||
@@ -110,6 +110,14 @@ const modelConfig = computed(() => {
|
|||||||
})
|
})
|
||||||
const bpmnInstances = () => (window as any)?.bpmnInstances
|
const bpmnInstances = () => (window as any)?.bpmnInstances
|
||||||
|
|
||||||
|
// 生成规范化的ID
|
||||||
|
const generateStandardId = (type: string): string => {
|
||||||
|
const prefix = type === 'message' ? 'Message_' : 'Signal_'
|
||||||
|
const timestamp = Date.now()
|
||||||
|
const random = Math.random().toString(36).substring(2, 6).toUpperCase()
|
||||||
|
return `${prefix}${timestamp}_${random}`
|
||||||
|
}
|
||||||
|
|
||||||
const initDataList = () => {
|
const initDataList = () => {
|
||||||
console.log(window, 'window')
|
console.log(window, 'window')
|
||||||
rootElements.value = bpmnInstances().modeler.getDefinitions().rootElements
|
rootElements.value = bpmnInstances().modeler.getDefinitions().rootElements
|
||||||
@@ -131,7 +139,10 @@ const initDataList = () => {
|
|||||||
const openModel = (type) => {
|
const openModel = (type) => {
|
||||||
modelType.value = type
|
modelType.value = type
|
||||||
editingIndex.value = -1
|
editingIndex.value = -1
|
||||||
modelObjectForm.value = {}
|
modelObjectForm.value = {
|
||||||
|
id: generateStandardId(type),
|
||||||
|
name: ''
|
||||||
|
}
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,7 +200,7 @@ const addNewObject = () => {
|
|||||||
initDataList()
|
initDataList()
|
||||||
}
|
}
|
||||||
|
|
||||||
const removeObject = (type, row, index) => {
|
const removeObject = (type, row) => {
|
||||||
ElMessageBox.confirm(`确认移除该${type === 'message' ? '消息' : '信号'}吗?`, '提示', {
|
ElMessageBox.confirm(`确认移除该${type === 'message' ? '消息' : '信号'}吗?`, '提示', {
|
||||||
confirmButtonText: '确 认',
|
confirmButtonText: '确 认',
|
||||||
cancelButtonText: '取 消'
|
cancelButtonText: '取 消'
|
||||||
|
|||||||
Reference in New Issue
Block a user