fix
This commit is contained in:
parent
18d24c37b8
commit
afed8e9d40
|
|
@ -26,18 +26,18 @@ export const on_load_rel = ({
|
|||
}
|
||||
|
||||
return `\
|
||||
(arg: {
|
||||
async (arg: {
|
||||
reload: () => Promise<void>;
|
||||
orderBy?: Record<string, "asc" | "desc">;
|
||||
paging: { take: number; skip: number };
|
||||
mode: 'count' | 'query'
|
||||
}) => {
|
||||
if (isEditor) return [${JSON.stringify(sample)}];
|
||||
|
||||
return new Promise(async (done) => {
|
||||
if (arg.mode === 'count') {
|
||||
return await db.${table}.count();
|
||||
}
|
||||
|
||||
return new Promise(async (done) => {
|
||||
${!isEmptyString(type) && ["checkbox", "typeahead", "button"].includes(type as any) ? `` : `const fields = parseGenField(rel__gen_fields);
|
||||
const res = generateSelect(fields);`}
|
||||
|
||||
|
|
|
|||
|
|
@ -265,10 +265,7 @@ export const TableList: FC<TableListProp> = ({
|
|||
);
|
||||
let childs: any[] = [];
|
||||
|
||||
let checkedBox: any[] = [];
|
||||
|
||||
let sub_name = "fields";
|
||||
// if (mode === "table") sub_name = "columns";
|
||||
|
||||
switch (mode) {
|
||||
case "table":
|
||||
|
|
|
|||
|
|
@ -34,11 +34,10 @@ export const on_load = ({
|
|||
}
|
||||
|
||||
return `\
|
||||
(arg: TableOnLoad) => {
|
||||
async (arg: TableOnLoad) => {
|
||||
if (isEditor)
|
||||
return [${JSON.stringify(sample)}];
|
||||
|
||||
return new Promise(async (done) => {
|
||||
let where = arg.where;
|
||||
if (arg.mode === "count") {
|
||||
return await db.${table}.count({
|
||||
|
|
@ -48,6 +47,7 @@ export const on_load = ({
|
|||
});
|
||||
}
|
||||
|
||||
return new Promise(async (done) => {
|
||||
const items = await db.${table}.findMany({
|
||||
select: ${JSON.stringify(select, null, 2).split("\n").join("\n ")},
|
||||
orderBy: arg.orderBy || {
|
||||
|
|
|
|||
|
|
@ -26,14 +26,14 @@ export const on_load = ({
|
|||
}
|
||||
|
||||
return `\
|
||||
(arg: TableOnLoad) => {
|
||||
async (arg: TableOnLoad) => {
|
||||
if (isEditor) return [${JSON.stringify(sample)}];
|
||||
|
||||
return new Promise(async (done) => {
|
||||
if (arg.mode === 'count') {
|
||||
return await db.${table}.count();
|
||||
}
|
||||
|
||||
return new Promise(async (done) => {
|
||||
const items = await db.${table}.findMany({
|
||||
select: ${JSON.stringify(select, null, 2).split("\n").join("\n ")},
|
||||
orderBy: arg.orderBy || {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { GFCol, PropOptRaw, createItem, formatName } from "../utils";
|
||||
import get from "lodash.get";
|
||||
import { GenMasterDetailArg, codeBuild } from "./utils";
|
||||
import { gen_table_list } from "../gen_table_list/gen_table_list";
|
||||
import { createItem, formatName } from "../utils";
|
||||
import { GenMasterDetailArg, codeBuild } from "./utils";
|
||||
export const genList = async (arg: GenMasterDetailArg, data: any) => {
|
||||
for (const c of get(data, "child.content.childs") || []) {
|
||||
if (c.component?.id === "c68415ca-dac5-44fe-aeb6-936caf8cc491") {
|
||||
|
|
@ -99,12 +99,12 @@ type ActionItem =
|
|||
id: "567d5362-2cc8-4ca5-a531-f771a5c866c2",
|
||||
props: {
|
||||
name: arg.gen_table,
|
||||
gen_table: arg.gen_table,
|
||||
gen__table: arg.gen_table,
|
||||
generate: "y",
|
||||
on_load: "",
|
||||
row_click: res.row_click,
|
||||
selected: res.selected,
|
||||
gen_fields: [JSON.stringify(arg.gen_fields)],
|
||||
gen__fields: [JSON.stringify(arg.gen_fields)],
|
||||
child: {
|
||||
childs: [],
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue