更改为巡检异常上报

This commit is contained in:
2025-03-19 09:33:28 +08:00
parent 3d3fc88d15
commit 754a4e6782
3 changed files with 37 additions and 3 deletions

View File

@ -27,9 +27,7 @@ class Ticket extends Auth
$ticket_region = $this->request->post('ticket_region');
$ticket_address = $this->request->post('ticket_address');
$imgs = $this->request->post('imgs');
$ticket_project_use = $this->request->post('ticket_project_use');
$ticket_work_use = $this->request->post('ticket_work_use');
$ticket_price =$this->request->post('ticket_price');
$data = [
'uid' => $this->staff->id,
'utype' => $this->staff->id,

View File

@ -3,6 +3,7 @@
namespace plugin\inspection\model;
use Cassandra\Date;
use plugin\ticket\model\TicketInspectionShare;
use plugin\ticket\model\TicketTicket;
use think\admin\Model;
@ -73,7 +74,7 @@ class InspectionRecord extends Model
public function ticket()
{
return $this->morphMany(TicketTicket::class, 'source');
return $this->hasMany(TicketInspectionShare::class, 'record_id', 'id');
}
}

View File

@ -0,0 +1,35 @@
<?php
namespace plugin\ticket\model;
use think\admin\Model;
class TicketInspectionShare extends Model
{
protected $append = ['type_name', 'imgs_arr'];
public function getImgsArrAttr($value, $data)
{
return str2arr($data['imgs'] ?: '', '|');
}
public function type()
{
return $this->belongsTo(TicketType::class, 'type_id', 'id');
}
public function getTypeNameAttr($value, $data)
{
$type = $this->type()->find();
if (!empty($type)) {
return $type['name'];
} else {
return '未知';
}
}
public function linkedTicket()
{
return $this->belongsTo(TicketTicket::class, 'linked_ticket_id', 'id');
}
}