1、所有子表均不需要导入
<?php
namespace app\controller;
use app\BaseController;
/**
* 人员控制器
*/
class User extends BaseController
{
use \tpScriptVueCurd\base\controller\Controller;
public function init(): void
{
$this->title='人员信息';
$this->md=\app\model\User::make($this);
/*******只导入本表数据*********/
$this->baseAndChildImport=false;
}
/**
* 所有子表的控制器对象
* @return array
*/
protected function childControllers(): array
{
return [
Pets::make(),
];
}
}
2、或者在子表中控制,不在父表中导入本子表的数据
<?php
namespace app\controller;
use tpScriptVueCurd\base\model\BaseModel;
use tpScriptVueCurd\FieldCollection;
use tpScriptVueCurd\option\FunControllerListChildBtn;
/**
* 宠物控制器
*/
class Pets extends \app\BaseController
{
use \tpScriptVueCurd\base\controller\Controller;
public function init(): void
{
$this->title='宠物';
$this->md=\app\model\Pets::make($this);
/*******父控制器执行导入的时候不再能导入本表数据*********/
$this->parentImportSelf=false;
}
protected function parentController(): ?object
{
return User::make();
}
public static function baseListBtnText(FunControllerListChildBtn $btn, BaseModel $info): void
{
$btn->text='所有宠物';
}
}