新增大型机械设备及仪器台账模块
This commit is contained in:
parent
9c3a0776db
commit
718ba7c753
@ -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\controller\supervision_dangerous;
|
||||
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\supervision_dangerous\SupervisionLargeMechanicalEquipmentLists;
|
||||
use app\adminapi\logic\supervision_dangerous\SupervisionLargeMechanicalEquipmentLogic;
|
||||
use app\adminapi\validate\supervision_dangerous\SupervisionLargeMechanicalEquipmentValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 大型机械设备及仪器台账控制器
|
||||
* Class SupervisionLargeMechanicalEquipmentController
|
||||
* @package app\adminapi\controller\supervision_dangerous
|
||||
*/
|
||||
class SupervisionLargeMechanicalEquipmentController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取大型机械设备及仪器台账列表
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/03/02 09:51
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new SupervisionLargeMechanicalEquipmentLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加大型机械设备及仪器台账
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/03/02 09:51
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new SupervisionLargeMechanicalEquipmentValidate())->post()->goCheck('add');
|
||||
$result = SupervisionLargeMechanicalEquipmentLogic::add($params);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(SupervisionLargeMechanicalEquipmentLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑大型机械设备及仪器台账
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/03/02 09:51
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new SupervisionLargeMechanicalEquipmentValidate())->post()->goCheck('edit');
|
||||
$result = SupervisionLargeMechanicalEquipmentLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(SupervisionLargeMechanicalEquipmentLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除大型机械设备及仪器台账
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/03/02 09:51
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new SupervisionLargeMechanicalEquipmentValidate())->post()->goCheck('delete');
|
||||
$result = SupervisionLargeMechanicalEquipmentLogic::delete($params);
|
||||
if (true === $result) {
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(SupervisionLargeMechanicalEquipmentLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取大型机械设备及仪器台账详情
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/03/02 09:51
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new SupervisionLargeMechanicalEquipmentValidate())->goCheck('detail');
|
||||
$result = SupervisionLargeMechanicalEquipmentLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -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_dangerous;
|
||||
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\supervision_dangerous\SupervisionLargeMechanicalEquipmentMaintenanceRecordLists;
|
||||
use app\adminapi\logic\supervision_dangerous\SupervisionLargeMechanicalEquipmentMaintenanceRecordLogic;
|
||||
use app\adminapi\validate\supervision_dangerous\SupervisionLargeMechanicalEquipmentMaintenanceRecordValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 工程监理--大型机械设备及仪器修保养记录控制器
|
||||
* Class SupervisionLargeMechanicalEquipmentMaintenanceRecordController
|
||||
* @package app\adminapi\controller\supervision_dangerous
|
||||
*/
|
||||
class SupervisionLargeMechanicalEquipmentMaintenanceRecordController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取工程监理--大型机械设备及仪器修保养记录列表
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/03/02 09:51
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new SupervisionLargeMechanicalEquipmentMaintenanceRecordLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加工程监理--大型机械设备及仪器修保养记录
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/03/02 09:51
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new SupervisionLargeMechanicalEquipmentMaintenanceRecordValidate())->post()->goCheck('add');
|
||||
$result = SupervisionLargeMechanicalEquipmentMaintenanceRecordLogic::add($params);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(SupervisionLargeMechanicalEquipmentMaintenanceRecordLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑工程监理--大型机械设备及仪器修保养记录
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/03/02 09:51
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new SupervisionLargeMechanicalEquipmentMaintenanceRecordValidate())->post()->goCheck('edit');
|
||||
$result = SupervisionLargeMechanicalEquipmentMaintenanceRecordLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(SupervisionLargeMechanicalEquipmentMaintenanceRecordLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除工程监理--大型机械设备及仪器修保养记录
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/03/02 09:51
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new SupervisionLargeMechanicalEquipmentMaintenanceRecordValidate())->post()->goCheck('delete');
|
||||
SupervisionLargeMechanicalEquipmentMaintenanceRecordLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取工程监理--大型机械设备及仪器修保养记录详情
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/03/02 09:51
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new SupervisionLargeMechanicalEquipmentMaintenanceRecordValidate())->goCheck('detail');
|
||||
$result = SupervisionLargeMechanicalEquipmentMaintenanceRecordLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
<?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_dangerous;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\supervision_dangerous\SupervisionLargeMechanicalEquipment;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\supervision_project\SupervisionParticipatingUnits;
|
||||
use app\common\model\supervision_project\SupervisionProject;
|
||||
|
||||
|
||||
/**
|
||||
* 大型机械设备及仪器台账列表
|
||||
* Class SupervisionLargeMechanicalEquipmentLists
|
||||
* @package app\adminapi\listssupervision_dangerous
|
||||
*/
|
||||
class SupervisionLargeMechanicalEquipmentLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2024/03/02 09:51
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['project_id', 'company_id', 'approval_type'],
|
||||
'%like%' => ['sn', 'name', 'use_site', 'approval_result'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取大型机械设备及仪器台账列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2024/03/02 09:51
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return SupervisionLargeMechanicalEquipment::withoutField('create_time,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();
|
||||
$company = SupervisionParticipatingUnits::field('unit_name')->where('id',$data['company_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['project_name'];
|
||||
$data['company_name'] = $company['unit_name'];
|
||||
$data['approval_type_text'] = $data->approval_type_text;
|
||||
$data['first_audit_opinion_text'] = $data->first_audit_opinion_text;
|
||||
$data['final_audit_opinion_text'] = $data->final_audit_opinion_text;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取大型机械设备及仪器台账数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2024/03/02 09:51
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return SupervisionLargeMechanicalEquipment::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
@ -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_dangerous;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\supervision_dangerous\SupervisionLargeMechanicalEquipmentMaintenanceRecord;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
||||
/**
|
||||
* 工程监理--大型机械设备及仪器修保养记录列表
|
||||
* Class SupervisionLargeMechanicalEquipmentMaintenanceRecordLists
|
||||
* @package app\adminapi\listssupervision_dangerous
|
||||
*/
|
||||
class SupervisionLargeMechanicalEquipmentMaintenanceRecordLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2024/03/02 09:51
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['large_mechanical_equipment_id'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取工程监理--大型机械设备及仪器修保养记录列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2024/03/02 09:51
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return SupervisionLargeMechanicalEquipmentMaintenanceRecord::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/03/02 09:51
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return SupervisionLargeMechanicalEquipmentMaintenanceRecord::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
@ -69,7 +69,7 @@ class SupervisionWitnessSamplingDetailLists extends BaseAdminDataLists implement
|
||||
$data['name'] = $material_entry_detail['name'];
|
||||
$data['brand'] = $material_entry_detail['brand'];
|
||||
$data['model'] = $material_entry_detail['model'];
|
||||
$data['contract_brand'] = $material_entry_detail->contract_brand_text;
|
||||
$data['contract_brand_text'] = $material_entry_detail->contract_brand_text;
|
||||
$data['entry_number'] = $material_entry_detail['entry_number'];
|
||||
$data['enter_time'] = $material_entry['$material_entry'];
|
||||
$data['sampling_date'] = $witness_sampling['sampling_date'];
|
||||
|
@ -0,0 +1,188 @@
|
||||
<?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_dangerous;
|
||||
|
||||
|
||||
use app\common\model\supervision_dangerous\SupervisionLargeMechanicalEquipment;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\supervision_dangerous\SupervisionLargeMechanicalEquipmentMaintenanceRecord;
|
||||
use app\common\model\supervision_project\SupervisionParticipatingUnits;
|
||||
use app\common\model\supervision_project\SupervisionProject;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 大型机械设备及仪器台账逻辑
|
||||
* Class SupervisionLargeMechanicalEquipmentLogic
|
||||
* @package app\adminapi\logic\supervision_dangerous
|
||||
*/
|
||||
class SupervisionLargeMechanicalEquipmentLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加大型机械设备及仪器台账
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/03/02 09:51
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res = SupervisionLargeMechanicalEquipment::create([
|
||||
'project_id' => $params['project_id'],
|
||||
'sn' => data_unique_code('SBYQTZ'),
|
||||
'name' => $params['name'],
|
||||
'use_site' => $params['use_site'],
|
||||
'entry_time' => !empty($params['entry_time']) ? strtotime($params['entry_time']) : 0,
|
||||
'company_id' => $params['company_id'],
|
||||
'approval_date' => !empty($params['approval_date']) ? strtotime($params['approval_date']) : 0,
|
||||
'approval_result' => $params['approval_result'],
|
||||
'approval_form_code' => $params['approval_form_code'],
|
||||
'approval_type' => $params['approval_type'],
|
||||
'first_audit_opinion' => $params['first_audit_opinion'],
|
||||
'first_auditor' => $params['first_auditor'],
|
||||
'first_audit_time' => !empty($params['first_audit_time']) ? strtotime($params['first_audit_time']) : 0,
|
||||
'final_audit_opinion' => $params['final_audit_opinion'],
|
||||
'final_audit_time' => !empty($params['final_audit_time']) ? strtotime($params['final_audit_time']) : 0,
|
||||
'remark' => $params['remark'],
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null
|
||||
]);
|
||||
if(!empty($params['maintenance_record'])){
|
||||
foreach($params['maintenance_record'] as $v){
|
||||
SupervisionLargeMechanicalEquipmentMaintenanceRecord::create([
|
||||
'large_mechanical_equipment_id' => $res->id,
|
||||
'reg_date' => !empty($v['reg_date']) ? strtotime($v['reg_date']) : 0,
|
||||
'month_warranty_file' => $v['month_warranty_file'],
|
||||
'maintenance_period' => !empty($v['maintenance_period']) ? strtotime($v['maintenance_period']) : 0,
|
||||
'accessory_one_validity' => !empty($v['accessory_one_validity']) ? strtotime($v['accessory_one_validity']) : 0,
|
||||
'accessory_two_validity' => !empty($v['accessory_two_validity']) ? strtotime($v['accessory_two_validity']) : 0,
|
||||
]);
|
||||
}
|
||||
}
|
||||
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/03/02 09:51
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
SupervisionLargeMechanicalEquipment::where('id', $params['id'])->update([
|
||||
'project_id' => $params['project_id'],
|
||||
'name' => $params['name'],
|
||||
'use_site' => $params['use_site'],
|
||||
'entry_time' => !empty($params['entry_time']) ? strtotime($params['entry_time']) : 0,
|
||||
'company_id' => $params['company_id'],
|
||||
'approval_date' => !empty($params['approval_date']) ? strtotime($params['approval_date']) : 0,
|
||||
'approval_result' => $params['approval_result'],
|
||||
'approval_form_code' => $params['approval_form_code'],
|
||||
'approval_type' => $params['approval_type'],
|
||||
'first_audit_opinion' => $params['first_audit_opinion'],
|
||||
'first_auditor' => $params['first_auditor'],
|
||||
'first_audit_time' => !empty($params['first_audit_time']) ? strtotime($params['first_audit_time']) : 0,
|
||||
'final_audit_opinion' => $params['final_audit_opinion'],
|
||||
'final_audit_time' => !empty($params['final_audit_time']) ? strtotime($params['final_audit_time']) : 0,
|
||||
'remark' => $params['remark'],
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
'update_time' => time()
|
||||
]);
|
||||
if(!empty($params['maintenance_record'])){
|
||||
foreach($params['maintenance_record'] as $v){
|
||||
if(!empty($v['id'])){
|
||||
SupervisionLargeMechanicalEquipmentMaintenanceRecord::where('id',$v['id'])->update([
|
||||
'large_mechanical_equipment_id' => $params['id'],
|
||||
'reg_date' => !empty($v['reg_date']) ? strtotime($v['reg_date']) : 0,
|
||||
'month_warranty_file' => $v['month_warranty_file'],
|
||||
'maintenance_period' => !empty($v['maintenance_period']) ? strtotime($v['maintenance_period']) : 0,
|
||||
'accessory_one_validity' => !empty($v['accessory_one_validity']) ? strtotime($v['accessory_one_validity']) : 0,
|
||||
'accessory_two_validity' => !empty($v['accessory_two_validity']) ? strtotime($v['accessory_two_validity']) : 0,
|
||||
'update_time' => time()
|
||||
]);
|
||||
}else{
|
||||
SupervisionLargeMechanicalEquipmentMaintenanceRecord::create([
|
||||
'large_mechanical_equipment_id' => $params['id'],
|
||||
'reg_date' => !empty($v['reg_date']) ? strtotime($v['reg_date']) : 0,
|
||||
'month_warranty_file' => $v['month_warranty_file'],
|
||||
'maintenance_period' => !empty($v['maintenance_period']) ? strtotime($v['maintenance_period']) : 0,
|
||||
'accessory_one_validity' => !empty($v['accessory_one_validity']) ? strtotime($v['accessory_one_validity']) : 0,
|
||||
'accessory_two_validity' => !empty($v['accessory_two_validity']) ? strtotime($v['accessory_two_validity']) : 0,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
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/03/02 09:51
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
$maintenance_record = SupervisionLargeMechanicalEquipmentMaintenanceRecord::where('large_mechanical_equipment_id',$params['id'])->findOrEmpty();
|
||||
if(!$maintenance_record->isEmpty()){
|
||||
self::setError('当前数据下存在机械维修保养记录,请先删除机械维修保养记录数据');
|
||||
return false;
|
||||
}
|
||||
return SupervisionLargeMechanicalEquipment::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取大型机械设备及仪器台账详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2024/03/02 09:51
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = SupervisionLargeMechanicalEquipment::withoutField('create_time,update_time,delete_time')->findOrEmpty($params['id']);
|
||||
$project = SupervisionProject::field('project_name')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$company = SupervisionParticipatingUnits::field('unit_name')->where('id',$data['company_id'])->findOrEmpty();
|
||||
$data['project_name'] = $project['project_name'];
|
||||
$data['company_name'] = $company['unit_name'];
|
||||
$data['approval_type_text'] = $data->approval_type_text;
|
||||
$data['first_audit_opinion_text'] = $data->first_audit_opinion_text;
|
||||
$data['final_audit_opinion_text'] = $data->final_audit_opinion_text;
|
||||
return $data->toArray();
|
||||
}
|
||||
}
|
@ -0,0 +1,115 @@
|
||||
<?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_dangerous;
|
||||
|
||||
|
||||
use app\common\model\supervision_dangerous\SupervisionLargeMechanicalEquipmentMaintenanceRecord;
|
||||
use app\common\logic\BaseLogic;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 工程监理--大型机械设备及仪器修保养记录逻辑
|
||||
* Class SupervisionLargeMechanicalEquipmentMaintenanceRecordLogic
|
||||
* @package app\adminapi\logic\supervision_dangerous
|
||||
*/
|
||||
class SupervisionLargeMechanicalEquipmentMaintenanceRecordLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加工程监理--大型机械设备及仪器修保养记录
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/03/02 09:51
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
SupervisionLargeMechanicalEquipmentMaintenanceRecord::create([
|
||||
'large_mechanical_equipment_id' => $params['large_mechanical_equipment_id'],
|
||||
'reg_date' => !empty($params['reg_date']) ? strtotime($params['reg_date']) : 0,
|
||||
'month_warranty_file' => $params['month_warranty_file'],
|
||||
'maintenance_period' => !empty($params['maintenance_period']) ? strtotime($params['maintenance_period']) : 0,
|
||||
'accessory_one_validity' => !empty($params['accessory_one_validity']) ? strtotime($params['accessory_one_validity']) : 0,
|
||||
'accessory_two_validity' => !empty($params['accessory_two_validity']) ? strtotime($params['accessory_two_validity']) : 0,
|
||||
]);
|
||||
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/03/02 09:51
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
SupervisionLargeMechanicalEquipmentMaintenanceRecord::where('id', $params['id'])->update([
|
||||
'large_mechanical_equipment_id' => $params['large_mechanical_equipment_id'],
|
||||
'reg_date' => !empty($params['reg_date']) ? strtotime($params['reg_date']) : 0,
|
||||
'month_warranty_file' => $params['month_warranty_file'],
|
||||
'maintenance_period' => !empty($params['maintenance_period']) ? strtotime($params['maintenance_period']) : 0,
|
||||
'accessory_one_validity' => !empty($params['accessory_one_validity']) ? strtotime($params['accessory_one_validity']) : 0,
|
||||
'accessory_two_validity' => !empty($params['accessory_two_validity']) ? strtotime($params['accessory_two_validity']) : 0,
|
||||
'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/03/02 09:51
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return SupervisionLargeMechanicalEquipmentMaintenanceRecord::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取工程监理--大型机械设备及仪器修保养记录详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2024/03/02 09:51
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
return SupervisionLargeMechanicalEquipmentMaintenanceRecord::withoutField('create_time,update_time,delete_time')->findOrEmpty($params['id'])->toArray();
|
||||
}
|
||||
}
|
@ -17,6 +17,8 @@ namespace app\adminapi\logic\supervision_work;
|
||||
|
||||
use app\common\model\supervision_work\SupervisionMaterialEntryDetail;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\supervision_work\SupervisionMaterialParallelTestingDetail;
|
||||
use app\common\model\supervision_work\SupervisionWitnessSamplingDetail;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
@ -99,6 +101,16 @@ class SupervisionMaterialEntryDetailLogic extends BaseLogic
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
$jz_data = SupervisionWitnessSamplingDetail::where('material_entry_detail_id',$params['id'])->findOrEmpty();
|
||||
if(!$jz_data->isEmpty()){
|
||||
self::setError('该数据下存在见证信息,请先删除见证信息');
|
||||
return false;
|
||||
}
|
||||
$pxce_data = SupervisionMaterialParallelTestingDetail::where('material_entry_detail_id',$params['id'])->findOrEmpty();
|
||||
if(!$pxce_data->isEmpty()){
|
||||
self::setError('该数据下存在平行检验信息,请先删除平行检验信息');
|
||||
return false;
|
||||
}
|
||||
return SupervisionMaterialEntryDetail::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,126 @@
|
||||
<?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_dangerous;
|
||||
|
||||
|
||||
use app\common\model\supervision_dangerous\SupervisionLargeMechanicalEquipment;
|
||||
use app\common\model\supervision_dangerous\SupervisionLargeMechanicalEquipmentMaintenanceRecord;
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 工程监理--大型机械设备及仪器修保养记录验证器
|
||||
* Class SupervisionLargeMechanicalEquipmentMaintenanceRecordValidate
|
||||
* @package app\adminapi\validate\supervision_dangerous
|
||||
*/
|
||||
class SupervisionLargeMechanicalEquipmentMaintenanceRecordValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require|checkData',
|
||||
'large_mechanical_equipment_id' => 'require|checkLargeMechanicalEquipment',
|
||||
'reg_date' => 'require|dateFormat:Y-m-d',
|
||||
'month_warranty_file' => 'require',
|
||||
'maintenance_period' => 'require|dateFormat:Y-m-d',
|
||||
'accessory_one_validity' => 'require|dateFormat:Y-m-d',
|
||||
'accessory_two_validity' => 'require|dateFormat:Y-m-d',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'large_mechanical_equipment_id' => '大型机械设备及仪器id',
|
||||
'reg_date' => '登记日期',
|
||||
'month_warranty_file' => '机械每月维修保养附件',
|
||||
'maintenance_period' => '设备维保有效期',
|
||||
'accessory_one_validity' => '附配件1有效期',
|
||||
'accessory_two_validity' => '附配件2有效期',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return SupervisionLargeMechanicalEquipmentMaintenanceRecordValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/03/02 09:51
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['large_mechanical_equipment_id','reg_date','month_warranty_file','maintenance_period','accessory_one_validity','accessory_two_validity']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return SupervisionLargeMechanicalEquipmentMaintenanceRecordValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/03/02 09:51
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','large_mechanical_equipment_id','reg_date','month_warranty_file','maintenance_period','accessory_one_validity','accessory_two_validity']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return SupervisionLargeMechanicalEquipmentMaintenanceRecordValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/03/02 09:51
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return SupervisionLargeMechanicalEquipmentMaintenanceRecordValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/03/02 09:51
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
public function checkData($value): bool|string
|
||||
{
|
||||
$data = SupervisionLargeMechanicalEquipmentMaintenanceRecord::where('id',$value)->findOrEmpty();
|
||||
if($data->isEmpty()){
|
||||
return '数据不存在';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function checkLargeMechanicalEquipment($value): bool|string
|
||||
{
|
||||
$data = SupervisionLargeMechanicalEquipment::where('id',$value)->findOrEmpty();
|
||||
if($data->isEmpty()){
|
||||
return '大型机械设备及仪器台账信息不存在';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,230 @@
|
||||
<?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_dangerous;
|
||||
|
||||
|
||||
use app\common\model\dict\DictData;
|
||||
use app\common\model\supervision_dangerous\SupervisionLargeMechanicalEquipment;
|
||||
use app\common\model\supervision_dangerous\SupervisionLargeMechanicalEquipmentMaintenanceRecord;
|
||||
use app\common\model\supervision_project\SupervisionParticipatingUnits;
|
||||
use app\common\model\supervision_project\SupervisionProject;
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 大型机械设备及仪器台账验证器
|
||||
* Class SupervisionLargeMechanicalEquipmentValidate
|
||||
* @package app\adminapi\validate\supervision_dangerous
|
||||
*/
|
||||
class SupervisionLargeMechanicalEquipmentValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require|checkData',
|
||||
'project_id' => 'require|checkProject',
|
||||
'name' => 'require',
|
||||
'entry_time' => 'require|dateFormat:Y-m-d',
|
||||
'company_id' => 'require|checkCompany',
|
||||
'approval_date' => 'require|dateFormat:Y-m-d',
|
||||
'approval_type' => 'checkApprovalType',
|
||||
'first_audit_opinion' => 'checkFirstAuditOpinion',
|
||||
'first_audit_time' => 'dateFormat:Y-m-d',
|
||||
'final_audit_opinion' => 'checkFinalAuditOpinion',
|
||||
'final_audit_time' => 'dateFormat:Y-m-d',
|
||||
'annex' => 'checkAnnex',
|
||||
'maintenance_record' => 'checkMaintenanceRecord'
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'project_id' => '项目id',
|
||||
'sn' => '序号',
|
||||
'name' => '大型机械设备及仪器具',
|
||||
'use_site' => '使用部位',
|
||||
'entry_time' => '进场时间',
|
||||
'company_id' => '报审单位名称',
|
||||
'approval_date' => '报审日期',
|
||||
'approval_result' => '报审结果',
|
||||
'approval_form_code' => '报审表编号',
|
||||
'approval_type' => '报审类型',
|
||||
'first_audit_opinion' => '专监初审意见',
|
||||
'first_auditor' => '初审人',
|
||||
'first_audit_time' => '初审时间',
|
||||
'final_audit_opinion' => '总监审定结论',
|
||||
'final_audit_time' => '审定时间',
|
||||
'remark' => '备注',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return SupervisionLargeMechanicalEquipmentValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/03/02 09:51
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('id',true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return SupervisionLargeMechanicalEquipmentValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/03/02 09:51
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return SupervisionLargeMechanicalEquipmentValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/03/02 09:51
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return SupervisionLargeMechanicalEquipmentValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/03/02 09:51
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
public function checkData($value): bool|string
|
||||
{
|
||||
$data = SupervisionLargeMechanicalEquipment::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 checkCompany($value,$rule,$params){
|
||||
$data = SupervisionParticipatingUnits::where('id',$value)->where('project_id',$params['project_id'])->findOrEmpty();
|
||||
if($data->isEmpty()){
|
||||
return '报审单位信息不存在';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function checkApprovalType($value): bool|string
|
||||
{
|
||||
$dict = DictData::where('type_value','approval_type')->column('value');
|
||||
if(!in_array($value,$dict)){
|
||||
return '报审类型数据值无效';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function checkFirstAuditOpinion($value): bool|string
|
||||
{
|
||||
$dict = DictData::where('type_value','first_audit_opinion')->column('value');
|
||||
if(!in_array($value,$dict)){
|
||||
return '专监初审意见数据值无效';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function checkFinalAuditOpinion($value): bool|string
|
||||
{
|
||||
$dict = DictData::where('type_value','final_audit_opinion')->column('value');
|
||||
if(!in_array($value,$dict)){
|
||||
return '总监审定结论数据值无效';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function checkAnnex($value): bool|string
|
||||
{
|
||||
if(!empty($value) && $value != '' && !is_array($value)){
|
||||
return '附件格式错误';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function checkMaintenanceRecord($value): bool|string
|
||||
{
|
||||
if(!isset($value) || $value == '') return true;
|
||||
if(!is_array($value)) return '维修保养记录数据格式错误';
|
||||
foreach($value as $k=>$v){
|
||||
if(!empty($v['id'])){
|
||||
$data = SupervisionLargeMechanicalEquipmentMaintenanceRecord::where('id',$v['id'])->findOrEmpty();
|
||||
if($data->isEmpty()){
|
||||
return '维修保养记录列表第'.($k+1).'行数据不存在';
|
||||
}
|
||||
}
|
||||
if(empty($v['reg_date'])){
|
||||
return '维修保养记录列表第'.($k+1).'行登记日期为空';
|
||||
}else{
|
||||
if(date('Y-m-d',strtotime($v['reg_date'])) != $v['reg_date']){
|
||||
return '维修保养记录列表第'.($k+1).'行登记日期必须是Y-m-d格式';
|
||||
}
|
||||
}
|
||||
if(empty($v['month_warranty_file'])) return '维修保养记录列表第'.($k+1).'行机械每月维修保养附件为空';
|
||||
if(empty($v['maintenance_period'])){
|
||||
return '维修保养记录列表第'.($k+1).'行设备维保有效期为空';
|
||||
}else{
|
||||
if(date('Y-m-d',strtotime($v['maintenance_period'])) != $v['maintenance_period']){
|
||||
return '维修保养记录列表第'.($k+1).'行设备维保有效期必须是Y-m-d格式';
|
||||
}
|
||||
}
|
||||
if(empty($v['accessory_one_validity'])){
|
||||
return '维修保养记录列表第'.($k+1).'行附配件1有效期为空';
|
||||
}else{
|
||||
if(date('Y-m-d',strtotime($v['accessory_one_validity'])) != $v['accessory_one_validity']){
|
||||
return '维修保养记录列表第'.($k+1).'行附配件1有效期必须是Y-m-d格式';
|
||||
}
|
||||
}
|
||||
if(empty($v['accessory_two_validity'])){
|
||||
return '维修保养记录列表第'.($k+1).'行附配件2有效期为空';
|
||||
}else{
|
||||
if(date('Y-m-d',strtotime($v['accessory_two_validity'])) != $v['accessory_two_validity']){
|
||||
return '维修保养记录列表第'.($k+1).'行附配件2有效期必须是Y-m-d格式';
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
<?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_dangerous;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use app\common\model\dict\DictData;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
|
||||
/**
|
||||
* 大型机械设备及仪器台账模型
|
||||
* Class SupervisionLargeMechanicalEquipment
|
||||
* @package app\common\model\supervision_dangerous
|
||||
*/
|
||||
class SupervisionLargeMechanicalEquipment extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
protected $name = 'supervision_large_mechanical_equipment';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
public function getEntryTimeAttr($value): string
|
||||
{
|
||||
return !empty($value) ? date('Y-m-d',$value) : '';
|
||||
}
|
||||
|
||||
public function getApprovalDateAttr($value): string
|
||||
{
|
||||
return !empty($value) ? date('Y-m-d',$value) : '';
|
||||
}
|
||||
|
||||
public function getFirstAuditTimeAttr($value): string
|
||||
{
|
||||
return !empty($value) ? date('Y-m-d',$value) : '';
|
||||
}
|
||||
|
||||
public function getFinalAuditTimeAttr($value): string
|
||||
{
|
||||
return !empty($value) ? date('Y-m-d',$value) : '';
|
||||
}
|
||||
|
||||
public function getApprovalTypeTextAttr($value,$data){
|
||||
$dict = DictData::where('type_value','approval_type')->column('name','value');
|
||||
return !empty($data['approval_type']) ? $dict[$data['approval_type']] : '';
|
||||
}
|
||||
|
||||
public function getFinalAuditOpinionTextAttr($value,$data){
|
||||
$dict = DictData::where('type_value','final_audit_opinion')->column('name','value');
|
||||
return !empty($data['final_audit_opinion']) ? $dict[$data['final_audit_opinion']] : '';
|
||||
}
|
||||
|
||||
public function getFirstAuditOpinionTextAttr($value,$data){
|
||||
$dict = DictData::where('type_value','first_audit_opinion')->column('name','value');
|
||||
return !empty($data['first_audit_opinion']) ? $dict[$data['first_audit_opinion']] : '';
|
||||
}
|
||||
|
||||
public function getAnnexAttr($value)
|
||||
{
|
||||
return !empty($value) ? json_decode($value,true) : '';
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
<?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_dangerous;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
|
||||
/**
|
||||
* 工程监理--大型机械设备及仪器修保养记录模型
|
||||
* Class SupervisionLargeMechanicalEquipmentMaintenanceRecord
|
||||
* @package app\common\model\supervision_dangerous
|
||||
*/
|
||||
class SupervisionLargeMechanicalEquipmentMaintenanceRecord extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
protected $name = 'supervision_large_mechanical_equipment_maintenance_record';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
public function getRegDateAttr($value): string
|
||||
{
|
||||
return !empty($value) ? date('Y-m-d',$value) : '';
|
||||
}
|
||||
|
||||
public function getMaintenancePeriodAttr($value): string
|
||||
{
|
||||
return !empty($value) ? date('Y-m-d',$value) : '';
|
||||
}
|
||||
|
||||
public function getAccessoryOneValidityAttr($value): string
|
||||
{
|
||||
return !empty($value) ? date('Y-m-d',$value) : '';
|
||||
}
|
||||
|
||||
public function getAccessoryTwoValidityAttr($value): string
|
||||
{
|
||||
return !empty($value) ? date('Y-m-d',$value) : '';
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user