!11 修复用户归还设备时出现的报错问题

Merge pull request !11 from 卖报的阿童木/dev
This commit is contained in:
celaraze 2023-02-28 02:53:33 +00:00 committed by Gitee
commit 5608655740
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 7 additions and 3 deletions

View File

@ -75,12 +75,16 @@ class CheckRecordController extends AdminController
if (empty($check)) {
return admin_trans_label('Record None');
} else {
$check_item = $check->check_item;
$check_item = match ($check->check_item) {
get_class(new \App\Models\DeviceRecord()) => 'device',
get_class(new \App\Models\PartRecord()) => 'part',
get_class(new \App\Models\SoftwareRecord()) => 'software',
};
$item = Support::getItemRecordByClass($check_item, $item_id);
if (empty($item)) {
return admin_trans_label('Item None');
} else {
return $item->name;
return $item->asset_number;
}
}
});

View File

@ -35,7 +35,7 @@ class DeviceTrackUpdateDeleteForm extends Form implements LazyRenderable
}
// 设备追踪
$device_track = DeviceTrack::where('id', $id)->first();
$device_track = DeviceTrack::where('device_id', $id)->first();
$device_track->return_time = $return_time;
$device_track->return_description = $return_description;