assign('phone',$Data['phone']); $this->assign('companyid',$Data['companyid']); $this->display('Maint/device_manger'); } public function change() { $Data=I(''); $Map['sp_monitor.company']=$Data['companyid']; switch ($Data['type']) { case 'fire': $Map['sp_monitor.dwtype']=1; break; case 'water': $Map['sp_monitor.dwtype']=array('in','2,5'); break; case 'fume': $Map['sp_monitor.dwtype']=3; break; case 'rtu': $Map['sp_monitor.dwtype']=6; break; case 'efire': $Map['sp_monitor.dwtype']=7; break; default: break; } $count=M('monitor')->where($Map)->count(); $this->assign('count',$count); $this->assign('phone',$Data['phone']); $this->assign('companyid',$Data['companyid']); $this->assign('type',$Data['type']); //print_r($Map); //$ResData=M('monitor')->field('sp_maint_info.status,sp_monitor.*,sp_maint_info.datetime')->join('left join sp_maint_info ON sp_monitor.owner_code = sp_maint_info.owner_code')->where($Map)->select(); $ResData=M('monitor')->where($Map)->select(); //echo M('monitor')->getLastSql(); //$this->assign('ResData1',$ResData1); $this->assign('ResData',$ResData); $this->display('Maint/dmanger-list'); } public function setform() { $Data=I(); $ownid=""; $ownsta=""; $num=0; foreach($Data[status]as $key=>$value){ $ownid.="$key,"; $ownsta.="$value,"; $num+=1; } $ownid=substr($ownid,0,strlen($ownid)-1); $ownsta=substr($ownsta,0,strlen($ownsta)-1); $this->assign('ownid',$ownid); $this->assign('ownsta',$ownsta); $this->assign('count',$num); $this->assign('type',$Data['type']); $this->assign('editor',$Data['phone']); $ownids = explode(',',$Data[ownids]); $ownidsta = explode(',',$Data[ownidsta]); $ownstatus=array_combine($ownids,$ownidsta); $time=date('Y-m-d h:i:s',time()); if($Data['companyid']){ $ResData=M('owner_company')->where("owner_id=$Data[companyid]")->find(); } $this->assign('owner_id',$ResData['owner_id']); $this->assign('owner_name',$ResData['owner_name']); $this->assign('address',$ResData['owner_address']); $sql="insert into sp_maint_info(owner_code,company,type,status,datetime,qianming,editor,comp_name,owner_address) values "; foreach($ownstatus as $key=>$value){ $sql.="('$key','$Data[owner_id]','$Data[types]','$value','$time','$Data[qianming]','$Data[editors]','$Data[owner_name]','$Data[owner_address]');"; } $sql=substr($sql,0,strlen($sql)-1).";"; //echo $sql; if($Data[ownids]){ if(strlen($Data[qianming]) > 1){ if($Data[ownids]>0){ $val=M()->execute($sql); if($val){ echo ""; }else{ $this->error('提交失败'); } }else{ $this->error('请选择设备'); } }else{ $this->error('请进行签名'); } } $this->display('Maint/setform'); } public function maintlist() { $Data=I(); $Map['sp_maint_info.type']=$Data['type']; $Map['sp_maint_info.company']=$Data['compangid']; $counts=M('maint_info')->where($Map)->count(); //echo $counts; $ResData=M('maint_info')->where($Map)->order("datetime desc")->select(); //echo M('maint_info')->getLastSql(); $this->assign('ResData',$ResData); $this->assign('counts',$counts); $this->assign('count',$Data['count']); $this->assign('type',$Data['type']); $this->assign('companyid',$Data['compangid']); $this->display('Maint/maint-list'); } } ?>