38
38
<el-radio-group v-model =" applicationForm.type" class =" card__radio" >
39
39
<el-row :gutter =" 16" >
40
40
<el-col :span =" 12" >
41
- <el-card
42
- shadow =" never"
43
- class =" mb-16"
44
- :class =" applicationForm.type === 'SIMPLE' ? 'active' : ''"
45
- >
41
+ <el-card shadow =" never" :class =" applicationForm.type === 'SIMPLE' ? 'active' : ''" >
46
42
<el-radio value =" SIMPLE" size =" large" >
47
43
<p class =" mb-4" >{{ $t('views.application.simple') }}</p >
48
44
<el-text type =" info" >{{
52
48
</el-card >
53
49
</el-col >
54
50
<el-col :span =" 12" >
55
- <el-card
56
- shadow =" never"
57
- class =" mb-16"
58
- :class =" isWorkFlow(applicationForm.type) ? 'active' : ''"
59
- >
51
+ <el-card shadow =" never" :class =" isWorkFlow(applicationForm.type) ? 'active' : ''" >
60
52
<el-radio value =" WORK_FLOW" size =" large" >
61
53
<p class =" mb-4" >{{ $t('views.application.workflow') }}</p >
62
54
<el-text type =" info" >{{
68
60
</el-row >
69
61
</el-radio-group >
70
62
</el-form-item >
63
+ <el-form-item
64
+ :label =" $t('views.document.upload.template')"
65
+ v-if =" applicationForm.type === 'WORK_FLOW'"
66
+ >
67
+ <div class =" w-full" >
68
+ <el-row :gutter =" 16" >
69
+ <el-col :span =" 12" >
70
+ <el-card
71
+ class =" radio-card cursor"
72
+ shadow =" never"
73
+ @click =" selectedType('blank')"
74
+ :class =" appTemplate === 'blank' ? 'active' : ''"
75
+ >
76
+ {{ $t('views.application.applicationForm.form.appTemplate.blankApp') }}
77
+ </el-card >
78
+ </el-col >
79
+ <el-col :span =" 12" >
80
+ <el-card
81
+ class =" radio-card cursor"
82
+ shadow =" never"
83
+ :class =" appTemplate === 'assistant' ? 'active' : ''"
84
+ @click =" selectedType('assistant')"
85
+ >
86
+ {{ $t('views.application.applicationForm.form.appTemplate.assistantApp') }}
87
+ </el-card >
88
+ </el-col >
89
+ </el-row >
90
+ </div >
91
+ </el-form-item >
71
92
</el-form >
72
93
<template #footer >
73
94
<span class =" dialog-footer" >
@@ -89,6 +110,7 @@ import type { FormInstance, FormRules } from 'element-plus'
89
110
import applicationApi from ' @/api/application'
90
111
import { MsgSuccess , MsgAlert } from ' @/utils/message'
91
112
import { isWorkFlow } from ' @/utils/application'
113
+ import { baseNodes } from ' @/workflow/common/data'
92
114
import { t } from ' @/locales'
93
115
const router = useRouter ()
94
116
const emit = defineEmits ([' refresh' ])
@@ -106,6 +128,12 @@ const optimizationPrompt =
106
128
' <data></data>' +
107
129
t (' views.application.applicationForm.dialog.defaultPrompt2' )
108
130
131
+ const workflowDefault = ref <any >({
132
+ edges: [],
133
+ nodes: baseNodes
134
+ })
135
+ const appTemplate = ref (' blank' )
136
+
109
137
const applicationFormRef = ref ()
110
138
111
139
const loading = ref (false )
@@ -207,6 +235,11 @@ const submitHandle = async (formEl: FormInstance | undefined) => {
207
235
if (! formEl ) return
208
236
await formEl .validate ((valid ) => {
209
237
if (valid ) {
238
+ if (isWorkFlow (applicationForm .value .type ) && appTemplate .value === ' blank' ) {
239
+ workflowDefault .value .nodes [0 ].properties .node_data .desc = applicationForm .value .desc
240
+ workflowDefault .value .nodes [0 ].properties .node_data .name = applicationForm .value .name
241
+ applicationForm .value [' work_flow' ] = workflowDefault .value
242
+ }
210
243
applicationApi .postApplication (applicationForm .value , loading ).then ((res ) => {
211
244
MsgSuccess (t (' common.createSuccess' ))
212
245
if (isWorkFlow (applicationForm .value .type )) {
@@ -220,6 +253,18 @@ const submitHandle = async (formEl: FormInstance | undefined) => {
220
253
})
221
254
}
222
255
256
+ function selectedType(type : string ) {
257
+ appTemplate .value = type
258
+ }
259
+
223
260
defineExpose ({ open })
224
261
</script >
225
- <style lang="scss" scope></style >
262
+ <style lang="scss" scope>
263
+ .radio-card {
264
+ line-height : 22px ;
265
+ & .active {
266
+ border-color : var (--el-color-primary );
267
+ color : var (--el-color-primary );
268
+ }
269
+ }
270
+ </style >
0 commit comments