92 lines
4.1 KiB
PHP
92 lines
4.1 KiB
PHP
<?php
|
|
|
|
namespace App\Admin\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Slowlyo\OwlAdmin\Renderers\Page;
|
|
use Slowlyo\OwlAdmin\Controllers\AdminController;
|
|
use App\Admin\Components;
|
|
|
|
class CustomRegionController extends AdminController
|
|
{
|
|
protected string $pageTitle = '标题';
|
|
|
|
protected string $queryPath = 'custom-region';
|
|
|
|
public function index()
|
|
{
|
|
$page = $this->basePage()->body([
|
|
\amisMake()->GridNav()->options(
|
|
$this->regionList()
|
|
)
|
|
]);
|
|
|
|
return $this->response()->success($page);
|
|
}
|
|
|
|
private function regionList(){
|
|
$regionList = [
|
|
[
|
|
'id' => 1,
|
|
'name' => '实验田1',
|
|
'cover' => 'https://internal-amis-res.cdn.bcebos.com/images/icon-1.png'
|
|
]
|
|
];
|
|
return array_map(function($region){
|
|
return [
|
|
"icon"=> $region['cover'],
|
|
"text"=> $region['name'],
|
|
'clickAction' => [
|
|
'actionType'=> 'dialog',
|
|
'dialog' => \amisMake()->Dialog()->title($region['name'])
|
|
->size('full')->body([
|
|
\amisMake()->Tabs()->tabsMode('simple')->name('detailTab')->tabs([
|
|
[
|
|
'title' => '基地详情',
|
|
'value' => 'detail',
|
|
'tab'=>\amisMake()->Service()->schemaApi(admin_url('custom-region-detail?type=detail'))
|
|
],
|
|
[//有监控设备才有
|
|
'title' => '监控视频',
|
|
'value' => 'video',
|
|
'tab'=>\amisMake()->Service()->schemaApi(admin_url('custom-region-detail?type=video'))
|
|
],
|
|
[//有气象设备才有
|
|
'title' => '气象数据',
|
|
'value' => 'qixiang',
|
|
'tab'=>\amisMake()->Service()->schemaApi(admin_url('custom-region-detail?type=qixiang'))
|
|
],
|
|
[//有水质设备才有
|
|
'title' => '水质数据',
|
|
'value' => 'shuizi',
|
|
'tab'=>\amisMake()->Service()->schemaApi(admin_url('custom-region-detail?type=shuizi'))
|
|
],
|
|
[//有土壤设备才有
|
|
'title' => '土壤数据',
|
|
'value' => 'turang',
|
|
'tab'=>\amisMake()->Service()->schemaApi(admin_url('custom-region-detail?type=turang'))
|
|
],
|
|
[//有通风设备才有
|
|
'title' => '通风设备',
|
|
'value' => 'tongfeng',
|
|
'tab'=>\amisMake()->Service()->schemaApi(admin_url('custom-region-detail?type=tongfeng'))
|
|
],
|
|
[//有喷灌设备才有
|
|
'title' => '喷灌设备',
|
|
'value' => 'penguan',
|
|
'tab'=>\amisMake()->Service()->schemaApi(admin_url('custom-region-detail?type=penguan'))
|
|
],
|
|
|
|
]),
|
|
])
|
|
]
|
|
];
|
|
}, $regionList);
|
|
}
|
|
|
|
public function regionDetail(Request $request)
|
|
{
|
|
return \amisMake()->Wrapper()->body($request->type ?? '找不到type');
|
|
}
|
|
}
|