Skip to content

Commit f14dead

Browse files
committed
fix: [BPM 工作流] 更多设置不能选中表单项问题
1 parent ab8761d commit f14dead

File tree

4 files changed

+71
-27
lines changed

4 files changed

+71
-27
lines changed

src/components/SimpleProcessDesignerV2/src/nodes-config/components/HttpRequestParamSetting.vue

Lines changed: 35 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<el-form-item label-position="top" label="请求头">
3-
<div class="flex pt-2" v-for="(item, index) in props.header" :key="index">
3+
<div class="flex pb-4" v-for="(item, index) in props.header" :key="index">
44
<div class="mr-2">
55
<el-form-item
66
:prop="`${bind}.header.${index}.key`"
@@ -10,18 +10,20 @@
1010
trigger: 'blur'
1111
}"
1212
>
13-
<el-input class="w-160px" v-model="item.key" />
13+
<el-input v-model="item.key" style="width: 160px" />
1414
</el-form-item>
1515
</div>
1616
<div class="mr-2">
17-
<el-select class="w-100px!" v-model="item.type">
18-
<el-option
19-
v-for="types in BPM_HTTP_REQUEST_PARAM_TYPES"
20-
:key="types.value"
21-
:label="types.label"
22-
:value="types.value"
23-
/>
24-
</el-select>
17+
<el-form-item>
18+
<el-select v-model="item.type" style="width: 160px" @change="handleTypeChange(item)">
19+
<el-option
20+
v-for="types in BPM_HTTP_REQUEST_PARAM_TYPES"
21+
:key="types.value"
22+
:label="types.label"
23+
:value="types.value"
24+
/>
25+
</el-select>
26+
</el-form-item>
2527
</div>
2628
<div class="mr-2">
2729
<el-form-item
@@ -34,8 +36,8 @@
3436
>
3537
<el-input
3638
v-if="item.type === BpmHttpRequestParamTypeEnum.FIXED_VALUE"
37-
class="w-160px"
3839
v-model="item.value"
40+
style="width: 200px"
3941
/>
4042
</el-form-item>
4143
<el-form-item
@@ -48,8 +50,8 @@
4850
>
4951
<el-select
5052
v-if="item.type === BpmHttpRequestParamTypeEnum.FROM_FORM"
51-
class="w-160px!"
5253
v-model="item.value"
54+
style="width: 200px"
5355
>
5456
<el-option
5557
v-for="(field, fIdx) in formFieldOptions"
@@ -70,7 +72,7 @@
7072
</el-button>
7173
</el-form-item>
7274
<el-form-item label-position="top" label="请求体">
73-
<div class="flex pt-2" v-for="(item, index) in props.body" :key="index">
75+
<div class="flex pb-4" v-for="(item, index) in props.body" :key="index">
7476
<div class="mr-2">
7577
<el-form-item
7678
:prop="`${bind}.body.${index}.key`"
@@ -80,18 +82,20 @@
8082
trigger: 'blur'
8183
}"
8284
>
83-
<el-input class="w-160px" v-model="item.key" />
85+
<el-input v-model="item.key" style="width: 160px" />
8486
</el-form-item>
8587
</div>
8688
<div class="mr-2">
87-
<el-select class="w-100px!" v-model="item.type">
88-
<el-option
89-
v-for="types in BPM_HTTP_REQUEST_PARAM_TYPES"
90-
:key="types.value"
91-
:label="types.label"
92-
:value="types.value"
93-
/>
94-
</el-select>
89+
<el-form-item>
90+
<el-select v-model="item.type" style="width: 160px" @change="handleTypeChange(item)">
91+
<el-option
92+
v-for="types in BPM_HTTP_REQUEST_PARAM_TYPES"
93+
:key="types.value"
94+
:label="types.label"
95+
:value="types.value"
96+
/>
97+
</el-select>
98+
</el-form-item>
9599
</div>
96100
<div class="mr-2">
97101
<el-form-item
@@ -104,8 +108,8 @@
104108
>
105109
<el-input
106110
v-if="item.type === BpmHttpRequestParamTypeEnum.FIXED_VALUE"
107-
class="w-160px"
108111
v-model="item.value"
112+
style="width: 200px"
109113
/>
110114
</el-form-item>
111115
<el-form-item
@@ -118,8 +122,8 @@
118122
>
119123
<el-select
120124
v-if="item.type === BpmHttpRequestParamTypeEnum.FROM_FORM"
121-
class="w-160px!"
122125
v-model="item.value"
126+
style="width: 200px"
123127
>
124128
<el-option
125129
v-for="(field, fIdx) in formFieldOptions"
@@ -170,6 +174,13 @@ const props = defineProps({
170174
171175
// 流程表单字段,发起人字段
172176
const formFieldOptions = useFormFieldsAndStartUser()
177+
178+
/** 监听类型变化,清空值 */
179+
const handleTypeChange = (item: HttpRequestParam) => {
180+
// 当类型改变时,清空值
181+
item.value = ''
182+
}
183+
173184
/** 添加请求配置项 */
174185
const addHttpRequestParam = (arr: HttpRequestParam[]) => {
175186
arr.push({

src/components/SimpleProcessDesignerV2/src/nodes-config/components/HttpRequestSetting.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
/>
3434
</el-form-item>
3535
<el-form-item>
36-
<div class="flex pt-2" v-for="(item, index) in setting.response" :key="index">
36+
<div class="flex pt-4" v-for="(item, index) in setting.response" :key="index">
3737
<div class="mr-2">
3838
<el-form-item
3939
:prop="`${formItemPrefix}.response.${index}.key`"
@@ -74,10 +74,12 @@
7474
/>
7575
</div>
7676
</div>
77+
</el-form-item>
78+
<div class="pt-1">
7779
<el-button type="primary" text @click="addHttpResponseSetting(setting.response!)">
7880
<Icon icon="ep:plus" class="mr-5px" />添加一行
7981
</el-button>
80-
</el-form-item>
82+
</div>
8183
</div>
8284
</template>
8385
<script setup lang="ts">

src/views/bpm/model/form/ExtraSettings.vue

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,34 @@ import { ProcessVariableEnum } from '@/components/SimpleProcessDesignerV2/src/co
232232
import HttpRequestSetting from '@/components/SimpleProcessDesignerV2/src/nodes-config/components/HttpRequestSetting.vue'
233233
234234
const modelData = defineModel<any>()
235+
const formFields = ref<string[]>([])
236+
237+
const props = defineProps({
238+
// 流程表单 ID
239+
modelFormId: {
240+
type: Number,
241+
required: false,
242+
default: undefined,
243+
}
244+
})
245+
246+
247+
// 监听 modelFormId 变化
248+
watch(
249+
() => props.modelFormId,
250+
async (newVal) => {
251+
if (newVal) {
252+
const form = await FormApi.getForm(newVal);
253+
formFields.value = form?.fields;
254+
} else {
255+
// 如果 modelFormId 为空,清空表单字段
256+
formFields.value = [];
257+
}
258+
},
259+
{ immediate: true },
260+
);
261+
// 暴露给子组件使用
262+
provide('formFields', formFields)
235263
236264
/** 自定义 ID 流程编码 */
237265
const timeOptions = ref([

src/views/bpm/model/form/index.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,10 @@
7777

7878
<!-- 第四步:更多设置 -->
7979
<div v-show="currentStep === 3" class="mx-auto w-700px">
80-
<ExtraSettings v-model="formData" ref="extraSettingsRef" />
80+
<ExtraSettings
81+
ref="extraSettingsRef"
82+
v-model="formData"
83+
:model-form-id="formData.formId"/>
8184
</div>
8285
</div>
8386
</div>

0 commit comments

Comments
 (0)