fix: 修复页面间状态丢失问题并优化选择页面
- 修复选择审批人后再选择抄送人导致状态丢失的问题 - 使用独立的 sessionStorage key (selectedApprovers, selectedCc) - 组件每次挂载时从 sessionStorage 恢复状态 - 只在提交/保存成功后清除 sessionStorage - 优化人员选择页面布局和样式 - 更新 CLAUDE.md 文档记录问题和解决方案 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class BusinessTripItinerary extends Model
|
||||
{
|
||||
protected $table = 'business_trip_itinerary';
|
||||
|
||||
protected $fillable = [
|
||||
'business_trip_id',
|
||||
'start_time',
|
||||
'end_time',
|
||||
'departure',
|
||||
'destination',
|
||||
'transport',
|
||||
'trip_type',
|
||||
'remark',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'business_trip_id' => 'integer',
|
||||
'start_time' => 'datetime',
|
||||
'end_time' => 'datetime',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
|
||||
/**
|
||||
* 行程类型常量
|
||||
*/
|
||||
const TRIP_TYPE_ONEWAY = 'oneway'; // 单程
|
||||
const TRIP_TYPE_ROUNDTRIP = 'roundtrip'; // 往返
|
||||
|
||||
/**
|
||||
* 关联出差申请
|
||||
*/
|
||||
public function businessTrip()
|
||||
{
|
||||
return $this->belongsTo(BusinessTrip::class, 'business_trip_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算天数
|
||||
*/
|
||||
public function getDurationDays(): int
|
||||
{
|
||||
if (!$this->start_time || !$this->end_time) {
|
||||
return 0;
|
||||
}
|
||||
$start = \DateTime::createFromFormat('Y-m-d H:i:s', $this->start_time);
|
||||
$end = \DateTime::createFromFormat('Y-m-d H:i:s', $this->end_time);
|
||||
if (!$start || !$end) {
|
||||
return 0;
|
||||
}
|
||||
return $end->diff($start)->days + 1;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user