新增旁站等级内容

This commit is contained in:
weiz 2024-02-27 15:17:14 +08:00
parent c4990ab1c1
commit e83f361589
15 changed files with 1643 additions and 0 deletions

View File

@ -0,0 +1,108 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\controller\supervision_work;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\supervision_work\SupervisionSideStationLists;
use app\adminapi\logic\supervision_work\SupervisionSideStationLogic;
use app\adminapi\validate\supervision_work\SupervisionSideStationValidate;
/**
* 工程监理--旁站登记控制器
* Class SupervisionSideStationController
* @package app\adminapi\controller\supervision_work
*/
class SupervisionSideStationController extends BaseAdminController
{
/**
* @notes 获取工程监理--旁站登记列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/27 13:58
*/
public function lists()
{
return $this->dataLists(new SupervisionSideStationLists());
}
/**
* @notes 添加工程监理--旁站登记
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/27 13:58
*/
public function add()
{
$params = (new SupervisionSideStationValidate())->post()->goCheck('add');
$result = SupervisionSideStationLogic::add($params,$this->adminId);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(SupervisionSideStationLogic::getError());
}
/**
* @notes 编辑工程监理--旁站登记
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/27 13:58
*/
public function edit()
{
$params = (new SupervisionSideStationValidate())->post()->goCheck('edit');
$result = SupervisionSideStationLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(SupervisionSideStationLogic::getError());
}
/**
* @notes 删除工程监理--旁站登记
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/27 13:58
*/
public function delete()
{
$params = (new SupervisionSideStationValidate())->post()->goCheck('delete');
SupervisionSideStationLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取工程监理--旁站登记详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/27 13:58
*/
public function detail()
{
$params = (new SupervisionSideStationValidate())->goCheck('detail');
$result = SupervisionSideStationLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,108 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\controller\supervision_work;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\supervision_work\SupervisionSideStationProblemLists;
use app\adminapi\logic\supervision_work\SupervisionSideStationProblemLogic;
use app\adminapi\validate\supervision_work\SupervisionSideStationProblemValidate;
/**
* 工程监理--旁站问题控制器
* Class SupervisionSideStationProblemController
* @package app\adminapi\controller\supervision_work
*/
class SupervisionSideStationProblemController extends BaseAdminController
{
/**
* @notes 获取工程监理--旁站问题列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/27 13:58
*/
public function lists()
{
return $this->dataLists(new SupervisionSideStationProblemLists());
}
/**
* @notes 添加工程监理--旁站问题
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/27 13:58
*/
public function add()
{
$params = (new SupervisionSideStationProblemValidate())->post()->goCheck('add');
$result = SupervisionSideStationProblemLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(SupervisionSideStationProblemLogic::getError());
}
/**
* @notes 编辑工程监理--旁站问题
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/27 13:58
*/
public function edit()
{
$params = (new SupervisionSideStationProblemValidate())->post()->goCheck('edit');
$result = SupervisionSideStationProblemLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(SupervisionSideStationProblemLogic::getError());
}
/**
* @notes 删除工程监理--旁站问题
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/27 13:58
*/
public function delete()
{
$params = (new SupervisionSideStationProblemValidate())->post()->goCheck('delete');
SupervisionSideStationProblemLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取工程监理--旁站问题详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/27 13:58
*/
public function detail()
{
$params = (new SupervisionSideStationProblemValidate())->goCheck('detail');
$result = SupervisionSideStationProblemLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,108 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\controller\supervision_work;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\supervision_work\SupervisionSideStationResultLists;
use app\adminapi\logic\supervision_work\SupervisionSideStationResultLogic;
use app\adminapi\validate\supervision_work\SupervisionSideStationResultValidate;
/**
* 工程监理--旁站结果控制器
* Class SupervisionSideStationResultController
* @package app\adminapi\controller\supervision_work
*/
class SupervisionSideStationResultController extends BaseAdminController
{
/**
* @notes 获取工程监理--旁站结果列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/27 13:58
*/
public function lists()
{
return $this->dataLists(new SupervisionSideStationResultLists());
}
/**
* @notes 添加工程监理--旁站结果
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/27 13:58
*/
public function add()
{
$params = (new SupervisionSideStationResultValidate())->post()->goCheck('add');
$result = SupervisionSideStationResultLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(SupervisionSideStationResultLogic::getError());
}
/**
* @notes 编辑工程监理--旁站结果
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/27 13:58
*/
public function edit()
{
$params = (new SupervisionSideStationResultValidate())->post()->goCheck('edit');
$result = SupervisionSideStationResultLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(SupervisionSideStationResultLogic::getError());
}
/**
* @notes 删除工程监理--旁站结果
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/27 13:58
*/
public function delete()
{
$params = (new SupervisionSideStationResultValidate())->post()->goCheck('delete');
SupervisionSideStationResultLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取工程监理--旁站结果详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/27 13:58
*/
public function detail()
{
$params = (new SupervisionSideStationResultValidate())->goCheck('detail');
$result = SupervisionSideStationResultLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,94 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\lists\supervision_work;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\auth\Admin;
use app\common\model\supervision_project\SupervisionParticipatingUnits;
use app\common\model\supervision_project\SupervisionProject;
use app\common\model\supervision_work\SupervisionCheckItem;
use app\common\model\supervision_work\SupervisionSideStation;
use app\common\lists\ListsSearchInterface;
/**
* 工程监理--旁站登记列表
* Class SupervisionSideStationLists
* @package app\adminapi\listssupervision_work
*/
class SupervisionSideStationLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/02/27 13:58
*/
public function setSearch(): array
{
return [
'=' => ['project_id', 'side_station_type'],
'%like%' => ['side_station_code'],
];
}
/**
* @notes 获取工程监理--旁站登记列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/02/27 13:58
*/
public function lists(): array
{
return SupervisionSideStation::withoutField('update_time,delete_time')->where($this->searchWhere)
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function($data){
$project = SupervisionProject::field('project_name')->where('id',$data['project_id'])->findOrEmpty();
$check_item = SupervisionCheckItem::field('node_name')->where('id',$data['check_item_id'])->findOrEmpty();
$company = SupervisionParticipatingUnits::field('unit_name')->where('id',$data['company_id'])->findOrEmpty();
$check_item_detail = SupervisionCheckItem::where('id','in',$data['check_item_detail_ids'])->column('node_name');
$create_user = Admin::field('name')->where('id',$data['create_user'])->findOrEmpty();
$data['project_name'] = $project['project_name'];
$data['check_item_name'] = $check_item['node_name'];
$data['company_name'] = $company['unit_name'];
$data['check_item_detail_name'] = implode(',',$check_item_detail);
$data['create_user_name'] = $create_user['name'];
$data['side_station_type_text'] = $data->side_station_type_text;
$data['side_station_result_text'] = $data->side_station_result_text;
})
->toArray();
}
/**
* @notes 获取工程监理--旁站登记数量
* @return int
* @author likeadmin
* @date 2024/02/27 13:58
*/
public function count(): int
{
return SupervisionSideStation::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,76 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\lists\supervision_work;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\supervision_work\SupervisionSideStationProblem;
use app\common\lists\ListsSearchInterface;
/**
* 工程监理--旁站问题列表
* Class SupervisionSideStationProblemLists
* @package app\adminapi\listssupervision_work
*/
class SupervisionSideStationProblemLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/02/27 13:58
*/
public function setSearch(): array
{
return [
'=' => ['side_station_id'],
];
}
/**
* @notes 获取工程监理--旁站问题列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/02/27 13:58
*/
public function lists(): array
{
return SupervisionSideStationProblem::withoutField('create_time,update_time,delete_time')->where($this->searchWhere)
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取工程监理--旁站问题数量
* @return int
* @author likeadmin
* @date 2024/02/27 13:58
*/
public function count(): int
{
return SupervisionSideStationProblem::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,79 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\lists\supervision_work;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\supervision_work\SupervisionSideStationResult;
use app\common\lists\ListsSearchInterface;
/**
* 工程监理--旁站结果列表
* Class SupervisionSideStationResultLists
* @package app\adminapi\listssupervision_work
*/
class SupervisionSideStationResultLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/02/27 13:58
*/
public function setSearch(): array
{
return [
'=' => ['side_station_id', 'must_check', 'check_result'],
];
}
/**
* @notes 获取工程监理--旁站结果列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/02/27 13:58
*/
public function lists(): array
{
return SupervisionSideStationResult::withoutField('create_time,update_time,delete_time')->where($this->searchWhere)
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function($data){
$data['must_check_text'] = $data->must_check_text;
$data['check_result_text'] = $data->check_result_text;
})
->toArray();
}
/**
* @notes 获取工程监理--旁站结果数量
* @return int
* @author likeadmin
* @date 2024/02/27 13:58
*/
public function count(): int
{
return SupervisionSideStationResult::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,225 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\logic\supervision_work;
use app\common\model\auth\Admin;
use app\common\model\supervision_project\SupervisionParticipatingUnits;
use app\common\model\supervision_project\SupervisionProject;
use app\common\model\supervision_work\SupervisionCheckItem;
use app\common\model\supervision_work\SupervisionSideStation;
use app\common\logic\BaseLogic;
use app\common\model\supervision_work\SupervisionSideStationProblem;
use app\common\model\supervision_work\SupervisionSideStationResult;
use think\facade\Db;
/**
* 工程监理--旁站登记逻辑
* Class SupervisionSideStationLogic
* @package app\adminapi\logic\supervision_work
*/
class SupervisionSideStationLogic extends BaseLogic
{
/**
* @notes 添加工程监理--旁站登记
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/02/27 13:58
*/
public static function add(array $params,$admin_id): bool
{
Db::startTrans();
try {
$res = SupervisionSideStation::create([
'project_id' => $params['project_id'],
'side_station_code' => data_unique_code('PZ'),
'side_station_type' => $params['side_station_type'],
'check_item_id' => $params['check_item_id'],
'position' => $params['position'],
'company_id' => $params['company_id'],
'start_time' => !empty($params['start_time']) ? strtotime($params['start_time']) : 0,
'end_time' => !empty($params['end_time']) ? strtotime($params['end_time']) : 0,
'workers' => $params['workers'],
'managers' => $params['managers'],
'situation' => $params['situation'],
'side_station_result' => $params['side_station_result'],
'side_station_user' => $params['side_station_user'],
'check_item_detail_ids' => $params['check_item_detail_ids'] ? json_encode($params['check_item_detail_ids']) : null,
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
'create_user' => $admin_id
]);
if(!empty($params['side_result'])){
foreach($params['side_result'] as $v){
SupervisionSideStationResult::create([
'side_station_id' => $res->id,
'check_type' => $v['check_type'],
'check_content' => $v['check_content'],
'must_check' => $v['must_check'],
'check_result' => $v['check_result']
]);
}
}
if(!empty($params['side_problem'])){
foreach($params['side_problem'] as $v){
SupervisionSideStationProblem::create([
'side_station_id' => $res->id,
'problem_cate' => $v['problem_cate'],
'problem_description' => $v['problem_description'],
'problem_name' => $v['problem_name'],
]);
}
}
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑工程监理--旁站登记
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/02/27 13:58
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
SupervisionSideStation::where('id', $params['id'])->update([
'project_id' => $params['project_id'],
'side_station_type' => $params['side_station_type'],
'check_item_id' => $params['check_item_id'],
'position' => $params['position'],
'company_id' => $params['company_id'],
'start_time' => !empty($params['start_time']) ? strtotime($params['start_time']) : 0,
'end_time' => !empty($params['end_time']) ? strtotime($params['end_time']) : 0,
'workers' => $params['workers'],
'managers' => $params['managers'],
'situation' => $params['situation'],
'side_station_result' => $params['side_station_result'],
'side_station_user' => $params['side_station_user'],
'check_item_detail_ids' => $params['check_item_detail_ids'] ? json_encode($params['check_item_detail_ids']) : null,
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
'update_time' => time(),
]);
if(!empty($params['side_result'])){
foreach($params['side_result'] as $v){
if(!empty($v['id'])){
SupervisionSideStationResult::where('id',$v['id'])->update([
'side_station_id' => $params['id'],
'check_type' => $v['check_type'],
'check_content' => $v['check_content'],
'must_check' => $v['must_check'],
'check_result' => $v['check_result'],
'update_time' => time(),
]);
}else{
SupervisionSideStationResult::create([
'side_station_id' => $params['id'],
'check_type' => $v['check_type'],
'check_content' => $v['check_content'],
'must_check' => $v['must_check'],
'check_result' => $v['check_result']
]);
}
}
}
if(!empty($params['side_problem'])){
foreach($params['side_problem'] as $v){
if(!empty($v['id'])){
SupervisionSideStationProblem::where('id',$v['id'])->update([
'side_station_id' => $params['id'],
'problem_cate' => $v['problem_cate'],
'problem_description' => $v['problem_description'],
'problem_name' => $v['problem_name'],
'update_time' => time(),
]);
}else{
SupervisionSideStationProblem::create([
'side_station_id' => $params['id'],
'problem_cate' => $v['problem_cate'],
'problem_description' => $v['problem_description'],
'problem_name' => $v['problem_name'],
]);
}
}
}
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除工程监理--旁站登记
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/02/27 13:58
*/
public static function delete(array $params): bool
{
$side_station_result = SupervisionSideStationResult::where('side_station_id',$params['id'])->findOrEmpty();
if(!$side_station_result->isEmpty()){
self::setError('该旁站内容下存在旁站结果数据,请先删除旁站结果数据');
return false;
}
$side_station_problem = SupervisionSideStationProblem::where('side_station_id',$params['id'])->findOrEmpty();
if(!$side_station_problem->isEmpty()){
self::setError('该旁站内容下存在旁站问题数据,请先删除旁站问题数据');
return false;
}
return SupervisionSideStation::destroy($params['id']);
}
/**
* @notes 获取工程监理--旁站登记详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/02/27 13:58
*/
public static function detail($params): array
{
$data = SupervisionSideStation::withoutField('update_time,delete_time')->findOrEmpty($params['id']);
$project = SupervisionProject::field('project_name')->where('id',$data['project_id'])->findOrEmpty();
$check_item = SupervisionCheckItem::field('node_name')->where('id',$data['check_item_id'])->findOrEmpty();
$company = SupervisionParticipatingUnits::field('unit_name')->where('id',$data['company_id'])->findOrEmpty();
$check_item_detail = SupervisionCheckItem::where('id','in',$data['check_item_detail_ids'])->column('node_name');
$create_user = Admin::field('name')->where('id',$data['create_user'])->findOrEmpty();
$data['project_name'] = $project['project_name'];
$data['check_item_name'] = $check_item['node_name'];
$data['company_name'] = $company['unit_name'];
$data['check_item_detail_name'] = implode(',',$check_item_detail);
$data['create_user_name'] = $create_user['name'];
$data['side_station_type_text'] = $data->side_station_type_text;
$data['side_station_result_text'] = $data->side_station_result_text;
return $data->toArray();
}
}

View File

@ -0,0 +1,111 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\logic\supervision_work;
use app\common\model\supervision_work\SupervisionSideStationProblem;
use app\common\logic\BaseLogic;
use think\facade\Db;
/**
* 工程监理--旁站问题逻辑
* Class SupervisionSideStationProblemLogic
* @package app\adminapi\logic\supervision_work
*/
class SupervisionSideStationProblemLogic extends BaseLogic
{
/**
* @notes 添加工程监理--旁站问题
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/02/27 13:58
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
SupervisionSideStationProblem::create([
'side_station_id' => $params['side_station_id'],
'problem_cate' => $params['problem_cate'],
'problem_description' => $params['problem_description'],
'problem_name' => $params['problem_name']
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑工程监理--旁站问题
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/02/27 13:58
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
SupervisionSideStationProblem::where('id', $params['id'])->update([
'side_station_id' => $params['side_station_id'],
'problem_cate' => $params['problem_cate'],
'problem_description' => $params['problem_description'],
'problem_name' => $params['problem_name'],
'update_time' => time(),
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除工程监理--旁站问题
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/02/27 13:58
*/
public static function delete(array $params): bool
{
return SupervisionSideStationProblem::destroy($params['id']);
}
/**
* @notes 获取工程监理--旁站问题详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/02/27 13:58
*/
public static function detail($params): array
{
return SupervisionSideStationProblem::withoutField('create_time,update_time,delete_time')->findOrEmpty($params['id'])->toArray();
}
}

View File

@ -0,0 +1,116 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\logic\supervision_work;
use app\common\model\supervision_work\SupervisionSideStationResult;
use app\common\logic\BaseLogic;
use think\facade\Db;
/**
* 工程监理--旁站结果逻辑
* Class SupervisionSideStationResultLogic
* @package app\adminapi\logic\supervision_work
*/
class SupervisionSideStationResultLogic extends BaseLogic
{
/**
* @notes 添加工程监理--旁站结果
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/02/27 13:58
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
SupervisionSideStationResult::create([
'side_station_id' => $params['side_station_id'],
'check_type' => $params['check_type'],
'check_content' => $params['check_content'],
'must_check' => $params['must_check'],
'check_result' => $params['check_result']
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑工程监理--旁站结果
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/02/27 13:58
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
SupervisionSideStationResult::where('id', $params['id'])->update([
'side_station_id' => $params['side_station_id'],
'check_type' => $params['check_type'],
'check_content' => $params['check_content'],
'must_check' => $params['must_check'],
'check_result' => $params['check_result'],
'update_time' => time(),
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除工程监理--旁站结果
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/02/27 13:58
*/
public static function delete(array $params): bool
{
return SupervisionSideStationResult::destroy($params['id']);
}
/**
* @notes 获取工程监理--旁站结果详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/02/27 13:58
*/
public static function detail($params): array
{
$data = SupervisionSideStationResult::withoutField('create_time,update_time,delete_time')->findOrEmpty($params['id']);
$data['must_check_text'] = $data->must_check_text;
$data['check_result_text'] = $data->check_result_text;
return $data->toArray();
}
}

View File

@ -0,0 +1,122 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\validate\supervision_work;
use app\common\model\supervision_work\SupervisionSideStation;
use app\common\model\supervision_work\SupervisionSideStationProblem;
use app\common\validate\BaseValidate;
/**
* 工程监理--旁站问题验证器
* Class SupervisionSideStationProblemValidate
* @package app\adminapi\validate\supervision_work
*/
class SupervisionSideStationProblemValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require|checkData',
'side_station_id' => 'require|checkSideStation',
'problem_cate' => 'require',
'problem_description' => 'require',
'problem_name' => 'require',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'side_station_id' => '旁站id',
'problem_cate' => '问题分类',
'problem_description' => '问题说明',
'problem_name' => '问题名称',
];
/**
* @notes 添加场景
* @return SupervisionSideStationProblemValidate
* @author likeadmin
* @date 2024/02/27 13:58
*/
public function sceneAdd()
{
return $this->only(['side_station_id','problem_cate','problem_description','problem_name']);
}
/**
* @notes 编辑场景
* @return SupervisionSideStationProblemValidate
* @author likeadmin
* @date 2024/02/27 13:58
*/
public function sceneEdit()
{
return $this->only(['id','side_station_id','problem_cate','problem_description','problem_name']);
}
/**
* @notes 删除场景
* @return SupervisionSideStationProblemValidate
* @author likeadmin
* @date 2024/02/27 13:58
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return SupervisionSideStationProblemValidate
* @author likeadmin
* @date 2024/02/27 13:58
*/
public function sceneDetail()
{
return $this->only(['id']);
}
public function checkData($value): bool|string
{
$data = SupervisionSideStationProblem::where('id',$value)->findOrEmpty();
if($data->isEmpty()){
return '数据不存在';
}
return true;
}
public function checkInspection($value): bool|string
{
$data = SupervisionSideStation::where('id',$value)->findOrEmpty();
if($data->isEmpty()){
return '旁站信息不存在';
}
return true;
}
}

View File

@ -0,0 +1,124 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\validate\supervision_work;
use app\common\model\supervision_work\SupervisionSideStation;
use app\common\model\supervision_work\SupervisionSideStationResult;
use app\common\validate\BaseValidate;
/**
* 工程监理--旁站结果验证器
* Class SupervisionSideStationResultValidate
* @package app\adminapi\validate\supervision_work
*/
class SupervisionSideStationResultValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require|checkData',
'side_station_id' => 'require|checkSideStation',
'check_type' => 'require',
'check_content' => 'require',
'must_check' => 'require|in:0,1',
'check_result' => 'require|in:0,1',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'side_station_id' => '旁站id',
'check_type' => '检查类别',
'check_content' => '检查内容',
'must_check' => '是否必检',
'check_result' => '检查结果',
];
/**
* @notes 添加场景
* @return SupervisionSideStationResultValidate
* @author likeadmin
* @date 2024/02/27 13:58
*/
public function sceneAdd()
{
return $this->only(['side_station_id','check_type','check_content','must_check','check_result']);
}
/**
* @notes 编辑场景
* @return SupervisionSideStationResultValidate
* @author likeadmin
* @date 2024/02/27 13:58
*/
public function sceneEdit()
{
return $this->only(['id','side_station_id','check_type','check_content','must_check','check_result']);
}
/**
* @notes 删除场景
* @return SupervisionSideStationResultValidate
* @author likeadmin
* @date 2024/02/27 13:58
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return SupervisionSideStationResultValidate
* @author likeadmin
* @date 2024/02/27 13:58
*/
public function sceneDetail()
{
return $this->only(['id']);
}
public function checkData($value): bool|string
{
$data = SupervisionSideStationResult::where('id',$value)->findOrEmpty();
if($data->isEmpty()){
return '数据不存在';
}
return true;
}
public function checkSideStation($value): bool|string
{
$data = SupervisionSideStation::where('id',$value)->findOrEmpty();
if($data->isEmpty()){
return '旁站信息不存在';
}
return true;
}
}

View File

@ -0,0 +1,231 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\validate\supervision_work;
use app\common\model\dict\DictData;
use app\common\model\supervision_project\SupervisionParticipatingUnits;
use app\common\model\supervision_project\SupervisionProject;
use app\common\model\supervision_work\SupervisionCheckItem;
use app\common\model\supervision_work\SupervisionSideStation;
use app\common\model\supervision_work\SupervisionSideStationProblem;
use app\common\model\supervision_work\SupervisionSideStationResult;
use app\common\validate\BaseValidate;
/**
* 工程监理--旁站登记验证器
* Class SupervisionSideStationValidate
* @package app\adminapi\validate\supervision_work
*/
class SupervisionSideStationValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require|checkData',
'project_id' => 'require|checkProject',
'side_station_type' => 'require|checkSideStationType',
'check_item_id' => 'require|checkCheckItem',
'company_id' => 'checkCompany',
'start_time' => 'require|dateFormat:Y-m-d H:i:s',
'end_time' => 'require|dateFormat:Y-m-d H:i:s',
'workers' => 'integer',
'managers' => 'integer',
'side_station_result' => 'in:0,1',
'check_item_detail_ids' => 'checkCheckItemDetail',
'annex' => 'checkAnnex',
'side_result' => 'checkSideResult',
'side_problem' => 'checkSideProblem'
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'project_id' => '项目id',
'side_station_code' => '旁站编号',
'side_station_type' => '旁站类型',
'check_item_id' => '单位工程',
'position' => '部位',
'company_id' => '施工单位',
'start_time' => '旁站开始时间',
'end_time' => '旁站结束时间',
'workers' => '施工人数',
'managers' => '管理人数',
'situation' => '现场施工情况',
'side_station_result' => '旁站结果 0-完成 1-交班',
'side_station_user' => '旁站人员',
'create_user' => '创建人',
];
/**
* @notes 添加场景
* @return SupervisionSideStationValidate
* @author likeadmin
* @date 2024/02/27 13:58
*/
public function sceneAdd()
{
return $this->remove('id',true);
}
/**
* @notes 编辑场景
* @return SupervisionSideStationValidate
* @author likeadmin
* @date 2024/02/27 13:58
*/
public function sceneEdit()
{}
/**
* @notes 删除场景
* @return SupervisionSideStationValidate
* @author likeadmin
* @date 2024/02/27 13:58
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return SupervisionSideStationValidate
* @author likeadmin
* @date 2024/02/27 13:58
*/
public function sceneDetail()
{
return $this->only(['id']);
}
public function checkData($value): bool|string
{
$data = SupervisionSideStation::where('id',$value)->findOrEmpty();
if($data->isEmpty()){
return '数据不存在';
}
return true;
}
public function checkProject($value): bool|string
{
$data = SupervisionProject::where('id',$value)->findOrEmpty();
if($data->isEmpty()){
return '项目信息不存在';
}
return true;
}
public function checkSideStationType($value): bool|string
{
$dict = DictData::where('type_value','side_station_type')->column('value');
if(!in_array($value,$dict)){
return '旁站类型数据值无效';
}
return true;
}
public function checkCheckItem($value,$rule,$params): bool|string
{
$data = SupervisionCheckItem::where('id',$value)->where('project_id',$params['project_id'])->where('node_type',2)->findOrEmpty();
if($data->isEmpty()){
return '单位工程数据不存在';
}
return true;
}
public function checkCompany($value,$rule,$params): bool|string
{
$data = SupervisionParticipatingUnits::where('id',$value)->where('project_id',$params['project_id'])->findOrEmpty();
if($data->isEmpty()){
return '施工单位信息不存在';
}
return true;
}
public function checkCheckItemDetail($value,$rule,$params): bool|string
{
if(!isset($value) || $value == '') return true;
if(!is_array($value)) return '检查表单选择数据格式错误';
foreach($value as $v){
$data = SupervisionCheckItem::where('id',$v)->where('project_id',$params['project_id'])->findOrEmpty();
if($data->isEmpty()){
return '检查项节点数据不存在';
}
}
return true;
}
public function checkAnnex($value): bool|string
{
if(!empty($value) && $value != '' && !is_array($value)){
return '附件格式错误';
}
return true;
}
public function checkSideResult($value): bool|string
{
if(!isset($value) || $value == '') return true;
if(!is_array($value)) return '旁站结果数据格式错误';
foreach($value as $k=>$v){
if(!empty($v['id'])){
$data = SupervisionSideStationResult::where('id',$v['id'])->findOrEmpty();
if($data->isEmpty()){
return '旁站结果列表第'.($k+1).'行数据不存在';
}
}
if(empty($v['check_type'])) return '旁站结果列表第'.($k+1).'行检查类别为空';
if(empty($v['check_content'])) return '旁站结果列表第'.($k+1).'行检查内容为空';
if(!isset($v['must_check']) || $v['must_check'] == '') return '旁站结果列表第'.($k+1).'行是否必检为空';
if(!in_array($v['must_check'],[0,1])) return '旁站结果列表第'.($k+1).'行是否必检数据值无效';
if(!isset($v['check_result']) || $v['check_result'] == '') return '旁站结果列表第'.($k+1).'行检查结果为空';
if(!in_array($v['check_result'],[0,1])) return '旁站结果列表第'.($k+1).'行检查结果数据值无效';
}
return true;
}
public function checkSideProblem($value): bool|string
{
if(!isset($value) || $value == '') return true;
if(!is_array($value)) return '旁站问题数据格式错误';
foreach($value as $k=>$v){
if(!empty($v['id'])){
$data = SupervisionSideStationProblem::where('id',$v['id'])->findOrEmpty();
if($data->isEmpty()){
return '旁站问题列表第'.($k+1).'行数据不存在';
}
}
if(empty($v['problem_cate'])) return '旁站问题列表第'.($k+1).'行问题分类为空';
if(empty($v['problem_description'])) return '旁站问题列表第'.($k+1).'行问题说明为空';
if(empty($v['problem_name'])) return '旁站问题列表第'.($k+1).'行问题名称为空';
}
return true;
}
}

View File

@ -0,0 +1,63 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\supervision_work;
use app\common\model\BaseModel;
use app\common\model\dict\DictData;
use think\model\concern\SoftDelete;
/**
* 工程监理--旁站登记模型
* Class SupervisionSideStation
* @package app\common\model\supervision_work
*/
class SupervisionSideStation extends BaseModel
{
use SoftDelete;
protected $name = 'supervision_side_station';
protected $deleteTime = 'delete_time';
public function getAnnexAttr($value)
{
return !empty($value) ? json_decode($value,true) : '';
}
public function getCheckItemDetailIdsAttr($value)
{
return !empty($value) ? json_decode($value,true) : '';
}
public function getSideStationTypeTextAttr($value,$data){
$dict = DictData::where('type_value','side_station_type')->column('name','value');
return !empty($data['side_station_type']) ? $dict[$data['side_station_type']] : '';
}
public function getSideStationResultTextAttr($value,$data){
$arr = [0=>'完成', 1=>'交班'];
return $arr[$data['side_station_result']];
}
public function getStartTimeAttr($value): string
{
return !empty($value) ? date('Y-m-d H:i:s', $value) : '';
}
public function getEndTimeAttr($value): string
{
return !empty($value) ? date('Y-m-d H:i:s', $value) : '';
}
}

View File

@ -0,0 +1,34 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\supervision_work;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 工程监理--旁站问题模型
* Class SupervisionSideStationProblem
* @package app\common\model\supervision_work
*/
class SupervisionSideStationProblem extends BaseModel
{
use SoftDelete;
protected $name = 'supervision_side_station_problem';
protected $deleteTime = 'delete_time';
}

View File

@ -0,0 +1,44 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\supervision_work;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 工程监理--旁站结果模型
* Class SupervisionSideStationResult
* @package app\common\model\supervision_work
*/
class SupervisionSideStationResult extends BaseModel
{
use SoftDelete;
protected $name = 'supervision_side_station_result';
protected $deleteTime = 'delete_time';
public function getMustCheckTextAttr($value,$data): string
{
$arr = [0=>'否',1=>'是'];
return $arr[$data['must_check']];
}
public function getCheckResultTextAttr($value,$data): string
{
$arr = [0=>'合格',1=>'不合格'];
return $arr[$data['check_result']];
}
}