595 lines
31 KiB
PHP
595 lines
31 KiB
PHP
<?php
|
|
|
|
namespace App\Admin\Controllers;
|
|
|
|
use Slowlyo\OwlAdmin\Renderers\{Button, Form, Page, TableColumn, TextControl, Component, CRUDTable, Card, Video, DateRangeControl};
|
|
use Slowlyo\OwlAdmin\Controllers\AdminController;
|
|
use App\Services\Admin\DeviceService;
|
|
use App\Models\Device;
|
|
use App\Models\Keyword;
|
|
use App\Admin\Components;
|
|
|
|
class DeviceController extends AdminController
|
|
{
|
|
protected string $serviceName = DeviceService::class;
|
|
|
|
protected string $pageTitle = '设备管理';
|
|
|
|
public function options(){
|
|
$list = $this->service->listQuery()->select(['id as value', 'name as label'])->get();
|
|
|
|
return $this->response()->success($list);
|
|
}
|
|
|
|
public function list(): Page
|
|
{
|
|
$crud = $this->baseCRUD()
|
|
->filterTogglable(false)
|
|
->headerToolbar([
|
|
$this->createButton(true, 'lg'),
|
|
...$this->baseHeaderToolBar(),
|
|
])
|
|
->filter($this->baseFilter()->actions([])->body([
|
|
TextControl::make()->name('name')->label('名称')->size('md'),
|
|
amisMake()->SelectControl()->name('factory')->label('厂家')->options(Keyword::getByParentKey('device-factory')->pluck('name', 'id')->toArray())->size('md'),
|
|
amisMake()->SelectControl()->name('type')->label('类型')->options(Device::typeMap())->size('md'),
|
|
Components::make()->keywordsTagControl('group_tags', '分组', 'device-group')->size('md'),
|
|
Button::make()->label(__('admin.reset'))->actionType('clear-and-submit'),
|
|
amis('submit')->label(__('admin.search'))->level('primary'),
|
|
]))
|
|
->quickSaveItemApi(admin_url('quick-edit/devices/$id'))
|
|
->columns([
|
|
TableColumn::make()->name('id')->label('ID')->sortable(true),
|
|
TableColumn::make()->name('name')->label('名称'),
|
|
TableColumn::make()->name('factory.name')->label('厂家'),
|
|
TableColumn::make()->name('sn')->label('编号'),
|
|
TableColumn::make()->name('type')->type('mapping')->map(Device::typeMap())->label('类型'),
|
|
TableColumn::make()->name('is_enable')->type('switch')->label('显示')->quickEdit(Components::make()->enableControl('is_enable', '', 'inline')->saveImmediately(true)),
|
|
TableColumn::make()->name('is_recommend')->type('switch')->label('推荐')->quickEdit(Components::make()->enableControl('is_recommend', '', 'inline')->saveImmediately(true)),
|
|
TableColumn::make()->name('sort')->label(__('admin.order'))->align('center')->quickEdit(Components::make()->sortControl('sort', __('admin.order'))->saveImmediately(true)),
|
|
TableColumn::make()->name('created_at')->label('创建时间')->type('datetime')->sortable(true),
|
|
TableColumn::make()->name('updated_at')->label('更新时间')->type('datetime')->sortable(true),
|
|
$this->rowActions(true, 'lg'),
|
|
]);
|
|
|
|
return $this->baseList($crud);
|
|
}
|
|
|
|
public function form(): Form
|
|
{
|
|
return $this->baseForm()->body([
|
|
TextControl::make()->name('name')->label('名称')->required(true),
|
|
TextControl::make()->name('sn')->label('编号')->required(true),
|
|
\amisMake()->SelectControl()->name('powered_by')->label('厂家')->options(Keyword::getByParentKey('device-factory')->pluck('name', 'id')->toArray())->required(true),
|
|
TextControl::make()->name('model_sn')->label('型号'),
|
|
\amisMake()->RadiosControl()->name('type')->label('类型')->options(Device::typeMap())->required(true),
|
|
// 监控设备-额外参数
|
|
// rtsp://admin:lcdx12345@172.16.40.2:554/Streaming/Channels/5201
|
|
TextControl::make()->name('extends.rtsp_url')->hiddenOn('data.type != '.Device::TYPE_MONITOR)->label(__('device.rtsp_url')),
|
|
// rtsp://admin:lcdx12345@172.16.40.2:554/Streaming/tracks/5201
|
|
TextControl::make()->name('extends.rtsp_history')->hiddenOn('data.type != '.Device::TYPE_MONITOR)->label(__('device.rtsp_history')),
|
|
|
|
Components::make()->keywordsTagControl('group_tags', '分组', 'device-group'),
|
|
Components::make()->sortControl('sort', __('admin.order')),
|
|
TextControl::make()->name('is_enable')->type('switch')->default(1)->label('显示'),
|
|
TextControl::make()->name('is_recommend')->type('switch')->default(0)->label('推荐'),
|
|
]);
|
|
}
|
|
|
|
public function detail(): Form
|
|
{
|
|
return $this->baseDetail()->body([
|
|
TextControl::make()->static(true)->name('id')->label('ID'),
|
|
TextControl::make()->static(true)->name('name')->label('名称'),
|
|
TextControl::make()->static(true)->name('sn')->label('编号'),
|
|
TextControl::make()->static(true)->name('created_at')->label('创建时间'),
|
|
TextControl::make()->static(true)->name('updated_at')->label('更新时间')
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* 监控设备列表
|
|
*/
|
|
public function monitorList()
|
|
{
|
|
if ($this->actionOfGetData()) {
|
|
return $this->response()->success($this->service->list());
|
|
}
|
|
return CRUDTable::make()
|
|
->mode('cards')
|
|
->hideCheckToggler()
|
|
->columnsCount(3)
|
|
->perPage(6)
|
|
->affixHeader(false)
|
|
->filterTogglable(true)
|
|
->set('primaryField', $this->service->primaryKey())
|
|
->api(admin_url($this->queryPath . '?_action=getData&_type=' . Device::TYPE_MONITOR))
|
|
->footerToolbar(['statistics', 'pagination'])
|
|
->headerToolbar([])
|
|
->filter($this->baseFilter()->actions([])->body([
|
|
TextControl::make()->name('name')->label('点位名称')->size('md'),
|
|
Button::make()->label(__('admin.reset'))->actionType('clear-and-submit'),
|
|
Component::make()->setType('submit')->label(__('admin.search'))->level('primary'),
|
|
]))
|
|
->actions([])
|
|
->itemClassName('col-sm-4')
|
|
->card(Card::make()->header(['title' => '$name'])->body(Video::make()->videoType('video/x-flv')->muted(true)->autoPlay(true)->src('${src}')));
|
|
}
|
|
|
|
/**
|
|
* 监控历史视频
|
|
*/
|
|
public function monitorVideoList()
|
|
{
|
|
if ($this->actionOfGetData()) {
|
|
return $this->response()->success($this->service->list());
|
|
}
|
|
return CRUDTable::make()
|
|
->mode('cards')
|
|
->hideCheckToggler()
|
|
->columnsCount(3)
|
|
->perPage(6)
|
|
->affixHeader(false)
|
|
->filterTogglable(true)
|
|
->set('primaryField', $this->service->primaryKey())
|
|
->api(admin_url($this->queryPath . '?_action=getData&_type=' . Device::TYPE_MONITOR . '&_mode=history'))
|
|
->footerToolbar(['statistics', 'pagination'])
|
|
->headerToolbar([])
|
|
->filter($this->baseFilter()->actions([])->body([
|
|
TextControl::make()->name('name')->label('点位名称')->size('md'),
|
|
DateRangeControl::make()->name('date')->label('日期')->maxDate('now')->size('md'),
|
|
Button::make()->label(__('admin.reset'))->actionType('clear-and-submit'),
|
|
Component::make()->setType('submit')->label(__('admin.search'))->level('primary'),
|
|
]))
|
|
->actions([])
|
|
->itemClassName('col-sm-4')
|
|
->card(Card::make()->header(['title' => '$name'])->body(Video::make()->videoType('video/x-flv')->muted(true)->autoPlay(true)->src('${src}')));
|
|
}
|
|
|
|
/**
|
|
* 气象图表
|
|
*/
|
|
public function meteorologicalChart(){
|
|
$randArr = function () {
|
|
$_arr = [];
|
|
for ($i = 0; $i < 7; $i++) {
|
|
$_arr[] = random_int(10, 200);
|
|
}
|
|
return '[' . implode(',', $_arr) . ']';
|
|
};
|
|
|
|
$random1 = $randArr();
|
|
$random2 = $randArr();
|
|
|
|
return $this->basePage()->title('')->body([
|
|
\amisMake()->grid()->columns([
|
|
\amisMake()->Form()->title('搜索条件')->mode('inline')->body([
|
|
\amisMake()->TextControl()->label('设备名称'),
|
|
\amisMake()->DateRangeControl()->label('时间范围'),
|
|
amis('submit')->label(__('admin.search'))->level('primary'),
|
|
]),
|
|
]),
|
|
\amisMake()->grid()->columns([
|
|
amisMake()->Flex()->items([
|
|
amisMake()->Card()->className('m-r')->body(
|
|
amisMake()->Chart()->config("{
|
|
title:{ text: '空气温度', subtext: '℃'},
|
|
tooltip: { trigger: 'axis' },
|
|
xAxis: { type: 'category', boundaryGap: false, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] },
|
|
yAxis: { type: 'value' },
|
|
grid:{ left: '7%', right:'3%', top: 60, bottom: 30, },
|
|
series: [
|
|
{ name:'空气温度', data: {$random2}, type: 'line', areaStyle: {}, smooth: true, symbol: 'none', },
|
|
]}")
|
|
),
|
|
amisMake()->Card()->className('m-r')->body(
|
|
amisMake()->Chart()->config("{
|
|
title:{ text: '空气湿度', subtext: '%RH'},
|
|
tooltip: { trigger: 'axis' },
|
|
xAxis: { type: 'category', boundaryGap: false, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] },
|
|
yAxis: { type: 'value' },
|
|
grid:{ left: '7%', right:'3%', top: 60, bottom: 30, },
|
|
series: [
|
|
{ name: '空气湿度', data: {$random1}, type: 'line', areaStyle: {}, smooth: true, symbol: 'none', },
|
|
]}")
|
|
),
|
|
amisMake()->Card()->className('m-r')->body(
|
|
amisMake()->Chart()->config("{
|
|
title:{ text: '光照强度LUX', },
|
|
tooltip: { trigger: 'axis' },
|
|
xAxis: { type: 'category', boundaryGap: false, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] },
|
|
yAxis: { type: 'value' },
|
|
grid:{ left: '7%', right:'3%', top: 60, bottom: 30, },
|
|
series: [
|
|
{ name: '光照强度LUX', data: {$random1}, type: 'line', areaStyle: {}, smooth: true, symbol: 'none', },
|
|
]}")
|
|
),
|
|
amisMake()->Card()->body(
|
|
amisMake()->Chart()->config("{
|
|
title:{ text: '光照强度LUX', },
|
|
tooltip: { trigger: 'axis' },
|
|
xAxis: { type: 'category', boundaryGap: false, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] },
|
|
yAxis: { type: 'value' },
|
|
grid:{ left: '7%', right:'3%', top: 60, bottom: 30, },
|
|
series: [
|
|
{ name: '光照强度LUX', data: {$random1}, type: 'line', areaStyle: {}, smooth: true, symbol: 'none', },
|
|
]}")
|
|
),
|
|
]),
|
|
]),
|
|
\amisMake()->grid()->columns([
|
|
amisMake()->Flex()->items([
|
|
amisMake()->Card()->className('m-r')->body(
|
|
amisMake()->Chart()->config("{
|
|
title:{ text: '空气温度', subtext: '℃'},
|
|
tooltip: { trigger: 'axis' },
|
|
xAxis: { type: 'category', boundaryGap: false, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] },
|
|
yAxis: { type: 'value' },
|
|
grid:{ left: '7%', right:'3%', top: 60, bottom: 30, },
|
|
series: [
|
|
{ name:'空气温度', data: {$random2}, type: 'line', areaStyle: {}, smooth: true, symbol: 'none', },
|
|
]}")
|
|
),
|
|
amisMake()->Card()->className('m-r')->body(
|
|
amisMake()->Chart()->config("{
|
|
title:{ text: '空气湿度', subtext: '%RH'},
|
|
tooltip: { trigger: 'axis' },
|
|
xAxis: { type: 'category', boundaryGap: false, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] },
|
|
yAxis: { type: 'value' },
|
|
grid:{ left: '7%', right:'3%', top: 60, bottom: 30, },
|
|
series: [
|
|
{ name: '空气湿度', data: {$random1}, type: 'line', areaStyle: {}, smooth: true, symbol: 'none', },
|
|
]}")
|
|
),
|
|
amisMake()->Card()->className('m-r')->body(
|
|
amisMake()->Chart()->config("{
|
|
title:{ text: '光照强度LUX', },
|
|
tooltip: { trigger: 'axis' },
|
|
xAxis: { type: 'category', boundaryGap: false, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] },
|
|
yAxis: { type: 'value' },
|
|
grid:{ left: '7%', right:'3%', top: 60, bottom: 30, },
|
|
series: [
|
|
{ name: '光照强度LUX', data: {$random1}, type: 'line', areaStyle: {}, smooth: true, symbol: 'none', },
|
|
]}")
|
|
),
|
|
amisMake()->Card()->body(
|
|
amisMake()->Chart()->config("{
|
|
title:{ text: '光照强度LUX', },
|
|
tooltip: { trigger: 'axis' },
|
|
xAxis: { type: 'category', boundaryGap: false, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] },
|
|
yAxis: { type: 'value' },
|
|
grid:{ left: '7%', right:'3%', top: 60, bottom: 30, },
|
|
series: [
|
|
{ name: '光照强度LUX', data: {$random1}, type: 'line', areaStyle: {}, smooth: true, symbol: 'none', },
|
|
]}")
|
|
),
|
|
]),
|
|
]),
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* 水质图表
|
|
*/
|
|
public function waterChart(){
|
|
$randArr = function () {
|
|
$_arr = [];
|
|
for ($i = 0; $i < 7; $i++) {
|
|
$_arr[] = random_int(10, 200);
|
|
}
|
|
return '[' . implode(',', $_arr) . ']';
|
|
};
|
|
|
|
$random1 = $randArr();
|
|
$random2 = $randArr();
|
|
|
|
return $this->basePage()->title('')->body([
|
|
\amisMake()->grid()->columns([
|
|
\amisMake()->Form()->title('搜索条件')->mode('inline')->body([
|
|
\amisMake()->TextControl()->label('设备名称'),
|
|
\amisMake()->DateRangeControl()->label('时间范围'),
|
|
amis('submit')->label(__('admin.search'))->level('primary'),
|
|
]),
|
|
]),
|
|
\amisMake()->grid()->columns([
|
|
amisMake()->Flex()->items([
|
|
amisMake()->Card()->className('m-r')->body(
|
|
amisMake()->Chart()->config("{
|
|
title:{ text: '氯', subtext: 'mg/L'},
|
|
tooltip: { trigger: 'axis' },
|
|
xAxis: { type: 'category', boundaryGap: false, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] },
|
|
yAxis: { type: 'value' },
|
|
grid:{ left: '7%', right:'3%', top: 60, bottom: 30, },
|
|
series: [
|
|
{ name:'氯', data: {$random2}, type: 'line', areaStyle: {}, smooth: true, symbol: 'none', },
|
|
]}")
|
|
),
|
|
amisMake()->Card()->className('m-r')->body(
|
|
amisMake()->Chart()->config("{
|
|
title:{ text: '电导率', subtext: 'us/cm'},
|
|
tooltip: { trigger: 'axis' },
|
|
xAxis: { type: 'category', boundaryGap: false, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] },
|
|
yAxis: { type: 'value' },
|
|
grid:{ left: '7%', right:'3%', top: 60, bottom: 30, },
|
|
series: [
|
|
{ name: '电导率', data: {$random1}, type: 'line', areaStyle: {}, smooth: true, symbol: 'none', },
|
|
]}")
|
|
),
|
|
amisMake()->Card()->className('m-r')->body(
|
|
amisMake()->Chart()->config("{
|
|
title:{ text: '氧气', subtext: 'mg/L'},
|
|
tooltip: { trigger: 'axis' },
|
|
xAxis: { type: 'category', boundaryGap: false, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] },
|
|
yAxis: { type: 'value' },
|
|
grid:{ left: '7%', right:'3%', top: 60, bottom: 30, },
|
|
series: [
|
|
{ name: '光照强度LUX', data: {$random1}, type: 'line', areaStyle: {}, smooth: true, symbol: 'none', },
|
|
]}")
|
|
),
|
|
amisMake()->Card()->body(
|
|
amisMake()->Chart()->config("{
|
|
title:{ text: 'PH'},
|
|
tooltip: { trigger: 'axis' },
|
|
xAxis: { type: 'category', boundaryGap: false, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] },
|
|
yAxis: { type: 'value' },
|
|
grid:{ left: '7%', right:'3%', top: 60, bottom: 30, },
|
|
series: [
|
|
{ name: '光照强度LUX', data: {$random1}, type: 'line', areaStyle: {}, smooth: true, symbol: 'none', },
|
|
]}")
|
|
),
|
|
]),
|
|
]),
|
|
\amisMake()->grid()->columns([
|
|
amisMake()->Flex()->items([
|
|
amisMake()->Card()->className('m-r')->body(
|
|
amisMake()->Chart()->config("{
|
|
title:{ text: '温度', subtext: '℃'},
|
|
tooltip: { trigger: 'axis' },
|
|
xAxis: { type: 'category', boundaryGap: false, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] },
|
|
yAxis: { type: 'value' },
|
|
grid:{ left: '7%', right:'3%', top: 60, bottom: 30, },
|
|
series: [
|
|
{ name:'温度', data: {$random2}, type: 'line', areaStyle: {}, smooth: true, symbol: 'none', },
|
|
]}")
|
|
),
|
|
amisMake()->Card()->body(
|
|
amisMake()->Chart()->config("{
|
|
title:{ text: '浊度', subtext: 'NTU'},
|
|
tooltip: { trigger: 'axis' },
|
|
xAxis: { type: 'category', boundaryGap: false, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] },
|
|
yAxis: { type: 'value' },
|
|
grid:{ left: '7%', right:'3%', top: 60, bottom: 30, },
|
|
series: [
|
|
{ name: '空气湿度', data: {$random1}, type: 'line', areaStyle: {}, smooth: true, symbol: 'none', },
|
|
]}")
|
|
)
|
|
]),
|
|
]),
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* 土壤图表
|
|
*/
|
|
public function soilChart(){
|
|
$randArr = function () {
|
|
$_arr = [];
|
|
for ($i = 0; $i < 7; $i++) {
|
|
$_arr[] = random_int(10, 200);
|
|
}
|
|
return '[' . implode(',', $_arr) . ']';
|
|
};
|
|
|
|
$random1 = $randArr();
|
|
$random2 = $randArr();
|
|
|
|
return $this->basePage()->title('')->body([
|
|
\amisMake()->grid()->columns([
|
|
\amisMake()->Form()->title('搜索条件')->mode('inline')->body([
|
|
\amisMake()->TextControl()->label('设备名称'),
|
|
\amisMake()->DateRangeControl()->label('时间范围'),
|
|
amis('submit')->label(__('admin.search'))->level('primary'),
|
|
]),
|
|
]),
|
|
\amisMake()->grid()->columns([
|
|
amisMake()->Flex()->items([
|
|
amisMake()->Card()->className('m-r')->body(
|
|
amisMake()->Chart()->config("{
|
|
title:{ text: '氯', subtext: 'mg/L'},
|
|
tooltip: { trigger: 'axis' },
|
|
xAxis: { type: 'category', boundaryGap: false, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] },
|
|
yAxis: { type: 'value' },
|
|
grid:{ left: '7%', right:'3%', top: 60, bottom: 30, },
|
|
series: [
|
|
{ name:'氯', data: {$random2}, type: 'line', areaStyle: {}, smooth: true, symbol: 'none', },
|
|
]}")
|
|
),
|
|
amisMake()->Card()->className('m-r')->body(
|
|
amisMake()->Chart()->config("{
|
|
title:{ text: '电导率', subtext: 'us/cm'},
|
|
tooltip: { trigger: 'axis' },
|
|
xAxis: { type: 'category', boundaryGap: false, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] },
|
|
yAxis: { type: 'value' },
|
|
grid:{ left: '7%', right:'3%', top: 60, bottom: 30, },
|
|
series: [
|
|
{ name: '电导率', data: {$random1}, type: 'line', areaStyle: {}, smooth: true, symbol: 'none', },
|
|
]}")
|
|
),
|
|
amisMake()->Card()->className('m-r')->body(
|
|
amisMake()->Chart()->config("{
|
|
title:{ text: '氧气', subtext: 'mg/L'},
|
|
tooltip: { trigger: 'axis' },
|
|
xAxis: { type: 'category', boundaryGap: false, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] },
|
|
yAxis: { type: 'value' },
|
|
grid:{ left: '7%', right:'3%', top: 60, bottom: 30, },
|
|
series: [
|
|
{ name: '光照强度LUX', data: {$random1}, type: 'line', areaStyle: {}, smooth: true, symbol: 'none', },
|
|
]}")
|
|
),
|
|
amisMake()->Card()->body(
|
|
amisMake()->Chart()->config("{
|
|
title:{ text: 'PH'},
|
|
tooltip: { trigger: 'axis' },
|
|
xAxis: { type: 'category', boundaryGap: false, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] },
|
|
yAxis: { type: 'value' },
|
|
grid:{ left: '7%', right:'3%', top: 60, bottom: 30, },
|
|
series: [
|
|
{ name: '光照强度LUX', data: {$random1}, type: 'line', areaStyle: {}, smooth: true, symbol: 'none', },
|
|
]}")
|
|
),
|
|
]),
|
|
]),
|
|
\amisMake()->grid()->columns([
|
|
amisMake()->Flex()->items([
|
|
amisMake()->Card()->className('m-r')->body(
|
|
amisMake()->Chart()->config("{
|
|
title:{ text: '温度', subtext: '℃'},
|
|
tooltip: { trigger: 'axis' },
|
|
xAxis: { type: 'category', boundaryGap: false, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] },
|
|
yAxis: { type: 'value' },
|
|
grid:{ left: '7%', right:'3%', top: 60, bottom: 30, },
|
|
series: [
|
|
{ name:'温度', data: {$random2}, type: 'line', areaStyle: {}, smooth: true, symbol: 'none', },
|
|
]}")
|
|
),
|
|
amisMake()->Card()->body(
|
|
amisMake()->Chart()->config("{
|
|
title:{ text: '浊度', subtext: 'NTU'},
|
|
tooltip: { trigger: 'axis' },
|
|
xAxis: { type: 'category', boundaryGap: false, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] },
|
|
yAxis: { type: 'value' },
|
|
grid:{ left: '7%', right:'3%', top: 60, bottom: 30, },
|
|
series: [
|
|
{ name: '空气湿度', data: {$random1}, type: 'line', areaStyle: {}, smooth: true, symbol: 'none', },
|
|
]}")
|
|
)
|
|
]),
|
|
]),
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* 空气条件设置
|
|
*/
|
|
public function airDetail(){
|
|
return amisMake()->Grid()->columns([
|
|
amisMake()->Wrapper()->sm(6)->body([
|
|
amisMake()->Panel()->title('智能开关设置')
|
|
->labelWidth(100)
|
|
->className('Panel--success')
|
|
->body([
|
|
\amisMake()->Form()->title('')->mode('horizontal')->body([
|
|
amisMake()->FieldSetControl()->title('智能开启')->body([
|
|
\amisMake()->SwitchControl()->name('open_is_enable')->label('开关'),
|
|
\amisMake()->ConditionBuilderControl()->label('条件')->fields([
|
|
[
|
|
'label' => '温度', 'type'=>'number','step'=>'0.01','name'=>'q',
|
|
'operators'=> [
|
|
'equal', 'not_equal', 'less', 'less_or_equal', 'greater', 'greater_or_equal', 'between', 'not_between',
|
|
// 'is_empty', 'is_not_empty'
|
|
]
|
|
],
|
|
[
|
|
'label' => '湿度', 'type'=>'number','step'=>'0.01','name'=>'x',
|
|
'operators'=> [
|
|
'equal', 'not_equal', 'less', 'less_or_equal', 'greater', 'greater_or_equal', 'between', 'not_between',
|
|
// 'is_empty', 'is_not_empty'
|
|
]
|
|
],
|
|
]),
|
|
]),
|
|
amisMake()->FieldSetControl()->title('智能关闭')->body([
|
|
\amisMake()->SwitchControl()->name('close_is_enable')->label('开关'),
|
|
\amisMake()->ConditionBuilderControl()->label('条件')->fields([
|
|
[
|
|
'label' => '温度', 'type'=>'number','step'=>'0.01','name'=>'q',
|
|
'operators'=> [
|
|
'equal', 'not_equal', 'less', 'less_or_equal', 'greater', 'greater_or_equal', 'between', 'not_between',
|
|
// 'is_empty', 'is_not_empty'
|
|
]
|
|
],
|
|
[
|
|
'label' => '湿度', 'type'=>'number','step'=>'0.01','name'=>'x',
|
|
'operators'=> [
|
|
'equal', 'not_equal', 'less', 'less_or_equal', 'greater', 'greater_or_equal', 'between', 'not_between',
|
|
// 'is_empty', 'is_not_empty'
|
|
]
|
|
],
|
|
]),
|
|
]),
|
|
]),
|
|
])
|
|
]),
|
|
amisMake()->Wrapper()->sm(6)->body([
|
|
amisMake()->Panel()->title('开关记录')
|
|
->className('Panel--success')
|
|
->body([
|
|
\amisMake()->Table()->title('')
|
|
->data([
|
|
'items' => [
|
|
[
|
|
'name'=> '温度>10℃',
|
|
'name1'=> '关闭',
|
|
'time1'=> '2023-03-21 10:00:00',
|
|
]
|
|
]
|
|
])
|
|
->columns([
|
|
amisMake()->TableColumn()->name('name')->label('触发条件'),
|
|
amisMake()->TableColumn()->name('name1')->label('状态'),
|
|
amisMake()->TableColumn()->name('time1')->label('执行时间'),
|
|
])
|
|
])
|
|
]),
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* 喷灌
|
|
*/
|
|
public function wasserstrahlDetail(){
|
|
return amisMake()->Grid()->columns([
|
|
amisMake()->Wrapper()->sm(6)->body([
|
|
amisMake()->Panel()->title('智能喷灌设置')
|
|
->subFormMode('horizontal')
|
|
->labelWidth(80)
|
|
->className('Panel--success')
|
|
->body([
|
|
\amisMake()->Form()->title('')->mode('horizontal')->body([
|
|
amisMake()->FieldSetControl()->title('定时喷灌')->body([
|
|
\amisMake()->SwitchControl()->name('is_enable')->label('开关'),
|
|
\amisMake()->ArrayControl()->name('config')->label('定时')->items([
|
|
amisMake()->ComboControl()->items([
|
|
\amisMake()->InputTimeRange(),
|
|
\amisMake()->TextControl()->name('input')->label('喷灌量')->labelWidth(30),
|
|
]),
|
|
]),
|
|
]),
|
|
]),
|
|
])
|
|
]),
|
|
amisMake()->Wrapper()->sm(6)->body([
|
|
amisMake()->Panel()->title('开关记录')
|
|
->className('Panel--success')
|
|
->body([
|
|
\amisMake()->Table()->title('')
|
|
->data([
|
|
'items' => [
|
|
[
|
|
'name'=> '定时喷灌',
|
|
'name1'=> '关闭',
|
|
'time1'=> '2023-03-21 10:00:00',
|
|
]
|
|
]
|
|
])
|
|
->columns([
|
|
amisMake()->TableColumn()->name('name')->label('触发条件'),
|
|
amisMake()->TableColumn()->name('name1')->label('状态'),
|
|
amisMake()->TableColumn()->name('time1')->label('执行时间'),
|
|
])
|
|
])
|
|
]),
|
|
]);
|
|
}
|
|
}
|