This commit is contained in:
rizrmd 2024-08-08 08:50:20 +00:00
parent 55801d62fb
commit 6e0ba25f08
2 changed files with 22 additions and 24 deletions

View File

@ -16,7 +16,7 @@ export const generateTableList = async (
let table = "" as string;
try {
table = eval(data.gen__table.value);
} catch (e) {
} catch (e) {
table = data.gen__table?.value;
}
const raw_fields = JSON.parse(data.gen__fields.value) as (

View File

@ -18,28 +18,26 @@ export const FormatValue: FC<{
if (gen_fields) {
const gf = JSON.stringify(gen_fields);
if (!fields_map.has(gf)) {
fields_map.set(
gf,
gen_fields.map((e: any) => {
if (typeof e === "string") {
return JSON.parse(e);
} else {
return {
...JSON.parse(e.value),
checked: e.checked.map((ex: any) => {
if (typeof ex === "string") {
return JSON.parse(ex);
}
try {
return JSON.parse(ex["value"]);
} catch (em) {
return null;
}
}),
};
}
})
);
const result = gen_fields.map((e: any) => {
if (typeof e === "string") {
return JSON.parse(e);
} else {
return {
...JSON.parse(e.value),
checked: e.checked.map((ex: any) => {
if (typeof ex === "string") {
return JSON.parse(ex);
}
try {
return JSON.parse(ex["value"]);
} catch (em) {
return null;
}
}),
};
}
});
fields_map.set(gf, result);
}
const fields = fields_map.get(gf);
@ -178,4 +176,4 @@ const timeAgo = (date: any) => {
const ceil_comma = (number: number) => {
if (!number) return 0;
return Math.ceil(number * 100) / 100;
};
};