Commit 5d65b4e3 authored by chenshouchao's avatar chenshouchao

Merge branch 'feat-20220705-customTemplate' into 'release'

Feat 20220705 custom template

See merge request !78
parents d09fba1a 92ced994
...@@ -63,6 +63,22 @@ const ProjectSubmitWork = () => { ...@@ -63,6 +63,22 @@ const ProjectSubmitWork = () => {
const { run } = useMyRequest(fetchTemplateConfigInfo, { const { run } = useMyRequest(fetchTemplateConfigInfo, {
onSuccess: (res: IResponse<ITemplateConfig>) => { onSuccess: (res: IResponse<ITemplateConfig>) => {
// setTemplateConfigInfo(templateConfigJson as ITemplateConfig); // setTemplateConfigInfo(templateConfigJson as ITemplateConfig);
res.data.tasks.forEach((task) => {
task.parameters.forEach((parameter) => {
let value: any = undefined;
if (parameter.defaultValue) {
value = parameter.defaultValue;
} else if (
parameter.domType.toLowerCase() === "multipleselect" ||
parameter.domType.toLowerCase() === "checkbox"
) {
value = [];
} else {
value = "";
}
parameter.value = value;
});
});
setTemplateConfigInfo(res.data); setTemplateConfigInfo(res.data);
configFormRef.current.setInitName(res.data.title); configFormRef.current.setInitName(res.data.title);
}, },
......
...@@ -12,6 +12,7 @@ export interface IParameter { ...@@ -12,6 +12,7 @@ export interface IParameter {
id?: string; id?: string;
name: string; name: string;
required: boolean; required: boolean;
defaultValue: any;
domType: IDomType; domType: IDomType;
classType: string; classType: string;
classTypeName: string; classTypeName: string;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment