public static function getTempateSet($type)
 {
     $bl = AlarmLevelBlacklist::find()->select('level')->column();
     if ($type == 3) {
         //无线设备
         $rows = self::find()->with(["wireless" => function ($query) {
             $query->select("id,label,status");
         }])->where(["type" => $type])->asArray()->all();
         $data = new \stdClass();
         foreach ($rows as $row) {
             if (!$row["wireless"]) {
                 continue;
             }
             $alarm = Yii::$app->db->createCommand('select alarmLevel from wireless_device_alarm where deviceId="' . $row['device_id'] . '" order by update_time desc limit 1')->queryOne();
             if ($row['wireless']['status'] != 1 && $alarm && in_array($alarm["alarmLevel"], $bl)) {
                 $row['wireless']['status'] = 1;
             }
             $d = array_merge($row["wireless"], ["areaId" => $row["areaId"]]);
             $data->{$row["id"]} = ["data" => $d, "attributes" => json_decode($row["attributes"]), "links" => json_decode($row["links"])];
         }
     } else {
         $rows = self::find()->with(["device" => function ($query) {
             $query->select("id,label,status");
         }])->where(["type" => $type])->asArray()->all();
         $data = new \stdClass();
         foreach ($rows as $row) {
             if (!$row["device"]) {
                 continue;
             }
             $alarm = Yii::$app->db->createCommand('select alarmLevel from device_alarm where deviceId="' . $row['device_id'] . '" order by update_time desc limit 1')->queryOne();
             if ($row['device']['status'] != 1 && $alarm && in_array($alarm["alarmLevel"], $bl)) {
                 $row['device']['status'] = 1;
             }
             $d = array_merge($row["device"], ["areaId" => $row["areaId"]]);
             $data->{$row["id"]} = ["data" => $d, "attributes" => json_decode($row["attributes"]), "links" => json_decode($row["links"])];
         }
     }
     return $data;
 }
 public function actionDeleteBl($id)
 {
     AlarmLevelBlacklist::findOne($id)->delete();
     return $this->redirect(['level-blacklist']);
 }