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