public function actionSaveConfig()
 {
     $selected = \Yii::$app->request->post("selected");
     $type = \Yii::$app->request->post("type");
     InfoConfig::updateAll(["is_show" => 0], ["type_id" => $type]);
     InfoConfig::updateAll(["is_show" => 1], ["type_id" => $type, "id" => $selected]);
     return Json::encode(["status" => 1]);
 }
 /**
  * 设备提示信息
  * @param $deviceId
  * @return string
  */
 protected function getTip($deviceId)
 {
     $this->layout = false;
     $device = DeviceInfo::find()->with(["type", "model"])->where(["id" => $deviceId])->one();
     if (!$device) {
         return "设备未找到";
     }
     $deviceConfig = ArrayHelper::map(InfoConfig::getTipConfig(1), "key", "value");
     $perfConfig = ArrayHelper::map(InfoConfig::getTipConfig(2), "key", "value");
     $perfData = DeviceTaskSummary::find()->where(["taskId" => array_values($perfConfig), "devId" => $deviceId])->select(["taskId", "currentValue"])->groupBy("taskId")->asArray()->all();
     $perfData = ArrayHelper::map($perfData, "taskId", "currentValue");
     return $this->render("tip", ["model" => $device, "deviceConfig" => $deviceConfig, "perfConfig" => $perfConfig, "perfData" => $perfData]);
 }
 public function actionAjaxDeviceTip()
 {
     $this->layout = false;
     $id = Yii::$app->request->get("id");
     $fromWhere = Yii::$app->request->get("fromWhere");
     if ($fromWhere == 'path') {
         return $this->pathDetail(Yii::$app->request->get("from"), Yii::$app->request->get("to"));
     }
     $device = WirelessDeviceInfo::find()->with(["type", "model"])->where(["id" => $id])->one();
     $deviceConfig = ArrayHelper::map(InfoConfig::getTipConfig(1), "key", "value");
     $perfConfig = ArrayHelper::map(InfoConfig::getTipConfig(2), "key", "value");
     $perfData = WirelessDeviceTaskSummary::find()->where(["taskId" => array_values($perfConfig), "devId" => $id])->select(["taskId", "currentValue"])->groupBy("taskId")->asArray()->all();
     $perfData = ArrayHelper::map($perfData, "taskId", "currentValue");
     return $this->render("tip", ["model" => $device, "deviceConfig" => $deviceConfig, "perfConfig" => $perfConfig, "perfData" => $perfData]);
 }