Commit 71a3352a authored by chenshouchao's avatar chenshouchao

fix: 提交任务页面拿到模板信息后给每个参数设置值

parent c25862bb
...@@ -57,6 +57,22 @@ const ProjectSubmitWork = () => { ...@@ -57,6 +57,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