query("SELECT count(*) as zs FROM sp_owner where dwtype=1 AND company=".$Data['companyid']); $waterzs=M()->query("SELECT count(*) as zs FROM sp_owner where dwtype in(2,5) AND company=".$Data['companyid']); $fumezs=M()->query("SELECT count(*) as zs FROM sp_owner where dwtype=3 AND company=".$Data['companyid']); $rtuzs=M()->query("SELECT count(*) as zs FROM sp_owner where dwtype=6 AND company=".$Data['companyid']); $efirezs=M()->query("SELECT count(*) as zs FROM sp_owner where dwtype=7 AND company=".$Data['companyid']); $videozs=M()->query("SELECT count(*) as zs FROM sp_owner where dwtype=16 AND company=".$Data['companyid']); $elevatorzs=M()->query("SELECT count(*) as zs FROM sp_owner where dwtype=17 AND company=".$Data['companyid']); $firehydrant=M()->query("SELECT count(*) as zs FROM sp_owner where dwtype=4 AND company=".$Data['companyid']); $wellcover=M()->query("SELECT count(*) as zs FROM sp_owner where dwtype=128 AND company=".$Data['companyid']); $typezs=array(); $typezs['firezs']=$firezs[0]['zs']; $typezs['waterzs']=$waterzs[0]['zs']; $typezs['fumezs']=$fumezs[0]['zs']; $typezs['rtuzs']=$rtuzs[0]['zs']; $typezs['efirezs']=$efirezs[0]['zs']; $typezs['videozs']=$videozs[0]['zs']; $typezs['elevatorzs']=$elevatorzs[0]['zs']; $typezs['firehydrant']=$firehydrant[0]['zs']; $typezs['wellcover']=$wellcover[0]['zs']; $this->assign('typezs',$typezs); $this->assign('companyid',$Data['companyid']); $this->display('Index/device_manger'); } public function change() { $Data=I(''); $Map['company']=$Data['companyid']; switch ($Data['type']) { case 'fire': $Map['dwtype']=1; break; case 'water': $Map['dwtype']=array('in','2,5'); break; case 'fume': $Map['dwtype']=3; break; case 'rtu': $Map['dwtype']=6; break; case 'efire': $Map['dwtype']=7; $ResData=M()->query("SELECT a.owner_code, a.owner_name, a.company, b.true_status,a.dwtype FROM sp_owner a INNER JOIN sp_devices_status b ON a.owner_code=b.deviceid where dwtype=7 AND company=".$Map['company']); // print_r($ResData); foreach ($ResData as $key=>$value){ if($ResData[$key]['true_status']=='75'){ $ResData[$key]['dstatus']='离线'; }else{ $ResData[$key]['dstatus']='在线'; } } break; case 'video': $Map['dwtype']=16; $ResData=M()->query("SELECT owner_code, owner_name, company, dwtype FROM sp_owner where dwtype=16 AND company=".$Map['company']); break; case 'elevator': $Map['dwtype']=17; // print_r("SELECT owner_code, owner_name, company FROM sp_owner where dwtype=17 AND company=".$Map['company']); $ResData=M()->query("SELECT owner_code, owner_name, company, dwtype FROM sp_owner where dwtype=17 AND company=".$Map['company']); // print_r($ResData); break; case 'firehydrant': $Map['dwtype']=4; $ResData=M()->query("SELECT owner_code, owner_name, company, dwtype FROM sp_owner where dwtype=4 AND company=".$Map['company']); break; case 'wellcover': $Map['dwtype']=128; $ResData=M()->query("SELECT owner_code, owner_name, company, dwtype FROM sp_owner where dwtype=128 AND company=".$Map['company']); break; default: break; } if($Map['dwtype']!=7&&$Map['dwtype']!=16&&$Map['dwtype']!=17&&$Map['dwtype']!=4&&$Map['dwtype']!=128){ $ResData=M('monitor')->where($Map)->select(); } $this->assign('company',$Data['companyid']); $this->assign('ResData',$ResData); $this->display('Index/dmanger-list'); } } ?>