1919 link
2020 size =" small"
2121 style =" color : #ff4d4f "
22- @click =" removeObject('message', scope.row, scope.$index )"
22+ @click =" removeObject('message', scope.row)"
2323 >
2424 移除
2525 </el-button >
4747 link
4848 size =" small"
4949 style =" color : #ff4d4f "
50- @click =" removeObject('signal', scope.row, scope.$index )"
50+ @click =" removeObject('signal', scope.row)"
5151 >
5252 移除
5353 </el-button >
@@ -110,6 +110,14 @@ const modelConfig = computed(() => {
110110})
111111const bpmnInstances = () => (window as any )?.bpmnInstances
112112
113+ // 生成规范化的ID
114+ const generateStandardId = (type : string ): string => {
115+ const prefix = type === ' message' ? ' Message_' : ' Signal_'
116+ const timestamp = Date .now ()
117+ const random = Math .random ().toString (36 ).substring (2 , 6 ).toUpperCase ()
118+ return ` ${prefix }${timestamp }_${random } `
119+ }
120+
113121const initDataList = () => {
114122 console .log (window , ' window' )
115123 rootElements .value = bpmnInstances ().modeler .getDefinitions ().rootElements
@@ -131,7 +139,10 @@ const initDataList = () => {
131139const openModel = (type ) => {
132140 modelType .value = type
133141 editingIndex .value = - 1
134- modelObjectForm .value = {}
142+ modelObjectForm .value = {
143+ id: generateStandardId (type ),
144+ name: ' '
145+ }
135146 dialogVisible .value = true
136147}
137148
@@ -189,7 +200,7 @@ const addNewObject = () => {
189200 initDataList ()
190201}
191202
192- const removeObject = (type , row , index ) => {
203+ const removeObject = (type , row ) => {
193204 ElMessageBox .confirm (` 确认移除该${type === ' message' ? ' 消息' : ' 信号' }吗? ` , ' 提示' , {
194205 confirmButtonText: ' 确 认' ,
195206 cancelButtonText: ' 取 消'
0 commit comments