import * as React from 'react'; import { observer } from 'mobx-react'; import { List, FA } from 'tonva-react-form'; import { Page, nav } from 'tonva-tools'; import { TuidMain, Query, Entity } from '../../entities'; import { VForm } from '../form'; import { VEntity } from '../CVEntity'; import { QueryUI, CQuery } from './cQuery'; import { DefaultRow } from './defaultRow'; export class VQueryMain extends VEntity { protected vForm: VForm; private row: React.StatelessComponent; async open(param?:any):Promise { this.vForm = this.createForm(this.onSubmit, param); let {row, queryRow} = this.ui; this.row = queryRow || row || DefaultRow; this.openPage(this.view); } onSubmit = async () => { let params = this.vForm.getValues(); if (this.entity.isPaged === true) { await this.entity.resetPage(30, params); await this.entity.loadPage(); this.replacePage(this.pageResult); } else { let data = await this.entity.query(params); this.replacePage(this.queryResult, data); } } again = () => { this.vForm.reset(); this.replacePage(this.view); } renderExtra() { return; } renderRow = (item:any, index:number) => ; protected view = () => {this.vForm.render('mx-3 my-2')} {this.renderExtra()} ; protected pageResult = () => { let {name, list} = this.entity; let rightClose = ; return ; } protected queryResult = observer((result:any) => { let rightClose = ; return
{JSON.stringify(result, undefined, '\t')}
; }) }