feat: [bpm][antd] bpmn设计器脚本任务优化

This commit is contained in:
jason
2025-12-08 23:41:34 +08:00
parent fba43de19f
commit 70bcc5ea0f
2 changed files with 53 additions and 49 deletions

View File

@@ -2,6 +2,7 @@
import { nextTick, onBeforeUnmount, ref, toRaw, watch } from 'vue'; import { nextTick, onBeforeUnmount, ref, toRaw, watch } from 'vue';
import { import {
Form,
FormItem, FormItem,
Input, Input,
Select, Select,
@@ -75,47 +76,50 @@ watch(
<template> <template>
<div class="mt-4"> <div class="mt-4">
<FormItem label="脚本格式"> <Form :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }">
<Input <FormItem label="脚本格式">
v-model:value="scriptTaskForm.scriptFormat" <Input
allow-clear v-model:value="scriptTaskForm.scriptFormat"
@input="updateElementTask()" allow-clear
@change="updateElementTask()" @input="updateElementTask()"
/> @change="updateElementTask()"
</FormItem> />
<FormItem label="脚本类型"> </FormItem>
<Select v-model:value="scriptTaskForm.scriptType"> <!-- TODO scriptType 外部资源 内联脚本 flowable 文档 https://www.flowable.com/open-source/docs/bpmn/ch07b-BPMN-Constructs#script-task 没看到到有相应的属性 -->
<SelectOption value="inline">内联脚本</SelectOption> <FormItem label="脚本类型">
<SelectOption value="external">外部资源</SelectOption> <Select v-model:value="scriptTaskForm.scriptType">
</Select> <SelectOption value="inline">内联脚本</SelectOption>
</FormItem> <SelectOption value="external">外部资源</SelectOption>
<FormItem label="脚本" v-show="scriptTaskForm.scriptType === 'inline'"> </Select>
<Textarea </FormItem>
v-model:value="scriptTaskForm.script" <FormItem label="脚本" v-show="scriptTaskForm.scriptType === 'inline'">
:auto-size="{ minRows: 2, maxRows: 4 }" <Textarea
allow-clear v-model:value="scriptTaskForm.script"
@input="updateElementTask()" :auto-size="{ minRows: 2, maxRows: 4 }"
@change="updateElementTask()" allow-clear
/> @input="updateElementTask()"
</FormItem> @change="updateElementTask()"
<FormItem />
label="资源地址" </FormItem>
v-show="scriptTaskForm.scriptType === 'external'" <FormItem
> label="资源地址"
<Input v-show="scriptTaskForm.scriptType === 'external'"
v-model:value="scriptTaskForm.resource" >
allow-clear <Input
@input="updateElementTask()" v-model:value="scriptTaskForm.resource"
@change="updateElementTask()" allow-clear
/> @input="updateElementTask()"
</FormItem> @change="updateElementTask()"
<FormItem label="结果变量"> />
<Input </FormItem>
v-model:value="scriptTaskForm.resultVariable" <FormItem label="结果变量">
allow-clear <Input
@input="updateElementTask()" v-model:value="scriptTaskForm.resultVariable"
@change="updateElementTask()" allow-clear
/> @input="updateElementTask()"
</FormItem> @change="updateElementTask()"
/>
</FormItem>
</Form>
</div> </div>
</template> </template>

View File

@@ -73,7 +73,6 @@ const httpTaskForm = ref<any>({ ...DEFAULT_HTTP_FORM });
const bpmnElement = ref(); const bpmnElement = ref();
const httpInitializing = ref(false); const httpInitializing = ref(false);
const bpmnInstances = () => (window as any)?.bpmnInstances; const bpmnInstances = () => (window as any)?.bpmnInstances;
// 判断字符串是否包含表达式 // 判断字符串是否包含表达式
@@ -84,7 +83,6 @@ const isExpression = (value: string): boolean => {
}; };
const collectHttpExtensionInfo = () => { const collectHttpExtensionInfo = () => {
const businessObject = bpmnElement.value?.businessObject; const businessObject = bpmnElement.value?.businessObject;
const extensionElements = businessObject?.extensionElements; const extensionElements = businessObject?.extensionElements;
const httpFields = new Map<string, string>(); const httpFields = new Map<string, string>();
@@ -311,9 +309,11 @@ const handleExecuteTypeChange = (value: any) => {
/** 打开请求头编辑器 */ /** 打开请求头编辑器 */
const openHttpHeaderEditor = () => { const openHttpHeaderEditor = () => {
httpHeaderEditorApi.setData ({ httpHeaderEditorApi
headers: httpTaskForm.value.requestHeaders .setData({
}).open(); headers: httpTaskForm.value.requestHeaders,
})
.open();
}; };
/** 保存请求头 */ /** 保存请求头 */
@@ -321,9 +321,9 @@ const handleHeadersSave = (headersStr: string) => {
httpTaskForm.value.requestHeaders = headersStr; httpTaskForm.value.requestHeaders = headersStr;
}; };
const [HttpHeaderEditorModal, httpHeaderEditorApi] = useVbenModal( { const [HttpHeaderEditorModal, httpHeaderEditorApi] = useVbenModal({
connectedComponent: HttpHeaderEditor, connectedComponent: HttpHeaderEditor,
}) });
onBeforeUnmount(() => { onBeforeUnmount(() => {
bpmnElement.value = null; bpmnElement.value = null;