chore: 模版创建流水线

pull/453/head
xiaojunnuo 2025-06-25 18:40:20 +08:00
parent 29906ec057
commit 529482a83e
1 changed files with 18 additions and 6 deletions

View File

@ -42,11 +42,11 @@ export function useTemplate() {
const randomMin = Math.floor(Math.random() * 60); const randomMin = Math.floor(Math.random() * 60);
const templateFormRef = ref(); const templateFormRef = ref();
async function onSubmit(opts: { form: any }) { async function doSubmit(opts: { form: any }) {
const form = opts.form; const form = opts.form;
await templateFormRef.value.validate(); await templateFormRef.value.validate();
const tempInputs = templateFormRef.value.getFormData(); const tempInputs = templateFormRef.value.getForm();
let newPipeline = cloneDeep(pipeline); let newPipeline = cloneDeep(pipeline);
newPipeline = fillPipelineByDefaultForm(newPipeline, form); newPipeline = fillPipelineByDefaultForm(newPipeline, form);
@ -64,9 +64,11 @@ export function useTemplate() {
} }
} }
const title = form.title;
newPipeline.title = title;
const groupId = form.groupId; const groupId = form.groupId;
const { id } = await templateApi.CreatePipelineByTemplate({ await templateApi.CreatePipelineByTemplate({
title: form.title, title,
content: JSON.stringify(newPipeline), content: JSON.stringify(newPipeline),
keepHistoryCount: 30, keepHistoryCount: 30,
groupId, groupId,
@ -76,7 +78,7 @@ export function useTemplate() {
const crudOptions = { const crudOptions = {
form: { form: {
onSubmit, doSubmit,
wrapper: { wrapper: {
title: `从模版<${detail.template.title}>创建流水线`, title: `从模版<${detail.template.title}>创建流水线`,
width: 1100, width: 1100,
@ -92,6 +94,16 @@ export function useTemplate() {
}, },
}, },
columns: { columns: {
title: {
title: "流水线标题",
type: "text",
form: {
component: {
placeholder: "请输入流水线标题",
},
rules: [{ required: true, message: "请输入流水线标题" }],
},
},
triggerCron: { triggerCron: {
title: "定时触发", title: "定时触发",
type: "text", type: "text",
@ -133,7 +145,7 @@ export function useTemplate() {
name: GroupSelector, name: GroupSelector,
vModel: "modelValue", vModel: "modelValue",
}, },
order: 9999, order: 99,
}, },
}, },
}, },