This commit is contained in:
MeSHard
2025-12-01 11:19:23 +08:00
parent adc5fd81aa
commit b22d09bd39
4440 changed files with 815952 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
<?php
namespace app\admin\controller\yq\base_config;
use app\common\controller\Backend;
/**
* 载货品类管理
*
* @icon fa fa-circle-o
*/
class Cargo extends Backend
{
/**
* Cargo模型对象
* @var \app\admin\model\yq\base_config\Cargo
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\yq\base_config\Cargo;
$this->view->assign("statusList", $this->model->getStatusList());
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
}

View File

@@ -0,0 +1,37 @@
<?php
namespace app\admin\controller\yq\base_config;
use app\common\controller\Backend;
/**
* A3-1司机服务配置
*
* @icon fa fa-circle-o
*/
class Driver extends Backend
{
/**
* Driver模型对象
* @var \app\admin\model\yq\base_config\Driver
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\yq\base_config\Driver;
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
}

View File

@@ -0,0 +1,62 @@
<?php
namespace app\admin\controller\yq\base_config;
use app\common\controller\Backend;
/**
* A1-1预警处理配置管理
*
* @icon fa fa-circle-o
*/
class Early extends Backend
{
/**
* Early模型对象
* @var \app\admin\model\yq\base_config\Early
*/
protected $model = null;
protected $searchFields = 'early.id,early.name';
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\yq\base_config\Early;
$this->assign('triggerTypeList',$this->model->getTriggerTypeList());
$this->assign('lvList',$this->model->getLvList());
$this->assign('departmentList',$this->model->getDepartmentList());
$this->assign('feedbackTimeList',$this->model->getFeedbackTimeList());
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
public function index()
{
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if (false === $this->request->isAjax()) {
return $this->view->fetch();
}
//如果发送的来源是 Selectpage则转发到 Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
$list = $this->model
->with('type')
->where($where)
->order($sort, $order)
->paginate($limit);
$result = ['total' => $list->total(), 'rows' => $list->items()];
return json($result);
}
}

View File

@@ -0,0 +1,54 @@
<?php
namespace app\admin\controller\yq\base_config;
use app\common\controller\Backend;
/**
* A1-2预警处理配置类型管理
*
* @icon fa fa-circle-o
*/
class EventType extends Backend
{
/**
* Event_type模型对象
* @var \app\admin\model\yq\base_config\EventType
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\yq\base_config\EventType;
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
public function json_index()
{
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if (false === $this->request->isAjax()) {
return $this->view->fetch();
}
//如果发送的来源是 Selectpage则转发到 Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
$list = $this->model
->where($where)
->order($sort, $order)
->paginate($limit);
$result = ['total' => $list->total(), 'rows' => $list->items()];
return json($result['rows']);
}
}

View File

@@ -0,0 +1,247 @@
<?php
namespace app\admin\controller\yq\base_config;
use app\common\controller\Backend;
use think\Db;
use think\exception\PDOException;
use think\exception\ValidateException;
/**
* A2-1周界配置管理
*
* @icon fa fa-circle-o
*/
class Perimeter extends Backend
{
/**
* Perimeter模型对象
* @var \app\admin\model\yq\base_config\Perimeter
*/
protected $model = null;
protected $searchFields = 'perimeter.id,perimeter.name';
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\yq\base_config\Perimeter;
$this->assign('stopList', $this->model->getStopList());
$this->assign('banList', $this->model->getBanList());
$this->assign('hazardList', $this->model->getHazardList());
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
// 周界配置
public function config()
{
if ($this->request->isAjax() && $this->request->isPost()) {
$params = $this->request->post();
if (empty($params['info']) || empty($params['perimeter_id'])) {
$this->error('请先画区域~');
}
$info_arr = json_decode($params['info'], true);
$str = '';
foreach ($info_arr as $key => $value) {
$str .= $value['lng'] . ',' . $value['lat'] . ';';
}
$str = rtrim($str, ';');
// 112.18721,31.052017;112.179486,31.050105;112.176567,31.043561;112.175967,31.036354;112.176911,31.028705;112.17837,31.022527;112.183863,31.017525;112.186695,31.016422;112.193819,31.01576;112.202402,31.015686;112.211243,31.016569;112.220684,31.017893;112.228581,31.02032;112.231671,31.024145;112.233559,31.031426;112.233301,31.038781;112.235104,31.045105;112.23416,31.051944;112.226692,31.054664;112.21871,31.055988;112.209784,31.057679;112.203518,31.059958;112.197424,31.05937;112.190901,31.057679;112.186867,31.05187
halt($str);
$res = \app\admin\model\yq\base_config\Perimeter::update(['info' => $str, 'id' => $params['perimeter_id']]);
if ($res) {
$this->error('设置成功~');
} else {
$this->error('设置失败~');
}
}
if (!$this->model->get(input('ids'))) {
$this->error('数据不存在');
}
$res = $this->model->where('is_del', 1)->order('id')->select();
foreach ($res as $key => &$value) {
switch ($value['region_lv']) {
case 21:
$value['region_lv'] = 1;
break;
case 22:
$value['region_lv'] = 2;
break;
default :
$value['region_lv'] = 0;
break;
}
}
$this->assign('data', json_encode($res));
$this->assign('perimeter_id', input('ids'));
$this->view->engine->layout(false);
return $this->view->fetch();
}
public function index()
{
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if (false === $this->request->isAjax()) {
return $this->view->fetch();
}
//如果发送的来源是 Selectpage则转发到 Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
$list = $this->model
->with(['parent', 'typeo', 'typet'])
->where($where)
->order($sort, $order)
->paginate($limit);
$result = ['total' => $list->total(), 'rows' => $list->items()];
return json($result);
}
public function add()
{
if (false === $this->request->isPost()) {
return $this->view->fetch();
}
$params = $this->request->post('row/a');
if (empty($params)) {
$this->error(__('Parameter %s can not be empty', ''));
}
$params = $this->preExcludeFields($params);
if (!$params['region_lv'] || $params['region_lv'] == '') {
$this->error('请选择周界等级~');
}
if (!$params['region_type'] || $params['region_type'] == '') {
$this->error('请选择周界区域~');
}
if ($params['region_lv'] == 21) {
if (empty($params['pid'])) {
$this->error('当前为三级周界等级,请选择二级周界~');
}
if (empty($params['stop_vehicle']) && $params['stop_vehicle'] != 0) {
$this->error('当前为三级周界等级,请设置可停车辆数~');
}
if (empty($params['feasible_vehicle']) && $params['feasible_vehicle'] != 0) {
$this->error('当前为三级周界等级,请设置可行车辆数~');
}
if (empty($params['max_speed']) && $params['max_speed'] != 0) {
$this->error('当前为三级周界等级,请设置最大限速~');
}
}
if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
$params[$this->dataLimitField] = $this->auth->id;
}
$result = false;
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
$this->model->validateFailException()->validate($validate);
}
$result = $this->model->allowField(true)->save($params);
Db::commit();
} catch (ValidateException|PDOException|Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($result === false) {
$this->error(__('No rows were inserted'));
}
$this->success();
}
public function edit($ids = null)
{
$row = $this->model->get($ids);
if (!$row) {
$this->error(__('No Results were found'));
}
$adminIds = $this->getDataLimitAdminIds();
if (is_array($adminIds) && !in_array($row[$this->dataLimitField], $adminIds)) {
$this->error(__('You have no permission'));
}
if (false === $this->request->isPost()) {
$this->view->assign('row', $row);
return $this->view->fetch();
}
$params = $this->request->post('row/a');
if (empty($params)) {
$this->error(__('Parameter %s can not be empty', ''));
}
$params = $this->preExcludeFields($params);
if (!$params['region_lv'] || $params['region_lv'] == '') {
$this->error('请选择周界等级~');
}
if (!$params['region_type'] || $params['region_type'] == '') {
$this->error('请选择周界区域~');
}
if ($params['region_lv'] == 21) {
if (empty($params['pid'])) {
$this->error('当前为三级周界等级,请选择二级周界~');
}
if (empty($params['stop_vehicle']) && $params['stop_vehicle'] != 0) {
$this->error('当前为三级周界等级,请设置可停车辆数~');
}
if (empty($params['feasible_vehicle']) && $params['feasible_vehicle'] != 0) {
$this->error('当前为三级周界等级,请设置可行车辆数~');
}
if (empty($params['max_speed']) && $params['max_speed'] != 0) {
$this->error('当前为三级周界等级,请设置最大限速~');
}
}
$result = false;
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
$row->validateFailException()->validate($validate);
}
$result = $row->allowField(true)->save($params);
Db::commit();
} catch (ValidateException|PDOException|Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if (false === $result) {
$this->error(__('No rows were updated'));
}
$this->success();
}
}

