Fix: Bugs fixed #10703 (#11132)

### What problem does this PR solve?

Fix: Bugs fixed #10703

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
chanx
2025-11-10 14:12:45 +08:00
committed by GitHub
parent d207291217
commit 726473fd39
8 changed files with 69 additions and 623 deletions

View File

@ -81,31 +81,34 @@ export const GobalParamSheet = (props: IGobalParamModalProps) => {
const { saveGraph, loading } = useSaveGraph();
const handleSubmit = (value: FieldValues) => {
const handleSubmit = async (value: FieldValues) => {
const param = {
...(data.dsl?.variables || {}),
[value.name]: value,
} as Record<string, GobalVariableType>;
saveGraph(undefined, {
const res = await saveGraph(undefined, {
gobalVariables: param,
});
if (!loading) {
setTimeout(() => {
refetch();
}, 500);
if (res.code === 0) {
refetch();
}
hideAddModal();
};
const handleDeleteGobalVariable = (key: string) => {
const handleDeleteGobalVariable = async (key: string) => {
const param = {
...(data.dsl?.variables || {}),
} as Record<string, GobalVariableType>;
delete param[key];
saveGraph(undefined, {
const res = await saveGraph(undefined, {
gobalVariables: param,
});
refetch();
console.log('delete gobal variable-->', res);
if (res.code === 0) {
refetch();
}
};
const handleEditGobalVariable = (item: FieldValues) => {

View File

@ -356,15 +356,19 @@ export const buildDslGobalVariables = (
return { globals: dsl.globals, variables: dsl.variables || {} };
}
let gobalVariablesTemp = {};
let gobalVariablesTemp: Record<string, any> = {};
let gobalSystem: Record<string, any> = {};
Object.keys(dsl.globals)?.forEach((key) => {
if (key.indexOf('sys') > -1) {
gobalSystem[key] = dsl.globals[key];
}
});
Object.keys(gobalVariables).forEach((key) => {
gobalVariablesTemp = {
['env.' + key]: gobalVariables[key].value,
};
gobalVariablesTemp['env.' + key] = gobalVariables[key].value;
});
const gobalVariablesResult = {
...dsl.globals,
...gobalSystem,
...gobalVariablesTemp,
};
return { globals: gobalVariablesResult, variables: gobalVariables };