init
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\admin\app\controller;
|
||||
|
||||
use plugin\admin\app\service\DeviceUsageService;
|
||||
use support\Response;
|
||||
|
||||
/**
|
||||
* 设备使用情况(参照旧系统 device_details.tpl.html)
|
||||
*/
|
||||
class DeviceUsageController extends Base
|
||||
{
|
||||
private DeviceUsageService $service;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->service = new DeviceUsageService();
|
||||
}
|
||||
|
||||
public function index(): Response
|
||||
{
|
||||
return raw_view('device-usage/index');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备使用情况列表(Layui table 格式,带数据权限)
|
||||
*/
|
||||
public function select(): Response
|
||||
{
|
||||
$params = request()->get();
|
||||
$result = $this->service->getUsageList($params);
|
||||
|
||||
return json([
|
||||
'code' => 0,
|
||||
'msg' => '',
|
||||
'count' => $result['total'],
|
||||
'data' => $result['data'],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备下拉选项(带数据权限,复用 DeviceStatusService)
|
||||
*/
|
||||
public function deviceOptions(): Response
|
||||
{
|
||||
return json(['code' => 0, 'msg' => 'ok', 'data' => $this->service->getDeviceOptions()]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user