View File

@@ -0,0 +1,106 @@
<?php
namespace app\admin\controller\yq\base_config;
use app\common\controller\Backend;
use fast\Tree;
/**
* A2-2周界类型管理
*
* @icon fa fa-circle-o
*/
class PerimeterType extends Backend
{
/**
* Perimeter_type模型对象
* @var \app\admin\model\yq\base_config\PerimeterType
*/
protected $model = null;
protected $rulelist = [];
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\yq\base_config\PerimeterType;
// 必须将结果集转换为数组
$ruleList = \think\Db::name("perimeter_type")->order('sort DESC,id ASC')->select();
foreach ($ruleList as $k => &$v) {
$v['name'] = __($v['name']);
}
unset($v);
Tree::instance()->init($ruleList)->icon = ['&nbsp;&nbsp;&nbsp;&nbsp;', '&nbsp;&nbsp;&nbsp;&nbsp;', '&nbsp;&nbsp;&nbsp;&nbsp;'];
$this->rulelist = Tree::instance()->getTreeList(Tree::instance()->getTreeArray(0), 'name');
$ruledata = [0 => __('None')];
foreach ($this->rulelist as $k => &$v) {
$ruledata[$v['id']] = $v['name'];
unset($v['spacer']);
}
unset($v);
$this->view->assign('ruledata', $ruledata);
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
public function index()
{
if ($this->request->isAjax()) {
$list = $this->rulelist;
$total = count($this->rulelist);
$result = array("total" => $total, "rows" => $list);
return json($result);
}
return $this->view->fetch();
}
// 联动获取周界等级
public function type()
{
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if (false === $this->request->isAjax()) {
return $this->view->fetch();
}
//如果发送的来源是 Selectpage则转发到 Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
$new_where = [];
$new_where['is_del'] = ['=', 1];
$params = $this->request->param();
if (isset($params['pid']) && !empty($params['pid'])) {
$new_where['pid'] = ['=', $params['pid']];
} else {
$new_where['pid'] = ['=', 0];
}
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
$list = $this->model
->where($where)
->where($new_where)
->order('sort', 'asc')
->paginate($limit);
$result = ['total' => $list->total(), 'rows' => $list->items()];
$data = [];
foreach ($result['rows'] as $k => $v) {
$data[] = [
'name' => $v['name'],
'value' => $v['id']
];
}
return json(['code' => 1, 'data' => $data]);
}
}