37
37
</el-form-item >
38
38
<!-- HTTP 请求触发器 -->
39
39
<div
40
- v-if =" configForm.type === TriggerTypeEnum.HTTP_REQUEST && configForm.httpRequestSetting"
40
+ v-if ="
41
+ (configForm.type === TriggerTypeEnum.HTTP_REQUEST ||
42
+ configForm.type === TriggerTypeEnum.ASYNC_HTTP_REQUEST) &&
43
+ configForm.httpRequestSetting
44
+ "
41
45
>
42
46
<el-form-item >
43
47
<el-alert
58
62
:bind =" 'httpRequestSetting'"
59
63
/>
60
64
<!-- 返回值设置-->
61
- <el-form-item label =" 返回值" >
62
- <el-alert
63
- title =" 通过请求返回值, 可以修改流程表单的值"
64
- type =" warning"
65
- show-icon
66
- :closable =" false"
67
- />
68
- </el-form-item >
69
- <el-form-item >
70
- <div
71
- class =" flex pt-2"
72
- v-for =" (item, index) in configForm.httpRequestSetting.response"
73
- :key =" index"
74
- >
75
- <div class =" mr-2" >
76
- <el-form-item
77
- :prop =" `httpRequestSetting.response.${index}.key`"
78
- :rules =" {
79
- required: true,
80
- message: '表单字段不能为空',
81
- trigger: 'blur'
82
- }"
83
- >
84
- <el-select class =" w-160px!" v-model =" item.key" placeholder =" 请选择表单字段" >
85
- <el-option
86
- v-for =" (field, fIdx) in formFields"
87
- :key =" fIdx"
88
- :label =" field.title"
89
- :value =" field.field"
90
- :disabled =" !field.required"
91
- />
92
- </el-select >
93
- </el-form-item >
94
- </div >
95
- <div class =" mr-2" >
96
- <el-form-item
97
- :prop =" `httpRequestSetting.response.${index}.value`"
98
- :rules =" {
99
- required: true,
100
- message: '请求返回字段不能为空',
101
- trigger: 'blur'
102
- }"
103
- >
104
- <el-input class =" w-160px" v-model =" item.value" placeholder =" 请求返回字段" />
105
- </el-form-item >
106
- </div >
107
- <div class =" mr-1 pt-1 cursor-pointer" >
108
- <Icon
109
- icon =" ep:delete"
110
- :size =" 18"
111
- @click =" deleteHttpResponseSetting(configForm.httpRequestSetting.response!, index)"
112
- />
65
+ <div v-if =" configForm.type === TriggerTypeEnum.HTTP_REQUEST" >
66
+ <el-form-item label =" 返回值" >
67
+ <el-alert
68
+ title =" 通过请求返回值, 可以修改流程表单的值"
69
+ type =" warning"
70
+ show-icon
71
+ :closable =" false"
72
+ />
73
+ </el-form-item >
74
+ <el-form-item >
75
+ <div
76
+ class =" flex pt-2"
77
+ v-for =" (item, index) in configForm.httpRequestSetting.response"
78
+ :key =" index"
79
+ >
80
+ <div class =" mr-2" >
81
+ <el-form-item
82
+ :prop =" `httpRequestSetting.response.${index}.key`"
83
+ :rules =" {
84
+ required: true,
85
+ message: '表单字段不能为空',
86
+ trigger: 'blur'
87
+ }"
88
+ >
89
+ <el-select class =" w-160px!" v-model =" item.key" placeholder =" 请选择表单字段" >
90
+ <el-option
91
+ v-for =" (field, fIdx) in formFields"
92
+ :key =" fIdx"
93
+ :label =" field.title"
94
+ :value =" field.field"
95
+ :disabled =" !field.required"
96
+ />
97
+ </el-select >
98
+ </el-form-item >
99
+ </div >
100
+ <div class =" mr-2" >
101
+ <el-form-item
102
+ :prop =" `httpRequestSetting.response.${index}.value`"
103
+ :rules =" {
104
+ required: true,
105
+ message: '请求返回字段不能为空',
106
+ trigger: 'blur'
107
+ }"
108
+ >
109
+ <el-input class =" w-160px" v-model =" item.value" placeholder =" 请求返回字段" />
110
+ </el-form-item >
111
+ </div >
112
+ <div class =" mr-1 pt-1 cursor-pointer" >
113
+ <Icon
114
+ icon =" ep:delete"
115
+ :size =" 18"
116
+ @click ="
117
+ deleteHttpResponseSetting(configForm.httpRequestSetting.response!, index)
118
+ "
119
+ />
120
+ </div >
113
121
</div >
114
- </ div >
115
- < el-button
116
- type = " primary "
117
- text
118
- @click = " addHttpResponseSetting(configForm.httpRequestSetting.response!) "
119
- >
120
- <Icon icon = " ep:plus " class = " mr-5px " />添加一行
121
- </el-button >
122
- </el-form-item >
122
+ < el-button
123
+ type = " primary "
124
+ text
125
+ @click = " addHttpResponseSetting(configForm.httpRequestSetting.response!) "
126
+ >
127
+ < Icon icon = " ep:plus " class = " mr-5px " />添加一行
128
+ </ el-button >
129
+ </el-form-item >
130
+ </div >
123
131
</div >
124
132
125
133
<!-- 表单数据修改触发器 -->
@@ -385,14 +393,28 @@ let originalSetting: TriggerSetting | undefined
385
393
/** 触发器类型改变了 */
386
394
const changeTriggerType = () => {
387
395
if (configForm .value .type === TriggerTypeEnum .HTTP_REQUEST ) {
388
- configForm .value .httpRequestSetting = originalSetting ?.httpRequestSetting || {
389
- url: ' ' ,
390
- header: [],
391
- body: [],
392
- response: []
393
- }
396
+ configForm .value .httpRequestSetting =
397
+ originalSetting ?.type === TriggerTypeEnum .HTTP_REQUEST && originalSetting .httpRequestSetting
398
+ ? originalSetting .httpRequestSetting
399
+ : {
400
+ url: ' ' ,
401
+ header: [],
402
+ body: [],
403
+ response: []
404
+ }
394
405
configForm .value .formSettings = undefined
395
- } else if (configForm .value .type === TriggerTypeEnum .FORM_UPDATE ) {
406
+ } else if (configForm .value .type === TriggerTypeEnum .ASYNC_HTTP_REQUEST ) {
407
+ configForm .value .httpRequestSetting =
408
+ originalSetting ?.type === TriggerTypeEnum .ASYNC_HTTP_REQUEST && originalSetting .httpRequestSetting
409
+ ? originalSetting .httpRequestSetting
410
+ : {
411
+ url: ' ' ,
412
+ header: [],
413
+ body: [],
414
+ response: []
415
+ }
416
+ configForm .value .formSettings = undefined
417
+ }else if (configForm .value .type === TriggerTypeEnum .FORM_UPDATE ) {
396
418
configForm .value .formSettings =
397
419
originalSetting ?.type === TriggerTypeEnum .FORM_UPDATE && originalSetting .formSettings
398
420
? originalSetting .formSettings
@@ -405,7 +427,6 @@ const changeTriggerType = () => {
405
427
]
406
428
configForm .value .httpRequestSetting = undefined
407
429
} else if (configForm .value .type === TriggerTypeEnum .FORM_DELETE ) {
408
- console .log (' originalSetting?.type' , originalSetting ?.type )
409
430
configForm .value .formSettings =
410
431
originalSetting ?.type === TriggerTypeEnum .FORM_DELETE && originalSetting .formSettings
411
432
? originalSetting .formSettings
@@ -531,7 +552,10 @@ const saveConfig = async () => {
531
552
/** 获取节点展示内容 */
532
553
const getShowText = (): string => {
533
554
let showText = ' '
534
- if (configForm .value .type === TriggerTypeEnum .HTTP_REQUEST ) {
555
+ if (
556
+ configForm .value .type === TriggerTypeEnum .HTTP_REQUEST ||
557
+ configForm .value .type === TriggerTypeEnum .ASYNC_HTTP_REQUEST
558
+ ) {
535
559
showText = ` ${configForm .value .httpRequestSetting ?.url } `
536
560
} else if (configForm .value .type === TriggerTypeEnum .FORM_UPDATE ) {
537
561
for (const [index, setting] of configForm .value .formSettings ! .entries ()) {
@@ -556,7 +580,7 @@ const getShowText = (): string => {
556
580
/** 显示触发器节点配置, 由父组件传过来 */
557
581
const showTriggerNodeConfig = (node : SimpleFlowNode ) => {
558
582
nodeName .value = node .name
559
- originalSetting = node .triggerSetting
583
+ originalSetting = node .triggerSetting ? JSON . parse ( JSON . stringify ( node . triggerSetting )) : {}
560
584
if (node .triggerSetting ) {
561
585
configForm .value = {
562
586
type: node .triggerSetting .type ,
0 commit comments