|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
import { ITreeNode } from "@blueprintjs/core";
|
|
|
|
|
import { observable, toJS } from "mobx";
|
|
|
|
|
import { safeEval } from "../../Common/eval";
|
|
|
|
|
import { Singleton } from "../../Common/Singleton";
|
|
|
|
|
import { FixedNotZero } from "../../Common/Utils";
|
|
|
|
|
import { TemplateParam } from "../../DatabaseServices/Template/Param/TemplateParam";
|
|
|
|
@ -71,10 +72,13 @@ export class TempalteEditorStore extends Singleton implements IConfigStore
|
|
|
|
|
tempPar.name = par.name;
|
|
|
|
|
this.Template.Params.push(tempPar);
|
|
|
|
|
}
|
|
|
|
|
tempPar.value = par.value;
|
|
|
|
|
tempPar.expr = par.expr;
|
|
|
|
|
tempPar.description = par.description;
|
|
|
|
|
tempPar.type = par.type ?? TemplateParamType.Float;
|
|
|
|
|
if (tempPar.type === TemplateParamType.Float)
|
|
|
|
|
tempPar.value = (typeof par.value === "string" ? safeEval(par.value) : par.value) || 0;
|
|
|
|
|
else
|
|
|
|
|
tempPar.value = par.value;
|
|
|
|
|
}
|
|
|
|
|
}, "修改模板参数");
|
|
|
|
|
|
|
|
|
@ -88,22 +92,4 @@ export class TempalteEditorStore extends Singleton implements IConfigStore
|
|
|
|
|
newConfig.option = toJS(this.params);
|
|
|
|
|
return newConfig;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async WriteParamsToTemplate()
|
|
|
|
|
{
|
|
|
|
|
for (let par of this.params)
|
|
|
|
|
{
|
|
|
|
|
let tempPar = this.Template.GetParam(par.name);
|
|
|
|
|
if (!tempPar)
|
|
|
|
|
{
|
|
|
|
|
tempPar = new TemplateParam();
|
|
|
|
|
this.Template.Params.push(tempPar);
|
|
|
|
|
}
|
|
|
|
|
tempPar.value = par.value;
|
|
|
|
|
tempPar.description = par.description;
|
|
|
|
|
tempPar.expr = par.expr;
|
|
|
|
|
tempPar.type = par.type ?? TemplateParamType.Float;
|
|
|
|
|
}
|
|
|
|
|
await this.Template.UpdateTemplateTree();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|