This commit is contained in:
weiz 2024-03-01 16:51:35 +08:00
parent 0f6ebdb702
commit 1b89cef9a9
2 changed files with 10 additions and 0 deletions

View File

@ -104,6 +104,7 @@ class SupervisionAcceptLogic extends BaseLogic
*/
public static function edit(array $params,$admin_id): bool
{
$data = SupervisionAccept::field('check_item_detail_ids')->where('id',$params['id'])->findOrEmpty();
Db::startTrans();
try {
SupervisionAccept::where('id', $params['id'])->update([
@ -120,6 +121,10 @@ class SupervisionAcceptLogic extends BaseLogic
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
'update_time' => time(),
]);
if(json_encode($data['check_item_detail_ids']) != json_encode($params['check_item_detail_ids'])){
$accept_check_result_result_ids = SupervisionAcceptResult::where('accept_id',$params['id'])->column('id');
SupervisionAcceptResult::destroy($accept_check_result_result_ids);
}
if(!empty($params['accept_check_result'])){
foreach($params['accept_check_result'] as $v){
if(!empty($v['id'])){

View File

@ -106,6 +106,7 @@ class SupervisionSideStationLogic extends BaseLogic
*/
public static function edit(array $params,$admin_id): bool
{
$data = SupervisionSideStation::field('check_item_detail_ids')->where('id',$params['id'])->findOrEmpty();
Db::startTrans();
try {
SupervisionSideStation::where('id', $params['id'])->update([
@ -125,6 +126,10 @@ class SupervisionSideStationLogic extends BaseLogic
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
'update_time' => time(),
]);
if(json_encode($data['check_item_detail_ids']) != json_encode($params['check_item_detail_ids'])){
$side_result_ids = SupervisionSideStationResult::where('side_station_id',$params['id'])->column('id');
SupervisionSideStationResult::destroy($side_result_ids);
}
if(!empty($params['side_result'])){
foreach($params['side_result'] as $v){
if(!empty($v['id'])){