--- a/application/p/controller/EquipmentRecord.php +++ b/application/p/controller/EquipmentRecord.php @@ -45,8 +45,10 @@ $start_date = $this->request->post("start_date"); $end_date = $this->request->post("end_date"); $department_uuid_str = $this->request->post("department_uuid_str"); - $where = array('a.relation_type'=>['in',[9,21,7100]]); -// $where['a.is_del'] = 0; + $where = array( + 'a.relation_type'=>['in',[1,2,3,4,9,10,21,7100]], + 'a.is_del' => 0, + ); if (!empty($start_date) && !empty($end_date)) { $where['a.date'] = ['between', [$start_date, $end_date]]; } @@ -513,13 +515,27 @@ //9 51 kx21n //21 66 西门子 //7100 80 日立 - $equipment_type_num = [9,7100,21]; + // The UI exposes three canonical groups. Include every compatible + // source relation type when a canonical group is selected. + $equipment_type_num = [ + 1 => [1,9], + 2 => [2,3,10,7100], + 3 => [4,21], + ]; if (!empty($equipment_type)) { + $relation_type = []; foreach (explode(',',$equipment_type) as $type){ - $relation_type[] = $equipment_type_num[$type-1]; + if (isset($equipment_type_num[$type])) { + $relation_type = array_merge($relation_type, $equipment_type_num[$type]); + } } - $where['a.relation_type'] = ['in',$relation_type]; + if ($relation_type) { + $where['a.relation_type'] = ['in',array_values(array_unique($relation_type))]; + } + } else { + $where['a.relation_type'] = ['in',[1,2,3,4,9,10,21,7100]]; } + $where['a.is_del'] = 0; if (!empty($start_date) && !empty($end_date)) { $where['a.date'] = ['between', [$start_date, $end_date]]; }