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

@ -18,28 +18,26 @@ export const FormatValue: FC<{
if (gen_fields) { if (gen_fields) {
const gf = JSON.stringify(gen_fields); const gf = JSON.stringify(gen_fields);
if (!fields_map.has(gf)) { if (!fields_map.has(gf)) {
fields_map.set( const result = gen_fields.map((e: any) => {
gf, if (typeof e === "string") {
gen_fields.map((e: any) => { return JSON.parse(e);
if (typeof e === "string") { } else {
return JSON.parse(e); return {
} else { ...JSON.parse(e.value),
return { checked: e.checked.map((ex: any) => {
...JSON.parse(e.value), if (typeof ex === "string") {
checked: e.checked.map((ex: any) => { return JSON.parse(ex);
if (typeof ex === "string") { }
return JSON.parse(ex); try {
} return JSON.parse(ex["value"]);
try { } catch (em) {
return JSON.parse(ex["value"]); return null;
} catch (em) { }
return null; }),
} };
}), }
}; });
} fields_map.set(gf, result);
})
);
} }
const fields = fields_map.get(gf); const fields = fields_map.get(gf);