liyinglin 3 years ago
parent 4c9298eefb
commit 40eba9e8b3

@ -102,10 +102,10 @@ class ProjectController extends CommonController
$headList = Admin::whereIn('id', $adminIds)->get(); $headList = Admin::whereIn('id', $adminIds)->get();
// 获取病区选中的护工 // 获取病区选中的护工
foreach ($headList as $item) { foreach ($headList as $item) {
$item->selected = 'false'; $item->selected = '';
if ($areaId) { if ($areaId) {
$has = AdminAreaLink::where('area_id', $areaId)->where('admin_id', $item->id)->count(); $has = AdminAreaLink::where('area_id', $areaId)->where('admin_id', $item->id)->count();
if ($has) $item->selected = 'true'; if ($has) $item->selected = 'selected';
} }
} }
return $this->ajaxResponse($headList); return $this->ajaxResponse($headList);

@ -293,7 +293,7 @@
console.log(res) console.log(res)
for (var i = 0; i < res.length; i++) { for (var i = 0; i < res.length; i++) {
$("#head_option").append('<option selected="' + res[i].selected + '" value="' + res[i].id + '">' + res[i].name + '</option>'); $("#head_option").append('<option ' + res[i].selected + ' value=' + res[i].id + '>' + res[i].name + '</option>');
} }
}); });

Loading…
Cancel
Save