|
@@ -26,8 +26,16 @@
|
|
type="primary"
|
|
type="primary"
|
|
preIcon="ep:plus"
|
|
preIcon="ep:plus"
|
|
title="添加监听器"
|
|
title="添加监听器"
|
|
|
|
+ size="small"
|
|
@click="openListenerForm(null)"
|
|
@click="openListenerForm(null)"
|
|
/>
|
|
/>
|
|
|
|
+ <XButton
|
|
|
|
+ type="success"
|
|
|
|
+ preIcon="ep:select"
|
|
|
|
+ title="选择监听器"
|
|
|
|
+ size="small"
|
|
|
|
+ @click="openProcessListenerDialog"
|
|
|
|
+ />
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<!-- 监听器 编辑/创建 部分 -->
|
|
<!-- 监听器 编辑/创建 部分 -->
|
|
@@ -240,11 +248,21 @@
|
|
</template>
|
|
</template>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
</div>
|
|
</div>
|
|
|
|
+
|
|
|
|
+ <!-- 选择弹窗 -->
|
|
|
|
+ <ProcessListenerDialog ref="processListenerDialogRef" @select="selectListener" />
|
|
</template>
|
|
</template>
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
import { ElMessageBox } from 'element-plus'
|
|
import { ElMessageBox } from 'element-plus'
|
|
import { createListenerObject, updateElementExtensions } from '../../utils'
|
|
import { createListenerObject, updateElementExtensions } from '../../utils'
|
|
-import { initListenerType, initListenerForm, listenerType, fieldType } from './utilSelf'
|
|
|
|
|
|
+import {
|
|
|
|
+ initListenerType,
|
|
|
|
+ initListenerForm,
|
|
|
|
+ listenerType,
|
|
|
|
+ fieldType,
|
|
|
|
+ initListenerForm2
|
|
|
|
+} from './utilSelf'
|
|
|
|
+import ProcessListenerDialog from './ProcessListenerDialog.vue'
|
|
|
|
|
|
defineOptions({ name: 'ElementListeners' })
|
|
defineOptions({ name: 'ElementListeners' })
|
|
|
|
|
|
@@ -284,6 +302,7 @@ const resetListenersList = () => {
|
|
}
|
|
}
|
|
// 打开 监听器详情 侧边栏
|
|
// 打开 监听器详情 侧边栏
|
|
const openListenerForm = (listener, index?) => {
|
|
const openListenerForm = (listener, index?) => {
|
|
|
|
+ // debugger
|
|
if (listener) {
|
|
if (listener) {
|
|
listenerForm.value = initListenerForm(listener)
|
|
listenerForm.value = initListenerForm(listener)
|
|
editingListenerIndex.value = index
|
|
editingListenerIndex.value = index
|
|
@@ -321,6 +340,7 @@ const openListenerFieldForm = (field, index?) => {
|
|
}
|
|
}
|
|
// 保存监听器注入字段
|
|
// 保存监听器注入字段
|
|
const saveListenerFiled = async () => {
|
|
const saveListenerFiled = async () => {
|
|
|
|
+ // debugger
|
|
let validateStatus = await listenerFieldFormRef.value.validate()
|
|
let validateStatus = await listenerFieldFormRef.value.validate()
|
|
if (!validateStatus) return // 验证不通过直接返回
|
|
if (!validateStatus) return // 验证不通过直接返回
|
|
if (editingListenerFieldIndex.value === -1) {
|
|
if (editingListenerFieldIndex.value === -1) {
|
|
@@ -337,6 +357,7 @@ const saveListenerFiled = async () => {
|
|
}
|
|
}
|
|
// 移除监听器字段
|
|
// 移除监听器字段
|
|
const removeListenerField = (index) => {
|
|
const removeListenerField = (index) => {
|
|
|
|
+ // debugger
|
|
ElMessageBox.confirm('确认移除该字段吗?', '提示', {
|
|
ElMessageBox.confirm('确认移除该字段吗?', '提示', {
|
|
confirmButtonText: '确 认',
|
|
confirmButtonText: '确 认',
|
|
cancelButtonText: '取 消'
|
|
cancelButtonText: '取 消'
|
|
@@ -349,6 +370,7 @@ const removeListenerField = (index) => {
|
|
}
|
|
}
|
|
// 移除监听器
|
|
// 移除监听器
|
|
const removeListener = (index) => {
|
|
const removeListener = (index) => {
|
|
|
|
+ debugger
|
|
ElMessageBox.confirm('确认移除该监听器吗?', '提示', {
|
|
ElMessageBox.confirm('确认移除该监听器吗?', '提示', {
|
|
confirmButtonText: '确 认',
|
|
confirmButtonText: '确 认',
|
|
cancelButtonText: '取 消'
|
|
cancelButtonText: '取 消'
|
|
@@ -365,6 +387,7 @@ const removeListener = (index) => {
|
|
}
|
|
}
|
|
// 保存监听器配置
|
|
// 保存监听器配置
|
|
const saveListenerConfig = async () => {
|
|
const saveListenerConfig = async () => {
|
|
|
|
+ // debugger
|
|
let validateStatus = await listenerFormRef.value.validate()
|
|
let validateStatus = await listenerFormRef.value.validate()
|
|
if (!validateStatus) return // 验证不通过直接返回
|
|
if (!validateStatus) return // 验证不通过直接返回
|
|
const listenerObject = createListenerObject(listenerForm.value, false, prefix)
|
|
const listenerObject = createListenerObject(listenerForm.value, false, prefix)
|
|
@@ -389,6 +412,28 @@ const saveListenerConfig = async () => {
|
|
listenerForm.value = {}
|
|
listenerForm.value = {}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// 打开监听器弹窗
|
|
|
|
+const processListenerDialogRef = ref()
|
|
|
|
+const openProcessListenerDialog = async () => {
|
|
|
|
+ processListenerDialogRef.value.open('execution')
|
|
|
|
+}
|
|
|
|
+const selectListener = (listener) => {
|
|
|
|
+ const listenerForm = initListenerForm2(listener)
|
|
|
|
+ const listenerObject = createListenerObject(listenerForm, false, prefix)
|
|
|
|
+ bpmnElementListeners.value.push(listenerObject)
|
|
|
|
+ elementListenersList.value.push(listenerForm)
|
|
|
|
+
|
|
|
|
+ // 保存其他配置
|
|
|
|
+ otherExtensionList.value =
|
|
|
|
+ bpmnElement.value.businessObject?.extensionElements?.values?.filter(
|
|
|
|
+ (ex) => ex.$type !== `${prefix}:ExecutionListener`
|
|
|
|
+ ) ?? []
|
|
|
|
+ updateElementExtensions(
|
|
|
|
+ bpmnElement.value,
|
|
|
|
+ otherExtensionList.value.concat(bpmnElementListeners.value)
|
|
|
|
+ )
|
|
|
|
+}
|
|
|
|
+
|
|
watch(
|
|
watch(
|
|
() => props.id,
|
|
() => props.id,
|
|
(val) => {
|
|
(val) => {
|